Example #1
0
 /**
  * Retrieve job information by given ID.
  *
  * @param $job_id Integer - Given job id.
  * @return Array - Job information
  */
 public function findBy($job_id)
 {
     // validate the given ID.
     $this->validate(['id' => $job_id]);
     // return validation error if the given ID is not valid.
     if (count($this->validation_log) > 0) {
         return ['validation', $this->validation_log];
     }
     $this->query = "SELECT * FROM jobs WHERE id = :job_id";
     $this->params = [':job_id' => $job_id];
     $job = $this->query()->fetchAll();
     // return empty array if there are no jobs.
     if (count($job) < 1) {
         return [];
     }
     // fetch all candidates for the given job.
     $candidates = new Candidates();
     $job[0]['candidates'] = $candidates->findByJobId($job_id);
     return $job;
 }
 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');
             });
         });
     });
 }
Example #3
0
 private function getMassImportCandidates()
 {
     $db = DatabaseConnection::getInstance();
     // Find the files the user has uploaded and put them in an array
     if (isset($_SESSION['CATS']) && !empty($_SESSION['CATS'])) {
         $siteID = $_SESSION['CATS']->getSiteID();
         $userID = $_SESSION['CATS']->getUserID();
     } else {
         CommonErrors::fatal(COMMONERROR_NOTLOGGEDIN, $this);
     }
     list($documents, $success, $failed) = $this->getMassImportDocuments();
     if (!count($documents)) {
         return array(array(), array(), array(), array());
     }
     $importedCandidates = array();
     $importedDocuments = array();
     $importedFailed = array();
     $importedDuplicates = array();
     for ($ind = 0; $ind < count($_SESSION['CATS_PARSE_TEMP']); $ind++) {
         $doc = $_SESSION['CATS_PARSE_TEMP'][$ind];
         // Get parsed information instead (if available)
         for ($ind2 = 0; $ind2 < count($documents); $ind2++) {
             if ($documents[$ind2]['id'] == $ind) {
                 $doc = $documents[$ind2];
             }
         }
         if (isset($doc['success']) && $doc['success']) {
             $candidateAdded = false;
             if (isset($doc['lastName']) && $doc['lastName'] != '' && isset($doc['firstName']) && $doc['firstName'] != '') {
                 $isCandidateUnique = true;
                 /**
                  * We need to check for duplicate candidate entries before adding a new
                  * candidate into CATS. The criteria is as follows:
                  * - if email is present, does it match an existing e-mail
                  * - if last name and zip code or last name and phone numbers are present, do they match likewise
                  */
                 if (strpos($doc['email'], '@') !== false) {
                     $sql = sprintf('SELECT count(*) ' . 'FROM candidate ' . 'WHERE (candidate.email1 = %s OR candidate.email2 = %s) ' . 'AND candidate.site_id = %d', $db->makeQueryString($doc['email']), $db->makeQueryString($doc['email']), $this->_siteID);
                     if ($db->getColumn($sql, 0, 0) > 0) {
                         $isCandidateUnique = false;
                     }
                 }
                 if (strlen($doc['lastName']) > 3 && isset($doc['phone']) && strlen($doc['phone']) >= 10) {
                     $sql = sprintf('SELECT count(*) ' . 'FROM candidate ' . 'WHERE candidate.last_name = %s ' . 'AND (candidate.phone_home = %s ' . 'OR candidate.phone_work = "%s ' . 'OR candidate.phone_cell = "%s) ' . 'AND candidate.site_id = %d', $db->makeQueryString($doc['lastName']), $db->makeQueryString($doc['phone']), $db->makeQueryString($doc['phone']), $db->makeQueryString($doc['phone']), $this->_siteID);
                     if ($db->getColumn($sql, 0, 0) > 0) {
                         $isCandidateUnique = false;
                     }
                 }
                 if (strlen($doc['lastName']) > 3 && isset($doc['zip']) && strlen($doc['zip']) >= 5) {
                     $sql = sprintf('SELECT count(*) ' . 'FROM candidate ' . 'WHERE candidate.last_name = %s ' . 'AND candidate.zip = %s ' . 'AND candidate.site_id = %d', $db->makeQueryString($doc['lastName']), $db->makeQueryString($doc['zipCode']), $this->_siteID);
                     if ($db->getColumn($sql, 0, 0) > 0) {
                         $isCandidateUnique = false;
                     }
                 }
                 if ($isCandidateUnique) {
                     // This was parsed data
                     $candidates = new Candidates($siteID);
                     $candidateID = $candidates->add($doc['firstName'], '', $doc['lastName'], $doc['email'], '', $doc['phone'], '', '', $doc['address'], $doc['city'], $doc['state'], $doc['zipCode'], '', $doc['skills'], NULL, '', false, '', '', 'This resume was parsed automatically. You should review it for errors.', '', '', $userID, $userID, '', 0, 0, '', true);
                     if ($candidateID > 0) {
                         $candidateAdded = true;
                         // set the date created to the file modification date
                         $db->query(sprintf('UPDATE candidate SET date_created = "%s", date_modified = "%s" ' . 'WHERE candidate_id = %d AND site_id = %d', date('c', $doc['cTime']), date('c', $doc['cTime']), $candidateID, $siteID));
                         // Success, attach resume to candidate as attachment
                         $ac = new AttachmentCreator($siteID);
                         if ($ac->createFromFile(DATA_ITEM_CANDIDATE, $candidateID, $doc['name'], $doc['realName'], '', true, true)) {
                             // FIXME: error checking on fail?
                         }
                         $importedCandidates[] = array('name' => trim($doc['firstName'] . ' ' . $doc['lastName']), 'resume' => $doc['realName'], 'url' => sprintf('%s?m=candidates&a=show&candidateID=%d', CATSUtility::getIndexName(), $candidateID), 'location' => trim($doc['city'] . ' ' . $doc['state'] . ' ' . $doc['zipCode']));
                     }
                 } else {
                     $importedDuplicates[] = array('name' => trim($doc['firstName'] . ' ' . $doc['lastName']), 'resume' => $doc['realName']);
                     @unlink($doc['name']);
                     $candidateAdded = true;
                 }
             }
             /**
              * A candidate was unable to be automatically added, add them as a
              * bulk resume document which is still searchable and can be manually
              * converted into a candidate later.
              */
             if (!$candidateAdded) {
                 $brExists = false;
                 $error = false;
                 /**
                  * Bulk resumes can be "rescanned", make sure this particular file isn't a
                  * rescan before adding another copy.
                  */
                 if (preg_match('/^_BulkResume_(.*)\\.txt$/', $doc['realName'], $matches)) {
                     $attachments = new Attachments($this->_siteID);
                     $bulkResumes = $attachments->getBulkAttachments();
                     foreach ($bulkResumes as $bulkResume) {
                         $mp = explode('.', $bulkResume['originalFileName']);
                         $fileName = implode('.', array_slice($mp, 0, -1));
                         if (!strcmp($fileName, $matches[1])) {
                             $brExists = true;
                             if (FileUtility::isUploadFileSafe($siteID, 'massimport', $doc['name'])) {
                                 @unlink($doc['name']);
                             }
                             break;
                         }
                     }
                 }
                 if (!$brExists) {
                     $error = false;
                     $attachmentCreator = new AttachmentCreator($siteID);
                     $attachmentCreator->createFromFile(DATA_ITEM_BULKRESUME, 0, $doc['name'], $doc['realName'], '', true, true);
                     if ($attachmentCreator->isError()) {
                         $error = true;
                     }
                     if ($attachmentCreator->duplicatesOccurred()) {
                         $error = true;
                     }
                 }
                 // For use later on debugging
                 //$isTextExtractionError = $attachmentCreator->isTextExtractionError();
                 //$textExtractionErrorMessage = $attachmentCreator->getTextExtractionError();
                 if (!$error || $brExists) {
                     $importedDocuments[] = array('name' => $doc['realName']);
                 } else {
                     $importedFailed[] = array('name' => $doc['realName']);
                 }
             } else {
                 if (preg_match('/^_BulkResume_(.*)\\.txt$/', $doc['realName'], $matches)) {
                     $attachments = new Attachments($this->_siteID);
                     $bulkResumes = $attachments->getBulkAttachments();
                     foreach ($bulkResumes as $bulkResume) {
                         $mp = explode('.', $bulkResume['originalFileName']);
                         $fileName = implode('.', array_slice($mp, 0, -1));
                         if (!strcmp($fileName, $matches[1])) {
                             // Delete the permanent file
                             $attachments->delete($bulkResume['attachmentID'], true);
                             // Delete the temporary file
                             if (FileUtility::isUploadFileSafe($siteID, 'massimport', $doc['name'])) {
                                 @unlink($doc['name']);
                             }
                             break;
                         }
                     }
                 }
             }
         } else {
             // This document failed to convert to a text-format using doc2text
             $importedFailed[] = array('name' => $doc['realName']);
             // Make sure it's a safe filename to delete and located in the site's upload directory
             if (FileUtility::isUploadFileSafe($siteID, 'massimport', $doc['name'])) {
                 @unlink($doc['name']);
             }
         }
     }
     return array($importedCandidates, $importedDocuments, $importedFailed, $importedDuplicates);
 }
