Location: PHPKode > projects > MyJobList > MyJobList.v0.1/mjl-includes/employer.inc.php
<?php

function FUNCT_COMPANY_PASSWORD_FRM(){
	global $theme;
	$rdata = file_get_contents('mjl-themes/'.$theme.'/company_area_header.theme.html');
	$rdata .= file_get_contents('mjl-themes/'.$theme.'/company_pw_form.theme.html');
	$rdata .= file_get_contents('mjl-themes/'.$theme.'/company_area_footer.theme.html');
	return $rdata;
}

function FUNCT_POST_JOB_FORM(){
	global $theme;
	$jobform = file_get_contents('mjl-themes/'.$theme.'/company_job_header.theme.html');
	$jobform .= '<form method="POST" action="index.php?loc=enter">
	<table cellspacing="0" cellpadding="0" border="0" class="jobentry">
		<tr>
			<td colspan="2">Job Title<input type="TEXT" class="title" name="jobtitle" /></td>
		</tr>
		<tr>
			<td colspan="2">Job Location<input type="TEXT" class="location" name="joblocation" /></td>
		</tr>
		<tr>
			<td colspan="2">Job Description</td>
		</tr>
		<tr>
			<td colspan="2"><TEXTAREA rows="5" name="jobdescription"></TEXTAREA></td>
		</tr>
		<tr>
			<td colspan="2">Experience Requirements</td>
		</tr>
		<tr>
			<td colspan="2"><TEXTAREA rows="5" name="jobrequirements"></TEXTAREA></td>
		</tr>
		<tr>
			<td colspan="2">Educational Requirements</td>
		</tr>
		<tr>
			<td colspan="2"><TEXTAREA rows="5" name="edrequirements"></TEXTAREA></td>
		</tr>
		<tr>
			<td colspan="2">Benefits</td>
		</tr>
		<tr>
			<td colspan="2"><TEXTAREA rows="5" name="benefits"></TEXTAREA></td>
		</tr>';
		
	$result = mysql_query('SELECT * FROM categories ORDER BY `CATEGORY` ASC');
	$selectval = '';
	while($row = mysql_fetch_array($result)){
		$selectval .= '<option value="'.trim($row['CATEGORY']).'">'.trim($row['CATEGORY']).'</option>';
	}
	
	$jobform .= '
		<tr>
			<td colspan="2">
			Category<br />
			<select name="categories">'.$selectval.'</select>
			</td>
		</tr>
		<tr>
			<td colspan="2">	
				How To Apply<br />
				by email<input type="CHECKBOX" value="email" name="howapply[]" />
				by phone<input type="CHECKBOX" value="phone" name="howapply[]" />
				by fax<input type="CHECKBOX" value="fax" name="howapply[]" />
				by regular mail <input type="CHECKBOX" value="mail" name="howapply[]" />
				by online<input type="CHECKBOX" value="online" name="howapply[]" />
			</td>
		</tr>
		<tr>
			<td>Job Duration<br />
				<select name="jobduration">
					<option value="Internship">Internship</option>
					<option value="Regular">Regular</option>
					<option value="School Year">School Year</option>
					<option value="Seasonal">Seasonal</option>
					<option value="Services-Domestic">Services-Domestic</option>
					<option value="Temp">Temp</option>
					<option value="Temp to Hire">Temp to Hire</option>
					<option value="Trials - Medical, Clinical">Trials - Medical, Clinical</option>
					<option value="Volunteer">Volunteer</option>
				</select>
			</td>
			<td>
				Job Type<br />
				<select name="jobtype">
					<option value="Contract">Contract</option>
					<option value="Full Time">Full Time</option>
					<option value="Part Time - All">Part Time - All</option>
					<option value="Part Time - less than 20 hours">Part Time - less than 20 hours</option>
					<option value="Per Diem">Per Diem</option>
				</select>
			</td>
		</tr>
		<tr>
			<td>
				Wage Type<br />
				<select name="wagetype">
					<option value="Annual Salary">Annual Salary</option>
					<option value="Commission Only">Commission Only</option>
					<option value="Contract">Contract</option>
					<option value="Draw on Future Comm">Draw on Future Comm</option>
					<option value="Draw Plus Commission">Draw Plus Commission</option>
					<option value="Hourly Wage">Hourly Wage</option>
					<option value="Other Wage Type">Other Wage Type</option>
					<option value="">Per Diem</option>
					<option value="Per Diem">Per Mile</option>
					<option value="Salary Plus Commission">Salary Plus Commission</option>
					<option value="Volunteer">Volunteer</option>
				</select>
			</td><td><input type="SUBMIT" value="Add Position" class="jobbutton" />
		</tr>
	</table>
	</form>';
	$jobform .= file_get_contents('mjl-themes/'.$theme.'/company_job_footer.theme.html');

	return $jobform;
}

