34 lines
1.2 KiB
PHP
34 lines
1.2 KiB
PHP
<?php
|
|
|
|
class applicantname_grabber
|
|
{
|
|
|
|
public static function getLatestApplicantsName($pd_id)
|
|
{
|
|
$CI =&get_instance();
|
|
$CI->load->model('PD_Model');
|
|
//return ( $CI->PD_Model->selectCustomRecords(array('pd_co_applicant_id','applicant_name'),array('fk_pd_id' => $pd_id),PDAPPLICANTSDETAILS));
|
|
|
|
$columns = array('pd_co_applicant_id','applicant_name','TITLES.name as title');
|
|
$table = array(PDAPPLICANTSDETAILS.' as PDAPPLICANTSDETAILS');
|
|
$joins = array(
|
|
array('table' => TITLES. ' as TITLES',
|
|
'condition' =>"PDAPPLICANTSDETAILS.applicant_title_name = TITLES.title_id AND PDAPPLICANTSDETAILS.fk_pd_id = $pd_id",
|
|
'jointype' => 'INNER')
|
|
);
|
|
|
|
return ( $CI->PD_Model->getJoinRecords($columns,$table,$joins));
|
|
}
|
|
|
|
public static function getApplicantsNameById($id,$latest_applicants_names,$type = 1) //$type i for return name only, 2 for return title only, and 3 for return both
|
|
{
|
|
foreach ($latest_applicants_names as $key => $value) {
|
|
|
|
if($id == $value['pd_co_applicant_id'])
|
|
{
|
|
return $type == 1 ? $value['applicant_name'] : ($type == 2 ? $value['title'] : ($value['title'].' '.$value['applicant_name']));
|
|
}
|
|
}
|
|
}
|
|
}
|
|
?>
|