Ejemplo n.º 1
0
 private function addCandidateModal($contents = '', $fields = array())
 {
     /* 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.');
     }
     $jobOrderID = $_GET['jobOrderID'];
     $candidates = new Candidates($this->_siteID);
     /* Get possible sources. */
     $sourcesRS = $candidates->getPossibleSources();
     $sourcesString = ListEditor::getStringFromList($sourcesRS, 'name');
     /* Get extra fields. */
     $extraFieldRS = $candidates->extraFields->getValuesForAdd();
     $associatedAttachment = 0;
     $associatedAttachmentRS = array();
     $EEOSettings = new EEOSettings($this->_siteID);
     $EEOSettingsRS = $EEOSettings->getAll();
     if (is_array($parsingStatus = LicenseUtility::getParsingStatus()) && isset($parsingStatus['parseLimit'])) {
         $parsingStatus['parseLimit'] = $parsingStatus['parseLimit'] - 1;
     }
     $careerPortalSettings = new CareerPortalSettings($this->_siteID);
     $careerPortalSettingsRS = $careerPortalSettings->getAll();
     $careerPortalEnabled = intval($careerPortalSettingsRS['enabled']) ? true : false;
     /* Get questionnaires to attach (if public) */
     $questionnaire = new Questionnaire($this->_siteID);
     $questionnaires = $questionnaire->getAll(false);
     $this->_template->assign('careerPortalEnabled', $careerPortalEnabled);
     $this->_template->assign('questionnaires', $questionnaires);
     $this->_template->assign('contents', $contents);
     $this->_template->assign('isParsingEnabled', $tmp = LicenseUtility::isParsingEnabled());
     $this->_template->assign('parsingStatus', $parsingStatus);
     $this->_template->assign('extraFieldRS', $extraFieldRS);
     $this->_template->assign('sourcesRS', $sourcesRS);
     $this->_template->assign('isModal', true);
     $this->_template->assign('jobOrderID', $jobOrderID);
     $this->_template->assign('sourcesString', $sourcesString);
     $this->_template->assign('preassignedFields', $fields);
     $this->_template->assign('associatedAttachment', $associatedAttachment);
     $this->_template->assign('associatedAttachmentRS', $associatedAttachmentRS);
     $this->_template->assign('associatedTextResume', false);
     $this->_template->assign('associatedFileResume', false);
     $this->_template->assign('EEOSettingsRS', $EEOSettingsRS);
     if (!eval(Hooks::get('JO_ADD_CANDIDATE_MODAL'))) {
         return;
     }
     /* REMEMBER TO ALSO UPDATE CandidatesUI::add() IF APPLICABLE. */
     $this->_template->display('./modules/candidates/Add.tpl');
 }
Ejemplo n.º 2
0
 private function add($contents = '', $fields = array())
 {
     $candidates = new Candidates($this->_siteID);
     /* Get possible sources. */
     $sourcesRS = $candidates->getPossibleSources();
     $sourcesString = ListEditor::getStringFromList($sourcesRS, 'name');
     /* Get extra fields. */
     $extraFieldRS = $candidates->extraFields->getValuesForAdd();
     /* Get passed variables. */
     $preassignedFields = $_GET;
     if (count($fields) > 0) {
         $preassignedFields = array_merge($preassignedFields, $fields);
     }
     /* Get preattached resume, if any. */
     if ($this->isRequiredIDValid('attachmentID', $_GET)) {
         $associatedAttachment = $_GET['attachmentID'];
         $attachments = new Attachments($this->_siteID);
         $associatedAttachmentRS = $attachments->get($associatedAttachment);
         /* Show an attachment icon based on the document's file type. */
         $attachmentIcon = strtolower(FileUtility::getAttachmentIcon($associatedAttachmentRS['originalFilename']));
         $associatedAttachmentRS['attachmentIcon'] = $attachmentIcon;
         /* If the text field has any text, show a preview icon. */
         if ($associatedAttachmentRS['hasText']) {
             $associatedAttachmentRS['previewLink'] = sprintf('<a href="#" onclick="window.open(\'%s?m=candidates&amp;a=viewResume&amp;attachmentID=%s\', \'viewResume\', \'scrollbars=1,width=800,height=760\')"><img width="15" height="15" style="border: none;" src="images/popup.gif" alt="(Preview)" /></a>', CATSUtility::getIndexName(), $associatedAttachmentRS['attachmentID']);
         } else {
             $associatedAttachmentRS['previewLink'] = '&nbsp;';
         }
     } else {
         $associatedAttachment = 0;
         $associatedAttachmentRS = array();
     }
     /* Get preuploaded resume text, if any */
     if ($this->isRequiredIDValid('resumeTextID', $_GET, true)) {
         $associatedTextResume = $_SESSION['CATS']->retrieveData($_GET['resumeTextID']);
     } else {
         $associatedTextResume = false;
     }
     /* Get preuploaded resume file (unattached), if any */
     if ($this->isRequiredIDValid('resumeFileID', $_GET, true)) {
         $associatedFileResume = $_SESSION['CATS']->retrieveData($_GET['resumeFileID']);
         $associatedFileResume['id'] = $_GET['resumeFileID'];
         $associatedFileResume['attachmentIcon'] = strtolower(FileUtility::getAttachmentIcon($associatedFileResume['filename']));
     } else {
         $associatedFileResume = false;
     }
     $EEOSettings = new EEOSettings($this->_siteID);
     $EEOSettingsRS = $EEOSettings->getAll();
     if (!eval(Hooks::get('CANDIDATE_ADD'))) {
         return;
     }
     /* If parsing is not enabled server-wide, say so. */
     if (!LicenseUtility::isParsingEnabled()) {
         $isParsingEnabled = false;
     } else {
         if (!isset($preassignedFields['email'])) {
             $isParsingEnabled = true;
         } else {
             if (empty($preassignedFields['email'])) {
                 $isParsingEnabled = true;
             } else {
                 if (isset($preassignedFields['isFromParser']) && $preassignedFields['isFromParser']) {
                     $isParsingEnabled = true;
                 } else {
                     $isParsingEnabled = false;
                 }
             }
         }
     }
     if (is_array($parsingStatus = LicenseUtility::getParsingStatus()) && isset($parsingStatus['parseLimit'])) {
         $parsingStatus['parseLimit'] = $parsingStatus['parseLimit'] - 1;
     }
     $this->_template->assign('parsingStatus', $parsingStatus);
     $this->_template->assign('isParsingEnabled', $isParsingEnabled);
     $this->_template->assign('contents', $contents);
     $this->_template->assign('extraFieldRS', $extraFieldRS);
     $this->_template->assign('active', $this);
     $this->_template->assign('subActive', 'Add Candidate');
     $this->_template->assign('sourcesRS', $sourcesRS);
     $this->_template->assign('sourcesString', $sourcesString);
     $this->_template->assign('preassignedFields', $preassignedFields);
     $this->_template->assign('associatedAttachment', $associatedAttachment);
     $this->_template->assign('associatedAttachmentRS', $associatedAttachmentRS);
     $this->_template->assign('associatedTextResume', $associatedTextResume);
     $this->_template->assign('associatedFileResume', $associatedFileResume);
     $this->_template->assign('EEOSettingsRS', $EEOSettingsRS);
     $this->_template->assign('isModal', false);
     /* REMEMBER TO ALSO UPDATE JobOrdersUI::addCandidateModal() IF
      * APPLICABLE.
      */
     $this->_template->display('./modules/candidates/Add.tpl');
 }