* 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: setCandidateJobOrderRating.php 1479 2007-01-17 00:22:21Z will $ */ include_once './lib/Pipelines.php'; $interface = new SecureAJAXInterface(); if ($_SESSION['CATS']->getAccessLevel() < ACCESS_LEVEL_EDIT) { $interface->outputXMLErrorPage(-1, ERROR_NO_PERMISSION); die; } if (!$interface->isRequiredIDValid('candidateJobOrderID')) { $interface->outputXMLErrorPage(-1, 'Invalid candidate-joborder ID.'); die; } if (!$interface->isRequiredIDValid('rating', true, true) || $_REQUEST['rating'] < -6 || $_REQUEST['rating'] > 5) { $interface->outputXMLErrorPage(-1, 'Invalid rating.'); die; } $siteID = $interface->getSiteID(); $candidateJobOrderID = $_REQUEST['candidateJobOrderID']; $rating = $_REQUEST['rating']; $pipelines = new Pipelines($siteID); $pipelines->updateRatingValue($candidateJobOrderID, $rating); $newRating = $pipelines->getRatingValue($candidateJobOrderID); $output = "<data>\n" . " <errorcode>0</errorcode>\n" . " <errormessage></errormessage>\n" . " <newrating>" . $newRating . "</newrating>\n" . "</data>\n"; /* Send back the XML data. */ $interface->outputXMLPage($output);
* (or from the year in which this file was created to the year 2007) by * Cognizo Technologies, Inc. All Rights Reserved. * * * $Id: getPipelineDetails.php 2976 2007-08-30 18:18:48Z andrew $ */ include_once './lib/Pipelines.php'; $interface = new SecureAJAXInterface(); if (!$interface->isRequiredIDValid('candidateJobOrderID', false)) { $interface->outputXMLErrorPage(-1, 'Invalid candidate-joborder ID.'); die; } $siteID = $interface->getSiteID(); $candidateJobOrderID = $_REQUEST['candidateJobOrderID']; /* Get an array of the company's contacts data. */ $pipelines = new Pipelines($siteID); $pipelineActivitiesRS = $pipelines->getPipelineDetails($candidateJobOrderID); foreach ($pipelineActivitiesRS as $rowIndex => $row) { if (empty($pipelineActivitiesRS[$rowIndex]['notes'])) { $pipelineActivitiesRS[$rowIndex]['notes'] = '(No Notes)'; } } /* Output HTML. */ echo '<div class="noteUnsizedSpan">Activity History:</div>', '<table>'; if (empty($pipelineActivitiesRS)) { echo '<tr><td>No activity entries could be found.</td></tr>'; } else { foreach ($pipelineActivitiesRS as $activity) { echo '<tr>'; echo '<td style="padding-right: 6px; width: 160px;">', $activity['dateModified'], '</td>'; echo '<td style="padding-right: 6px; width: 125px">(', $activity['enteredByFirstName'], ' ', $activity['enteredByLastName'], ')</td>';
$interface->outputXMLErrorPage(-1, 'Invalid input.'); die; } $siteID = $interface->getSiteID(); $jobOrderID = $_REQUEST['joborderID']; $page = $_REQUEST['page']; $entriesPerPage = $_REQUEST['entriesPerPage']; $sortBy = $_REQUEST['sortBy']; $sortDirection = $_REQUEST['sortDirection']; $indexFile = $_REQUEST['indexFile']; $isPopup = $_REQUEST['isPopup'] == 1 ? true : false; $_SESSION['CATS']->setPipelineEntriesPerPage($entriesPerPage); $jobOrders = new JobOrders($siteID); $jobOrdersData = $jobOrders->get($jobOrderID); /* Get an array of the pipeline data. */ $pipelines = new Pipelines($siteID); $pipelinesRS = $pipelines->getJobOrderPipeline($jobOrderID); /* Format pipeline data. */ foreach ($pipelinesRS as $rowIndex => $row) { if ($row['submitted'] == '1') { $pipelinesRS[$rowIndex]['highlightStyle'] = 'jobLinkSubmitted'; } else { $pipelinesRS[$rowIndex]['highlightStyle'] = 'jobLinkCold'; } $pipelinesRS[$rowIndex]['addedByAbbrName'] = StringUtility::makeInitialName($pipelinesRS[$rowIndex]['addedByFirstName'], $pipelinesRS[$rowIndex]['addedByLastName'], LAST_NAME_MAXLEN); if ($row['attachmentPresent'] == 1) { $pipelinesRS[$rowIndex]['iconTag'] = '<img src="images/paperclip.gif" alt="" width="16" height="16" />'; } else { $pipelinesRS[$rowIndex]['iconTag'] = ' '; } $pipelinesRS[$rowIndex]['ratingLine'] = TemplateUtility::getRatingObject($pipelinesRS[$rowIndex]['ratingValue'], $pipelinesRS[$rowIndex]['candidateJobOrderID'], $_SESSION['CATS']->getCookie());
$activityNote = trim(urldecode($_REQUEST['notes'])); $activityDate = trim(urldecode($_REQUEST['date'])); $activityHour = trim(urldecode($_REQUEST['hour'])); $activityMinute = trim(urldecode($_REQUEST['minute'])); $activityAMPM = trim(urldecode($_REQUEST['ampm'])); if (!DateUtility::validate('-', $activityDate, DATE_FORMAT_MMDDYY)) { die('Invalid availability date.'); return; } /* Convert formatted time to UNIX timestamp. */ $time = strtotime(sprintf('%s:%s %s', $activityHour, $activityMinute, $activityAMPM)); /* Create MySQL date string w/ 24hr time (YYYY-MM-DD HH:MM:SS). */ $date = sprintf('%s %s', DateUtility::convert('-', $activityDate, DATE_FORMAT_MMDDYY, DATE_FORMAT_YYYYMMDD), date('H:i:00', $time)); /* Highlight what needs highlighting. */ if (strpos($activityNote, 'Status change: ') === 0) { $pipelines = new Pipelines($siteID); $statusRS = $pipelines->getStatusesForPicking(); foreach ($statusRS as $data) { $activityNote = StringUtility::replaceOnce($data['status'], '<span style="color: #ff6c00;">' . $data['status'] . '</span>', $activityNote); } } /* Save the new activity entry. */ $activityEntries = new ActivityEntries($siteID); $activityEntries->update($activityID, $type, $activityNote, $jobOrderID, $date, $_SESSION['CATS']->getTimeZoneOffset()); /* Grab the current activity entry. */ $activityEntry = $activityEntries->get($activityID); /* Send back "(No Notes)" to be displayed if we don't have any. */ if (empty($activityEntry['notes'])) { $activityEntry['notes'] = '(No Notes)'; } /* Send back the XML data. */
/** * Returns all mailer / e-mail settings for a site. * * @return array E-mail settings (setting => value). */ public function getAll() { // FIXME: This is violating just about every OO design principal I can come up with :) /* Default values. */ $pipelines = new Pipelines($this->_siteID); $statuses = $pipelines->getStatuses(); $candidateJoborderStatusSendsMessage = array(); foreach ($statuses as $status) { $candidateJoborderStatusSendsMessage[$status['statusID']] = $status['triggersEmail']; } $settings = array('fromAddress' => '*****@*****.**', 'configured' => '0', 'modeConfigurable' => '1', 'candidateJoborderStatusSendsMessage' => serialize($candidateJoborderStatusSendsMessage)); $sql = sprintf("SELECT\n settings.setting AS setting,\n settings.value AS value,\n settings.site_id AS siteID\n FROM\n settings\n WHERE\n settings.site_id = %s\n AND\n settings.settings_type = %s", $this->_siteID, SETTINGS_MAILER); $rs = $this->_db->getAllAssoc($sql); /* Override default settings with settings from the database. */ foreach ($rs as $rowIndex => $row) { foreach ($settings as $setting => $value) { if ($row['setting'] == $setting) { $settings[$setting] = $row['value']; } } } return $settings; }
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 ); } } }
private function onRemoveFromPipeline() { if ($this->_accessLevel < ACCESS_LEVEL_DELETE) { CommonErrors::fatal(COMMONERROR_PERMISSION, $this, 'Invalid user level for action.'); } /* 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']; if (!eval(Hooks::get('JO_ON_REMOVE_PIPELINE'))) { return; } $pipelines = new Pipelines($this->_siteID); $pipelines->remove($candidateID, $jobOrderID); if (!eval(Hooks::get('JO_ON_REMOVE_PIPELINE_POST'))) { return; } CATSUtility::transferRelativeURI('m=joborders&a=show&jobOrderID=' . $jobOrderID); }
/** * Processes an Add Activity / Change Status form and displays * candidates/AddActivityChangeStatusModal.tpl. This is factored out * for code clarity. * * @param boolean from joborders module perspective * @param integer "regarding" job order ID or -1 * @param string module directory * @return void */ private function _addActivityChangeStatus($isJobOrdersMode, $regardingID, $directoryOverride = '') { $notificationHTML = ''; $pipelines = new Pipelines($this->_siteID); $statusRS = $pipelines->getStatusesForPicking(); /* Module directory override for fatal() calls. */ if ($directoryOverride != '') { $moduleDirectory = $directoryOverride; } else { $moduleDirectory = $this->_moduleDirectory; } /* Bail out if we don't have a valid candidate ID. */ if (!$this->isRequiredIDValid('candidateID', $_POST)) { CommonErrors::fatalModal(COMMONERROR_BADINDEX, $this, 'Invalid candidate ID.'); } /* Do we have a valid status ID. */ if (!$this->isOptionalIDValid('statusID', $_POST)) { $statusID = -1; } else { $statusID = $_POST['statusID']; } $candidateID = $_POST['candidateID']; if (!eval(Hooks::get('CANDIDATE_ON_ADD_ACTIVITY_CHANGE_STATUS_PRE'))) { return; } if ($this->isChecked('addActivity', $_POST)) { /* Bail out if we don't have a valid job order ID. */ if (!$this->isOptionalIDValid('activityTypeID', $_POST)) { CommonErrors::fatalModal(COMMONERROR_BADINDEX, $this, 'Invalid activity type ID.'); } $activityTypeID = $_POST['activityTypeID']; $activityNote = $this->getTrimmedInput('activityNote', $_POST); $activityNote = htmlspecialchars($activityNote); // FIXME: Move this to a highlighter-method? */ if (strpos($activityNote, 'Status change: ') === 0) { foreach ($statusRS as $data) { $activityNote = StringUtility::replaceOnce($data['status'], '<span style="color: #ff6c00;">' . $data['status'] . '</span>', $activityNote); } } /* Add the activity entry. */ $activityEntries = new ActivityEntries($this->_siteID); $activityID = $activityEntries->add($candidateID, DATA_ITEM_CANDIDATE, $activityTypeID, $activityNote, $this->_userID, $regardingID); $activityTypes = $activityEntries->getTypes(); $activityTypeDescription = ResultSetUtility::getColumnValueByIDValue($activityTypes, 'typeID', $activityTypeID, 'type'); $activityAdded = true; } else { $activityAdded = false; $activityNote = ''; $activityTypeDescription = ''; } if ($regardingID <= 0 || $statusID == -1) { $statusChanged = false; $oldStatusDescription = ''; $newStatusDescription = ''; } else { $data = $pipelines->get($candidateID, $regardingID); /* Bail out if we got an empty result set. */ if (empty($data)) { $this->fatalModal('The specified pipeline entry could not be found.'); } $validStatus = ResultSetUtility::findRowByColumnValue($statusRS, 'statusID', $statusID); /* If the status is invalid or unchanged, don't mess with it. */ if ($validStatus === false || $statusID == $data['status']) { $oldStatusDescription = ''; $newStatusDescription = ''; $statusChanged = false; } else { $oldStatusDescription = $data['status']; $newStatusDescription = ResultSetUtility::getColumnValueByIDValue($statusRS, 'statusID', $statusID, 'status'); if ($oldStatusDescription != $newStatusDescription) { $statusChanged = true; } else { $statusChanged = false; } } if ($statusChanged && $this->isChecked('triggerEmail', $_POST)) { $customMessage = $this->getTrimmedInput('customMessage', $_POST); // FIXME: Actually validate the e-mail address? if (empty($data['candidateEmail'])) { $email = ''; $notificationHTML = '<p><span class="bold">Error:</span> An e-mail notification' . ' could not be sent to the candidate because the candidate' . ' does not have a valid e-mail address.</p>'; } else { if (empty($customMessage)) { $email = ''; $notificationHTML = '<p><span class="bold">Error:</span> An e-mail notification' . ' will not be sent because the message text specified was blank.</p>'; } else { if ($this->_accessLevel == ACCESS_LEVEL_DEMO) { $email = ''; $notificationHTML = '<p><span class="bold">Error:</span> Demo users can not send' . ' E-Mails. No E-Mail was sent.</p>'; } else { $email = $data['candidateEmail']; $notificationHTML = '<p>An e-mail notification has been sent to the candidate.</p>'; } } } } else { $email = ''; $customMessage = ''; $notificationHTML = '<p>No e-mail notification has been sent to the candidate.</p>'; } /* Set the pipeline entry's status, but don't send e-mails for now. */ $pipelines->setStatus($candidateID, $regardingID, $statusID, $email, $customMessage); /* If status = placed, and open positions > 0, reduce number of open positions by one. */ if ($statusID == PIPELINE_STATUS_PLACED && is_numeric($data['openingsAvailable']) && $data['openingsAvailable'] > 0) { $jobOrders = new JobOrders($this->_siteID); $jobOrders->updateOpeningsAvailable($regardingID, $data['openingsAvailable'] - 1); } } if ($this->isChecked('scheduleEvent', $_POST)) { /* Bail out if we received an invalid date. */ $trimmedDate = $this->getTrimmedInput('dateAdd', $_POST); if (empty($trimmedDate) || !DateUtility::validate('-', $trimmedDate, DATE_FORMAT_MMDDYY)) { CommonErrors::fatalModal(COMMONERROR_MISSINGFIELDS, $this, 'Invalid date.'); } /* Bail out if we don't have a valid event type. */ if (!$this->isRequiredIDValid('eventTypeID', $_POST)) { CommonErrors::fatalModal(COMMONERROR_BADINDEX, $this, 'Invalid event type ID.'); } /* Bail out if we don't have a valid time format ID. */ if (!isset($_POST['allDay']) || $_POST['allDay'] != '0' && $_POST['allDay'] != '1') { CommonErrors::fatalModal(COMMONERROR_MISSINGFIELDS, $this, 'Invalid time format ID.'); } $eventTypeID = $_POST['eventTypeID']; if ($_POST['allDay'] == 1) { $allDay = true; } else { $allDay = false; } $publicEntry = $this->isChecked('publicEntry', $_POST); $reminderEnabled = $this->isChecked('reminderToggle', $_POST); $reminderEmail = $this->getTrimmedInput('sendEmail', $_POST); $reminderTime = $this->getTrimmedInput('reminderTime', $_POST); $duration = $this->getTrimmedInput('duration', $_POST); /* Is this a scheduled event or an all day event? */ if ($allDay) { $date = DateUtility::convert('-', $trimmedDate, DATE_FORMAT_MMDDYY, DATE_FORMAT_YYYYMMDD); $hour = 12; $minute = 0; $meridiem = 'AM'; } else { /* Bail out if we don't have a valid hour. */ if (!isset($_POST['hour'])) { CommonErrors::fatalModal(COMMONERROR_MISSINGFIELDS, $this, 'Invalid hour.'); } /* Bail out if we don't have a valid minute. */ if (!isset($_POST['minute'])) { CommonErrors::fatalModal(COMMONERROR_MISSINGFIELDS, $this, 'Invalid minute.'); } /* Bail out if we don't have a valid meridiem value. */ if (!isset($_POST['meridiem']) || $_POST['meridiem'] != 'AM' && $_POST['meridiem'] != 'PM') { $this->fatalModal('Invalid meridiem value.', $moduleDirectory); } $hour = $_POST['hour']; $minute = $_POST['minute']; $meridiem = $_POST['meridiem']; /* Convert formatted time to UNIX timestamp. */ $time = strtotime(sprintf('%s:%s %s', $hour, $minute, $meridiem)); /* Create MySQL date string w/ 24hr time (YYYY-MM-DD HH:MM:SS). */ $date = sprintf('%s %s', DateUtility::convert('-', $trimmedDate, DATE_FORMAT_MMDDYY, DATE_FORMAT_YYYYMMDD), date('H:i:00', $time)); } $description = $this->getTrimmedInput('description', $_POST); $title = $this->getTrimmedInput('title', $_POST); /* Bail out if any of the required fields are empty. */ if (empty($title)) { CommonErrors::fatalModal(COMMONERROR_MISSINGFIELDS, $this); return; /*$this->fatalModal( 'Required fields are missing.', $moduleDirectory );*/ } if ($regardingID > 0) { $eventJobOrderID = $regardingID; } else { $eventJobOrderID = -1; } $calendar = new Calendar($this->_siteID); $eventID = $calendar->addEvent($eventTypeID, $date, $description, $allDay, $this->_userID, $candidateID, DATA_ITEM_CANDIDATE, $eventJobOrderID, $title, $duration, $reminderEnabled, $reminderEmail, $reminderTime, $publicEntry, $_SESSION['CATS']->getTimeZoneOffset()); if ($eventID <= 0) { $this->fatalModal('Failed to add calendar event.', $moduleDirectory); } /* Extract the date parts from the specified date. */ $parsedDate = strtotime($date); $formattedDate = date('l, F jS, Y', $parsedDate); $calendar = new Calendar($this->_siteID); $calendarEventTypes = $calendar->getAllEventTypes(); $eventTypeDescription = ResultSetUtility::getColumnValueByIDValue($calendarEventTypes, 'typeID', $eventTypeID, 'description'); $eventHTML = sprintf('<p>An event of type <span class="bold">%s</span> has been scheduled on <span class="bold">%s</span>.</p>', htmlspecialchars($eventTypeDescription), htmlspecialchars($formattedDate)); $eventScheduled = true; } else { $eventHTML = '<p>No event has been scheduled.</p>'; $eventScheduled = false; } if (isset($_GET['onlyScheduleEvent'])) { $onlyScheduleEvent = true; } else { $onlyScheduleEvent = false; } if (!$statusChanged && !$activityAdded && !$eventScheduled) { $changesMade = false; } else { $changesMade = true; } if (!eval(Hooks::get('CANDIDATE_ON_ADD_ACTIVITY_CHANGE_STATUS_POST'))) { return; } $this->_template->assign('candidateID', $candidateID); $this->_template->assign('regardingID', $regardingID); $this->_template->assign('oldStatusDescription', $oldStatusDescription); $this->_template->assign('newStatusDescription', $newStatusDescription); $this->_template->assign('statusChanged', $statusChanged); $this->_template->assign('activityAdded', $activityAdded); $this->_template->assign('activityDescription', $activityNote); $this->_template->assign('activityType', $activityTypeDescription); $this->_template->assign('eventScheduled', $eventScheduled); $this->_template->assign('eventHTML', $eventHTML); $this->_template->assign('notificationHTML', $notificationHTML); $this->_template->assign('onlyScheduleEvent', $onlyScheduleEvent); $this->_template->assign('changesMade', $changesMade); $this->_template->assign('isFinishedMode', true); $this->_template->assign('isJobOrdersMode', $isJobOrdersMode); $this->_template->display('./modules/candidates/AddActivityChangeStatusModal.tpl'); }
* License for the specific language governing rights and limitations * 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: getCandidateJobOrderID.php 1479 2007-01-17 00:22:21Z will $ */ include_once './lib/Pipelines.php'; $interface = new SecureAJAXInterface(); if (!$interface->isRequiredIDValid('candidateID', false)) { $interface->outputXMLErrorPage(-1, 'Invalid candidate ID.'); die; } if (!$interface->isRequiredIDValid('jobOrderID', false)) { $interface->outputXMLErrorPage(-1, 'Invalid job order ID.'); die; } $siteID = $interface->getSiteID(); $candidateID = $_REQUEST['candidateID']; $jobOrderID = $_REQUEST['jobOrderID']; /* Get the candidate-joborder ID. */ $pipelines = new Pipelines($siteID); $candidateJobOrderID = $pipelines->getCandidateJobOrderID($candidateID, $jobOrderID); /* Send back the XML data. */ $interface->outputXMLPage("<data>\n" . " <errorcode>0</errorcode>\n" . " <errormessage></errormessage>\n" . " <id>" . $candidateJobOrderID . "</id>\n" . "</data>\n");