* under the License. * * The Original Code is "CATS Standard Edition". * * The Initial Developer of the Original Code is Cognizo Technologies, Inc. * Portions created by the Initial Developer are Copyright (C) 2005 - 2007 * (or from the year in which this file was created to the year 2007) by * Cognizo Technologies, Inc. All Rights Reserved. * * * $Id: getCandidateIdByEmail.php 3078 2007-09-21 20:25:28Z will $ */ $interface = new SecureAJAXInterface(); include 'lib/Candidates.php'; if (!isset($_REQUEST['email'])) { die('Invalid E-Mail address.'); } $siteID = $interface->getSiteID(); $email = $_REQUEST['email']; $candidates = new Candidates($siteID); $output = "<data>\n"; $candidateID = $candidates->getIDByEmail($email); if ($candidateID == -1) { $output .= " <candidate>\n" . " <id>-1</id>\n" . " </candidate>\n"; } else { $candidateRS = $candidates->get($candidateID); $output .= " <candidate>\n" . " <id>" . $candidateID . "</id>\n" . " <name>" . $candidateRS['candidateFullName'] . "</name>\n" . " </candidate>\n"; } $output .= "</data>\n"; /* Send back the XML data. */ $interface->outputXMLPage($output);
private function checkEmailIsInSystem() { if (!eval(Hooks::get('TOOLBAR_CHECK_EMAIL'))) { return; } $this->_authenticate(); $email = $this->getTrimmedInput('email', $_GET); if (empty($email)) { $this->fatal('No e-mail address.'); } echo $email; $candidates = new Candidates($this->_siteID); $candidateID = $candidates->getIDByEmail($email); if ($candidateID < 0) { echo ':0'; } else { echo ':1'; } flush(); }
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 onApplyToJobOrder($siteID, $candidateID = false) { $jobOrders = new JobOrders($siteID); $careerPortalSettings = new CareerPortalSettings($siteID); if (!$this->isRequiredIDValid('ID', $_POST)) { CommonErrors::fatal(COMMONERROR_BADINDEX, $this, 'Invalid job order ID.'); return; } $jobOrderID = $_POST['ID']; $jobOrderData = $jobOrders->get($jobOrderID); if (!isset($jobOrderData['public']) || $jobOrderData['public'] == 0) { CommonErrors::fatal(COMMONERROR_BADINDEX, $this, 'The specified job order could not be found.'); return; } $lastName = $this->getTrimmedInput('lastName', $_POST); $middleName = $this->getTrimmedInput('middleName', $_POST); $firstName = $this->getTrimmedInput('firstName', $_POST); $email = $this->getTrimmedInput('email', $_POST); $email2 = $this->getTrimmedInput('email2', $_POST); $address = $this->getTrimmedInput('address', $_POST); $city = $this->getTrimmedInput('city', $_POST); $state = $this->getTrimmedInput('state', $_POST); $zip = $this->getTrimmedInput('zip', $_POST); $source = $this->getTrimmedInput('source', $_POST); $phone = $this->getTrimmedInput('phone', $_POST); $phoneHome = $this->getTrimmedInput('phoneHome', $_POST); $phoneCell = $this->getTrimmedInput('phoneCell', $_POST); $bestTimeToCall = $this->getTrimmedInput('bestTimeToCall', $_POST); $keySkills = $this->getTrimmedInput('keySkills', $_POST); $extraNotes = $this->getTrimmedInput('extraNotes', $_POST); $employer = $this->getTrimmedInput('employer', $_POST); $gender = $this->getTrimmedInput('eeogender', $_POST); $race = $this->getTrimmedInput('eeorace', $_POST); $veteran = $this->getTrimmedInput('eeoveteran', $_POST); $disability = $this->getTrimmedInput('eeodisability', $_POST); if (empty($firstName)) { CommonErrors::fatal(COMMONERROR_MISSINGFIELDS, $this, 'First Name is a required field - please have your administrator edit your templates to include the first name field.'); } if (empty($lastName)) { CommonErrors::fatal(COMMONERROR_MISSINGFIELDS, $this, 'Last Name is a required field - please have your administrator edit your templates to include the last name field.'); } if (empty($email)) { CommonErrors::fatal(COMMONERROR_MISSINGFIELDS, $this, 'E-Mail address is a required field - please have your administrator edit your templates to include the email field.'); } if (empty($source)) { $source = 'Online Careers Website'; } $users = new Users(CATS_ADMIN_SITE); $automatedUser = $users->getAutomatedUser(); /* Find if another user with same e-mail exists. If so, update the user * to contain the new information. */ $candidates = new Candidates($siteID); /** * Save basic information in a cookie in case the site is using registration to * process repeated postings, etc. */ $fields = array('firstName', 'lastName', 'email', 'address', 'city', 'state', 'zip', 'phone', 'phoneHome', 'phoneCell' ); $storedVal = ''; foreach ($fields as $field) { eval('$tmp = sprintf(\'"%s"="%s"\', $field, urlencode($' . $field . '));'); $storedVal .= $tmp; } // Store their information for an hour only (about 1 session), if they return they can log in again and // specify "remember me" which stores it for 2 weeks. @setcookie($this->getCareerPortalCookieName($siteID), $storedVal, time()+60*60); if ($candidateID !== false) { $candidate = $candidates->get($candidateID); // Candidate exists and registered. Update their profile with new values (if provided) $candidates->update( $candidateID, $candidate['isActive'] ? true : false, $firstName, $middleName, $lastName, $email, $email2, $phoneHome, $phoneCell, $phone, $address, $city, $state, $zip, $source, $keySkills, '', $employer, '', '', '', $candidate['notes'], '', $bestTimeToCall, $automatedUser['userID'], $automatedUser['userID'], $gender, $race, $veteran, $disability ); /* Update extra feilds */ $candidates->extraFields->setValuesOnEdit($candidateID); } else { // Lookup the candidate by e-mail, use that candidate instead if found (but don't update profile) $candidateID = $candidates->getIDByEmail($email); } if ($candidateID === false || $candidateID < 0) { /* New candidate. */ $candidateID = $candidates->add( $firstName, $middleName, $lastName, $email, $email2, $phoneHome, $phoneCell, $phone, $address, $city, $state, $zip, $source, $keySkills, '', $employer, '', '', '', 'Candidate submitted these notes with first application: ' . "\n\n" . $extraNotes, '', $bestTimeToCall, $automatedUser['userID'], $automatedUser['userID'], $gender, $race, $veteran, $disability ); /* Update extra fields. */ $candidates->extraFields->setValuesOnEdit($candidateID); } // If the candidate was added and a questionnaire exists for the job order if ($candidateID > 0 && ($questionnaireID = $jobOrderData['questionnaireID'])) { $questionnaireLib = new Questionnaire($siteID); // Perform any actions specified by the questionnaire $questionnaireLib->doActions($questionnaireID, $candidateID, $_POST); } $fileUploaded = false; /* Upload resume (no questionnaire) */ if (isset($_FILES['file']) && !empty($_FILES['file']['name'])) { $attachmentCreator = new AttachmentCreator($siteID); $attachmentCreator->createFromUpload( DATA_ITEM_CANDIDATE, $candidateID, 'file', false, true ); if ($attachmentCreator->isError()) { CommonErrors::fatal(COMMONERROR_FILEERROR, $this, $attachmentCreator->getError()); return; } $duplicatesOccurred = $attachmentCreator->duplicatesOccurred(); $isTextExtractionError = $attachmentCreator->isTextExtractionError(); $textExtractionErrorMessage = $attachmentCreator->getTextExtractionError(); // FIXME: Show parse errors! $fileUploaded = true; $resumePath = $attachmentCreator->getNewFilePath(); } /* Upload resume (with questionnaire) */ else if (isset($_POST['file']) && !empty($_POST['file'])) { $resumePath = ''; $newFilePath = FileUtility::getUploadFilePath($siteID, 'careerportaladd', $_POST['file']); if ($newFilePath !== false) { $attachmentCreator = new AttachmentCreator($siteID); $attachmentCreator->createFromFile( DATA_ITEM_CANDIDATE, $candidateID, $newFilePath, false, '', true, true ); if ($attachmentCreator->isError()) { CommonErrors::fatal(COMMONERROR_FILEERROR, $this, $attachmentCreator->getError()); return; } $duplicatesOccurred = $attachmentCreator->duplicatesOccurred(); $isTextExtractionError = $attachmentCreator->isTextExtractionError(); $textExtractionErrorMessage = $attachmentCreator->getTextExtractionError(); // FIXME: Show parse errors! $fileUploaded = true; $resumePath = $attachmentCreator->getNewFilePath(); } } $pipelines = new Pipelines($siteID); $activityEntries = new ActivityEntries($siteID); /* Is the candidate already in the pipeline for this job order? */ $rs = $pipelines->get($candidateID, $jobOrderID); if (count($rs) == 0) { /* Attempt to add the candidate to the pipeline. */ if (!$pipelines->add($candidateID, $jobOrderID)) { CommonErrors::fatal(COMMONERROR_RECORDERROR, $this, 'Failed to add candidate to pipeline.'); } // FIXME: For some reason, pipeline entries like to disappear between // the above add() and this get(). WTF? $rs = $pipelines->get($candidateID, $jobOrderID); if (isset($rs['candidateJobOrderID'])) $pipelines->updateRatingValue($rs['candidateJobOrderID'], -1); $newApplication = true; } else { $newApplication = false; } /* Build activity note. */ if (!$newApplication) { $activityNote = 'User re-applied through candidate portal'; } else { $activityNote = 'User applied through candidate portal'; } if ($fileUploaded) { if (!$duplicatesOccurred) { $activityNote .= ' <span style="font-weight: bold;">and' . ' attached a new resume (<a href="' . $resumePath . '">Download</a>)</span>'; } else { $activityNote .= ' and attached an existing resume (<a href="' . $resumePath . '">Download</a>)'; } } if (!empty($extraNotes)) { $activityNote .= '; added these notes: ' . $extraNotes; } /* Add the activity note. */ $activityID = $activityEntries->add( $candidateID, DATA_ITEM_CANDIDATE, ACTIVITY_OTHER, $activityNote, $automatedUser['userID'], $jobOrderID ); /* Send an E-Mail describing what happened. */ $emailTemplates = new EmailTemplates($siteID); $candidatesEmailTemplateRS = $emailTemplates->getByTag( 'EMAIL_TEMPLATE_CANDIDATEAPPLY' ); if (!isset($candidatesEmailTemplateRS['textReplaced']) || empty($candidatesEmailTemplateRS['textReplaced']) || $candidatesEmailTemplateRS['disabled'] == 1) { $candidatesEmailTemplate = ''; } else { $candidatesEmailTemplate = $candidatesEmailTemplateRS['textReplaced']; } /* Replace e-mail template variables. */ /* E-Mail #1 - to candidate */ $stringsToFind = array( '%CANDFIRSTNAME%', '%CANDFULLNAME%', '%JBODOWNER%', '%JBODTITLE%', '%JBODCLIENT%' ); $replacementStrings = array( $firstName, $firstName . ' ' . $lastName, $jobOrderData['ownerFullName'], $jobOrderData['title'], $jobOrderData['companyName'] //'<a href="http://' . $_SERVER['HTTP_HOST'] . substr($_SERVER['REQUEST_URI'], 0, strpos($_SERVER['REQUEST_URI'], '?')) . '?m=candidates&a=show&candidateID=' . $candidateID . '">'. // 'http://' . $_SERVER['HTTP_HOST'] . substr($_SERVER['REQUEST_URI'], 0, strpos($_SERVER['REQUEST_URI'], '?')) . '?m=candidates&a=show&candidateID=' . $candidateID . '</a>' ); $candidatesEmailTemplate = str_replace( $stringsToFind, $replacementStrings, $candidatesEmailTemplate ); $emailContents = $candidatesEmailTemplate; if (!empty($emailContents)) { if(!$candidates->isLoaded()) { $candidates->load($candidateID); } $candidates->sendEMail( $automatedUser['userID'], $email, CAREERS_CANDIDATEAPPLY_SUBJECT, $emailContents ); } /* E-Mail #2 - to owner */ $candidatesEmailTemplateRS = $emailTemplates->getByTag( 'EMAIL_TEMPLATE_CANDIDATEPORTALNEW' ); if (!isset($candidatesEmailTemplateRS['textReplaced']) || empty($candidatesEmailTemplateRS['textReplaced']) || $candidatesEmailTemplateRS['disabled'] == 1) { $candidatesEmailTemplate = ''; } else { $candidatesEmailTemplate = $candidatesEmailTemplateRS['textReplaced']; } // FIXME: This will break if 'http' is elsewhere in the URL. $uri = str_replace('employment', '', $_SERVER['REQUEST_URI']); $uri = str_replace('http://', 'http', $uri); $uri = str_replace('//', '/', $uri); $uri = str_replace('http', 'http://', $uri); $uri = str_replace('/careers', '', $uri); /* Replace e-mail template variables. */ $stringsToFind = array( '%CANDFIRSTNAME%', '%CANDFULLNAME%', '%JBODOWNER%', '%CANDOWNER%', // Because the candidate was just added, we assume '%JBODTITLE%', // the candidate owner = job order owner. '%JBODCLIENT%', '%CANDCATSURL%', '%JBODID%', '%JBODCATSURL%' ); $replacementStrings = array( $firstName, $firstName . ' ' . $lastName, $jobOrderData['ownerFullName'], $jobOrderData['ownerFullName'], $jobOrderData['title'], $jobOrderData['companyName'], '<a href="http://' . $_SERVER['HTTP_HOST'] . substr($uri, 0, strpos($uri, '?')) . '?m=candidates&a=show&candidateID=' . $candidateID . '">'. 'http://' . $_SERVER['HTTP_HOST'] . substr($uri, 0, strpos($uri, '?')) . '?m=candidates&a=show&candidateID=' . $candidateID . '</a>', $jobOrderData['jobOrderID'], '<a href="http://' . $_SERVER['HTTP_HOST'] . substr($uri, 0, strpos($uri, '?')) . '?m=joborders&a=show&jobOrderID=' . $jobOrderData['jobOrderID'] . '">'. 'http://' . $_SERVER['HTTP_HOST'] . substr($uri, 0, strpos($uri, '?')) . '?m=joborders&a=show&jobOrderID=' . $jobOrderData['jobOrderID'] . '</a>', ); $candidatesEmailTemplate = str_replace( $stringsToFind, $replacementStrings, $candidatesEmailTemplate ); $emailContents = $candidatesEmailTemplate; if (!empty($emailContents)) { if(!$jobOrders->isLoaded()) { $jobOrders->load($jobOrderID); } $jobOrders->sendEmail( $automatedUser['userID'], $jobOrderData['owner_email'], CAREERS_OWNERAPPLY_SUBJECT, $emailContents ); if ($jobOrderData['owner_email'] != $jobOrderData['recruiter_email']) { $jobOrders->sendEmail( $automatedUser['userID'], $jobOrderData['recruiter_email'], CAREERS_OWNERAPPLY_SUBJECT, $emailContents ); } } }
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; } }