Example #4
0
 public function isModuleActionPermitted($module = false, $action = false)
 {
     if ($module === false && isset($_REQUEST["m"])) {
         $module = $_REQUEST["m"];
     }
     if ($action === false && isset($_REQUEST["a"])) {
         $action = $_REQUEST["a"];
     }
     /**
      * if module not set, it is home module. It is allowed
      */
     if ($module === false) {
         return true;
     }
     $data_item_type = 0;
     $actionMapping = array();
     switch ($module) {
         case 'candidates':
             $data_item_type = 100;
             $actionMapping = Candidates::actionMapping();
             break;
         case 'companies':
             $data_item_type = 200;
             $actionMapping = Companies::actionMapping();
             break;
         case 'contacts':
             $data_item_type = 300;
             $actionMapping = Contacts::actionMapping();
             break;
         case 'joborders':
             $data_item_type = 400;
             $actionMapping = JobOrders::actionMapping();
             break;
     }
     /**
      * if $data_item_type is 0, it indicates other modules. so it is allowed
      */
     if ($data_item_type <= 0) {
         return true;
     }
     $modulePermission = isset($this->permission[$data_item_type]) ? $this->permission[$data_item_type] : array();
     /**
      * checks whether any one operation is allowed
      */
     $isModulePermited = false;
     if ($modulePermission) {
         foreach ($modulePermission as $operation => $permission) {
             if ($permission > 0) {
                 $isModulePermited = true;
                 break;
             }
         }
     }
     /**
      * since all the operation is not allowed, don't allow
      */
     if ($isModulePermited === false) {
         return false;
     }
     /**
      * if $action is false, check whether default action exist in action mapping
      */
     if ($action === false) {
         if (isset($actionMapping["default"])) {
             $action = $actionMapping["default"];
         }
     }
     if (!isset($actionMapping[$action])) {
         return true;
     }
     $operation = $actionMapping[$action];
     /**
      * if the action allowed
      */
     if (isset($modulePermission[$operation]) && $modulePermission[$operation] > 0) {
         return true;
     }
     return false;
 }