function FUNCT_EDIT_JOB_FORM($ejid){
	global $theme;

	$result = mysql_query('SELECT * FROM jobs WHERE `JID` = '.$ejid.' AND `CID` = '.$_SESSION['cid'].' LIMIT 1');

	while ($row = mysql_fetch_array($result)){
		$jtitle 		= $row['JOBTITLE'];
		$jlocation		= $row['JOBLOCATION'];
		$company 		= $row['CID'];
		$catid 			= $row['CATID'];
		$jdescription 	= $row['JOBDESCRIPTION'];
		$jrequirements 	= $row['JOBREQUIREMENTS'];
		$edrequirements	= $row['EDREQUIREMENTS'];
		$benefits 		= $row['BENEFITS'];
		$dateposted 	= $row['DATEPOSTED'];
		$howtoapply 	= unserialize(stripslashes($row['HOWTOAPPLY']));
		$jduration 		= $row['JOBDURATION'];
		$jtype 			= $row['JOBTYPE'];
		$wagetype 		= $row['WAGETYPE'];
	}
	
	$jobform = file_get_contents('mjl-themes/'.$theme.'/company_job_header.theme.html');
	$jobform .= '<form method="POST" action="index.php?loc=ed&jid='.$ejid.'">
	<table cellspacing="0" cellpadding="0" border="0" class="jobentry">
		<tr>
			<td colspan="2">Job Title<input type="TEXT" class="title" name="jobtitle" value="'.$jtitle.'" /></td>
		</tr>
		<tr>
			<td colspan="2">Job Location<input type="TEXT" class="location" name="joblocation" value="'.$jlocation.'" /></td>
		</tr>
		<tr>
			<td colspan="2">Job Description</td>
		</tr>
		<tr>
			<td colspan="2"><TEXTAREA rows="5" name="jobdescription">'.$jdescription.'</TEXTAREA></td>
		</tr>
		<tr>
			<td colspan="2">Experience Requirements</td>
		</tr>
		<tr>
			<td colspan="2"><TEXTAREA rows="5" name="jobrequirements">'.$jrequirements.'</TEXTAREA></td>
		</tr>
		<tr>
			<td colspan="2">Educational Requirements</td>
		</tr>
		<tr>
			<td colspan="2"><TEXTAREA rows="5" name="edrequirements">'.$edrequirements.'</TEXTAREA></td>
		</tr>
		<tr>
			<td colspan="2">Benefits</td>
		</tr>
		<tr>
			<td colspan="2"><TEXTAREA rows="5" name="benefits">'.$benefits.'</TEXTAREA></td>
		</tr>';
		
	$result = mysql_query('SELECT * FROM categories ORDER BY `CATEGORY` ASC');
	$selectval = '';
	while($row = mysql_fetch_array($result)){
		$selectval .= '<option value="'.trim($row['CATEGORY']).'">'.trim($row['CATEGORY']).'</option>';
	}
	
	$jobform .= '
		<tr>
			<td colspan="2">
			Category<br />
			<select name="categories"><option value="'.$catid.'" SELECTED>'.$catid.'</option>'.$selectval.'</select>
			</td>
		</tr>
		<tr>
			<td colspan="2">How To Apply<br />
				by email<input type="CHECKBOX" value="email" name="howapply[]" />
				by phone<input type="CHECKBOX" value="phone" name="howapply[]" />
				by fax<input type="CHECKBOX" value="fax" name="howapply[]" />
				by regular mail <input type="CHECKBOX" value="mail" name="howapply[]" />
				by online<input type="CHECKBOX" value="online" name="howapply[]" />
			</td>
		</tr>
		<tr>
			<td>Job Duration<br />
				<select name="jobduration">
					<option value="'.$jduration.'" SELECTED>'.$jduration.'</option>
					<option value="Internship">Internship</option>
					<option value="Regular">Regular</option>
					<option value="School Year">School Year</option>
					<option value="Seasonal">Seasonal</option>
					<option value="Services-Domestic">Services-Domestic</option>
					<option value="Temp">Temp</option>
					<option value="Temp to Hire">Temp to Hire</option>
					<option value="Trials - Medical, Clinical">Trials - Medical, Clinical</option>
					<option value="Volunteer">Volunteer</option>
				</select>
			</td>
			<td>
				Job Type<br />
				<select name="jobtype">
					<option value="'.$jtype.'" SELECTED>'.$jtype.'</option>
					<option value="Contract">Contract</option>
					<option value="Full Time">Full Time</option>
					<option value="Part Time - All">Part Time - All</option>
					<option value="Part Time - less than 20 hours">Part Time - less than 20 hours</option>
					<option value="Per Diem">Per Diem</option>
				</select>
			</td>
		</tr>
		<tr>
			<td>
				Wage Type<br />
				<select name="wagetype">
					<option value="'.$wagetype.'" SELECTED>'.$wagetype.'</option>
					<option value="Annual Salary">Annual Salary</option>
					<option value="Commission Only">Commission Only</option>
					<option value="Contract">Contract</option>
					<option value="Draw on Future Comm">Draw on Future Comm</option>
					<option value="Draw Plus Commission">Draw Plus Commission</option>
					<option value="Hourly Wage">Hourly Wage</option>
					<option value="Other Wage Type">Other Wage Type</option>
					<option value="">Per Diem</option>
					<option value="Per Diem">Per Mile</option>
					<option value="Salary Plus Commission">Salary Plus Commission</option>
					<option value="Volunteer">Volunteer</option>
				</select>
			</td><td><input type="SUBMIT" value="Update Position" class="jobbutton" />
		</tr>
	</table>
	</form>';
	$jobform .= file_get_contents('mjl-themes/'.$theme.'/company_job_footer.theme.html');

	return $jobform;
}

