Location: PHPKode > projects > E-hris > empprofile.php
<?php

error_reporting(E_ALL & ~E_NOTICE);
session_start();


include_once('includes/queryfunctions.php');
include_once('includes/functions.php');

//check if user is logged in
 if (empty($_SESSION["username"])) die("<meta http-equiv='refresh' content='1;url=login.php'>");

  include "includes/config.php";
  include "includes/functions.php";
  require_once "includes/db.php";

  $d = new dbC();
  $d->connect($db_host, $db_user, $db_pass, $db);

  $username = $_SESSION["username"];
  $sqlstr="select * from hrusers  where username like '%".$username."%'";
  $data=$d->query($sqlstr);
  $row=$d->fetch_object($data);
  $fullname=$row->name;
  $userid=$row->id;


if(isset($_GET["employee"])){
	$empid = $_GET["employee"];
}else{
	$empid = $_SESSION["userid"];
}

$sql=" =$empid";
$results=$d->query($sql,$conn);
$applicant = $d->fetch_object($results);
$today = getdate();

//update cv views - if applicant do not update the cvviews.
$sql="UPDATE applicant SET cvviews=$applicant->cvviews+1 WHERE applicantid=$cvid";
$viewresults=query($sql,$conn);
free_result($viewresults);

//check if user is logged in
SignedIn();
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Kemri-Wtrl - view cv</title>
<script language="JavaScript" src="js/highlight.js" type="text/javascript"></script>
<link href="css/main.css" rel="stylesheet" type="text/css">
<?php headericon(); ?>
</head>
<body>
<form action="viewcv.php" method="POST"  name="viewcv" id="viewcv" enctype="multipart/form-data">
<div align="center">
<table width="100%">
 <tr align="center">
   <td colspan="2">
   <?php 
   	echo "<h1>$applicant->applicant</h1> <br>
		Phone, Mob. : $applicant->hphone, $applicant->hmobile <br>
		P. O. Box: $applicant->hbox $applicant->htown - $applicant->hzip_postal, $applicant->nationality <br>
		Email: $applicant->hemail <br>";
   ?>
   </td>
 </tr>
 <tr>
   <th colspan="2" align="right"><?php //if ($_POST["Submit"]!=='Download CV') echo "<input type=\"submit\" name=\"Submit\" value=\"Download CV\" />" ?> Personal Details</th>
 </tr>
 <tr>
   <td align="left"><? echo "<b>Date of Birth : </b> ".$applicant->dob; ?></td>
   <td align="left"><? echo "<b>Sex : </b> ".$applicant->sex; ?></td>
 </tr>
 <tr>
   <td align="left"><? echo "<b>Marital Status : </b> ".$applicant->mstatus; ?></td>
   <td align="left"><? echo "<b>Nationality : </b> ".$applicant->nationality; ?></td>
 </tr>
 <tr>
   <td align="left"><? echo "<b>National ID/Passport Number : </b> ".$applicant->idppno; ?>
</td>
   <td align="left">&nbsp;</td>
 </tr>
 <tr align="center">
   <th colspan="2" align="left">&nbsp;
   </td>