Example #5
0
 public function actionVerify()
 {
     $this->layout = "vote";
     if (isset($_POST['seat_id'])) {
         $chosen = Yii::app()->session['chosenones'];
         unset($chosen[$_POST['seat_id']]);
         foreach ($_POST as $ckey => $cval) {
             if (substr($ckey, 0, 5) == 'calon' && $cval) {
                 $chosen[$_POST['seat_id']][] = substr($ckey, 5);
             }
         }
         Yii::app()->session['chosenones'] = $chosen;
     }
     if (isset($_POST['election_id'])) {
         if (isset($_POST['token_id'])) {
             $token = Tokens::model()->find('id=:token', array(':token' => $_POST['token_id']));
         }
         $election = Elections::model()->find('id=:election', array(':election' => $_POST['election_id']));
         $chosen = Yii::app()->session['chosenones'];
         $seats = Seats::model()->findAll(array("condition" => "election_id=" . $election->id, "order" => "priority asc"));
         foreach ($seats as $seat) {
             $candidates[$seat->id] = Candidates::model()->findAll(array('condition' => 'id in (' . join($chosen[$seat->id], ',') . ')', 'order' => 'name asc'));
         }
         if ($token && $election) {
             $this->render('verify', array('election' => $election, 'token' => $token, 'candidates' => $candidates, 'seats' => $seats, 'cnumber' => Yii::app()->session['cnumber']));
         }
     }
 }