function FUNCT_COMPANY_PROFILE(){
	global $theme;
	$result = mysql_query('SELECT * FROM companies WHERE CID = '.$_SESSION['cid'].' LIMIT 1');
	$cnt = mysql_num_rows($result);
	if ($cnt > 0){
		$row = mysql_fetch_array($result);
	}
$profform = file_get_contents('mjl-themes/'.$theme.'/company_profile_header.theme.html');
$profform .= '<form method="POST" action="index.php?loc=coprofile">	
<table cellspacing="2" cellpadding="0" border="0" class="coprofile">
	<tr><td align="right">Company Name: &nbsp;</td><td align="left"><input type="HIDDEN" name="cid" value="'.$row['CID'].'" /><input type="TEXT" name="coname" size="35" value="'.$row['COMPANYNAME'].'" /></td></tr>
	<tr><td align="right">Mail Address 1: &nbsp;</td><td align="left"><input type="TEXT" name="add1" size="45" value="'.$row['MAILADDRESS1'].'" /></td></tr>
	<tr><td align="right">Mail Address 2: &nbsp;</td><td align="left"><input type="TEXT" name="add2" size="45" value="'.$row['MAILADDRESS2'].'" /></td></tr>
	<tr><td align="right">City: &nbsp;</td><td align="left"><input type="TEXT" name="city" value="'.$row['CITY'].'" /></td></tr>
	<tr><td align="right">State: &nbsp;</td><td align="left"><input type="TEXT" name="state" value="'.$row['STATE'].'" /></td></tr>
	<tr><td align="right">Zip: &nbsp;</td><td align="left"><input type="TEXT" name="zip" value="'.$row['ZIP'].'" /></td></tr>
	<tr><td align="right">Phone: &nbsp;</td><td align="left"><input type="TEXT" name="phone" size="25" value="'.$row['PHONE'].'" /></td></tr>
	<tr><td align="right">Fax: &nbsp;</td><td align="left"><input type="TEXT" name="fax" size="25" value="'.$row['FAX'].'" /></td></tr>
	<tr><td align="right">Contact Name: &nbsp;</td><td align="left"><input type="TEXT" name="contact" size="35" value="'.$row['CONTACT'].'" /></td></tr>
	<tr><td align="right">Contact Email: &nbsp;</td><td align="left"><input type="TEXT" name="email" size="45" value="'.$row['CONTACTEMAIL'].'" /></td></tr>
	<tr><td align="right">Contact Title: &nbsp;</td><td align="left"><input type="TEXT" name="title" size="45" value="'.$row['CONTACTTITLE'].'" /></td></tr>
	<tr><td align="right">Website: &nbsp;</td><td align="left"><input type="TEXT" name="website" size="55" value="'.$row['WEBSITE'].'" /></td></tr>
	<tr><td align="right">About: &nbsp;</td><td align="left"><TEXTAREA rows="5" cols="45" name="about">'.$row['ABOUT'].'</TEXTAREA></td></tr>
	<tr><td colspan="2" align="center"><input type="submit" value="Update Profile" /></td></tr>
</table></form>';
$profform .= file_get_contents('mjl-themes/'.$theme.'/company_profile_footer.theme.html');

	return $profform;
}

