public function fire() { $sectors = JobAlerts::getJobSectors(); $jobTypes = JobAlerts::getJobTypes(); $locations = JobAlerts::getJobLocations(); // loop through all candidates Candidates::get()->each(function ($candidate) use($sectors, $jobTypes, $locations) { $candidate->jobAlerts->each(function ($jobAlert) use($sectors, $jobTypes, $locations) { // select all jobs, query derived from controller $jobs = DB::select("\n\t\t\t\t\tEXEC spJobSearch_Select \n\t\t\t\t\t@JobTitle = '', \n\t\t\t\t\t@LocationIDs = '{$jobAlert->location_id}', \n\t\t\t\t\t@SectorIDs = '{$jobAlert->sector_id}', \n\t\t\t\t\t@EmploymentTypeIDs = '{$jobAlert->job_type}'"); // dispatch mail Mail::send('candidate.jobalerts', ['sectors' => $sectors, 'job_types' => $jobTypes, 'locations' => $locations, 'alert' => $jobAlert, 'jobs' => $jobs], function ($message) use($candidate) { $message->to($candidate->email, $candidate->name)->subject('Job Alerts from KDC'); }); }); }); }
/** * Returns link HTML for a data item. * * @param flag Data Item type flag. * @param integer Data Item ID. * @param boolean Show name / data item title? * @return string Link HTML (<a href="...">...</a>). */ private function getHTMLOfLink($dataItemID, $dataItemType, $showTitle = true) { $string = '<a href="' . CATSUtility::getIndexName(); switch ($dataItemType) { case DATA_ITEM_CANDIDATE: $candidates = new Candidates($this->_siteID); $string .= '?m=candidates&a=show&candidateID=' . $dataItemID . '">'; $string .= '<img src="images/mru/candidate.gif" alt="" style="border: none;" title="Candidate" />'; if ($showTitle) { $data = $candidates->get($dataItemID); if (!isset($data['firstName'])) { $string = '<img src="images/mru/company.gif" alt="" style="border: none;" /> (Candidate Deleted)<a>'; } else { $string .= ' ' . $data['firstName'] . ' ' . $data['lastName']; } } $image = 'images/mru/candidate.gif'; break; case DATA_ITEM_COMPANY: $companies = new Companies($this->_siteID); $string .= '?m=companies&a=show&companyID=' . $dataItemID . '">'; $string .= '<img src="images/mru/company.gif" alt="" style="border: none;" title="Company" />'; if ($showTitle) { $data = $companies->get($dataItemID); if (!isset($data['name'])) { $string = '<img src="images/mru/company.gif" alt="" style="border: none;" /> (Company Deleted)<a>'; } else { $string .= ' ' . $data['name']; } } break; case DATA_ITEM_CONTACT: $contacts = new Contacts($this->_siteID); $string .= '?m=contacts&a=show&contactID=' . $dataItemID . '">'; $string .= '<img src="images/mru/contact.gif" alt="" style="border: none;" title="Contact" />'; if ($showTitle) { $data = $contacts->get($dataItemID); if (!isset($data['firstName'])) { $string = '<img src="images/mru/contact.gif" alt="" style="border: none;" /> (Contact Deleted)<a>'; } else { $string .= ' ' . $data['firstName'] . ' ' . $data['lastName']; } } break; case DATA_ITEM_JOBORDER: $jobOrders = new JobOrders($this->_siteID); $string .= '?m=joborders&a=show&jobOrderID=' . $dataItemID . '">'; $string .= '<img src="images/mru/job_order.gif" alt="" style="border: none;" title="Job Order" />'; if ($showTitle) { $data = $jobOrders->get($dataItemID); if (!isset($data['title'])) { $string = '<img src="images/mru/job_order.gif" alt="" style="border: none;" /> (Job Order Deleted)<a>'; } else { $string .= ' ' . $data['title']; } } break; } $string .= '</a>'; return $string; }
/** * Generates a string of Candidate info used for the popup tooltips. * * @param integer candidate ID * @param integer site ID * @return string info string */ private static function _candidate($candidateID, $siteID) { $candidates = new Candidates($siteID); $infoRS = $candidates->get($candidateID); if (empty($infoRS)) { return 'The specified candidate could not be found.'; } $infoString = sprintf('<span class="bold">Candidate:</span> %s %s', htmlspecialchars($infoRS['firstName']), htmlspecialchars($infoRS['lastName'])); if (!empty($infoRS['currentEmployer'])) { $infoString .= sprintf('<br /><span class="bold">Current Employer:</span> %s', htmlspecialchars($infoRS['currentEmployer'])); } if (!empty($infoRS['email1'])) { $infoString .= sprintf('<br /><span class="bold">Primary Email:</span> %s', htmlspecialchars($infoRS['email1'])); } if (!empty($infoRS['email2'])) { $infoString .= sprintf('<br /><span class="bold">Secondary Email:</span> %s', htmlspecialchars($infoRS['email2'])); } if (!empty($infoRS['phoneHome'])) { $infoString .= sprintf('<br /><span class="bold">Home Phone:</span> %s', htmlspecialchars($infoRS['phoneHome'])); } if (!empty($infoRS['phoneWork'])) { $infoString .= sprintf('<br /><span class="bold">Work Phone:</span> %s', htmlspecialchars($infoRS['phoneWork'])); } if (!empty($infoRS['phoneCell'])) { $infoString .= sprintf('<br /><span class="bold">Cell Phone:</span> %s', htmlspecialchars($infoRS['phoneCell'])); } if (!empty($infoRS['address'])) { $infoString .= sprintf('<br /><span class="bold">Address:</span><br /> %s', htmlspecialchars($infoRS['address'])); if (!empty($infoRS['city'])) { $infoString .= sprintf(' %s', htmlspecialchars($infoRS['city'])); } if (!empty($infoRS['state'])) { $infoString .= sprintf(' %s', htmlspecialchars($infoRS['state'])); } if (!empty($infoRS['zip'])) { $infoString .= sprintf(' %s', htmlspecialchars($infoRS['zip'])); } } return $infoString; }
private function viewItemHistory() { /* Bail out if the user doesn't have SA permissions. */ if ($this->_realAccessLevel < ACCESS_LEVEL_DEMO) { CommonErrors::fatal(COMMONERROR_PERMISSION, $this); return; //$this->fatal(ERROR_NO_PERMISSION); } /* Bail out if we don't have a valid data item type. */ if (!$this->isRequiredIDValid('dataItemType', $_GET)) { CommonErrors::fatal(COMMONERROR_BADINDEX, $this, 'Invalid data item type.'); } /* Bail out if we don't have a valid data item ID. */ if (!$this->isRequiredIDValid('dataItemID', $_GET)) { CommonErrors::fatal(COMMONERROR_BADINDEX, $this, 'Invalid data item ID.'); } $dataItemType = $_GET['dataItemType']; $dataItemID = $_GET['dataItemID']; switch ($dataItemType) { case DATA_ITEM_CANDIDATE: $candidates = new Candidates($this->_siteID); $data = $candidates->get($dataItemID); break; case DATA_ITEM_JOBORDER: $jobOrders = new JobOrders($this->_siteID); $data = $jobOrders->get($dataItemID); break; case DATA_ITEM_COMPANY: $companies = new Companies($this->_siteID); $data = $companies->get($dataItemID); break; case DATA_ITEM_CONTACT: $contacts = new Contacts($this->_siteID); $data = $contacts->get($dataItemID); break; default: CommonErrors::fatal(COMMONERROR_BADFIELDS, $this, 'Invalid data item type.'); break; } /* Get revision information. */ $history = new History($this->_siteID); $revisionRS = $history->getAll($dataItemType, $dataItemID); $this->_template->assign('active', $this); $this->_template->assign('subActive', 'Login Activity'); $this->_template->assign('data', $data); $this->_template->assign('revisionRS', $revisionRS); $this->_template->display('./modules/settings/ItemHistory.tpl'); }
if(!isset($_REQUEST['dataItemType'])) { CommonErrors::fatalModal(COMMONERROR_BADINDEX, $this, 'Required input missing.'); return; } $dataItemType = $_REQUEST['dataItemType']; $dataItemID = $_REQUEST['dataItemID']; $AUIEO_MODULE = ""; $AUIEO_NAME = ""; switch ($dataItemType) { case DATA_ITEM_CANDIDATE: include_once('./lib/Candidates.php'); $dataItem = new Candidates($siteID); $AUIEO_MODULE = "candidates"; $record=$dataItem->get($dataItemID); /* Bail out if record not found. */ if(empty($record)) { CommonErrors::fatalModal(COMMONERROR_BADINDEX, $this, 'Invalid data item ID for the Site '.$siteID); return; } $AUIEO_NAME = $record["firstName"]." ".$record["lastName"]; break; case DATA_ITEM_COMPANY: include_once('./lib/Companies.php'); $dataItem = new Companies($siteID); $AUIEO_MODULE = "companies"; $record=$dataItem->get($dataItemID); /* Bail out if record not found. */
* 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);
/** * It is assumed the applicant has completed a questionnaire using the Career * Portal and has been added to CATS as a candidate. Based on their responses * to the questionnaire, perform any actions provided by the questionnaire * based on their responses (which should be in post provided by postData); * * @param ID of the attached questionnaire ID * @param integer candidate_id from candidate table * @param array $_POST equivilent data */ public function doActions($questionnaireID, $candidateID, $postData) { // Get the candidate (if exists) $candidate = new Candidates($this->_siteID); if (!count($cData = $candidate->get($candidateID))) { return false; } // Default values (which may be changed by actions) $source = $notes = $keySkills = ''; $isHot = $canRelocate = 0; $isActive = 1; $qData = $this->get($questionnaireID); if (is_array($qData) && !empty($qData)) { if (!count($questions = $this->getQuestions($qData['questionnaireID']))) { return false; } foreach ($questions as $question) { $answerText = ''; switch ($question['questionType']) { case QUESTIONNAIRE_QUESTION_TYPE_CHECKBOX: // Multiple answers possible $answerIDs = array(); foreach ($question['answers'] as $answer) { $index = sprintf('questionnaire%dQuestion%dAnswer%d', $qData['questionnaireID'], $question['questionID'], $answer['answerID']); if (isset($postData[$index])) { $answerIDs[] = $answer['answerID']; } } break; case QUESTIONNAIRE_QUESTION_TYPE_RADIO: case QUESTIONNAIRE_QUESTION_TYPE_SELECT: // One answer $index = sprintf('questionnaire%dQuestion%d', $qData['questionnaireID'], $question['questionID']); $answerIDs = array(isset($postData[$index]) ? intval($postData[$index]) : false); break; case QUESTIONNAIRE_QUESTION_TYPE_TEXT: default: // text answer $index = sprintf('questionnaire%dQuestion%d', $qData['questionnaireID'], $question['questionID']); $answerText = substr(trim(isset($postData[$index]) ? $postData[$index] : ''), 0, 255); $answerIDs = array(); break; } foreach ($answerIDs as $answerID) { foreach ($question['answers'] as $answer) { if ($answer['answerID'] == $answerID) { if ($answerText != '') { $answerText .= ', '; } $answerText .= $answer['answerText']; // Perform any actions (if there are any) if (strlen($answer['actionSource'])) { if (strlen($source)) { $source .= ', '; } $source .= $answer['actionSource']; } if (strlen($answer['actionNotes'])) { if (strlen($notes)) { $notes .= ', '; } $notes .= $answer['actionNotes']; } if (strlen($answer['actionKeySkills'])) { if (strlen($keySkills)) { $keySkills .= ', '; } $keySkills .= $answer['actionKeySkills']; } if ($answer['actionIsHot']) { $isHot = 1; } if (!$answer['actionIsActive']) { $isActive = 0; } if ($answer['actionCanRelocate']) { $canRelocate = 1; } } } } // Log textual response (not multiple choice) // Save this candidates response $this->log($candidateID, $qData['title'], $qData['description'], $question['questionText'], $answerText); } } return $candidate->update($cData['candidateID'], $isActive ? true : false, $cData['firstName'], $cData['middleName'], $cData['lastName'], $cData['email1'], $cData['email2'], $cData['phoneHome'], $cData['phoneCell'], $cData['phoneWork'], $cData['address'], $cData['city'], $cData['state'], $cData['zip'], $source, $keySkills, $cData['dateAvailable'], $cData['currentEmployer'], $canRelocate ? true : false, $cData['currentPay'], $cData['desiredPay'], $notes, $cData['webSite'], $cData['bestTimeToCall'], $cData['owner'], $isHot ? true : false, $cData['email1'], $cData['email1']); }
public function ProcessCandidateRegistration($siteID, $template, $cookieFields = array(), $ignorePost = false) { $db = DatabaseConnection::getInstance(); $numMatches = preg_match_all('/\<input\-([A-Za-z0-9]+)\>/', $template, $matches); if (!$numMatches) return false; $fields = array(); foreach ($matches[1] as $tag) { // Default tags, NOT verification fields if (!strcasecmp('submit', $tag) || !strcasecmp('new', $tag) || !strcasecmp('registered', $tag) || !strcasecmp('rememberMe', $tag)) { continue; } // All verification tags MUST exist and be completed (javascript validates this) if (!isset($_POST[$tag]) || empty($_POST[$tag]) || $ignorePost) { // There is no post, but this call might be coming from saved cookie data if (!isset($cookieFields[$tag])) { // Some fields may have different naming if (!strcmp($tag, 'email') && isset($cookieFields[$id='email1'])) $fields[$tag] = $cookieFields[$id]; else if (!strcmp($tag, 'employer') && isset($cookieFields[$id='currentEmployer'])) $fields[$tag] = $cookieFields[$id]; else if (!strcmp($tag, 'phone') && isset($cookieFields[$id='phoneWork'])) $fields[$tag] = $cookieFields[$id]; else return false; } else { $fields[$tag] = $cookieFields[$tag]; } } else { $fields[$tag] = trim($_POST[$tag]); } } // Get a list of candidate fields to compare against $sql = 'SHOW COLUMNS FROM candidate'; $columns = $db->getAllAssoc($sql); for ($i = 0; $i < count($columns); $i++) { // Convert out of _ notation to camel notation $columns[$i]['CamelField'] = str_replace('_', '', $columns[$i]['Field']); } $verificationFields = 0; $sql = 'SELECT candidate_id FROM candidate WHERE '; foreach ($fields as $tag => $tagData) { foreach ($columns as $column => $columnData) { if (!strcasecmp($columnData['CamelField'], $tag)) { $sql .= 'LCASE(' . $columnData['Field'] . ') = ' . $db->makeQueryString(strtolower($tagData)) . ' AND '; $verificationFields++; } } } // There needs to be 1 verification field (equivilant of a "password"), otherwise anyone // could change anyone else's candidate information with as little as an e-mail address. if ($verificationFields < 1) { return false; } $sql .= sprintf('site_id = %d AND (LCASE(email1) = %s OR LCASE(email2) = %s) LIMIT 1', $siteID, $db->makeQueryString(strtolower($fields['email'])), $db->makeQueryString(strtolower($fields['email'])) ); $rs = $db->getAssoc($sql); if ($db->getNumRows()) { $candidates = new Candidates($siteID); $candidate = $candidates->get($rs['candidate_id']); // Setup a cookie to remember the user by for the next 2 weeks if (isset($_POST['rememberMe']) && !strcasecmp($_POST['rememberMe'], 'yes')) { $storedVal = ''; foreach ($fields as $tag => $tagData) { $storedVal .= sprintf('"%s"="%s"', urlencode($tag), urlencode($tagData)); } @setcookie($this->getCareerPortalCookieName($siteID), $storedVal, time()+60*60*24*7*2); } return $candidate; } return false; }
private function addActivityChangeStatus() { /* Bail out if we don't have a valid candidate ID. */ if (!$this->isRequiredIDValid('candidateID', $_GET)) { CommonErrors::fatalModal(COMMONERROR_BADINDEX, $this, 'Invalid candidate ID.'); } /* Bail out if we don't have a valid job order ID. */ if (!$this->isRequiredIDValid('jobOrderID', $_GET)) { CommonErrors::fatalModal(COMMONERROR_BADINDEX, $this, 'Invalid job order ID.'); } $candidateID = $_GET['candidateID']; $jobOrderID = $_GET['jobOrderID']; $candidates = new Candidates($this->_siteID); $candidateData = $candidates->get($candidateID); /* Bail out if we got an empty result set. */ if (empty($candidateData)) { CommonErrors::fatal(COMMONERROR_BADINDEX, $this, 'The specified candidate ID could not be found.'); } $pipelines = new Pipelines($this->_siteID); $pipelineData = $pipelines->get($candidateID, $jobOrderID); /* Bail out if we got an empty result set. */ if (empty($pipelineData)) { CommonErrors::fatal(COMMONERROR_BADINDEX, $this, 'The specified pipeline entry could not be found.'); } $statusRS = $pipelines->getStatusesForPicking(); $selectedStatusID = $pipelineData['statusID']; /* Override default send email behavior with site specific send email behavior. */ $mailerSettings = new MailerSettings($this->_siteID); $mailerSettingsRS = $mailerSettings->getAll(); $candidateJoborderStatusSendsMessage = unserialize($mailerSettingsRS['candidateJoborderStatusSendsMessage']); foreach ($statusRS as $index => $status) { $statusRS[$index]['triggersEmail'] = $candidateJoborderStatusSendsMessage[$status['statusID']]; } /* Get the change status email template. */ $emailTemplates = new EmailTemplates($this->_siteID); $statusChangeTemplateRS = $emailTemplates->getByTag('EMAIL_TEMPLATE_STATUSCHANGE'); if (empty($statusChangeTemplateRS) || empty($statusChangeTemplateRS['textReplaced'])) { $statusChangeTemplate = ''; $emailDisabled = $statusChangeTemplateRS['disabled']; } else { $statusChangeTemplate = $statusChangeTemplateRS['textReplaced']; $emailDisabled = $statusChangeTemplateRS['disabled']; } /* Replace e-mail template variables. '%CANDSTATUS%', '%JBODTITLE%', * '%JBODCLIENT%' are replaced by JavaScript. */ $stringsToFind = array('%CANDOWNER%', '%CANDFIRSTNAME%', '%CANDFULLNAME%'); $replacementStrings = array($candidateData['ownerFullName'], $candidateData['firstName'], $candidateData['firstName'] . ' ' . $candidateData['lastName']); $statusChangeTemplate = str_replace($stringsToFind, $replacementStrings, $statusChangeTemplate); $calendar = new Calendar($this->_siteID); $calendarEventTypes = $calendar->getAllEventTypes(); if (SystemUtility::isSchedulerEnabled() && !$_SESSION['CATS']->isDemo()) { $allowEventReminders = true; } else { $allowEventReminders = false; } $this->_template->assign('candidateID', $candidateID); $this->_template->assign('pipelineData', $pipelineData); $this->_template->assign('statusRS', $statusRS); $this->_template->assign('selectedJobOrderID', $jobOrderID); $this->_template->assign('selectedStatusID', $selectedStatusID); $this->_template->assign('calendarEventTypes', $calendarEventTypes); $this->_template->assign('allowEventReminders', $allowEventReminders); $this->_template->assign('userEmail', $_SESSION['CATS']->getEmail()); $this->_template->assign('onlyScheduleEvent', false); $this->_template->assign('statusChangeTemplate', $statusChangeTemplate); $this->_template->assign('emailDisabled', $emailDisabled); $this->_template->assign('isFinishedMode', false); $this->_template->assign('isJobOrdersMode', true); if (!eval(Hooks::get('JO_ADD_ACTIVITY_CHANGE_STATUS'))) { return; } $this->_template->display('./modules/candidates/AddActivityChangeStatusModal.tpl'); }
private function onShowQuestionnaire() { $candidateID = isset($_GET[$id = 'candidateID']) ? $_GET[$id] : false; $title = isset($_GET[$id = 'questionnaireTitle']) ? urldecode($_GET[$id]) : false; $printOption = isset($_GET[$id = 'print']) ? $_GET[$id] : ''; $printValue = !strcasecmp($printOption, 'yes') ? true : false; if (!$candidateID || !$title) { CommonErrors::fatal(COMMONERROR_BADINDEX); } $candidates = new Candidates($this->_siteID); $cData = $candidates->get($candidateID); $questionnaire = new Questionnaire($this->_siteID); $qData = $questionnaire->getCandidateQuestionnaire($candidateID, $title); $attachment = new Attachments($this->_siteID); $attachments = $attachment->getAll(DATA_ITEM_CANDIDATE, $candidateID); if (!empty($attachments)) { $resume = $candidates->getResume($attachments[0]['attachmentID']); $this->_template->assign('resumeText', str_replace("\n", "<br \\>\n", htmlentities(DatabaseSearch::fulltextDecode($resume['text'])))); $this->_template->assign('resumeTitle', htmlentities($resume['title'])); } $this->_template->assign('active', $this); $this->_template->assign('candidateID', $candidateID); $this->_template->assign('title', $title); $this->_template->assign('cData', $cData); $this->_template->assign('qData', $qData); $this->_template->assign('print', $printValue); $this->_template->display('./modules/candidates/Questionnaire.tpl'); }