/home/mip/public_html_/old-website/employer/func_proc.php
<?
require("../irisonline/config.php");  	
/*  Function to display the login form */
function display_login_form($msg=""){
global $iris_version;
?>
<html>
<head><title>IRIS Online - Employer Login</title>	  
<link href="css/menu.css" rel="stylesheet" type="text/css">
</head>
<body marginheight="0" marginwidth="0" leftmargin="0" topmargin="0" onLoad="document.forms[0].username.focus();">  	
<form method=post action="login.php" name=log>
<table border=0 cellspacing=0 width="100%" height=100% cellpadding="0" bgcolor="#dce5f4">
<tr><td bgcolor="#9cb6e0" valign="top" height="41">
	<table border=0 width=100% cellspacing=0 cellpadding=0>
	<tr><td valign=top><img src="img/logo.gif" border="0"><img src="img/logotxt.gif" border="0"></td>
	<td align="right" class="txtgray">&nbsp;&nbsp;</td></tr> 
	</table>		
</td></tr>
<tr><td background="img/menutile.gif" valign="top" height="25">&nbsp;</td></tr> 
<tr><td align=center>
	<table border="0" cellpadding="0" cellspacing="0" width=45%>
	<tr><td><img src="img/topleft-login.gif" border="0"></td>
	<td background="img/toptile-login.gif"><img src="img/toptile-login.gif" border="0"></td>
	<td><img src="img/topright-login.gif" border="0"></td></tr>
	<tr><td background="img/midleft-login.gif"><img src="img/midleft-login.gif" border="0"></td>
	<td width="100%" align="center" bgcolor="#dbdee3"><br>
		<table border="0" cellpadding="2" cellspacing="5" width=90%>
		<tr><td colspan="2" class="login"><b>Employers Login Here</b><br><font size=2 color="#605F5F">Please enter your username and password.</font>
		</td></tr>
		<tr><td colspan=2 class="error"><?php if ($msg) echo "$msg";?></td></tr>
		<tr><td><br><b>Username:</b>&nbsp;</td>
		<td><br><input type="text" name="username" size="25" maxlength="20" value=""></td>
		</tr>
		<tr><td><b>Password:</b></td>
		<td><p><input type="password" name="password" size="25" maxlength="20" value=""></p></td>
		</tr>
		<tr><td>&nbsp;</td>
		<td><p><input type="submit" name="submit" value="Submit" class="button">
		<input type="reset" name="reset" value="Reset" class="button"></p>
		</td></tr>
		</table><br>		
	</td>
	<td background="img/midright-login.gif"><img src="img/midright-login.gif" border="0"></td></tr>
	<tr><td><img src="img/botleft-login.gif" border="0"></td>
	<td background="img/bottile-login.gif"><img src="img/bottile-login.gif" border="0"></td>
	<td><img src="img/botright-login.gif" border="0"></td></tr>
	</table>
</td></tr>
<tr><td height=20>
	<table border=0 cellspacing=0 width="100%" cellpadding="0" bgcolor="#9cb6e0" height=100%>		
	<tr><td align=left>&nbsp;<font size="1" face="verdana"><?=$iris_version?></td>
	<td align=right><a href="mailto:support@quantumx.com"><font size="1" face="verdana" color="black">Quantum X, Inc.</font></a>
	<a href="http://www.quantumx.com" target="_blank"><img src="img/qxlogo-copyright.gif" border="0" align="absmiddle"></a>
	</td></tr>					
	</table>	
</td></tr>
</table>
</form>
</body></html>
<?						
}	
/* Function to do the page header. This includes the IRIS logo and the menu. */
function do_html_header($title){	
global $myprincipalid;
require_once("func_data_validation.php");
check_valid_user();	
?>
<html>
<head>
<title><?=$title?></title>    
<link href="css/menu.css" rel="stylesheet" type="text/css">    
<SCRIPT language=javascript src="js/menu.js"></SCRIPT>
<SCRIPT language=javascript src="js/autotab.js"></SCRIPT>
<script src="js/ajax.js" type="text/javascript"></script> 
<script src="js/func_ajax.js" type="text/javascript"></script>
<script>
function isNumberKey(evt) {
	var charCode = (evt.which) ? evt.which : event.keyCode
	if (charCode > 31 && (charCode < 48 || charCode > 57))
		return false;
	
		return true;
}
function popUp(URL) {
	day = new Date();
	id = day.getTime();
	eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width=400,height=300,left = 312,top = 234');");
}
</script>
</head>	
<body marginheight="0" marginwidth="0" leftmargin="0" topmargin="0" background="img/bodybg.jpg">	
<table border=0 cellspacing=0 width="100%" height=100% cellpadding="0" bgcolor="#dce5f4">
<tr><td bgcolor="#9cb6e0" valign="top" height="41">
	<table border=0 width=100% cellspacing=0 cellpadding=0>
	<tr><td valign=top><img src="img/logo.gif" border="0"><img src="img/logotxt.gif" border="0"></td>
	<td align="right" class="txtgray"></td></tr> 
	</table>		
</td></tr>
<tr><td valign="middle" background="img/menutile.gif" height="25">		
	<TABLE cellSpacing=0 cellPadding=0  border=0 width="100%">
    <tr><td background="img/menutile.jpg">				
		<TABLE cellSpacing=0 cellPadding=0  border=0>
		<TR><TD class=mainmenu id="settings" noWrap >
		&nbsp;<a href="my_profile.php"><font size="2" face="arial">My Profile</font></a>&nbsp;</TD>						
		<!--<TD class=mainmenu id="lineup" noWrap >
		&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="line_up.php"><font size="2" face="arial">Applicant Line Up</font></a>&nbsp;</TD>-->		
		<TD class=mainmenu id="reports" noWrap>
		&nbsp;&nbsp;&nbsp;&nbsp;<a href="manage_job_order.php?status=open"><font size="2" face="arial">My Job Orders</font></a>&nbsp;</TD>				        																
		<TD class=mainmenu id="appdata" noWrap >
		&nbsp;&nbsp;&nbsp;&nbsp;<a href="edit_source_survey.php"><font size="2" face="arial">Source Applicants</font></a>&nbsp;</TD>		
		<!--<TD class=mainmenu id="appdata" noWrap >
		&nbsp;&nbsp;&nbsp;&nbsp;<a href="report_StatusList.php" target="_blank"><font size="2" face="arial">Status Report</font></a>&nbsp;</TD>-->					
		<TD class=mainmenu id="joborder">
		&nbsp;&nbsp;&nbsp;&nbsp;<a href="new_joborder.php"><font size="2" face="arial">New Job Order</font></a>&nbsp;</TD>				
		<TD class=mainmenu id="statusreport">
		&nbsp;&nbsp;&nbsp;&nbsp;<a href="report_StatusListAdvance.php" target="_blank"><font size="2" face="arial">Status Report</font></a>&nbsp;</TD>				
		<TD class=mainmenu id="video">
		&nbsp;&nbsp;&nbsp;&nbsp;<a href="manage_video.php"><font size="2" face="arial">Video Conference</font></a>&nbsp;</TD>				
		<TD class=mainmenu id="logout">
		&nbsp;&nbsp;&nbsp;&nbsp;<a href="logout.php"><font size="2" face="arial">Logout</font></a>&nbsp;</TD>				
		</TR>
		</TABLE>				
	</td>
	<td valign="top" align="right">
		<table border=0 cellpadding="2" cellspacing="1" width="100%">
		<tr><TD align="center" valign="middle" width="100%" class="pagetitle"><?=$title?></td>
		</tr></table>
	</td><tr>
	</table>				
</td></tr>	 
<?
}
/* Function to do the page footer of the Quantum X*/
function do_html_footer(){
global $iris_version;
?>	
<tr><td height=20>
	<table border=0 cellspacing=0 width="100%" cellpadding="0" bgcolor="#9cb6e0" height=100%>		
	<tr><td align=left>&nbsp;<font size="1" face="verdana"><?=$iris_version?></td>
	<td align=right><a href="mailto:support@quantumx.com"><font size="1" face="verdana" color="black">Quantum X, Inc.</font></a>
	<a href="http://www.quantumx.com" target="_blank"><img src="img/qxlogo-copyright.gif" border="0" align="absmiddle"></a>
	</td></tr>					
	</table>	
</td></tr>		
</table>
</body>
</html>
<?
}
/* Function to do the report footer of the Quantum X*/
function do_report_footer(){	
?>
<tr><td></td></tr>
</table>
</body>
</html>
<?
}
/* Function to do the report_applicant header. Includes the IRIS logo. */
function do_report_header($title){
check_valid_user();
?>
<html>
<head>
<title><?=$title?></title>
<link href="css/menu.css" rel="stylesheet" type="text/css">
</head>	
<body marginheight="0" marginwidth="0" leftmargin="0" topmargin="0">
<table border=0 cellspacing=0 width="100%" cellpadding="0" bgcolor="#ffffff" height=100%>
<tr><td bgcolor="#ffffff" valign="top" height="55">
	<? echo report_headers(); ?>		
</td></tr>
<?
}
function do_resume_header($applicant_id,$title){
check_valid_user();	
global $PHP_SELF;
$company_logo = getfield("agency_logo","company",1,1);
?>
<html>
<head>
<title><?=get_applicantname($applicant_id)." $title"?></title>
<link href="css/menu.css" rel="stylesheet" type="text/css">
</head>	
<body marginheight="0" marginwidth="0" leftmargin="0" topmargin="0">
<table border=0 cellspacing=0 width="100%" cellpadding="0"  height=100%>
<tr><td valign="top" align=center height=50>
	<table border=0  width=750 cellspacing=3 cellpadding=3 align=center height=50>				
	<tr><td valign=top align="center" height=50><?if($company_logo){echo resize_pic(750,50,"../irisonline/".$company_logo,"Open this page to Word Doc","");}else{?><b><font size="3" color="black">Interactive Recruitment Information System</font></b><?}?></td>
	</tr>				 
	</table>		
<!--</td></tr>-->
<?
}
/* Function to do the report_applicant header. Includes the IRIS logo. */
function do_report_header2($title){
check_valid_user();
?>
<html>
<head>
<title><?=$title?></title>
<link href="css/menu.css" rel="stylesheet" type="text/css">
</head>	
<body marginheight="0" marginwidth="0" leftmargin="0" topmargin="0" width=100%>
<table border=0 cellspacing=0 width="100%" height=100% cellpadding="0" bgcolor="#dce5f4" height=100%>
<tr><td bgcolor="#9cb6e0" valign="middle" align="center" height=50>
	<table border=0 width=100% cellspacing=3 cellpadding=3>
	<tr><td valign=top width="30%" align="right"><b><font size="5">IRIS</font></b></td>
	<td valign="middle"><b><font size="3">Interactive Recruitment Information System</font></b></td></tr> 
	</table>		
</td></tr>
<tr><td valign=top height="1" bgcolor="#dbdee3">
	<table border=0 cellpadding='3' cellspacing='3' width="100%">
	<tr><td width="67%"><font size="2"><b><?=$title?></b></font></td>
	<td width=33% align=right>Date: <?=date("d-M-y")?>&nbsp;&nbsp;</td></tr>
	</table>
</td></tr>			
<tr><td valign=top height="1"><br>
<?
}
/* Function to do the page footer of the Quantum X*/
function do_report_footer2(){
?>
</td></tr>  
<tr><td>
	<table border=0 cellspacing=0 width="100%" cellpadding="0" >		
	<tr><td  height="20" colspan="10" align=right>
	<a href="mailto:support@quantumx.com"><font size="1" face="verdana"><b>Quantum X Inc.</b></font></a>
	</td></tr>					
	</table>
</td></tr>	
</table>
</body>
</html>
<?
}
/* Function to do the report_applicant header. Includes the IRIS logo. */
function do_report_header2a($title){
$logo_dir_employer = "../irisonline/";
$company = getdata_one("*","company",1,1);
check_valid_user();
?>
<html>
<head>
<title><?=$title?></title>
<link href="css/menu.css" rel="stylesheet" type="text/css">
</head>	
<body marginheight="0" marginwidth="0" leftmargin="0" topmargin="0" width=100>
<table border=0 cellspacing=0 cellpadding="0" WIDTH=100%>
<tr><td align="center"><? if($company[agency_logo]){ echo resize_pic(750,50,$logo_dir_employer.$company["agency_logo"],"Agency Logo",""); }?></td></tr>
<?
}
/* Function to do the report_applicant header. Without the IRIS logo. */
function do_report_header2b($title){
$company_logo = getfield("agency_logo","company",1,1);
check_valid_user();
?>
<html>
<head>
<title><?=$title?></title>
<link href="css/menu.css" rel="stylesheet" type="text/css">
</head>	
<body marginheight="0" marginwidth="0" leftmargin="12" rightmargin="12" topmargin="12" bottommargin="12" width=100>
<table border=0 cellspacing=0 cellpadding="0" WIDTH=100%>
<tr><td align="center">
<?if($company_logo){echo resize_pic(750,50,"../irisonline/".$company_logo,"Open this page to Word Doc","");}else{?><b><font size="3" color="black">Interactive Recruitment Information System</font></b><?}?>
</td></tr>
<?
}
function check_valid_user() {
global $principal_valid_user,$myprincipalid;
	if (!session_is_registered("principal_valid_user") && !session_is_registered("myprincipalid") && !$principal_valid_user && !$myprincipalid) {
		// they are not logged in      
		display_login_form("Session has timed out. Pls. login.");
		exit;
	}  
}	
function do_headname($applicant_id){  
	echo "<b>".$applicant_id."</b> :: <b>".get_applicantname($applicant_id)."</b>";
}
function get_age($birthday) {
	//for report_applicantlist
	//got code from phpmanual
	if (!ereg ("([0-9]{4})-([0-9]{1,2})-([0-9]{1,2})", $birthday, $regs)) { return false;} // Geb-Datum nicht korrekt bergeben
	$age = date("Y") - $regs[1];
	if ($regs[2] > date("m")) {$age--;}
	elseif ($regs[2] == date("m")) {
	if ($regs[3] > date("d")) {$age--;}
	}
	if($age<100)
			return $age;
	else
			return;		
} // Ende function get_age
function diff($num1, $num2){
	// output the difference of two numbers  
	$diff = $num1-$num2;
	return($diff);
}
function dateformat1($mysqldate,$style=""){				
	list($year,$month,$day) = explode("-", $mysqldate);
	
	settype($year, "integer"); 
	settype($month, "integer");
	settype($day, "integer");
	
	if(!$style) $style="M d, Y";
			
	if($year != '0000' && $month !='00' && $day !='00')	 		
			@$return_date = date("$style",mktime(0,0,0,$month,$day,$year));	 
	if($day == '00' && $month != '00')		 
		@$return_date = date("M Y",mktime(0,0,0,$month,"01",$year));		
	if($month == '00' && $year != '0000')			 
		@$return_date = "$year"; 
	if($return_date)
			return $return_date;
	else return;		
}
// format the mysqldate to "M d, Y"
function dateformat($mysqldate){				
	list($year,$month,$day) = explode("-", $mysqldate);   	  
	
	settype($year, "integer"); 
	settype($month, "integer");
	settype($day, "integer");
					
	if($month)  $return_date = date("M",mktime(0,0,0,$month,1,1));					 
	if($day) $return_date .= " $day,";
	if($year) $return_date .= " $year";		
	
	if($return_date)
			return $return_date;
	else return;		
}
// format the mysqldate to ""
function datenumformat($mysqldate,$style=""){				
	list($year,$month,$day) = explode("-", $mysqldate);   	  
	
	if($style=="m") $return_date = $month;					 
	elseif($style=="d") $return_date = $day;
	elseif($style=="Y") $return_date = $year;		
	elseif($style=="y") $return_date = substr($year,-2);
	
	if($return_date)
			return $return_date;
	else return;		
}
function addbreaks($string){
	return str_replace("\r","<br>",$string);
}
function convertToTextDate($mysqldate){	
	if($mysqldate && $mysqldate != '0000-00-00'){
		list($year,$month,$day) = explode("-",$mysqldate);
		$textdate = "$month/$day/$year";
		return $textdate;
	}
	return "";
}
function convertToMysqlDate($textdate){
	if($textdate){
		list($month,$day,$year) = explode("/",$textdate);
		$mysqldate = "$year-$month-$day";
		return $mysqldate;
	}
	return "";
}
function isdate($mysqldate){
	if(!$mysqldate)return false;		 
	$mydate = explode("-", $mysqldate);
	$mydate[2]=trim(substr($mydate[2],0,2));		
	return checkdate($mydate[1],$mydate[2],$mydate[0]);
}
function unixdate($mysqldate){
	$mydate = explode("-", $mysqldate);
	return mktime("","","",$mydate[1],$mydate[2],$mydate[0]);
}
function phpdate($mysqldate){
	if($mysqldate!="0000-00-00"&&$mysqldate)
		return date("d-M-y",unixdate($mysqldate));
	else
		return "";
}
// get the date when year is added or subtracted
function get_date($mysqldate,$addyears){				
	list($year,$month,$day) = explode("-", $mysqldate);   	  
	
	$year = $year + $addyears;		
	$return_date = "$year-$month-$day";				
			
	if($return_date)
		return $return_date;
	else return;		
}
function resize_pic($w,$h,$img,$alt="",$click=""){
	/* this function resizes images into their correct proportion
	$w= required width
	$h= required height
	$img = image file
	$alt= image description
	$click= if there is a value, the image is clickable, and opens to a new window at its full size
	*/
	@$tmp = GetImageSize($img);
	if(!$tmp[0]) $tmp[0]=1;
	if(!$tmp[1]) $tmp[1]=1;
	
	if($tmp[0] <= $w) $w = $tmp[0];
	if($tmp[1] <= $h) $h = $tmp[1]; 
	
	$width=abs($w);
	$height=abs($h);
	
	//if($click){$a1="<a href='$img' target=_blank>";$a2="</a>";$c1=" - Click to Enlarge";}
	return"$a1<img src=\"$img\" height=\"{$height}\" width=\"{$width}\" border=0 alt='$alt $c1'>$a2";	
}
function resize_pic1($w,$h,$img,$alt="",$click="",$default="", $border=""){
global $default_image;
	$tmp = @GetImageSize($img);// get image size
	if(!$tmp&&$default) {$tmp = @GetImageSize($default_image);$img=$default_image;}// get image size$default_image  
	elseif(!$tmp)return "";// if not an image, escape
	if($tmp[0]>=$tmp[1]){ // if width is greate than height 
	  $h=$w*$tmp[1]/$tmp[0];// compute the proportional height
	}else{
	  $w=$h*$tmp[0]/$tmp[1];// compute the proportional width
	}
	$width=abs($w);// there you go
	$height=abs($h);// there you go
	if($click){$a1="<a href='$img' target=_blank>";$a2="</a>";$c1=" - Click to Enlarge";}//if clickable, add anchors
	return"$a1<img src=\"$img\" height=\"{$height}\" width=\"{$width}\" border=$border alt='$alt $c1'>$a2";// return the image
}
?>