function FUNCT_JOB_LIST(){  //this is the list seen in the employer area
	global $theme;
	
	$result = mysql_query('SELECT * FROM jobs WHERE `CID` = '.$_SESSION['cid'].' ORDER BY `DATEPOSTED`' );
	
	$jobform = file_get_contents('mjl-themes/'.$theme.'/company_joblist_header.theme.html');
	$jobform	.= '<table border="0" cellspacing="0" cellpadding="0" class="empjoblist">
		<tr>
			<td class="emplh1">Job Title</td><td class="emplh2">Posted</td><td class="emplh3">Active</td><td class="emplh4">Action</td>
		</tr>';
	$jlistentry = '';
	while ($row = mysql_fetch_array($result)){
		if ($jlistentry == 'emplistentry1'){
			$jlistentry = 'emplistentry2';
		}else{
			$jlistentry = 'emplistentry1';
		}
		if ($row['ISENABLED'] == 1){
			$isactive = 'Y';
			$enableit = "";
		}else{
			$isactive = 'N';
			$enableit = ' | <a href="index.php?loc=ena&jid='.$row['JID'].'" title="Enable Position">Enable</a>';
		} 
		$jobform	.= '<tr><td class="'.$jlistentry.'"><a href="index.php?loc=ed&jid='.$row['JID'].'" title="Edit Position">'.$row['JOBTITLE'].'</a></td><td align="center" class="'.$jlistentry.'">'.$row['DATEPOSTED'].'</td><td align="center" class="'.$jlistentry.'">'.$isactive.'</td><td align="center" class="'.$jlistentry.'"><a href="index.php?loc=ed&jid='.$row['JID'].'" title="Edit Position">Edit</a> | <a href="index.php?loc=del&jid='.$row['JID'].'" title="Delete Position">Delete</a>'.$enableit.'</td></tr>';
	}
	$jobform		.= '</table>';
	$jobform .= file_get_contents('mjl-themes/'.$theme.'/company_joblist_footer.theme.html');

	return $jobform;
}