Example #6
0
$siteID=$_SESSION["CATS"]->getSiteID();
/* Bail out if dataItemType not set. */
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";
Example #7
0
 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');
 }
Example #8
0
 /**
  * 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>&nbsp;%s %s', htmlspecialchars($infoRS['firstName']), htmlspecialchars($infoRS['lastName']));
     if (!empty($infoRS['currentEmployer'])) {
         $infoString .= sprintf('<br /><span class="bold">Current Employer:</span>&nbsp;%s', htmlspecialchars($infoRS['currentEmployer']));
     }
     if (!empty($infoRS['email1'])) {
         $infoString .= sprintf('<br /><span class="bold">Primary Email:</span>&nbsp;%s', htmlspecialchars($infoRS['email1']));
     }
     if (!empty($infoRS['email2'])) {
         $infoString .= sprintf('<br /><span class="bold">Secondary Email:</span>&nbsp;%s', htmlspecialchars($infoRS['email2']));
     }
     if (!empty($infoRS['phoneHome'])) {
         $infoString .= sprintf('<br /><span class="bold">Home Phone:</span>&nbsp;%s', htmlspecialchars($infoRS['phoneHome']));
     }
     if (!empty($infoRS['phoneWork'])) {
         $infoString .= sprintf('<br /><span class="bold">Work Phone:</span>&nbsp;%s', htmlspecialchars($infoRS['phoneWork']));
     }
     if (!empty($infoRS['phoneCell'])) {
         $infoString .= sprintf('<br /><span class="bold">Cell Phone:</span>&nbsp;%s', htmlspecialchars($infoRS['phoneCell']));
     }
     if (!empty($infoRS['address'])) {
         $infoString .= sprintf('<br /><span class="bold">Address:</span><br />&nbsp;&nbsp;%s', htmlspecialchars($infoRS['address']));
         if (!empty($infoRS['city'])) {
             $infoString .= sprintf('&nbsp;%s', htmlspecialchars($infoRS['city']));
         }
         if (!empty($infoRS['state'])) {
             $infoString .= sprintf('&nbsp;%s', htmlspecialchars($infoRS['state']));
         }
         if (!empty($infoRS['zip'])) {
             $infoString .= sprintf('&nbsp;%s', htmlspecialchars($infoRS['zip']));
         }
     }
     return $infoString;
 }
Example #9
0
 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');
 }
* 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: getCandidateIdByPhone.php 3078 2007-09-21 20:25:28Z will $
*/
$interface = new SecureAJAXInterface();
include 'lib/Candidates.php';
if (!isset($_REQUEST['phone'])) {
    die('Invalid E-Mail address.');
}
$siteID = $interface->getSiteID();
$phone = $_REQUEST['phone'];
$candidates = new Candidates($siteID);
$output = "<data>\n";
$candidateID = $candidates->getIDByPhone($phone);
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);
?>


Example #11
0
 /**
  * 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']);
 }
Example #12
0
 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();
 }
Example #13
0
 /**
  * Creates and returns output to be written to a CSV / etc. file.
  *
  * @return string formatted output
  */
 public function getFormattedOutput()
 {
     switch ($this->_dataItemType) {
         case DATA_ITEM_CANDIDATE:
             $dataItem = new Candidates($this->_siteID);
             break;
         default:
             return false;
             break;
     }
     $this->_rs = $dataItem->getExport($this->_IDs);
     if (empty($this->_rs)) {
         return false;
     }
     /* Column names. */
     $outputString = implode($this->_separator, array_keys($this->_rs[0])) . "\r\n";
     foreach ($this->_rs as $rowIndex => $row) {
         foreach ($row as $key => $value) {
             /* Escape any double-quotes and place the value inside
              * double quotes.
              */
             $this->_rs[$rowIndex][$key] = '"' . str_replace('"', '""', $value) . '"';
         }
         $outputString .= implode($this->_separator, $this->_rs[$rowIndex]) . "\r\n";
     }
     return $outputString;
 }
