/recruitment/helper_functions.php
PHP | 2471 lines | 1897 code | 483 blank | 91 comment | 300 complexity | 2076517d8bbf362131b0b8741effd67a MD5 | raw file
Possible License(s): LGPL-2.1
Large files files are truncated, but you can click here to view the full file
- <?php
- require_once(realpath(dirname(__FILE__) . "/../lib/globals.php"));
-
- function clean($str) {
- $str = @trim($str);
- if(get_magic_quotes_gpc()) {
- $str = stripslashes($str);
- }
- return mysql_real_escape_string(strip_tags($str,'<br><br /><p></p>'));
- }
-
-
- function get_my_date_format($mySQLDate, $MediumLong){
- //$mySQLDate comes in as '2012-01-06' for Jan 6, 2012 or '2012-01-21' for Jan 21, 2012
-
- $returnVal = get_month_name(substr($mySQLDate,5,2),$MediumLong) . substr($mySQLDate,8,2) . ", " . substr($mySQLDate,0,4);
-
- return $returnVal;
- }
-
-
- function get_month_name($monthNumber,$MediumLong) {
- $mthName = "???";
- switch ($monthNumber) {
- case '01':
- $mthName = 'January';
- break;
- case '02':
- $mthName = 'February';
- break;
- case '03':
- $mthName = 'March';
- break;
- case '04':
- $mthName= 'April';
- break;
- case '05':
- $mthName = 'May';
- break;
- case '06':
- $mthName = 'June';
- break;
- case '07':
- $mthName = 'July';
- break;
- case '08':
- $mthName = 'August';
- break;
- case '09':
- $mthName = 'September';
- break;
- case '10':
- $mthName = 'October';
- break;
- case '11':
- $mthName = 'November';
- break;
- case '12':
- $mthName = 'December';
- break;
- default:
- $mthName = 'January';
- break;
- }//end switch
-
- if(strtolower($MediumLong) == "m"){
- $mthName = substr($mthName,0,3);
- }
- return $mthName . ' ';
- }
-
- function get_next_3days($date_reserved){
- //used in pay_advice.php to get the 3-day deadline
- //for applicants to pay and complete their forms
-
- $q = "SELECT DATE_ADD('$date_reserved', INTERVAL 3 DAY) AS expiry_three_days";
-
- $query = mysql_query($q);
- $row = mysql_fetch_assoc($query);
-
- return get_my_date_format($row['expiry_three_days'],'L');
- }
-
- function get_age_from_date($date_value, $return_format){
- // $q = "SELECT DATEDIFF(NOW(),'" . $date_value . "') AS age_days";
- $q = "SELECT DATEDIFF('" . $date_value . "', NOW()) AS age_days";
-
- $query = mysql_query($q);
- $row = mysql_fetch_assoc($query);
- $age_in_days = $row['age_days'];
- $returnVal = ' (' . $age_in_days . ' days to go).';
- return $returnVal;
- }
-
-
- function get_days_to_go ($date_value){
- $q = "SELECT DATEDIFF('" . $date_value . "', NOW()) AS age_days";
-
- $query = mysql_query($q);
- $row = mysql_fetch_assoc($query);
- $age_in_days = $row['age_days'];
-
- $returnVal = ' (';
-
- switch($age_in_days){
- case 0:
- $returnVal .= 'expires today at 12:00 midnight!)';
- break;
- case 1:
- $returnVal .= 'expires tomorrow at 12:00 midnight!)';
- break;
- default:
- $returnVal .= $age_in_days . ' days to go).';
- break;
- }
-
- return $returnVal;
- }
-
- function is_future_date($date_value){
- $q = "SELECT DATEDIFF('" . $date_value . "', NOW()) AS date_difference";
-
- $query = mysql_query($q);
- $row = mysql_fetch_assoc($query);
- $date_diff = $row['date_difference'];
-
- return ($date_diff > 0);
- }
-
-
- function is_date_past($date_value){
- $date_value = get_mysql_date($date_value);
- $q = "SELECT DATEDIFF('" . $date_value . "', NOW()) AS date_difference";
-
- $query = mysql_query($q);
- if(mysql_num_rows($query) > 0){
- $row = mysql_fetch_assoc($query);
- $date_diff = $row['date_difference'];
-
- }else{
- $date_diff = -1;
- }
-
- return ($date_diff < 0);
- }
-
- function is_dateformat_ddmmyyyy($dateStr){
- //we want to date that $dateStr came in the format 'DD/MM/YYYY'
- if(strlen($dateStr) != 10){
- return false;
- }
-
- $dd = substr($dateStr,0,2);
- $mm = substr($dateStr,3,2);
- $yy = substr($dateStr,6,4);
-
- return (checkdate($mm,$dd,$yy));
- }
-
- function get_mysql_date($dateparameter){
- //$dateparameter = 'DD/MM/YYYY'
- //we want to return 'YYYY-MM-DD'
- $returnDate = "'". substr($dateparameter,6,4) . "-" . substr($dateparameter,3,2) ."-" . substr($dateparameter,0,2) . "'";
- return $returnDate ;
- }
-
-
- function get_date_ddmmyyyy($dateparameter){
- //$dateparameter = mySQL date 'YYYY-MM-DD'
- //we want to return 'DD/MM/YYYY'
-
- $returnDate = substr($dateparameter,8,2) . "/" . substr($dateparameter,5,2) . "/" . substr($dateparameter,0,4);
- return $returnDate ;
- }
-
-
- function is_dateformat_mmmddyyyy($dateStr){
- /*
- $dt=$_POST['dt'];
- //$dt="02/28/2007";
- $arr=split("/",$dt); // splitting the array
- $mm=$arr[0]; // first element of the array is month
- $dd=$arr[1]; // second element is date
- $yy=$arr[2]; // third element is year
-
- If(!checkdate($mm,$dd,$yy)){
- echo "invalid date";
- }else {
- echo "Entry date is correct";
- } */
-
- $rT = 0;
-
- $dateStr = trim($dateStr);
-
- if (!isset($dateStr) || strlen($dateStr) != 10){
- //1980-01-01
- $rT = 0;
- }else{
- $arr = split("-",$dateStr); // splitting the array
- $yy = $arr[0];
- $mm = $arr[1];
- $dd = $arr[2];
-
- if (strlen($yy) == 4 && strlen($mm) == 2 && strlen($dd) == 2){
- if (is_numeric($yy) && is_numeric($mm) && is_numeric($dd)){
- if(checkdate($mm,$dd,$yy)){
- $rT = 1;
- }
- }
- }
- }//end if (!isset($dateStr) || strlen($dateStr)==0)
-
- return $rT;
- }
-
-
- function get_full_age_from_date($date_value, $return_format){
- if(!isset($date_value) || strlen($date_value) < 10){
- return 'Unknown Age';
- }
-
- $q = "SELECT DATEDIFF(NOW(),'" . $date_value . "') AS age_days";
-
- $query = mysql_query($q);
- $row = mysql_fetch_assoc($query);
- $age_in_days = $row['age_days'];
-
- $q = "SELECT FROM_DAYS($age_in_days) AS age_full";
- $query = mysql_query($q);
- $row = mysql_fetch_assoc($query);
- $age_in_full = $row['age_full'];
-
- $age_array = explode("-", $age_in_full);
- $age_years = (int)$age_array[0];
-
- $returnVal = $age_years;
-
- if($return_format == 'Full Details'){
- $age_months = (int)$age_array[1];
- $age_days = (int)$age_array[2];
-
- $y = ' year';
- $m = ' month';
- $d = ' day';
-
- if($age_years > 1){
- $y .= 's';
- }
-
- if($age_months > 1){
- $m .= 's';
- }
-
- if($age_days > 1){
- $d .= 's';
- }
-
- $y .= ', ';
- $m .= ' and ';
- $d .= ' old today';
-
- $returnVal = $age_years . $y . $age_months . $m . $age_days . $d;
- }
-
- return $returnVal;
- }
-
- function is_biodata_complete($applicantid){
- $returnVal = false;
-
- $q = "SELECT rowid, surname, firstname, othernames, gender, maritalstatus, physicalchallenge, birthdate, birthplace, hometown, lga, nationality ";
- $q .= "FROM tblapplicantsdetails WHERE appaccountrowid = $applicantid";
-
- $query = mysql_query($q);
- $foundRecord = mysql_num_rows($query);
-
- if ($foundRecord == 1) {
- $row = mysql_fetch_assoc($query);
-
- $returnVal = ( isset($row['gender']) && (strlen($row['gender']) == 1) && isset($row['birthdate']) && isset($row['hometown']) && isset($row['nationality']) && $row['nationality'] > 0);
- }
-
- return $returnVal;
- }
-
-
- function is_academic_qualification_complete($applicantid){
- $returnVal = false;
-
- $q = "SELECT rowid FROM tblapplicantshighestqual WHERE appaccountrowid = $applicantid";
-
- $query = mysql_query($q);
- $foundRecord = mysql_num_rows($query);
-
- return ($foundRecord == 1);
- }
-
-
- function is_primary_contact_complete($applicantid){
- $returnVal = false;
-
- $q = "SELECT currentaddress, permanenthomeaddress ";
- $q .= "FROM tblapplicantscontacts WHERE appaccountrowid = $applicantid";
-
- $query = mysql_query($q);
- $foundRecord = mysql_num_rows($query);
-
- if ($foundRecord == 1) {
- $row = mysql_fetch_assoc($query);
- $returnVal = ( isset($row['currentaddress']) && (strlen($row['currentaddress']) > 0) && isset($row['permanenthomeaddress']) && (strlen($row['permanenthomeaddress']) > 0) );
- }
-
- return $returnVal;
- }
-
-
- function count_applicant_professional_quals($applicantid){
- $returnVal = 0;
-
- $q = "SELECT COUNT(rowid) AS tot FROM tblapplicantsprofqualifications WHERE appaccountrowid = $applicantid";
- $query = mysql_query($q);
- $foundRecord = mysql_num_rows($query);
-
- if($foundRecord > 0){
- $row = mysql_fetch_assoc($query);
- $returnVal = $row['tot'];
- }
-
- return $returnVal;
- }
-
-
- function count_applicant_work_experience($applicantid){
- $returnVal = 0;
-
- $q = "SELECT COUNT(workingexpid) AS tot FROM tblapplicantsworkexperience WHERE appaccountrowid = $applicantid";
- $query = mysql_query($q);
- $foundRecord = mysql_num_rows($query);
-
- if($foundRecord > 0){
- $row = mysql_fetch_assoc($query);
- $returnVal = $row['tot'];
- }
-
- return $returnVal;
- }
-
- function get_job_title_from_advert_id($ad_id){
- $returnVal = '';
-
- if(!isset($ad_id) || !is_numeric($ad_id) || ((int)$ad_id < 0) ){
- $ad_id = 0;
- }
-
- $q = "SELECT tbladvertisements.vacancyid, tblvacancies.rankid, tblrank.name as position_name, tbldepartment.name as department_name ";
- $q .= "FROM tbladvertisements LEFT JOIN tblvacancies ON tbladvertisements.vacancyid = tblvacancies.vacancyid LEFT JOIN tblrank ON ";
- $q .= "tblvacancies.rankid = tblrank.rankid LEFT JOIN tbldepartment ON tblvacancies.departmentid = tbldepartment.departmentid WHERE advertisementid = $ad_id";
-
- $query = mysql_query($q);
- $foundRecord = mysql_num_rows($query);
-
- if ($foundRecord == 1) {
- $row = mysql_fetch_assoc($query);
- $returnVal = '<strong>'. $row['position_name'] . ' (' . $row['department_name'].')</strong>';
- }else {
- $returnVal = 'Job Position Undefined';
- }//end if ($foundRecord == 1)
-
- return $returnVal;
- }
-
-
- function is_exist_item($item_value, $item_value_is_num, $column_name, $table_name){
- //for this function to work, the target table must have a column called "row_id"
-
- $param_item_value = clean($item_value);
- $param_column_name = clean($column_name);
- $param_table_name = clean($table_name);
-
- $q = "SELECT row_id FROM $param_table_name WHERE $param_column_name = ";
-
- if($item_value_is_num == 1){
- $q .= "$param_item_value";
- }else{
- $q .= "'$param_item_value'";
- }
-
- $query = mysql_query($q);
- $foundRecord = mysql_num_rows($query);
-
- return $foundRecord > 0;
- }
-
-
- function is_exist_nok($ad_response_id){
- $ad_response_id = clean($ad_response_id);
-
- $q = "SELECT rowid FROM tblapplicantsnok WHERE advertresponseid = $ad_response_id";
-
- $query = mysql_query($q);
- $foundRecord = mysql_num_rows($query);
-
- return ($foundRecord > 0);
- }
-
- function is_exist_score_item($item){
- $item = clean($item);
-
- $q = "SELECT scoreitemid FROM tblinterviewscoreitems WHERE scoreitemdescription = '$item'";
-
- $query = mysql_query($q);
- $foundRecord = mysql_num_rows($query);
-
- return ($foundRecord > 0);
- }
-
-
- function is_exist_position($pos_id){
- $pos_id = clean($pos_id);
-
- if(! is_numeric($pos_id)){
- $pos_id = 0;
- }
-
- $q = "SELECT name FROM tblrank WHERE rankid = $pos_id";
-
- $query = mysql_query($q);
- $foundRecord = mysql_num_rows($query);
-
- return ($foundRecord > 0);
- }
-
- function is_exist_job_application_id($job_app_id){
- $job_app_id = clean($job_app_id);
-
- if(! is_numeric($job_app_id)){
- $job_app_id = 0;
- }
-
- $q = "SELECT advertid FROM tbladvertresponses WHERE responseid = $job_app_id";
-
- $query = mysql_query($q);
- $foundRecord = mysql_num_rows($query);
-
- return ($foundRecord > 0);
- }
-
-
- function is_exist_vacancy_id($vacancy_id){
- $vacancy_id = clean($vacancy_id);
-
- if(! is_numeric($vacancy_id)){
- $vacancy_id = 0;
- }
-
- $_SESSION['vac_PositionID'] = 0;
- $_SESSION['vac_DepartmentID'] = 0;
- $_SESSION['vac_WorkSchedule'] = '';
- $_SESSION['vac_WorkShifts'] = '';
- $_SESSION['vac_WorkHours'] = '';
- $_SESSION['vac_Slots'] = '';
- $_SESSION['vac_PosSummary'] = '';
- $_SESSION['vac_ExperienceRequirements'] = '';
- $_SESSION['vac_EducationRequirements'] = '';
- $_SESSION['vac_Advantage'] = '';
- $_SESSION['vac_Reason'] = 0;
- $_SESSION['vac_Status'] = '';
- $_SESSION['vac_VacantDate'] = '';
-
- $q = "SELECT rankid, departmentid, vacantslots, jobschedule, jobshifts, jobhours, positionsummary, educationrequirements, experiencerequirements, ";
- $q .= "additional_requirements, status, vacancyreasonid, effectivedate FROM tblvacancies WHERE vacancyid = $vacancy_id";
-
- $query = mysql_query($q);
- $foundRecord = mysql_num_rows($query);
-
- if($foundRecord == 1){
- $row = mysql_fetch_assoc($query);
-
- $_SESSION['vac_PositionID'] = $row['rankid'];
- $_SESSION['vac_DepartmentID'] = $row['departmentid'];
- $_SESSION['vac_WorkSchedule'] = $row['jobschedule'];
- $_SESSION['vac_WorkShifts'] = $row['jobshifts'];
- $_SESSION['vac_WorkHours'] = $row['jobhours'];
- $_SESSION['vac_Slots'] = $row['vacantslots'];
- $_SESSION['vac_PosSummary'] = $row['positionsummary'];
- $_SESSION['vac_ExperienceRequirements'] = $row['experiencerequirements'];
- $_SESSION['vac_EducationRequirements'] = $row['educationrequirements'];
- $_SESSION['vac_Advantage'] = $row['additional_requirements'];
- $_SESSION['vac_Reason'] = $row['vacancyreasonid'];
- $_SESSION['vac_Status'] = $row['status'];
- $_SESSION['vac_VacantDate'] = $row['effectivedate'];
- }
-
- return ($foundRecord > 0);
- }
-
-
- function is_exist_advert_id($advert_id){
- $advert_id = clean($advert_id);
-
- if(! is_numeric($advert_id)){
- $advert_id = 0;
- }
- $q = "SELECT adverttype FROM tbladvertisements WHERE advertisementid = $advert_id";
-
- $query = mysql_query($q);
- $foundRecord = mysql_num_rows($query);
-
- return ($foundRecord > 0);
- }
-
-
- function load_schedule_session_vars($schedule_id){
- $_SESSION['biz_MaxThreshold'] = 0;
- $_SESSION['biz_MaxPixChange'] = 0;
- $_SESSION['biz_MaxBiodataEdit'] = 0;
- $_SESSION['biz_MaxJobApps'] = 0;
- $_SESSION['biz_Referees'] = 0;
-
- $q = "SELECT threshold, maxpicturechange, maxbiodataedit, maxjobapplications, requiredreferees FROM tblrecruitmentsettings WHERE rowid = 1";
-
- $query = mysql_query($q);
- $foundRecord = mysql_num_rows($query);
-
- if($foundRecord == 1){
- $row = mysql_fetch_assoc($query);
-
- $_SESSION['biz_MaxThreshold'] = $row['threshold'];
- $_SESSION['biz_MaxPixChange'] = $row['maxpicturechange'];
- $_SESSION['biz_MaxBiodataEdit'] = $row['maxbiodataedit'];
- $_SESSION['biz_MaxJobApps'] = $row['maxjobapplications'];
- $_SESSION['biz_Referees'] = $row['requiredreferees'];
- }
- }
-
-
- function load_settings_into_session_vars(){
- $_SESSION['biz_MaxThreshold'] = 0;
- $_SESSION['biz_MaxPixChange'] = 0;
- $_SESSION['biz_MaxBiodataEdit'] = 0;
- $_SESSION['biz_MaxJobApps'] = 0;
- $_SESSION['biz_Referees'] = 0;
-
- $q = "SELECT threshold, maxpicturechange, maxbiodataedit, maxjobapplications, requiredreferees FROM tblrecruitmentsettings WHERE rowid = 1";
-
- $query = mysql_query($q);
- $foundRecord = mysql_num_rows($query);
-
- if($foundRecord == 1){
- $row = mysql_fetch_assoc($query);
-
- $_SESSION['biz_MaxThreshold'] = $row['threshold'];
- $_SESSION['biz_MaxPixChange'] = $row['maxpicturechange'];
- $_SESSION['biz_MaxBiodataEdit'] = $row['maxbiodataedit'];
- $_SESSION['biz_MaxJobApps'] = $row['maxjobapplications'];
- $_SESSION['biz_Referees'] = $row['requiredreferees'];
- }
- }
-
-
- function load_workschedules_into_combo($sess_schedule){
- $returnVal = "<option value = '-1'>-- Please Select --</option>";
- switch ($sess_schedule){
- case 'Full-Time';
- $returnVal .= "<option value = 'Full-Time' selected='selected'>Full Time</option>";
- $returnVal .= "<option value = 'Part-Time'>Part Time</option>";
- $returnVal .= "<option value = 'Full and Part Time'>Full and Part Time</option>";
- break;
- case 'Part-Time';
- $returnVal .= "<option value = 'Full-Time'>Full Time</option>";
- $returnVal .= "<option value = 'Part-Time' selected='selected'>Part Time</option>";
- $returnVal .= "<option value = 'Full and Part Time'>Full and Part Time</option>";
- break;
- case 'Full and Part Time';
- $returnVal .= "<option value = 'Full-Time'>Full Time</option>";
- $returnVal .= "<option value = 'Part-Time'>Part Time</option>";
- $returnVal .= "<option value = 'Full and Part Time' selected='selected'>Full and Part Time</option>";
- break;
- default:
- $returnVal .= "<option value = 'Full-Time'>Full Time</option>";
- $returnVal .= "<option value = 'Part-Time'>Part Time</option>";
- $returnVal .= "<option value = 'Full and Part Time'>Full and Part Time</option>";
- break;
- }
-
- return $returnVal;
- }
-
-
- function load_workshifts_into_combo($sess_shift){
- $returnVal = "<option value = '-1'>-- Please Select --</option>";
- switch ($sess_shift){
- case 'Days';
- $returnVal .= "<option value = 'Days' selected='selected'>Days</option>";
- $returnVal .= "<option value = 'Nights'>Nights</option>";
- $returnVal .= "<option value = 'Days and Nights'>Days and Nights</option>";
- break;
- case 'Nights';
- $returnVal .= "<option value = 'Days'>Days</option>";
- $returnVal .= "<option value = 'Nights' selected='selected'>Nights</option>";
- $returnVal .= "<option value = 'Days and Nights'>Days and Nights</option>";
- break;
- case 'Days and Nights';
- $returnVal .= "<option value = 'Days'>Days</option>";
- $returnVal .= "<option value = 'Nights'>Nights</option>";
- $returnVal .= "<option value = 'Days and Nights' selected='selected'>Days and Nights</option>";
- break;
- default:
- $returnVal .= "<option value = 'Days'>Days</option>";
- $returnVal .= "<option value = 'Nights'>Nights</option>";
- $returnVal .= "<option value = 'Days and Nights'>Days and Nights</option>";
- break;
- }
-
- return $returnVal;
- }
-
- function load_vacancyreasons_into_combo($sess_reason){
- $returnVal = '';
-
- $q = "SELECT rowid, vacancyreason FROM tblvacancyreasons ORDER BY vacancyreason";
- $query = mysql_query($q);
- $foundRecord = mysql_num_rows($query);
-
- if ($foundRecord > 0) {
- $returnVal .= "<option value = '-1'>-- Please Select --</option>";
- while ($row = mysql_fetch_assoc($query)){
- if($row['rowid'] == $sess_reason){
- $returnVal .= "<option value='" . $row['rowid'] . "' selected='selected'>" . $row['vacancyreason'] . "</option>";
- }else{
- $returnVal .= "<option value='" . $row['rowid'] . "'>" . $row['vacancyreason'] . "</option>";
- }
- }
- }else{
- $returnVal = "<option value = '-1'>No Data in Vacancy Reasons Table</option>";
- }//end if ($foundRecord == 1)
-
- return $returnVal;
- }
-
-
- function load_positionstatus_into_combo($sess_status){
- $returnVal = "<option value = '-1'>-- Please Select --</option>";
-
- switch ($sess_status){
- case 'Occupied';
- $returnVal .= "<option value = 'Occupied' selected='selected'>Occupied</option>";
- $returnVal .= "<option value = 'Not Occupied'>Not Occupied</option>";
- break;
- case 'Not Occupied';
- $returnVal .= "<option value = 'Occupied'>Occupied</option>";
- $returnVal .= "<option value = 'Not Occupied' selected='selected'>Not Occupied</option>";
- break;
- default:
- $returnVal .= "<option value = 'Occupied'>Occupied</option>";
- $returnVal .= "<option value = 'Not Occupied'>Not Occupied</option>";
- break;
- }
-
- return $returnVal;
- }
-
- function load_interview_panels_into_combo($sess_panel_id){
- $returnVal = '';
-
- $q = "SELECT rowid, panelname FROM tblinterviewpanels ORDER BY panelname";
- $query = mysql_query($q);
- $foundRecord = mysql_num_rows($query);
-
- if ($foundRecord > 0) {
- $returnVal .= "<option value = '-1'>-- Please Select --</option>";
- while ($row = mysql_fetch_assoc($query)){
- if($row['rowid'] == $sess_panel_id){
- $returnVal .= "<option value='" . $row['rowid'] . "' selected='selected'>" . $row['panelname'] . "</option>";
- }else{
- $returnVal .= "<option value='" . $row['rowid'] . "'>" . $row['panelname'] . "</option>";
- }
- }
- }else{
- $returnVal = "<option value = '-1'>No Data in Panels Table</option>";
- }//end if ($foundRecord == 1)
-
- return $returnVal;
- }
-
-
- function is_exist_interview_panel_id($panel_ID){
- $_SESSION['pnl_PanelName'] = '';
- $_SESSION['pnl_DateConstituted'] = '';
- $_SESSION['pnl_ConstitutedBy'] = '';
-
- $panel_ID = clean($panel_ID);
-
- if(! is_numeric($panel_ID)){
- $panel_ID = 0;
- }
-
- $q = "SELECT panelname, dateconstituted, constitutedby FROM tblinterviewpanels WHERE rowid = $panel_ID";
-
- $query = mysql_query($q);
- $foundRecord = mysql_num_rows($query);
-
- if($foundRecord == 1){
- $row = mysql_fetch_assoc($query);
- $_SESSION['pnl_PanelName'] = $row['panelname'];
- $_SESSION['pnl_DateConstituted'] = $row['dateconstituted'];
- $_SESSION['pnl_ConstitutedBy'] = $row['constitutedby'];
- }
-
- return ($foundRecord == 1);
- }
-
-
- function panel_is_used_in_records($panel_id){
- $returnVal = true; //assume is used
- //tblinterviewresults
-
- $q = "SELECT schedulerowid FROM tblinterviewschedules WHERE panelrowid = $panel_id";
-
- $query = mysql_query($q);
- $returnVal = (mysql_num_rows($query) > 0);
-
- return $returnVal;
- }
-
-
- function is_exist_interview_panel_member_id($member_ID){
- $_SESSION['mem_PanelID'] = 0;
- $_SESSION['mem_FullNames'] = '';
- $_SESSION['mem_PNumber'] = '';
- $_SESSION['mem_Department'] = 0;
- $_SESSION['mem_Role'] = '';
-
- $member_ID = clean($member_ID);
-
- if(! is_numeric($member_ID)){
- $member_ID = 0;
- }
-
- $q = "SELECT panelrowid, memberfullname, personnelnumber, memberdepartmentid, memberrole, tbldepartment.name as department FROM tblinterviewpanelmembers ";
- $q .= "LEFT JOIN tbldepartment ON tblinterviewpanelmembers.memberdepartmentid = tbldepartment.departmentid WHERE tblinterviewpanelmembers.rowid = $member_ID";
-
- $query = mysql_query($q);
- $foundRecord = mysql_num_rows($query);
-
- if($foundRecord == 1){
- $row = mysql_fetch_assoc($query);
- $_SESSION['mem_PanelID'] = $row['panelrowid'];
- $_SESSION['mem_FullNames'] = $row['memberfullname'];
- $_SESSION['mem_PNumber'] = $row['personnelnumber'];
- $_SESSION['mem_Department'] = $row['memberdepartmentid'];
- $_SESSION['mem_Role'] = $row['memberrole'];
- }
-
- return ($foundRecord == 1);
- }
-
- function is_exist_interview_schedule_id($schedule_id){
- $schedule_id = clean($schedule_id);
-
- if(! is_numeric($schedule_id)){
- $schedule_id = 0;
- }
-
- $_SESSION['schedule_AdvertID'] = 0;
- $_SESSION['schedule_StartDate'] = '';
- $_SESSION['schedule_EndDate'] = '';
- $_SESSION['schedule_Venue'] = '';
- $_SESSION['schedule_Times'] = '';
- $_SESSION['schedule_Parentpanel'] = 'Unknown Panel';
-
- $q = "SELECT panelrowid, advertid, startdate, enddate, sittingvenue, sittingtimes, panelname ";
- $q .= "FROM tblinterviewschedules INNER JOIN tblinterviewpanels ON tblinterviewschedules.panelrowid = tblinterviewpanels.rowid ";
- $q .= "WHERE schedulerowid = $schedule_id";
-
- $query = mysql_query($q);
- $foundRecord = mysql_num_rows($query);
-
- if($foundRecord == 1){
- $row = mysql_fetch_assoc($query);
- $_SESSION['schedule_AdvertID'] = $row['advertid'];
- $_SESSION['schedule_StartDate'] = $row['startdate'];
- $_SESSION['schedule_EndDate'] = $row['enddate'];
- $_SESSION['schedule_Venue'] = $row['sittingvenue'];
- $_SESSION['schedule_Times'] = $row['sittingtimes'];
- $_SESSION['schedule_Parentpanel'] = $row['panelname'];
- }
-
- return ($foundRecord > 0);
- }
-
-
- function is_exist_department($dept_id){
- $dept_id = clean($dept_id);
-
- if(! is_numeric($dept_id)){
- $dept_id = 0;
- }
-
- $q = "SELECT name FROM tbldepartment WHERE departmentid = $dept_id";
-
- $query = mysql_query($q);
- $foundRecord = mysql_num_rows($query);
-
- return ($foundRecord > 0);
- }
-
- function is_exist_unit($unit_id){
- $unit_id = clean($unit_id);
-
- if(! is_numeric($unit_id)){
- $unit_id = 0;
- }
-
- $q = "SELECT unitname FROM tblunits WHERE unitid = $unit_id";
-
- $query = mysql_query($q);
- $foundRecord = mysql_num_rows($query);
-
- return ($foundRecord > 0);
- }
-
-
- function is_exist_vacancyreason($vac_reason_id){
- $vac_reason_id = clean($vac_reason_id);
-
- if(! is_numeric($vac_reason_id)){
- $vac_reason_id = 0;
- }
-
- $q = "SELECT vacancyreason FROM tblvacancyreasons WHERE rowid = $vac_reason_id";
-
- $query = mysql_query($q);
- $foundRecord = mysql_num_rows($query);
-
- return ($foundRecord > 0);
- }
-
-
-
- function is_exist_user_account_id($user_id){
- $user_id = clean($user_id);
-
- if(! is_numeric($user_id)){
- $user_id = 0;
- }
-
- $q = "SELECT datecreated FROM tblapplicantsaccount WHERE account_rowid = $user_id";
-
- $query = mysql_query($q);
- $foundRecord = mysql_num_rows($query);
-
- return ($foundRecord > 0);
- }
-
- function is_exist_user_alternate_phone($user_id){
- $user_id = clean($user_id);
-
- if(! is_numeric($user_id)){
- $user_id = 0;
- }
-
- $q = "SELECT rowid FROM tblapplicantsotherphones WHERE appaccountrowid = $user_id";
-
- $query = mysql_query($q);
- $foundRecord = mysql_num_rows($query);
-
- return ($foundRecord > 0);
- }
-
-
- function is_exist_user_highest_qualification($user_id){
- $user_id = clean($user_id);
-
- if(! is_numeric($user_id)){
- $user_id = 0;
- }
-
- $q = "SELECT rowid FROM tblapplicantshighestqual WHERE appaccountrowid = $user_id";
-
- $query = mysql_query($q);
- $foundRecord = mysql_num_rows($query);
-
- return ($foundRecord > 0);
- }
-
-
- function is_exist_user_prof_qualification($user_id, $qual_id){
- $user_id = clean($user_id);
- $qual_id = clean($qual_id);
-
- if(!is_numeric($user_id) || !is_numeric($qual_id)){
- return true;
- }
-
- $q = "SELECT rowid FROM tblapplicantsprofqualifications WHERE appaccountrowid = $user_id AND qualificationid = $qual_id";
-
- $query = mysql_query($q);
- $foundRecord = mysql_num_rows($query);
-
- return ($foundRecord > 0);
- }
-
-
- function is_exist_prof_qualification($qual_ID){
- $_SESSION['prof_Qualification'] = 0;
- $_SESSION['prof_AwardBody'] = '';
- $_SESSION['prof_AwardYear'] = '';
-
- $qual_row_id = (int)$qual_ID;
- if(!is_numeric($qual_row_id)){
- return false;
- }
-
- $q = "SELECT qualificationid, yearobtained, awardingbody FROM tblapplicantsprofqualifications WHERE rowid = $qual_row_id";
- $query = mysql_query($q);
- $foundRecord = mysql_num_rows($query);
-
- if($foundRecord == 1){
- $row = mysql_fetch_assoc($query);
- $_SESSION['prof_Qualification'] = $row['qualificationid'];
- $_SESSION['prof_AwardBody'] = $row['awardingbody'];
- $_SESSION['prof_AwardYear'] = $row['yearobtained'];
- }
-
- return ($foundRecord == 1);
- }
-
-
- function is_exist_work_experience($exp_ID){
- $_SESSION['exp_Employer'] = '';
- $_SESSION['exp_Position'] = '';
- $_SESSION['exp_StartDate'] = '';
- $_SESSION['exp_EndDate'] = '';
- $_SESSION['exp_Duties'] = '';
-
- $exp_row_id = (int)$exp_ID;
- if(!is_numeric($exp_row_id)){
- return false;
- }
-
- $q = "SELECT employer, positionheld, responsibilities, datefrom, dateto FROM tblapplicantsworkexperience WHERE workingexpid = $exp_ID";
-
- $query = mysql_query($q);
- $foundRecord = mysql_num_rows($query);
-
- if($foundRecord == 1){
- $row = mysql_fetch_assoc($query);
- $_SESSION['exp_Employer'] = $row['employer'];
- $_SESSION['exp_Position'] = $row['positionheld'];
- $_SESSION['exp_StartDate'] = $row['datefrom'];
- $_SESSION['exp_EndDate'] = $row['dateto'];
- $_SESSION['exp_Duties'] = $row['responsibilities'];
- }
-
- return ($foundRecord == 1);
- }
-
-
- function get_ranks($sess_rank){
- $returnVal = '';
-
- $q = "SELECT rankid, name FROM tblrank ORDER BY name";
- $query = mysql_query($q);
- $foundRecord = mysql_num_rows($query);
-
- if ($foundRecord >= 1) {
- $returnVal .= "<option value = '-1'>-- Please Select --</option>";
- while ($row = mysql_fetch_assoc($query)){
- if($row['rankid'] == $sess_rank){
- $returnVal .= "<option value='" . $row['rankid'] . "' selected='selected'>" . $row['name'] . "</option>";
- }else{
- $returnVal .= "<option value='" . $row['rankid'] . "'>" . $row['name'] . "</option>";
- }
- }
- }else{
- $returnVal = "<option value = '-1'>No Data in Ranks Table</option>";
- }//end if ($foundRecord == 1)
-
- return $returnVal;
- }
-
-
- function get_departments($sess_dept){
- $returnVal = '';
-
- $q = "SELECT departmentid, name FROM tbldepartment ORDER BY name";
- $query = mysql_query($q);
- $foundRecord = mysql_num_rows($query);
-
- if ($foundRecord >= 1) {
- $returnVal .= "<option value = '-1'>-- Please Select --</option>";
- while ($row = mysql_fetch_assoc($query)){
- if($row['departmentid'] == $sess_dept){
- $returnVal .= "<option value='" . $row['departmentid'] . "' selected='selected'>" . $row['name'] . "</option>";
- }else{
- $returnVal .= "<option value='" . $row['departmentid'] . "'>" . $row['name'] . "</option>";
- }
- }
- }else{
- $returnVal = "<option value = '-1'>No Data in Departments Table</option>";
- }//end if ($foundRecord == 1)
-
- return $returnVal;
- }
-
-
- function get_units($sess_unit){
- $returnVal = '';
-
- $q = "SELECT unitid, unitname FROM tblunits ORDER BY unitname";
- $query = mysql_query($q);
- $foundRecord = mysql_num_rows($query);
-
- if ($foundRecord >= 1) {
- $returnVal .= "<option value = '-1'>-- Please Select --</option>";
- while ($row = mysql_fetch_assoc($query)){
- if($row['unitid'] == $sess_unit){
- $returnVal .= "<option value='" . $row['unitid'] . "' selected='selected'>" . $row['unitname'] . "</option>";
- }else{
- $returnVal .= "<option value='" . $row['unitid'] . "'>" . $row['unitname'] . "</option>";
- }
- }
- }else{
- $returnVal = "<option value = '-1'>No Data in Units Table</option>";
- }//end if ($foundRecord == 1)
-
- return $returnVal;
- }
-
-
- function get_titles_into_combo($sess_title){
- $returnVal = '';
-
- $q = "SELECT salutationid, salutation FROM tblsalutationslookup ORDER BY salutation";
- $query = mysql_query($q);
- $foundRecord = mysql_num_rows($query);
-
- if ($foundRecord >= 1) {
- $returnVal .= "<option value = '-1'>-- Please Select --</option>";
- while ($row = mysql_fetch_assoc($query)){
- if($row['salutationid'] == $sess_title){
- $returnVal .= "<option value='" . $row['salutationid'] . "' selected='selected'>" . $row['salutation'] . "</option>";
- }else{
- $returnVal .= "<option value='" . $row['salutationid'] . "'>" . $row['salutation'] . "</option>";
- }
- }
- $returnVal .= "<option value = '0'>-- Others --</option>";
- }else{
- $returnVal = "<option value = '-1'>No Data in Salutations Table</option>";
- }//end if ($foundRecord == 1)
-
- return $returnVal;
- }
-
-
- function get_countries_into_combo($sess_country){
- $returnVal = '';
-
- $q = "SELECT countryid, countryname FROM tblcountries ORDER BY countryname";
- $query = mysql_query($q);
- $foundRecord = mysql_num_rows($query);
-
- if ($foundRecord >= 1) {
- $returnVal .= "<option value = '-1'>-- Please Select --</option>";
- while ($row = mysql_fetch_assoc($query)){
- if($row['countryid'] == $sess_country){
- $returnVal .= "<option value='" . $row['countryid'] . "' selected='selected'>" . $row['countryname'] . "</option>";
- }else if (strtoupper($row['countryname']) == 'NIGERIA'){
- $returnVal .= "<option value='" . $row['countryid'] . "' selected='selected'>" . $row['countryname'] . "</option>";
- }else{
- $returnVal .= "<option value='" . $row['countryid'] . "'>" . $row['countryname'] . "</option>";
- }
- }
- // $returnVal .= "<option value = '0'>-- Others --</option>";
- }else{
- $returnVal = "<option value = '-1'>No Data in Countries Table</option>";
- }//end if ($foundRecord == 1)
-
- return $returnVal;
- }
-
-
- function get_states_into_combo($sess_state){
- $returnVal = '';
-
- $q = "SELECT stateid, statename FROM tblstate ORDER BY statename";
- $query = mysql_query($q);
- $foundRecord = mysql_num_rows($query);
-
- if ($foundRecord >= 1) {
- $returnVal .= "<option value = '-1'>-- Please Select --</option>";
- while ($row = mysql_fetch_assoc($query)){
- if($row['stateid'] == $sess_state){
- $returnVal .= "<option value='" . $row['stateid'] . "' selected='selected'>" . $row['statename'] . "</option>";
- }else{
- $returnVal .= "<option value='" . $row['stateid'] . "'>" . $row['statename'] . "</option>";
- }
- }
- $returnVal .= "<option value = '0'>Others [Non-Nigerian]</option>";
- }else{
- $returnVal = "<option value = '-1'>No Data in States Table</option>";
- }//end if ($foundRecord == 1)
-
- return $returnVal;
- }
-
- function get_lgas_into_combo($sess_lga, $state_id){
- $returnVal = '';
-
- $q = "SELECT lgaid, stateid, lganame FROM tbllga ";
-
- if(isset($state_id) && $state_id > 0){
- $q .= " WHERE stateid = $state_id ";
- }
- $q .= "ORDER BY lganame";
-
- $query = mysql_query($q);
- $foundRecord = mysql_num_rows($query);
-
- if ($foundRecord >= 1) {
- $returnVal .= "<option value = '-1'>-- Please Select --</option>";
- while ($row = mysql_fetch_assoc($query)){
- if($row['lgaid'] == $sess_lga){
- $returnVal .= "<option value='" . $row['lgaid'] . "' selected='selected'>" . $row['lganame'] . "</option>";
- }else{
- $returnVal .= "<option value='" . $row['lgaid'] . "'>" . $row['lganame'] . "</option>";
- }
- }
- $returnVal .= "<option value = '0'>Others [Non-Nigerian]</option>";
- }else{
- $returnVal = "<option value = '-1'>No Data in LGAs Table</option>";
- }//end if ($foundRecord == 1)
-
- return $returnVal;
- }
-
-
- function get_title_from_id($title_id){
- $returnVal = '';
-
- $q = "SELECT salutation FROM tblsalutationslookup WHERE salutationid = $title_id";
- $query = mysql_query($q);
- $foundRecord = mysql_num_rows($query);
-
- if ($foundRecord >= 1) {
- $row = mysql_fetch_assoc($query);
- $returnVal = $row['salutation'];
- }
-
- return $returnVal;
- }
-
-
- function get_unit_name_from_id($unit_id){
- $returnVal = '';
-
- $q = "SELECT unitname FROM tblunits WHERE unitid = $unit_id";
- $query = mysql_query($q);
- $foundRecord = mysql_num_rows($query);
-
- if ($foundRecord >= 1) {
- $row = mysql_fetch_assoc($query);
- $returnVal = $row['unitname'];
- }
-
- return $returnVal;
- }
-
- function get_department_name_from_id($dept_id){
- $returnVal = '';
-
- $q = "SELECT name FROM tbldepartment WHERE departmentid = $dept_id";
- $query = mysql_query($q);
- $foundRecord = mysql_num_rows($query);
-
- if ($foundRecord >= 1) {
- $row = mysql_fetch_assoc($query);
- $returnVal = $row['name'];
- }
-
- return $returnVal;
- }
-
-
- function get_position_name_from_id($pos_id){
- $returnVal = '';
-
- $q = "SELECT name FROM tblrank WHERE rankid = $pos_id";
- $query = mysql_query($q);
- $foundRecord = mysql_num_rows($query);
-
- if ($foundRecord >= 1) {
- $row = mysql_fetch_assoc($query);
- $returnVal = $row['name'];
- }
-
- return $returnVal;
- }
-
-
- function get_vacancyreason_from_id($reason_id){
- $returnVal = '';
-
- $q = "SELECT vacancyreason FROM tblvacancyreasons WHERE rowid = $reason_id";
- $query = mysql_query($q);
- $foundRecord = mysql_num_rows($query);
-
- if ($foundRecord > 0) {
- $row = mysql_fetch_assoc($query);
- $returnVal = $row['vacancyreason'];
- }
-
- return $returnVal;
- }
-
- function get_schedule_parent_id($schedule_id){
- $returnVal = '';
-
- $q = "SELECT panelrowid FROM tblinterviewschedules WHERE schedulerowid = $schedule_id";
-
- $query = mysql_query($q);
- $foundRecord = mysql_num_rows($query);
-
- if ($foundRecord > 0) {
- $row = mysql_fetch_assoc($query);
- $returnVal = $row['panelrowid'];
- }
-
- return $returnVal;
- }
-
-
- function load_unadvertised_jobs_into_combo($sess_vacancyid){
- $returnVal = '';
-
- $q = "SELECT tblvacancies.vacancyid, vacantslots, effectivedate, tblrank.name as position_name, tbldepartment.name as department_name FROM tblvacancies LEFT JOIN tblrank ON tblvacancies.rankid = tblrank.rankid LEFT JOIN tbldepartment ON tblvacancies.departmentid = tbldepartment.departmentid WHERE isadvertised = 'no' ORDER BY tblrank.name DESC";
-
- $query = mysql_query($q);
- $foundRecord = mysql_num_rows($query);
-
- if ($foundRecord > 0) {
- $returnVal .= "<option value = '-1'>-- Please Select --</option>";
- while ($row = mysql_fetch_assoc($query)){
- if($row['vacancyid'] == $sess_vacancyid){
- $returnVal .= "<option value='" . $row['vacancyid'] . "' selected='selected'>" . $row['position_name'] . " (" . $row['department_name']. ")</option>";
- }else{
- $returnVal .= "<option value='" . $row['vacancyid'] . "'>" . $row['position_name'] . " (" . $row['department_name']. ")</option>";
- }
- }
- }else{
- $returnVal = "<option value = '-1'>No Registered Job Posting Found</option>";
- }//end if ($foundRecord == 1)
-
- return $returnVal;
- }
-
- function commit_advert_response($advert_ID, $applicant_ID){
- $dt = date('Y-m-d');
- // $transcode = gettranscode('JB'); //from fee manager functions
-
- $q = "INSERT INTO tbladvertresponses (advertid, applicantid, responsedate, responsetime) ";
- $q .= "VALUES ($advert_ID, $applicant_ID, '$dt', curtime())";
-
- $query = mysql_query($q);
- return mysql_insert_id();
-
- /*
- $session = substr($dt,0,4);
- $amount = 2000.00;//should get this from a table: tblfeeitems or tblformfees?
-
- $q = "INSERT INTO tbl_feemngr_transaction(`transcode`, `studreg`,`code`,`transamount`,`session`, `paymentstatus`,`dategen`) ";
- $q .= "VALUES('$transcode','$applicant_ID','JOB',$amount,'$session','Not Paid', now())";
- $query = mysql_query($q);
- */
- }
-
-
- function count_adverts_responded_to($applicant_id){
- $q = "SELECT COUNT(responseid) AS tot_responses FROM tbladvertresponses WHERE applicantid = $applicant_id";
- $query = mysql_query($q);
- $foundRecord = mysql_num_rows($query);
-
- $c = 0;
- if($foundRecord == 1){
- $row = mysql_fetch_assoc($query);
- $c = $row['tot_responses'];
- }
-
- return $c;
- }
-
-
- function applicant_responded_to_this_advert($advert_id, $applicant_id){
- $q = "SELECT responseid FROM tbladvertresponses WHERE advertid = $advert_id AND applicantid = $applicant_id";
- $query = mysql_query($q);
- $foundRecord = mysql_num_rows($query);
-
- if($foundRecord == 1){
- $row = mysql_fetch_assoc($query);
- $_SESSION['advt_response_id'] = $row['responseid'];
- }
-
- return ($foundRecord > 0);
- }
-
- function get_advert_response_id_from_advert_id($advert_id, $applicant_id){
- $q = "SELECT responseid FROM tbladvertresponses WHERE advertid = $advert_id AND applicantid = $applicant_id";
-
- $query = mysql_query($q);
- $foundRecord = mysql_num_rows($query);
-
- $r = 0;
- if($foundRecord == 1){
- $row = mysql_fetch_assoc($query);
- $r = $row['responseid'];
- }
-
- return $r;
- }
-
- function applicant_submitted_this_application($advert_id, $applicant_id){
- $response_id = get_advert_response_id_from_advert_id($advert_id, $applicant_id);
-
- $q = "SELECT rowid FROM tblapplicantscvs WHERE advertresponseid = $response_id";
-
- $query = mysql_query($q);
- $foundRecord = mysql_num_rows($query);
-
- $returnVal = 0;
- if($foundRecord == 1){
- $row = mysql_fetch_assoc($query);
- $returnVal = $row['rowid'];
- }
-
- return $returnVal;
- }
-
- function get_applicant_row_id_from_cv_id($app_cv_id){
- $q = "SELECT cv.advertresponseid, resp.applicantid FROM tblapplicantscvs AS cv INNER JOIN tbladvertresponses AS resp ";
- $q .= "ON cv.advertresponseid = resp.responseid WHERE cv.rowid = $app_cv_id";
-
- $query = mysql_query($q);
- $foundRecord = mysql_num_rows($query);
-
- $r = 0;
- if($foundRecord == 1){
- $row = mysql_fetch_assoc($query);
- $r = $row['applicantid'];
- }
-
- return $r;
- }
-
-
- function get_applicant_fullnames($applicant_row_id){
- $q = "SELECT d.titleid, d.surname, d.firstname, d.othernames, t.salutation ";
- $q .= "FROM tblapplicantsdetails AS d LEFT JOIN tblsalutationslookup AS t ";
- $q .= "ON d.titleid = t.salutationid WHERE d.appaccountrowid = $applicant_row_id";
-
- $query = mysql_query($q);
- $foundRecord = mysql_num_rows($query);
-
- $r = '';
- if($foundRecord == 1){
- $row = mysql_fetch_assoc($query);
- $r = trim($row['salutation'] . ' ' . strtoupper($row['surname']) . ', ' . $row['firstname'] . ' ' . $row['othernames']);
- }
-
- return $r;
- }
-
-
- function get_advert_id_from_cv_id($app_cv_id){
- $q = "SELECT cv.advertresponseid, resp.advertid FROM tblapplicantscvs AS cv INNER JOIN tbladvertresponses AS resp ";
- $q .= "ON cv.advertresponseid = resp.responseid WHERE cv.rowid = $app_cv_id";
-
- $query = mysql_query($q);
- $foundRecord = mysql_num_rows($query);
-
- $r = 0;
- if($foundRecord == 1){
- $row = mysql_fetch_assoc($query);
- $r = $row['advertid'];
- }
-
- return $r;
- }
-
-
- function get_job_reference_number($advert_ID){
- $appyear = substr(date('Y-d-m'),0,4);
- return ('PJA-ABU' . substr($appyear,2,2) . '-' . str_pad($advert_ID, 3, "0", STR_PAD_LEFT)); //eg: ABU/PJA12/005
- // PJA12#ABU#005
- }
-
-
- function embed_user_profile_pic($userRowID, $path_shift){
- /* **************************************************************
- ** Function to try retrieve the URL of user's profile picture **
- ** Returns the URL pre-embedded in the <img > tag: **
- ** **************************************************************/
- $finalURL = get_current_photo($userRowID, $path_shift);
- if (user_photo_not_uploaded($userRowID)){
- $finalURL .= '<div style="float:center; text-align:center; width:100px; margin: 5px; margin-left:-3px; background-color:#eeeeee; border: 1px solid #339933"><a href="photo_upload.php" title="click to upload your photo">upload photo</a></div>';
- }
-
- echo $finalURL;
- }//end function getUserProfilePicURL()
-
-
- function getPicNA($gender){
- if($gender == 'F'){
- $p = 'naF';
- }else{
- $p = 'naM';
- }
- return $p;
- }
-
- function user_photo_not_uploaded($userRowID){
- $returnVal = true;
-
- if ($userRowID > 0){
- $q = "SELECT profile_pic FROM tblapplicantsdetails WHERE appaccountrowid = " . $userRowID;
-
- $query = mysql_query($q);
- $foundRecord = mysql_num_rows($query);
-
- if ($foundRecord == 1) {
- $row = mysql_fetch_assoc($query);
- if (isset($row['profile_pic']) && strlen($row['profile_pic']) == 16) {
- $returnVal = false;
- }
- }
- }
-
- return $returnVal;
- }
-
-
- function get_current_photo($userRowID, $path_shift){
- $finalURL = "";
- $returnVal = "";
- $altTitle = "Image Not Available";
- $naFile = 'naM';
-
- if ($userRowID > 0){
- $q = "SELECT surname, firstname, othernames, profile_pic, gender FROM tblapplicantsdetails WHERE appaccountrowid = " . $userRowID;
-
- $query = mysql_query($q);
- $foundRecord = mysql_num_rows($query);
-
- if ($foundRecord == 1) {
- $row = mysql_fetch_assoc($query);
-
- if (isset($row['profile_pic']) && strlen($row['profile_pic']) == 16) {
- $returnVal = $row['profile_pic'];
- $altTitle = $row['surname'] . ' ' . $row['firstname'] . ' ' . $row['othernames'];
- }else{
- $naFile = getPicNA($row['gender']);
- }//end if (isset($row['m_profile_pic']) && $row['m_profile_pic'] != "")
- }else {
- $returnVal = $naFile;
- }
-
- $returnVal = $path_shift . "profilepics/" . $returnVal . ".jpg";
- }else{
-
- $r = 'recruitment/profile/profilepics/naM.jpg';
- $returnVal = $path_shift . "profilepics/" . $returnVal . ".jpg";
- }
-
- // Whatever is to be returned, check that the image exists and is a file:
- if (file_exists ($returnVal) && (is_file($returnVal))) {
- $finalURL= "<img src='" . $returnVal . "' alt='" . $altTitle . "' title='" . $altTitle . "' width='95px' height='110px' style='border:solid 1px #000000'>";
- }else{
- $finalURL= "<img src='" . $path_shift . "profilepics/" . getPicNA($row['gender']) . ".jpg' alt='" . $altTitle . "' title='" . $altTitle . "' width='95px' height='110px' style='border:solid 1px #000000'>";
- }//end if (file_exists ($returnVal) && (is_file($returnVal)))
-
- return $finalURL;
- }
-
-
- function generate_random_chars($num_chars) {
- $returnVal = '';
- if ((is_numeric($num_chars)) && ($num_chars > 0) && (! is_null($num_chars))) {
-
- $accepted_chars = 'abcdefghijklmnpqrstuvwxyz1234567890ABCDEFGHIJKLMNPQRSTUVWXYZ{_}(-)~^$';
-
- // Seed the generator if necessary.
- srand(((int)((double)microtime()*1000003)) );
-
- for ($i = 0; $i < $num_chars; $i++) {
- $random_number = rand(0, (strlen($accepted_chars) -1));
- $returnVal .= $accepted_chars[$random_number];
- }
- }
- return $returnVal;
- }
-
-
- function get_qualification_types_into_combo($sess_qualID){
- $returnVal = '';
-
- $q = "SELECT id, certificate FROM tblqualificationslookup ORDER BY certificate";
- $query = mysql_query($q);
- $foundRecord = mysql_num_rows($query);
-
- if ($foundRecord >= 1) {
- $returnVal .= "<option value = '-1'>-- Please Select --</option>";
- while ($row = mysql_fetch_assoc($query)){
- if($row['id'] == $sess_qualID){
- $returnVal .= "<option value='" . $row['id'] . "' selected='selected'>" . $row['certificate'] . "</option>";
- }else{
- $returnVal .= "<option value='" . $row['id'] . "'>" . $row['certificate'] . "</option>";
- }
- }
- $returnVal .= "<option value = '0'>-- NONE --</option>";
- }else{
- $returnVal = "<option value = '-1'>No Data in Qualifications Table</option>";
- }//end if ($foundRecord == 1)
-
- return $returnVal;
- }
-
-
- function get_qualification_classes_into_combo($sess_qualclassID){
- $returnVal = '';
-
- $q = "SELECT qualificationclassid, qualification FROM tblqualificationclass ORDER BY qualification";
- $query = mysql_query($q);
- $foundRecord = mysql_num_rows($query);
-
- if ($foundRecord >= 1) {
- $returnVal .= "<option value = '-1'>-- Please Select --</option>";
- while ($row = mysql_fetch_assoc($query)){
- if($row['qualificationclassid'] == $sess_qualclassID){
- $returnVal .= "<option value='" . $row['qualificationclassid'] . "' selected='selected'>" . $row['qualification'] . "</option>";
- }else{
- $returnVal .= "<option value='" . $row['qualificationclassid'] . "'>" . $row['qualification'] . "</option>";
- }
- }
- $returnVal .= "<option value = '0'>-- Not Applicable --</option>";
- }else{
- $returnVal = "<option value = '-1'>No Data in Qualifications Table</option>";
- }//end if ($foundRecord == 1)
-
- return $returnVal;
- }
-
-
- function get_professional_qualifications_into_combo($sess_qualID){
- $returnVal = '';
-
- $q = "SELECT id, name FROM tblprofessionalqualslookup ORDER BY name";
- $query = mysql_query($q);
- $foundRecord = mysql_num_rows($query);
- if ($foundRecord >= 1) {
- $returnVal .= "<option value = '-1'>-- Please Select --</option>";
- while ($row = mysql_fetch_assoc($query)){
- if($row['id'] == $sess_qualID){
- $returnVal .= "<option value='" . $row['id'] . "' selected='selected'>" . $row['name'] . "</option>";
- }else{
- $returnVal .= "<option value='" . $row['id'] . "'>" . $row['name'] . "</option>";
- }
- }
- $returnVal .= "<option value = '0'>-- NONE --</option>";
- }else{
- $returnVal = "<option value = '-1'>No Data in Qualifications Table</option>";
- }//end if ($foundRecord == 1)
-
- return $returnVal;
- }
-
-
- function get_programmes_of_study_into_combo($sess_studyID){
- $returnVal = '';
-
- $q = "SELECT id, studyfield FROM tblstudyfieldlookup ORDER BY studyfield";
- $query = mysql_query($q);
- $foundRecord = mysql_num_rows($query);
-
- if ($foundRecord >= 1) {
- $returnVal .= "<option value = '-1'>-- Please Select --</option>";
- while ($row = mysql_fetch_assoc($query)){
- if($row['id'] == $sess_studyID){
- $returnVal .= "<option value='" . $row['id'] . "' selected='selected'>" . $row['studyfield'] . "</option>";
- }else{
- $returnVal .= "<option value='" . $row['id'] . "'>" . $row['studyfield'] . "</option>";
- }
- }
- $returnVal .= "<option value = '0'>-- Others --</option>";
- }else{
- $returnVal = "<option value = '-1'>No Data in Fields of Study Table</option>";
- }//end if ($foundRecord == 1)
-
- return $returnVal;
- }
-
-
- function get_applicant_advert_to_track($advert_ID, $applicant_id){
- $returnVal = '<table border="1px" style="border-collapse: collapse; width:100%; margin-top:10px" cellpadding="5px" cellspacing="10px">';
-
- if(!is_numeric($advert_ID) || ((int)$advert_ID < 1) || !is_numeric($applicant_id) || ((int)$applicant_id < 1)){
- $returnVal .= '<tr style="border: solid 1px;"><td colspan="2">Error while retrieving the requested information: <strong>"Invalid Advert ID"</strong></td></tr>';
- }else{
- $q = "SELECT tbladvertresponses.responseid, tbladvertresponses.advertid, applicantid, responsedate, ";
- $q .= "datecompleted, applicantcomments, tbladvertisements.advertisementid, adverttype, tbladvertisements.vacancyid, ";
- $q .= "tblvacancies.vacancyid, tblvacancies.rankid, tblvacancies.departmentid, tblrank.name as position_name, tbldepartment.name as department_name ";
- $q .= "FROM tbladvertresponses LEFT JOIN tbladvertisements ON tbladvertresponses.advertid = tbladvertisements.advertis…
Large files files are truncated, but you can click here to view the full file