function FUNCT_EMPLOYER_EMAIL($mtype = ''){
	global $theme;
	
	switch($mtype){
		case 'sent':
			$bgcolora = "background-color:#eeeeee;border-bottom:1px solid #000000";
			$bgcolorb = "background-color:#ffffff;";
			$sqlquery = 'SELECT * FROM mail WHERE FCID = '.$_SESSION['cid'].' ORDER BY SENTDATE ASC';
			break;
		default:
			$bgcolora = "background-color:#ffffff;";
			$bgcolorb = "background-color:#eeeeee;border-bottom:1px solid #000000";
			$sqlquery = 'SELECT * FROM mail WHERE TCID = '.$_SESSION['cid'].' ORDER BY SENTDATE ASC';
	} 
	$retval = file_get_contents('mjl-themes/'.$theme.'/company_area_header.theme.html');
	$retval .= '<div style="margin-left:25px;width:90%;text-align:left"><span class="mtab1" style="'.$bgcolora.';"><a href="?loc=messages&act=inbox" title="Inbox">Inbox</a></span><span class="mtab2" style="'.$bgcolorb.'"><a href="?loc=messages&act=sent" title="Sent">Sent</a></span><span class="mtab3">&nbsp;&nbsp;&nbsp;</span><br /><br /><table border="0" cellpadding="2" cellspacing="0" width="100%" class="msgblock">
	<tr><th>Subject</th><th>Name</th><th>Date</th><th>Action</th></tr>';

	$result = mysql_query($sqlquery) or die(mysql_errno().', '.mysql_error());
	$cnt = mysql_num_rows($result);
	if ($cnt == 0) {
		$retval .= '<tr><td colspan="4">There are no messages.</td></tr>';
	}else{
		switch($mtype){
			case 'sent':
				while($row = mysql_fetch_array($result)){
					$subresult = mysql_query('SELECT FIRSTNAME,LASTNAME FROM users WHERE UID = '.$row['UID'].' LIMIT 1') or die();
					$subrow = mysql_fetch_array($subresult);
					$retval .= '<tr><td><a href="?loc=msg&act='.$row['ID'].'">'.$row['SUBJECT'].'</a></td><td>'.$subrow['LASTNAME'].', '.$subrow['FIRSTNAME'].'</td><td>'.$row['SENTDATE'].'</td><td align="center"><a href="?loc=messages&act='.$mtype.'&a=del&mid='.$row['ID'].'"><img src="mjl-themes/'.$theme.'/delete.gif" border="0" alt="Delete"></a></td></tr>';
				}
				break;
			default:
				while($row = mysql_fetch_array($result)){
					$subresult = mysql_query('SELECT FIRSTNAME,LASTNAME FROM users WHERE UID = '.$row['UID'].' LIMIT 1') or die();
					$subrow = mysql_fetch_array($subresult);
					$retval .= '<tr><td><a href="?loc=msg&act='.$row['ID'].'">'.$row['SUBJECT'].'</a></td><td>'.$subrow['LASTNAME'].', '.$subrow['FIRSTNAME'].'</td><td>'.$row['SENTDATE'].'</td><td align="center"><a href="?loc=messages&act='.$mtype.'&a=del&mid='.$row['ID'].'"><img src="mjl-themes/'.$theme.'/delete.gif" border="0" alt="Delete"></a></td></tr>';
				}
		}
	}
	$retval .= "</table></div>";
	$retval .= file_get_contents('mjl-themes/'.$theme.'/company_area_footer.theme.html');
	return $retval;
}

function FUNCT_SHOW_EMPLOYER_MSG($msg, $ea = ''){
	global $theme;
	
	
	$sqltxt = 'SELECT * FROM mail WHERE ID = '.$msg.' LIMIT 1';
	$result = mysql_query($sqltxt) or die();
	$cnt = mysql_num_rows($result);
	$retval = file_get_contents('mjl-themes/'.$theme.'/company_area_header.theme.html');
	$retval .= '<a href="?loc=messages">Back</a>';
	if($cnt > 0){	
		$row = mysql_fetch_array($result);
		$subject = $row['SUBJECT'];
		$messg = $row['MESSAGE'];
		$cover = $row['COVER'];
		$resume= $row['RESUME'];
		
		if ($_SESSION['cid'] == $row['TCID']){
			$fromuser = $row['FUID'];
			$retval .= FUNT_READNEW_EMPLOYER_MSG($subject,$messg,$cover,$resume,$fromuser,$msg, $ea);
		}elseif($_SESSION['cid'] == $row['FCID']){
			$touser = $row['TUID'];
			$retval .= FUNT_READSENT_EMPLOYER_MSG($subject,$messg,$touser,$ea,$msg);
		}
	}
	
	$retval .= file_get_contents('mjl-themes/'.$theme.'/company_area_footer.theme.html');
	return $retval;
}