Example #14
0
    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;
    }
Example #15
0
 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');
 }
Example #16
0
echo $form->labelEx($model, 'token_id');
?>
		<?php 
echo $form->textField($model, 'token_id');
?>
		<?php 
echo $form->error($model, 'token_id');
?>
	</div>

	<div class="row">
		<?php 
echo $form->labelEx($model, 'candidate_id');
?>
		<?php 
echo $form->dropDownList($model, 'candidate_id', CHtml::listData(Candidates::model()->findAll(), 'id', 'name'), array('prompt' => 'Select a candidate'));
?>
		<?php 
echo $form->error($model, 'candidate_id');
?>
	</div>

	<div class="row">
		<?php 
echo $form->labelEx($model, 'created_date');
?>
		<?php 
echo $form->textField($model, 'created_date');
?>
		<?php 
echo $form->error($model, 'created_date');
Example #17
0
            $this->safeExit(0);
        }
        if ($values === 'YYYY-MM-DD' && !preg_match("/\\d\\d\\d\\d\\-\\d\\d\\-\\d\\d/", $data['Candidate'][$field])) {
            $this->header("HTTP/1.1 400 Bad Request");
            $this->safeExit(0);
        }
    }
    /**
     * Testable wrapper for Candidate::createNew
     *
     * @param string $DoB    Date of birth of the candidate
     * @param string $edc    EDC of the candidate
     * @param string $gender Gender of the candidate to be created
     * @param string $PSCID  PSCID of the candidate to be created
     *
     * @return none
     */
    public function createNew($DoB, $edc, $gender, $PSCID)
    {
        $user = \User::singleton();
        \Candidate::createNew($user->getCenterID(), $DoB, $edc, $gender, $PSCID);
    }
}
if (isset($_REQUEST['PrintCandidates'])) {
    if ($_SERVER['REQUEST_METHOD'] === 'POST') {
        $obj = new Candidates($_SERVER['REQUEST_METHOD'], $_POST);
    } else {
        $obj = new Candidates($_SERVER['REQUEST_METHOD']);
    }
    print $obj->toJSONString();
}
Example #18
0
function printCandidateList()
{
    $candidates = new Candidates();
    // Preparation {
    $conf = $_POST["conf"];
    $where = "";
    if ($conf["searchtype"] == 1) {
        $where = "statusid = " . $conf["statusid"];
    } else {
        if ($conf["searchtype"] == 2) {
            $where = "statusid > 0";
        } else {
            if ($conf["searchtype"] == 3) {
                $where = "statusid = 0";
            } else {
                if ($conf["searchtype"] == 4) {
                    $where = "statusid = -1";
                } else {
                    $where = "1=1";
                }
            }
        }
    }
    $where .= " AND c.deleted = 0";
    $candidatelist = $candidates->getRowSet(array("where" => $where, 'children' => true));
    $statuslist = sqlPull(array("table" => "candidate_status", "where" => "1=1"));
    $style = "style='border-style: none none solid none; border-width: 1px;'";
    // }
    print "<table width=100% height=100% cellspacing=0 style='border-color: BLACK; border-style: solid; border-width: 1px;'>";
    print "<tr bgcolor='#DDDDDD'><td align='center' height=1px colspan=5 " . $style . ">";
    print "Candidate List";
    print "</td></tr>";
    print "<tr><td align='center' width=15% " . $style . ">";
    print "Name";
    print "</td><td align='center' width=15% " . $style . ">";
    print "ID Number";
    print "</td><td align='center' width=15% " . $style . ">";
    print "Contact Number";
    print "</td><td align='center' width=15% " . $style . ">";
    print "Status";
    print "</td><td align='center' width=40% " . $style . ">";
    print "Notes";
    print "</td></tr>";
    foreach ($candidatelist as $candidatekey => $candidateval) {
        // Individual Preparation {
        $notelist = $candidateval['candidate_notes'];
        $notecount = count($notelist);
        if ($candidateval["statusid"] == null) {
            $status = -10;
        } else {
            $status = $candidateval["statusid"];
        }
        // }
        print "<tr><td align='center' " . $style . ">";
        print $candidateval["firstname"] . " " . $candidateval["lastname"];
        print "</td><td align='center' " . $style . ">";
        print $candidateval["idno"];
        print "</td><td align='center' " . $style . ">";
        print $candidateval["contactno"];
        print "</td><td align='center' " . $style . ">";
        print $candidateval['status'] ? $candidateval['status'] : 'Failed';
        print "</td><td align='center' " . $style . ">";
        if ($notecount > 0) {
            print "<table>";
            foreach ($notelist as $note0key => $noteval) {
                print "<tr><td>";
                print "<b>" . date("d/M/Y", $noteval["date"]) . "</b> " . $noteval["note"];
                print "</td></tr>";
            }
            print "</table>";
        } else {
            print "No Notes";
        }
        print "</td></tr>";
    }
    print "<tr><td height=100%;>";
    print "</td></tr>";
    print "</table>";
    // Javascript {
    print "<script type=\"text/javascript\">window.print();</script>";
    // }
    sleep(10);
    goHere("index.php?mode=maxine/index&action=candidatereports");
}
Example #19
0
<?php 
//trace("======");
/* 
 * CandidATS
 * Sites Management
 *
 * Copyright (C) 2014 - 2015 Auieo Software Private Limited, Parent Company of Unicomtech.
 * 
 * This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */

