private function show() { /* Is this a popup? */ if (isset($_GET['display']) && $_GET['display'] == 'popup') { $isPopup = true; } else { $isPopup = false; } /* Bail out if we don't have a valid candidate ID. */ if (!$this->isRequiredIDValid('candidateID', $_GET) && !isset($_GET['email'])) { CommonErrors::fatal(COMMONERROR_BADINDEX, $this, 'Invalid candidate ID.'); } $candidates = new Candidates($this->_siteID); if (isset($_GET['candidateID'])) { $candidateID = $_GET['candidateID']; } else { $candidateID = $candidates->getIDByEmail($_GET['email']); } $data = $candidates->get($candidateID); /* Bail out if we got an empty result set. */ if (empty($data)) { CommonErrors::fatal(COMMONERROR_BADINDEX, $this, 'The specified candidate ID could not be found.'); return; } if ($data['isAdminHidden'] == 1 && $this->_accessLevel < ACCESS_LEVEL_MULTI_SA) { $this->listByView('This candidate is hidden - only a CATS Administrator can unlock the candidate.'); return; } /* We want to handle formatting the city and state here instead * of in the template. */ $data['cityAndState'] = StringUtility::makeCityStateString($data['city'], $data['state']); /* * Replace newlines with <br />, fix HTML "special" characters, and * strip leading empty lines and spaces. */ $data['notes'] = trim(nl2br(htmlspecialchars($data['notes'], ENT_QUOTES))); /* Chop $data['notes'] to make $data['shortNotes']. */ if (strlen($data['notes']) > self::NOTES_MAXLEN) { $data['shortNotes'] = substr($data['notes'], 0, self::NOTES_MAXLEN); $isShortNotes = true; } else { $data['shortNotes'] = $data['notes']; $isShortNotes = false; } /* Format "can relocate" status. */ if ($data['canRelocate'] == 1) { $data['canRelocate'] = 'Yes'; } else { $data['canRelocate'] = 'No'; } if ($data['isHot'] == 1) { $data['titleClass'] = 'jobTitleHot'; } else { $data['titleClass'] = 'jobTitleCold'; } $attachments = new Attachments($this->_siteID); $attachmentsRS = $attachments->getAll(DATA_ITEM_CANDIDATE, $candidateID); foreach ($attachmentsRS as $rowNumber => $attachmentsData) { /* If profile image is not local, force it to be local. */ if ($attachmentsData['isProfileImage'] == 1) { $attachments->forceAttachmentLocal($attachmentsData['attachmentID']); } /* Show an attachment icon based on the document's file type. */ $attachmentIcon = strtolower(FileUtility::getAttachmentIcon($attachmentsRS[$rowNumber]['originalFilename'])); $attachmentsRS[$rowNumber]['attachmentIcon'] = $attachmentIcon; /* If the text field has any text, show a preview icon. */ if ($attachmentsRS[$rowNumber]['hasText']) { $attachmentsRS[$rowNumber]['previewLink'] = sprintf('<a href="#" onclick="window.open(\'%s?m=candidates&a=viewResume&attachmentID=%s\', \'viewResume\', \'scrollbars=1,width=800,height=760\')"><img width="15" height="15" style="border: none;" src="images/search.gif" alt="(Preview)" /></a>', CATSUtility::getIndexName(), $attachmentsRS[$rowNumber]['attachmentID']); } else { $attachmentsRS[$rowNumber]['previewLink'] = ' '; } } $pipelines = new Pipelines($this->_siteID); $pipelinesRS = $pipelines->getCandidatePipeline($candidateID); $sessionCookie = $_SESSION['CATS']->getCookie(); /* Format pipeline data. */ foreach ($pipelinesRS as $rowIndex => $row) { /* Hot jobs [can] have different title styles than normal * jobs. */ if ($row['isHot'] == 1) { $pipelinesRS[$rowIndex]['linkClass'] = 'jobLinkHot'; } else { $pipelinesRS[$rowIndex]['linkClass'] = 'jobLinkCold'; } $pipelinesRS[$rowIndex]['ownerAbbrName'] = StringUtility::makeInitialName($pipelinesRS[$rowIndex]['ownerFirstName'], $pipelinesRS[$rowIndex]['ownerLastName'], false, LAST_NAME_MAXLEN); $pipelinesRS[$rowIndex]['addedByAbbrName'] = StringUtility::makeInitialName($pipelinesRS[$rowIndex]['addedByFirstName'], $pipelinesRS[$rowIndex]['addedByLastName'], false, LAST_NAME_MAXLEN); $pipelinesRS[$rowIndex]['ratingLine'] = TemplateUtility::getRatingObject($pipelinesRS[$rowIndex]['ratingValue'], $pipelinesRS[$rowIndex]['candidateJobOrderID'], $sessionCookie); } $activityEntries = new ActivityEntries($this->_siteID); $activityRS = $activityEntries->getAllByDataItem($candidateID, DATA_ITEM_CANDIDATE); if (!empty($activityRS)) { foreach ($activityRS as $rowIndex => $row) { if (empty($activityRS[$rowIndex]['notes'])) { $activityRS[$rowIndex]['notes'] = '(No Notes)'; } if (empty($activityRS[$rowIndex]['jobOrderID']) || empty($activityRS[$rowIndex]['regarding'])) { $activityRS[$rowIndex]['regarding'] = 'General'; } $activityRS[$rowIndex]['enteredByAbbrName'] = StringUtility::makeInitialName($activityRS[$rowIndex]['enteredByFirstName'], $activityRS[$rowIndex]['enteredByLastName'], false, LAST_NAME_MAXLEN); } } /* Get upcoming calendar entries. */ $calendarRS = $candidates->getUpcomingEvents($candidateID); if (!empty($calendarRS)) { foreach ($calendarRS as $rowIndex => $row) { $calendarRS[$rowIndex]['enteredByAbbrName'] = StringUtility::makeInitialName($calendarRS[$rowIndex]['enteredByFirstName'], $calendarRS[$rowIndex]['enteredByLastName'], false, LAST_NAME_MAXLEN); } } /* Get extra fields. */ $extraFieldRS = $candidates->extraFields->getValuesForShow($candidateID); /* Add an MRU entry. */ $_SESSION['CATS']->getMRU()->addEntry(DATA_ITEM_CANDIDATE, $candidateID, $data['firstName'] . ' ' . $data['lastName']); /* Is the user an admin - can user see history? */ if ($this->_accessLevel < ACCESS_LEVEL_DEMO) { $privledgedUser = false; } else { $privledgedUser = true; } $EEOSettings = new EEOSettings($this->_siteID); $EEOSettingsRS = $EEOSettings->getAll(); $EEOValues = array(); /* Make a list of all EEO related values so they can be positioned by index * rather than static positioning (like extra fields). */ if ($EEOSettingsRS['enabled'] == 1) { if ($EEOSettingsRS['genderTracking'] == 1) { $EEOValues[] = array('fieldName' => 'Gender', 'fieldValue' => $data['eeoGenderText']); } if ($EEOSettingsRS['ethnicTracking'] == 1) { $EEOValues[] = array('fieldName' => 'Ethnicity', 'fieldValue' => $data['eeoEthnicType']); } if ($EEOSettingsRS['veteranTracking'] == 1) { $EEOValues[] = array('fieldName' => 'Veteran Status', 'fieldValue' => $data['eeoVeteranType']); } if ($EEOSettingsRS['disabilityTracking'] == 1) { $EEOValues[] = array('fieldName' => 'Disability Status', 'fieldValue' => $data['eeoDisabilityStatus']); } } $questionnaire = new Questionnaire($this->_siteID); $questionnaires = $questionnaire->getCandidateQuestionnaires($candidateID); $this->_template->assign('active', $this); $this->_template->assign('questionnaires', $questionnaires); $this->_template->assign('data', $data); $this->_template->assign('isShortNotes', $isShortNotes); $this->_template->assign('attachmentsRS', $attachmentsRS); $this->_template->assign('pipelinesRS', $pipelinesRS); $this->_template->assign('activityRS', $activityRS); $this->_template->assign('calendarRS', $calendarRS); $this->_template->assign('extraFieldRS', $extraFieldRS); $this->_template->assign('candidateID', $candidateID); $this->_template->assign('isPopup', $isPopup); $this->_template->assign('EEOSettingsRS', $EEOSettingsRS); $this->_template->assign('EEOValues', $EEOValues); $this->_template->assign('privledgedUser', $privledgedUser); $this->_template->assign('sessionCookie', $_SESSION['CATS']->getCookie()); if (!eval(Hooks::get('CANDIDATE_SHOW'))) { return; } $this->_template->display('./modules/candidates/Show.tpl'); }
public function show() { /* Is this a popup? */ if (isset($_GET['display']) && $_GET['display'] == 'popup') { $isPopup = true; } else { $isPopup = false; } /* Bail out if we don't have a valid candidate ID. */ if (!$this->isRequiredIDValid('candidateID', $_GET) && !isset($_GET['email'])) { CommonErrors::fatal(COMMONERROR_BADINDEX, $this, 'Invalid candidate ID.'); } $candidates = new Candidates($this->_siteID); if (isset($_GET['candidateID'])) { $candidateID = $_GET['candidateID']; } else { $candidateID = $candidates->getIDByEmail($_GET['email']); } $data = $candidates->get($candidateID); $emailList=array(); $sql="select * from email_history where for_id={$candidateID} and for_module='candidates'"; $db = DatabaseConnection::getInstance(); $emailList=$db->getAllAssoc($sql); /* Bail out if we got an empty result set. */ if (empty($data)) { CommonErrors::fatal(COMMONERROR_BADINDEX, $this, 'The specified candidate ID could not be found.'); return; } if ($data['is_admin_hidden'] == 1 && $this->_accessLevel < ACCESS_LEVEL_MULTI_SA) { $this->listByView('This candidate is hidden - only a CATS Administrator can unlock the candidate.'); return; } /* We want to handle formatting the city and state here instead * of in the template. */ $data['cityAndState'] = StringUtility::makeCityStateString( $data['city'], $data['state'] ); /* * Replace newlines with <br />, fix HTML "special" characters, and * strip leading empty lines and spaces. */ $data['notes'] = trim( nl2br(htmlspecialchars($data['notes'], ENT_QUOTES)) ); /* Chop $data['notes'] to make $data['shortNotes']. */ if (strlen($data['notes']) > self::NOTES_MAXLEN) { $data['shortNotes'] = substr( $data['notes'], 0, self::NOTES_MAXLEN ); $isShortNotes = true; } else { $data['shortNotes'] = $data['notes']; $isShortNotes = false; } /** * if ownertype is group, override the user full name */ if($data['ownertype']>0) { $sql="select * from auieo_groups where id={$data['owner']}"; $objDB=DatabaseConnection::getInstance(); $row=$objDB->getAssoc($sql); if($row) { $data["ownerFullName"]=$row["groupname"]; } } /* Format "can relocate" status. */ if ($data['can_relocate'] == 1) { $data['can_relocate'] = 'Yes'; } else { $data['can_relocate'] = 'No'; } if ($data['is_hot'] == 1) { $data['titleClass'] = 'jobTitleHot'; } else { $data['titleClass'] = 'jobTitleCold'; } $attachments = new Attachments($this->_siteID); $attachmentsRS = $attachments->getAll( DATA_ITEM_CANDIDATE, $candidateID ); foreach ($attachmentsRS as $rowNumber => $attachmentsData) { /* If profile image is not local, force it to be local. */ if ($attachmentsData['isProfileImage'] == 1) { $attachments->forceAttachmentLocal($attachmentsData['attachmentID']); } /* Show an attachment icon based on the document's file type. */ $attachmentIcon = strtolower( FileUtility::getAttachmentIcon( $attachmentsRS[$rowNumber]['originalFilename'] ) ); $attachmentsRS[$rowNumber]['attachmentIcon'] = $attachmentIcon; /* If the text field has any text, show a preview icon. */ if ($attachmentsRS[$rowNumber]['hasText']) { $attachmentsRS[$rowNumber]['previewLink'] = sprintf( '<a href="#" onclick="window.open(\'%s?m=candidates&a=viewResume&attachmentID=%s\', \'viewResume\', \'scrollbars=1,width=800,height=760\')"><img width="15" height="15" style="border: none;" src="images/search.gif" alt="(Preview)" /></a>', CATSUtility::getIndexName(), $attachmentsRS[$rowNumber]['attachmentID'] ); } else { $attachmentsRS[$rowNumber]['previewLink'] = ' '; } } $pipelines = new Pipelines($this->_siteID); $pipelinesRS = $pipelines->getCandidatePipeline($candidateID); $sessionCookie = $_SESSION['CATS']->getCookie(); /* Format pipeline data. */ foreach ($pipelinesRS as $rowIndex => $row) { /* Hot jobs [can] have different title styles than normal * jobs. */ if ($row['isHot'] == 1) { $pipelinesRS[$rowIndex]['linkClass'] = 'jobLinkHot'; } else { $pipelinesRS[$rowIndex]['linkClass'] = 'jobLinkCold'; } $pipelinesRS[$rowIndex]['ownerAbbrName'] = StringUtility::makeInitialName( $pipelinesRS[$rowIndex]['ownerFirstName'], $pipelinesRS[$rowIndex]['ownerLastName'], false, LAST_NAME_MAXLEN ); $pipelinesRS[$rowIndex]['addedByAbbrName'] = StringUtility::makeInitialName( $pipelinesRS[$rowIndex]['addedByFirstName'], $pipelinesRS[$rowIndex]['addedByLastName'], false, LAST_NAME_MAXLEN ); $pipelinesRS[$rowIndex]['ratingLine'] = TemplateUtility::getRatingObject( $pipelinesRS[$rowIndex]['ratingValue'], $pipelinesRS[$rowIndex]['candidateJobOrderID'], $sessionCookie ); } $activityEntries = new ActivityEntries($this->_siteID); $activityRS = $activityEntries->getAllByDataItem($candidateID, DATA_ITEM_CANDIDATE); if (!empty($activityRS)) { foreach ($activityRS as $rowIndex => $row) { if (empty($activityRS[$rowIndex]['notes'])) { $activityRS[$rowIndex]['notes'] = '(No Notes)'; } if (empty($activityRS[$rowIndex]['jobOrderID']) || empty($activityRS[$rowIndex]['regarding'])) { $activityRS[$rowIndex]['regarding'] = 'General'; } $activityRS[$rowIndex]['enteredByAbbrName'] = StringUtility::makeInitialName( $activityRS[$rowIndex]['enteredByFirstName'], $activityRS[$rowIndex]['enteredByLastName'], false, LAST_NAME_MAXLEN ); } } /* Get upcoming calendar entries. */ $calendarRS = $candidates->getUpcomingEvents($candidateID); if (!empty($calendarRS)) { foreach ($calendarRS as $rowIndex => $row) { $calendarRS[$rowIndex]['enteredByAbbrName'] = StringUtility::makeInitialName( $calendarRS[$rowIndex]['enteredByFirstName'], $calendarRS[$rowIndex]['enteredByLastName'], false, LAST_NAME_MAXLEN ); } } /* Get extra fields. */ $extraFieldRS = $candidates->extraFields->getValuesForShow($candidateID); /* Add an MRU entry. */ $_SESSION['CATS']->getMRU()->addEntry( DATA_ITEM_CANDIDATE, $candidateID, $data['first_name'] . ' ' . $data['last_name'] ); /* Is the user an admin - can user see history? */ if ($this->_accessLevel < ACCESS_LEVEL_DEMO) { $privledgedUser = false; } else { $privledgedUser = true; } $EEOSettings = new EEOSettings($this->_siteID); $EEOSettingsRS = $EEOSettings->getAll(); $EEOValues = array(); /* Make a list of all EEO related values so they can be positioned by index * rather than static positioning (like extra fields). */ if ($EEOSettingsRS['enabled'] == 1) { if ($EEOSettingsRS['genderTracking'] == 1) { $EEOValues[] = array('fieldName' => 'Gender', 'fieldValue' => $data['eeoGenderText']); } if ($EEOSettingsRS['ethnicTracking'] == 1) { $EEOValues[] = array('fieldName' => 'Ethnicity', 'fieldValue' => $data['eeoEthnicType']); } if ($EEOSettingsRS['veteranTracking'] == 1) { $EEOValues[] = array('fieldName' => 'Veteran Status', 'fieldValue' => $data['eeoVeteranType']); } if ($EEOSettingsRS['disabilityTracking'] == 1) { $EEOValues[] = array('fieldName' => 'Disability Status', 'fieldValue' => $data['eeoDisabilityStatus']); } } $questionnaire = new Questionnaire($this->_siteID); $questionnaires = $questionnaire->getCandidateQuestionnaires($candidateID); $indexName=CATSUtility::getIndexName(); $adminHidden=""; if ($data['is_admin_hidden'] == 1) { $adminHidden = "<p class='warning'>This Candidate is hidden. Only CATS Administrators can view it or search for it. To make it visible by the site users, click <a href='{$indexName}?m=candidates&a=administrativeHideShow&candidateID={$candidateID}&state=0' style='font-weight:bold;'>Here.</a></p>"; } $profileImage = false; foreach ($attachmentsRS as $rowNumber => $attachmentsData) { if ($attachmentsData['isProfileImage'] == '1') { $profileImage = true; } } $candidateShowClass="cprofileshow"; if ($profileImage) { $candidateShowClass="cshow"; //echo "<td width='390' height='100%'>"; } else { //echo "</td><td width='50%' height='100%'>"; } $recordInActive=""; if ($data['is_active'] != 1){ $recordInActive = " <span style='color:orange;'>(INACTIVE)</span> "; } $accessLevelEdit=""; if ($this->_accessLevel >= ACCESS_LEVEL_EDIT) { $accessLevelEdit= "<a href='#' id='addActivityLink' onclick=\"showPopWin('{$indexName}?m=candidates&a=addActivityChangeStatus&candidateID={$candidateID}&jobOrderID=-1', 600, 480, null); return false;\"> <img src='images/new_activity_inline.gif' width='16' height='16' class='absmiddle' title='Log an Activity / Change Status' alt='Log an Activity / Change Status' border='0' /> Log an Activity </a>"; } $this->_template->assign('active', $this); $this->_template->assign('email_list', $emailList); $this->_template->assign('candidateID', $candidateID); $this->_template->assign('questionnaires', $questionnaires); $this->_template->assign('accessLevelEdit', $accessLevelEdit); $this->_template->assign('data', $data); $this->_template->assign('candidateShowClass', $candidateShowClass); $this->_template->assign('recordInActive', $recordInActive); $this->_template->assign('isShortNotes', $isShortNotes); $this->_template->assign('adminHidden',$adminHidden); $this->_template->assign('attachmentsRS', $attachmentsRS); $this->_template->assign('pipelinesRS', $pipelinesRS); $this->_template->assign('activityRS', $activityRS); $this->_template->assign('calendarRS', $calendarRS); $this->_template->assign('extraFieldRS', $extraFieldRS); $this->_template->assign('candidateID', $candidateID); $this->_template->assign('isPopup', $isPopup); $this->_template->assign('EEOSettingsRS', $EEOSettingsRS); $this->_template->assign('EEOValues', $EEOValues); $this->_template->assign('privledgedUser', $privledgedUser); $this->_template->assign('sessionCookie', $_SESSION['CATS']->getCookie()); if (!eval(Hooks::get('CANDIDATE_SHOW'))) return; //$this->_template->display('./modules/candidates/show.php'); //return true; if (isset($_GET['display']) && $_GET['display'] == 'popup') { $this->_template->display('./modules/candidates/show_popup.php'); $isPopup = true; } else { $this->_template->display('./modules/candidates/show.php'); $isPopup = false; } }