function FUNT_READNEW_EMPLOYER_MSG($s,$m,$c,$r,$f,$mid,$eq){
	global $theme;
	
	$result = mysql_query('SELECT * FROM users WHERE UID = '.$f.' LIMIT 1');
	$row = mysql_fetch_array($result);
	$lname = $row['LASTNAME'];
	$fname = $row['FIRSTNAME'];
	if  ($c != -1){
		$result = mysql_query('SELECT * FROM covers WHERE ID = '.$c.' AND UID = '.$f.' LIMIT 1');
		$cnt = mysql_num_rows($result);
		if ($cnt > 0){
			$row = mysql_fetch_array($result);
			$cover = '<br /><strong>Attached Cover:</strong> <a href="?loc=cview&id='.$row['ID'].'" target="_blank">'.$row['COVERTITLE'].'</a><br />';
		}
	}else{
		$cover = '<br />';
	}
	if ($r != -1){
		$result = mysql_query('SELECT * FROM resumes WHERE ID = '.$r.' AND UID = '.$f.' LIMIT 1');
		$cnt = mysql_num_rows($result);
		if ($cnt > 0){
			$row = mysql_fetch_array($result);
			$resume = '<strong>Attached Resume:</strong> <a href="?loc=rview&id='.$row['ID'].'" target="_blank">'.$row['RESUMETITLE'].'</a><br /><br /><hr style="width:50%">';
		}
	}else{
		$resume = '<br /><br /><hr style="width:50%">';
	}
	
	$retval = '<div style="text-align:left;width:90%;margin:auto;padding:20px">
	<a href="?loc=msg&act='.$mid.'&a=reply"><img src="mjl-themes/'.$theme.'/reply.gif" border="0" alt="Reply"></a><br /><strong>From:</strong> '.$lname.','. $fname.'<br />';
	$retval .= '<strong>Subject:</strong> '.$s.'<hr style="width:50%">';
	$retval .= $cover;
	$retval .= $resume;
	$retval .= $m.'</div>';
	$replyfrm = '';

	if ($eq == 'reply'){
		$replyfrm = '<br /><br /><div class="replyfrm">
		<form method="post" action="?loc=msg&act='.$mid.'">
		<input type="hidden" name="touser" value="'.$f.'" />
		<input type="hidden" name="tsbj" value="'.$s.'" />
		<TEXTAREA name="myreply" class="replybox"></TEXTAREA><br />
		<input type="SUBMIT" value="Send Reply" />
		</form></div>';
	}	  
	
	return $replyfrm.$retval; 
}

function FUNT_READSENT_EMPLOYER_MSG($s,$m,$f, $eq, $mid){
	global $theme;
	
	$result = mysql_query('SELECT * FROM users WHERE UID = '.$f.' LIMIT 1');
	$row = mysql_fetch_array($result);
	$lname = $row['LASTNAME'];
	$fname = $row['FIRSTNAME'];

	
	$retval = '<div style="text-align:left;width:90%;margin:auto;padding:20px"><a href="?loc=messages&act=sent&a=del&mid='.$mid.'"><img src="mjl-themes/'.$theme.'/delete.gif" border="0" alt="Reply"></a>
<br /><strong>To:</strong> '.$lname.','. $fname.'<br />';
	$retval .= '<strong>Subject:</strong> '.$s.'<hr style="width:50%">';
	$retval .= $m.'</div>';

	return $retval;
}

?>
Return current item: MyJobList