ob_start();
if ($this->isPopup)
{
    TemplateUtility::printHeader('Candidate - '.$this->data['first_name'].' '.$this->data['last_name'], array( 'js/activity.js', 'js/sorttable.js', 'js/match.js', 'js/lib.js', 'js/pipeline.js', 'js/attachment.js'));
}
else
{
    TemplateUtility::printHeader('Candidate - '.$this->data['first_name'].' '.$this->data['last_name'], array( 'js/activity.js', 'js/sorttable.js', 'js/match.js', 'js/lib.js', 'js/pipeline.js', 'js/attachment.js'));
}
$AUIEO_HEADER=  ob_get_clean();

$AUIEO_CONTENT="";
ob_start();
if ($this->data['is_admin_hidden'] == 1)
{
    ?>
    <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="<?php echo(CATSUtility::getIndexName()); ?>?m=candidates&a=administrativeHideShow&candidateID=<?php echo($this->candidateID); ?>&state=0" style="font-weight:bold;">Here.</a></p>
<?php 
 * 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);
Example #21
0
 /**
  * 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&amp;a=show&amp;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 .= '&nbsp;' . $data['firstName'] . ' ' . $data['lastName'];
                 }
             }
             $image = 'images/mru/candidate.gif';
             break;
         case DATA_ITEM_COMPANY:
             $companies = new Companies($this->_siteID);
             $string .= '?m=companies&amp;a=show&amp;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 .= '&nbsp;' . $data['name'];
                 }
             }
             break;
         case DATA_ITEM_CONTACT:
             $contacts = new Contacts($this->_siteID);
             $string .= '?m=contacts&amp;a=show&amp;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 .= '&nbsp;' . $data['firstName'] . ' ' . $data['lastName'];
                 }
             }
             break;
         case DATA_ITEM_JOBORDER:
             $jobOrders = new JobOrders($this->_siteID);
             $string .= '?m=joborders&amp;a=show&amp;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 .= '&nbsp;' . $data['title'];
                 }
             }
             break;
     }
     $string .= '</a>';
     return $string;
 }
Example #22
0
 /**
  * Returns the data model based on the primary key given in the GET variable.
  * If the data model is not found, an HTTP exception will be raised.
  * @param integer the ID of the model to be loaded
  */
 public function loadModel($id)
 {
     $model = Candidates::model()->findByPk($id);
     if ($model === null) {
         throw new CHttpException(404, 'The requested page does not exist.');
     }
     return $model;
 }