Education
 </tr>
 <tr align="center">
   <td width="46%" align="left"> 
   <?
     $sqlstr="select *,degreeclass.degreeclass as degclass,
	  (case highereducourse when 1 then 'Post Graduate Certificate' when 2 then 'Post Graduate Diploma' when 3 then 'MSc' when 4 then 'MA'  
	  when 5 then 'MEd' when 6 then 'Mmed' when 7 then 'MPH' when 8 then 'MBA' end) as highereducourse
	  from interneducation inner join degreeclass on degreeclass.id=interneducation.degreeclass where applicantid=$cvid";
    // echo $sqlstr;
	 
	 $data=mysql_query($sqlstr,$conn);
	 $rows=mysql_fetch_object($data);
	 
	 	echo "<b>Name of Secondary School : </b> ".$rows->secschool;
		
		
   ?>
   <td width="54%" align="left"> <? echo "<b>Grade Scored : </b> ".$rows->secgrade; ?> </td>
 </tr>
 <tr align="center">
   <td align="left"><? echo "<b>University : </b> ".$rows->university; ?></td> 
   <td align="left"><? echo "<b>Year Completed : </b> ".$rows->yearcompleted; ?></td>
 </tr>
 <tr align="center">
   <td align="left"><? echo "<b>Degree : </b> ".$rows->degree; ?></td>
   <td align="left"><? echo "<b>Major Subject : </b> ".$rows->majorsubject; ?></td>
 </tr>
 <tr align="center">
   <td align="left"><? echo "<b>class : </b> ".$rows->degclass; ?></td>
   <td align="left"><? echo "<b>if unclassified average marks : </b> ".$rows->averagemark; ?></td>
 </tr>
 <tr align="center">
   <td align="left"><? echo "<b>If not completed last two years average grade : </b> ".$rows->twoyraverage; ?></td>
   <td align="left"><? echo "<b>Are you registered for a higher degree : </b> ";
     if ($rows->highereduregistration==1)
       echo "Yes";
	 else
	   echo "No";	  
 ?></td>
 </tr>
 <tr align="center">
   <td align="left"><? echo "<b>If yes What course ? : </b> ".$rows->highereducourse; ?></td>
   <td align="left"><? echo "<b>Name of Institution: </b> ".$rows->institution; ?></td>
 </tr>
 <tr align="center">
   <td align="left"><? echo "<b>Subject : </b> ".$rows->subject; ?></td>
   <td align="left">&nbsp;</td>
 </tr>
 <tr align="center">
   <th align="left" colspan="2"><b>Research Experience</b><?
   $sqlstr="select * from internexperience where applicantid=$cvid";
    // echo $sqlstr;
	 
	 $data=mysql_query($sqlstr,$conn);
	 $rows=mysql_fetch_object($data);
   
   ?></td>
    </tr>
 <tr align="center">
   <td align="left"><? echo "<b>Undertook a research project in undergraduate studies : </b> ";
    if ($rows->undergradproject==1)
       echo "Yes";
	 else
	   echo "No";	
    ?></td>
   <td align="left"><? echo "<b>Project title : </b> ".$rows->projectitle; ?></td>
 </tr>
 <tr align="center">
   <td align="left"><? echo "<b>Key Finding : </b> ".$rows->keyfinding; ?></td>
   <td align="left"><? echo "<b>Project grade : </b> ".$rows->projectgrade; ?></td>
 </tr>
 <tr align="center">
   <td align="left"><? echo "<b>Current Attached to a research institute : </b> ";
   
   if ($rows->researchattachment==1)
     echo "Yes";
   else
     echo "No";
    ?></td>
   <td align="left"><? echo "<b>Name of Institute : </b> ".$rows->institutionattached; ?></td>
 </tr>
 <tr align="center">
   <td colspan="2" align="left"><? echo "<b>5 research techniques(incuding social science research) for which you have working knowledge</b> ".$rows->researchtech;  ?></td>
   </tr>
 <tr align="center">
   <th colspan="2" align="left">&nbsp;</td> Professional Experience 
 </tr>
 <tr align="center">
   <td colspan="2" align="left">
   <?
   $querystr="SELECT id,applicantid,organization,jobtitle,startmonth,startyear,endmonth,endyear
		FROM experience
		WHERE experience.applicantid = $cvid";
	$results=query($querystr,$conn);
	//check if data is returned
	echo "<table border=\"0\" width=\"100%\">";  		
	echo "<tr\"><td><b>Organization</b></td><td><b>Job Title</b></td><td><b>From</b></td><td><b>To</b></td></tr>";
	while ($profexper = fetch_object($results)){
		//alternate row colour
		
			echo "<tr>";
		  
			echo "<td align=\"left\"><input name=\"id\" type=\"hidden\" value=\"$profexper->id\">$profexper->organization</td>
				<td align=\"left\">$profexper->jobtitle</td>
				<td align=\"left\">$profexper->startmonth / $profexper->startyear</td>
				<td align=\"left\">$profexper->endmonth / $profexper->endyear</td>
				
			</tr>";
	}
	echo "</table>";
	?>
   </td>
   </tr>
 <tr align="center">
   <th colspan="2" align="left">Internship Preference</th>
   </tr>
 <tr align="center">
   <td colspan="2" align="left">
   <? 
     $sqlstr="select concat_ws('. ', firstchoice,program) as firstchoice from internexperience inner join internshipprogram on firstchoice=internshipprogram.id
	   where applicantid=$cvid";
   
	 
	 $data=mysql_query($sqlstr,$conn);
	 $rows=mysql_fetch_object($data);
	 
	 echo $rows->firstchoice."<br>"; 
	
	 $sqlstr="select concat_ws('.', secondchoice,program) as secondchoice from internexperience inner join internshipprogram on secondchoice =internshipprogram.id
	   where applicantid=$cvid";
    
	 
	 $data=mysql_query($sqlstr,$conn);
	 $rows=mysql_fetch_object($data);
	 
	
	 echo $rows->secondchoice."<br>"; 
	 
	  $sqlstr="select concat_ws('. ', thirdchoice,program) as thirdchoice from internexperience inner join internshipprogram on thirdchoice=internshipprogram.id
	   where applicantid=$cvid";
   
	 
	 $data=mysql_query($sqlstr,$conn);
	 $rows=mysql_fetch_object($data);
	 
	 
	 echo $rows->thirdchoice."<br>"; 
   
   ?>
   </td>
   </tr>
 <tr align="center">
   <th colspan="2" align="left">Referees</th>
 </tr>
 <tr align="center">
   <td colspan="2" align="left"><?
   $querystr="SELECT id,applicantid,name,organization,refposition,telephone,email,relation FROM referee
		WHERE referee.applicantid =  $cvid";
	$results=query($querystr,$conn);
	//check if data is returned
	echo "<table border=\"0\" width=\"100%\">";  		
	echo "<tr class=\"boldtext\"><td>Name</td><td>Organization</td><td>Position</td><td>Telephone</td><td>Email</td><td>Relation</td></tr>";
	while ($ref = fetch_object($results)){
		//alternate row colour
		
			echo "<tr>";
		
			echo "<td align=\"left\"><input name=\"idsearch\" type=\"hidden\" value=\"$ref->id\">$ref->name</td>
				<td align=\"left\">$ref->organization</td>
				<td align=\"left\">$ref->refposition</td>				
				<td align=\"left\">$ref->telephone</td>
				<td align=\"left\">$ref->email</td>
				<td align=\"left\">$ref->relation</td>
			</tr>";
	}
	echo "</table>";
	?>
   </td>
 </tr>
 </table>
</div>
</form>
</body>

</html>
<?php //} ?>
Return current item: E-hris