예제 #1
0
 private function show()
 {
     /* Bail out if we don't have a valid company ID. */
     if (!$this->isRequiredIDValid('companyID', $_GET)) {
         $this->listByView('Invalid company ID.');
         return;
     }
     $companyID = $_GET['companyID'];
     $companies = new Companies($this->_siteID);
     $data = $companies->get($companyID);
     /* Bail out if we got an empty result set. */
     if (empty($data)) {
         $this->listByView('The specified company ID could not be found.');
         return;
     }
     /* We want to handle formatting the city and state here instead
      * of in the template.
      */
     $data['cityAndState'] = StringUtility::makeCityStateString($data['city'], $data['state']);
     /*
      * Replace newlines with <br />, fix HTML "special" characters, and
      * strip leading empty lines and spaces.
      */
     $data['notes'] = trim(nl2br(htmlspecialchars($data['notes'], ENT_QUOTES)));
     /* Chop $data['notes'] to make $data['shortNotes']. */
     if (strlen($data['notes']) > self::NOTES_MAXLEN) {
         $data['shortNotes'] = substr($data['notes'], 0, self::NOTES_MAXLEN);
         $isShortNotes = true;
     } else {
         $data['shortNotes'] = $data['notes'];
         $isShortNotes = false;
     }
     /* Hot companies [can] have different title styles than normal companies. */
     if ($data['isHot'] == 1) {
         $data['titleClass'] = 'jobTitleHot';
     } else {
         $data['titleClass'] = 'jobTitleCold';
     }
     /* Link to Google Maps for this address */
     if (!empty($data['address']) && !empty($data['city']) && !empty($data['state'])) {
         $data['googleMaps'] = '<a href="http://maps.google.com/maps?q=' . urlencode($data['address']) . '+' . urlencode($data['city']) . '+' . urlencode($data['state']);
         /* Google Maps will find an address without Zip. */
         if (!empty($data['zip'])) {
             $data['googleMaps'] .= '+' . $data['zip'];
         }
         $data['googleMaps'] .= '" target=_blank><img src="images/google_maps.gif" style="border: none;" class="absmiddle" /></a>';
     } else {
         $data['googleMaps'] = '';
     }
     /* Attachments */
     $attachments = new Attachments($this->_siteID);
     $attachmentsRS = $attachments->getAll(DATA_ITEM_COMPANY, $companyID);
     foreach ($attachmentsRS as $rowNumber => $attachmentsData) {
         /* Show an attachment icon based on the document's file type. */
         $attachmentIcon = strtolower(FileUtility::getAttachmentIcon($attachmentsRS[$rowNumber]['originalFilename']));
         $attachmentsRS[$rowNumber]['attachmentIcon'] = $attachmentIcon;
     }
     /* Job Orders for this company */
     $jobOrders = new JobOrders($this->_siteID);
     $jobOrdersRS = $jobOrders->getAll(JOBORDERS_STATUS_ALL, -1, $companyID, -1);
     if (!empty($jobOrdersRS)) {
         foreach ($jobOrdersRS as $rowIndex => $row) {
             /* Convert '00-00-00' dates to empty strings. */
             $jobOrdersRS[$rowIndex]['startDate'] = DateUtility::fixZeroDate($jobOrdersRS[$rowIndex]['startDate']);
             /* Hot jobs [can] have different title styles than normal
              * jobs.
              */
             if ($jobOrdersRS[$rowIndex]['isHot'] == 1) {
                 $jobOrdersRS[$rowIndex]['linkClass'] = 'jobLinkHot';
             } else {
                 $jobOrdersRS[$rowIndex]['linkClass'] = 'jobLinkCold';
             }
             $jobOrdersRS[$rowIndex]['recruiterAbbrName'] = StringUtility::makeInitialName($jobOrdersRS[$rowIndex]['recruiterFirstName'], $jobOrdersRS[$rowIndex]['recruiterLastName'], false, LAST_NAME_MAXLEN);
             $jobOrdersRS[$rowIndex]['ownerAbbrName'] = StringUtility::makeInitialName($jobOrdersRS[$rowIndex]['ownerFirstName'], $jobOrdersRS[$rowIndex]['ownerLastName'], false, LAST_NAME_MAXLEN);
         }
     }
     /* Contacts for this company */
     $contacts = new Contacts($this->_siteID);
     $contactsRS = $contacts->getAll(-1, $companyID);
     $contactsRSWC = null;
     if (!empty($contactsRS)) {
         foreach ($contactsRS as $rowIndex => $row) {
             /* Hot contacts [can] have different title styles than normal contacts. */
             if ($contactsRS[$rowIndex]['isHot'] == 1) {
                 $contactsRS[$rowIndex]['linkClass'] = 'jobLinkHot';
             } else {
                 $contactsRS[$rowIndex]['linkClass'] = 'jobLinkCold';
             }
             if (!empty($contactsRS[$rowIndex]['ownerFirstName'])) {
                 $contactsRS[$rowIndex]['ownerAbbrName'] = StringUtility::makeInitialName($contactsRS[$rowIndex]['ownerFirstName'], $contactsRS[$rowIndex]['ownerLastName'], false, LAST_NAME_MAXLEN);
             } else {
                 $contactsRS[$rowIndex]['ownerAbbrName'] = 'None';
             }
             if ($contactsRS[$rowIndex]['leftCompany'] == 0) {
                 $contactsRSWC[] = $contactsRS[$rowIndex];
             } else {
                 $contactsRS[$rowIndex]['linkClass'] = 'jobLinkDead';
             }
         }
     }
     /* Add an MRU entry. */
     $_SESSION['CATS']->getMRU()->addEntry(DATA_ITEM_COMPANY, $companyID, $data['name']);
     /* Get extra fields. */
     $extraFieldRS = $companies->extraFields->getValuesForShow($companyID);
     /* Get departments. */
     $departmentsRS = $companies->getDepartments($companyID);
     /* Is the user an admin - can user see history? */
     if ($this->_accessLevel < ACCESS_LEVEL_DEMO) {
         $privledgedUser = false;
     } else {
         $privledgedUser = true;
     }
     $this->_template->assign('active', $this);
     $this->_template->assign('data', $data);
     $this->_template->assign('attachmentsRS', $attachmentsRS);
     $this->_template->assign('departmentsRS', $departmentsRS);
     $this->_template->assign('extraFieldRS', $extraFieldRS);
     $this->_template->assign('isShortNotes', $isShortNotes);
     $this->_template->assign('jobOrdersRS', $jobOrdersRS);
     $this->_template->assign('contactsRS', $contactsRS);
     $this->_template->assign('contactsRSWC', $contactsRSWC);
     $this->_template->assign('privledgedUser', $privledgedUser);
     $this->_template->assign('companyID', $companyID);
     if (!eval(Hooks::get('CLIENTS_SHOW'))) {
         return;
     }
     $this->_template->display('./modules/companies/Show.tpl');
 }
예제 #2
0
    public function show()
    {
        /* Bail out if we don't have a valid candidate ID. */
        if (!$this->isRequiredIDValid('jobOrderID', $_GET))
        {
            /* FIXME: fatalPopup()? */
            CommonErrors::fatal(COMMONERROR_BADINDEX, $this, 'Invalid job order ID.');
        }

        $jobOrderID = $_GET['jobOrderID'];


        $jobOrders = new JobOrders($this->_siteID);
        $data = $jobOrders->get($jobOrderID);

        /* Bail out if we got an empty result set. */
        if (empty($data))
        {
            CommonErrors::fatal(COMMONERROR_BADINDEX, $this, 'The specified job order ID could not be found.');
        }

        if ($data['is_admin_hidden'] == 1 && $this->_accessLevel < ACCESS_LEVEL_MULTI_SA)
        {
            $this->listByView('This Job Order is hidden - only a CATS Administrator can unlock the Job Order.');
            return;
        }

        /* We want to handle formatting the city and state here instead of in
         * the template.
         */
        $data['cityAndState'] = StringUtility::makeCityStateString(
            $data['city'], $data['state']
        );
        /**
         * if ownertype is group, override the user full name
         */
        if($data['ownertype']>0)
        {
            $sql="select * from auieo_groups where id={$data['owner']}";
            $objDB=DatabaseConnection::getInstance();
            $row=$objDB->getAssoc($sql);
            if($row)
            {
                $data["ownerFullName"]=$row["groupname"];
            }
        }

        $data['description'] = trim($data['description']);
        $data['notes'] = trim($data['notes']);

        /* Determine the Job Type Description */
        $data['typeDescription'] = $jobOrders->typeCodeToString($data['type']);

        /* Convert '00-00-00' dates to empty strings. */
        $data['startDate'] = DateUtility::fixZeroDate(
            $data['startDate']
        );

        /* Hot jobs [can] have different title styles than normal jobs. */
        if ($data['is_hot'] == 1)
        {
            $data['titleClass'] = 'jobTitleHot';
        }
        else
        {
            $data['titleClass'] = 'jobTitleCold';
        }

        if ($data['public'] == 1)
        {
            $data['public'] = '<img src="images/public.gif" height="16" '
                . 'width="16" title="This Job Order is marked as Public." />';
        }
        else
        {
            $data['public'] = '';
        }

        $attachments = new Attachments($this->_siteID);
        $attachmentsRS = $attachments->getAll(
            DATA_ITEM_JOBORDER, $jobOrderID
        );

        foreach ($attachmentsRS as $rowNumber => $attachmentsData)
        {
            /* Show an attachment icon based on the document's file type. */
            $attachmentIcon = strtolower(
                FileUtility::getAttachmentIcon(
                    $attachmentsRS[$rowNumber]['originalFilename']
                )
            );

            $attachmentsRS[$rowNumber]['attachmentIcon'] = $attachmentIcon;
        }

        $careerPortalSettings = new CareerPortalSettings($this->_siteID);
        $careerPortalSettingsRS = $careerPortalSettings->getAll();

        if ($careerPortalSettingsRS['enabled'] == 1)
        {
            $careerPortalEnabled = true;
        }
        else
        {
            $careerPortalEnabled = false;
        }

        /* Add an MRU entry. */
        $_SESSION['CATS']->getMRU()->addEntry(
            DATA_ITEM_JOBORDER, $jobOrderID, $data['title']
        );

        if ($this->_accessLevel < ACCESS_LEVEL_DEMO)
        {
            $privledgedUser = false;
        }
        else
        {
            $privledgedUser = true;
        }

        /* Get extra fields. */
        $extraFieldRS = $jobOrders->extraFields->getValuesForShow($jobOrderID);

        $pipelineEntriesPerPage = $_SESSION['CATS']->getPipelineEntriesPerPage();

        $sessionCookie = $_SESSION['CATS']->getCookie();

        /* Get pipeline graph. */
        $graphs = new graphs();
        $pipelineGraph = $graphs->miniJobOrderPipeline(450, 250, array($jobOrderID));

        /* Get questionnaire information (if exists) */
        $questionnaireID = false;
        $questionnaireData = false;
        $careerPortalURL = false;
        $isPublic = false;



        if ($careerPortalEnabled && $data['public'])
        {
            $isPublic = true;
            if ($data['questionnaire_id'])
            {
                $questionnaire = new Questionnaire($this->_siteID);
                $q = $questionnaire->get($data['questionnaire_id']);
                if (is_array($q) && !empty($q))
                {
                    $questionnaireID = $q['questionnaireID'];
                    $questionnaireData = $q;
                }
            }
        }

        $careerPortalSettings = new CareerPortalSettings($this->_siteID);
        $cpSettings = $careerPortalSettings->getAll();
        if (intval($cpSettings['enabled']))
        {
            $careerPortalURL = CATSUtility::getAbsoluteURI() . 'careers/';
        }

        //$sql="select * from auieo_fields where site_id={$this->_siteID} and tablename='joborder' and presence!=1";
        //$db=DatabaseConnection::getInstance();
        //$arrAssoc=$db->getAllAssoc($sql);
        
        $adminHidden="";
        if ($data['is_admin_hidden'] == 1)
        {
            $adminHidden = "<p class='warning'>This Job Order is hidden.  Only CATS Administrators can view it or search for it.  To make it visible by the site users, click <a href='index.php?m=joborders&amp;a=administrativeHideShow&amp;jobOrderID={$jobOrderID}&amp;state=0' style='font-weight:bold;'>Here.</a></p>";
        }
        
        $strFrozen="";
        if (isset($frozen))
        {
            $strFrozen = "<table style='font-weight:bold; border: 1px solid #000; background-color: #ffed1a; padding:5px; margin-bottom:7px;' width='100%' id='candidateAlreadyInSystemTable'>
                <tr>
                    <td class='tdVertical' style='width:100%;'>
                        This Job Order is {$this->data['status']} and can not be modified.
                       ";
            if ($this->accessLevel >= ACCESS_LEVEL_EDIT)
            {
                $strFrozen = $strFrozen . "
                           <a id='edit_link' href='index.php?m=joborders&amp;a=edit&amp;jobOrderID={$this->jobOrderID}'>
                               <img src='images/actions/edit.gif' width='16' height='16' class='absmiddle' alt='edit' border='0' />&nbsp;Edit
                           </a>
                           the Job Order to make it Active.&nbsp;&nbsp;
                       ";
            } 
            $strFrozen = $strFrozen . "
                    </td>
                </tr>
            </table>
        ";
        }
        $public="";
        if ($isPublic)
        {
            $public = "<div style='background-color: #E6EEFE; padding: 10px; margin: 5px 0 12px 0; border: 1px solid #728CC8;'>
            <b>This job order is public";
            if ($careerPortalURL === false)
            {
                $public = $public . ".</b>";
            }
            else
            {
                $public = $public . "
                and will be shown on your
                ";
                if ($_SESSION['CATS']->getAccessLevel() >= ACCESS_LEVEL_SA){ 
                    $public = $public . "
                    <a style='font-weight: bold;' href='{$careerPortalURL}'>Careers Website</a>.
                ";
                }
                else
                {
                    $public = $public . "
                    Careers Website.
                ";
                } 
                $public = $public . "</b>
            ";
            } 
            if ($questionnaireID !== false)
            {
                $public = $public . "<br />Applicants must complete the '<i>{$questionnaireData['title']}</i>' (<a href='index.php?m=settings&a=careerPortalQuestionnaire&questionnaireID={$questionnaireID}'>edit</a>) questionnaire when applying.";
            }
            else
            {
                $public = $public . "<br />You have not attached any ";
                if ($_SESSION['CATS']->getAccessLevel() >= ACCESS_LEVEL_SA)
                {
                    $public = $public . "<a href='index.php?m=settings&a=careerPortalSettings'>Questionnaires</a>.";
                }
                else
                {
                    $public = $public . "Questionnaires.";
                }
            }
            $public = $public . "</div>";
        }
        
        $ACCESS_LEVEL_EDIT_BUTTON="";
        if ($this->_accessLevel >= ACCESS_LEVEL_EDIT)
        { 
            $ACCESS_LEVEL_EDIT_BUTTON = "<a id='edit_link' href='index.php?m=joborders&amp;a=edit&amp;jobOrderID={$jobOrderID}'>
                <img src='images/actions/edit.gif' width='16' height='16' class='absmiddle' alt='edit' border='0' />&nbsp;Edit
            </a>";
        }
        $ACCESS_LEVEL_DELETE_BUTTON="";
        if ($this->_accessLevel >= ACCESS_LEVEL_DELETE)
        { 
            $ACCESS_LEVEL_DELETE_BUTTON = "<a id='delete_link' href='index.php?m=joborders&amp;a=delete&amp;jobOrderID={$jobOrderID}' onclick=\"javascript:return confirm('Delete this job order?');\">
                <img src='images/actions/delete.gif' width='16' height='16' class='absmiddle' alt='delete' border='0' />&nbsp;Delete
            </a>";
        }
        $ACCESS_LEVEL_MULTI_SA_BUTTON="";
        if ($this->_accessLevel >= ACCESS_LEVEL_MULTI_SA)
        {
            if ($data['is_admin_hidden'] == 1)
            {
                $ACCESS_LEVEL_MULTI_SA_BUTTON = "<a href='index.php?m=joborders&amp;a=administrativeHideShow&amp;jobOrderID={$jobOrderID}&amp;state=0'>
                    <img src='images/resume_preview_inline.gif' width='16' height='16' class='absmiddle' alt='delete' border='0' />&nbsp;Administrative Show
                </a>";
            }
            else
            {
                $ACCESS_LEVEL_MULTI_SA_BUTTON = "<a href='index.php?m=joborders&amp;a=administrativeHideShow&amp;jobOrderID={$jobOrderID}&amp;state=1'>
                <img src='images/resume_preview_inline.gif' width='16' height='16' class='absmiddle' alt='delete' border='0' />&nbsp;Administrative Hide
            </a>";
            }
        }
        $ACCESS_LEVEL_EDIT_CONSIDER="";
        if ($this->_accessLevel >= ACCESS_LEVEL_EDIT)
        { 
            $ACCESS_LEVEL_EDIT_CONSIDER = "<a href='#' onclick=\"showPopWin('index.php?m=joborders&amp;a=considerCandidateSearch&amp;jobOrderID={$jobOrderID}', 820, 550, null); return false;\">
                <img src='images/consider.gif' width='16' height='16' class='absmiddle' alt='add candidate' border='0' />&nbsp;Add Candidate to This Job Order Pipeline
            </a>";
        }
        
        $this->_template->assign('active', $this);
        $this->_template->assign('public', $public);
        $this->_template->assign('ACCESS_LEVEL_EDIT_BUTTON', $ACCESS_LEVEL_EDIT_BUTTON);
        $this->_template->assign('ACCESS_LEVEL_DELETE_BUTTON', $ACCESS_LEVEL_DELETE_BUTTON);
        $this->_template->assign('ACCESS_LEVEL_MULTI_SA_BUTTON', $ACCESS_LEVEL_MULTI_SA_BUTTON);
        $this->_template->assign('ACCESS_LEVEL_EDIT_CONSIDER', $ACCESS_LEVEL_EDIT_CONSIDER);
        $this->_template->assign('questionnaireID', $questionnaireID);
        $this->_template->assign('questionnaireData', $questionnaireData);
        $this->_template->assign('careerPortalURL', $careerPortalURL);
        $this->_template->assign('data', $data);
        $this->_template->assign('frozen', $strFrozen);
        $this->_template->assign('adminHidden',$adminHidden);
        $this->_template->assign('extraFieldRS', $extraFieldRS);
        $this->_template->assign('attachmentsRS', $attachmentsRS);
        $this->_template->assign('pipelineEntriesPerPage', $pipelineEntriesPerPage);
        $this->_template->assign('pipelineGraph', $pipelineGraph);
        $this->_template->assign('jobOrderID', $jobOrderID);
        $this->_template->assign('careerPortalEnabled', $careerPortalEnabled);
        $this->_template->assign('privledgedUser', $privledgedUser);
        $this->_template->assign('sessionCookie', $_SESSION['CATS']->getCookie());
        //$this->_template->assign('fields_detail',$arrAssoc);

        if (!eval(Hooks::get('JO_SHOW'))) return;
        /* Is this a popup? */
        if (isset($_GET['display']) && $_GET['display'] == 'popup')
        {
            $this->_template->display('./modules/joborders/show_popup.php');
            $isPopup = true;
        }
        else
        {
            $this->_template->display('./modules/joborders/Show.php');
            $isPopup = false;
        }
    }
예제 #3
0
 private function show()
 {
     /* Is this a popup? */
     if (isset($_GET['display']) && $_GET['display'] == 'popup') {
         $isPopup = true;
     } else {
         $isPopup = false;
     }
     /* Bail out if we don't have a valid candidate ID. */
     if (!$this->isRequiredIDValid('jobOrderID', $_GET)) {
         /* FIXME: fatalPopup()? */
         CommonErrors::fatal(COMMONERROR_BADINDEX, $this, 'Invalid job order ID.');
     }
     $jobOrderID = $_GET['jobOrderID'];
     $jobOrders = new JobOrders($this->_siteID);
     $data = $jobOrders->get($jobOrderID);
     /* Bail out if we got an empty result set. */
     if (empty($data)) {
         CommonErrors::fatal(COMMONERROR_BADINDEX, $this, 'The specified job order ID could not be found.');
     }
     if ($data['isAdminHidden'] == 1 && $this->_accessLevel < ACCESS_LEVEL_MULTI_SA) {
         $this->listByView('This Job Order is hidden - only a CATS Administrator can unlock the Job Order.');
         return;
     }
     /* We want to handle formatting the city and state here instead of in
      * the template.
      */
     $data['cityAndState'] = StringUtility::makeCityStateString($data['city'], $data['state']);
     $data['description'] = trim($data['description']);
     $data['notes'] = trim($data['notes']);
     /* Determine the Job Type Description */
     $data['typeDescription'] = $jobOrders->typeCodeToString($data['type']);
     /* Convert '00-00-00' dates to empty strings. */
     $data['startDate'] = DateUtility::fixZeroDate($data['startDate']);
     /* Hot jobs [can] have different title styles than normal jobs. */
     if ($data['isHot'] == 1) {
         $data['titleClass'] = 'jobTitleHot';
     } else {
         $data['titleClass'] = 'jobTitleCold';
     }
     if ($data['public'] == 1) {
         $data['public'] = '<img src="images/public.gif" height="16" ' . 'width="16" title="This Job Order is marked as Public." />';
     } else {
         $data['public'] = '';
     }
     $attachments = new Attachments($this->_siteID);
     $attachmentsRS = $attachments->getAll(DATA_ITEM_JOBORDER, $jobOrderID);
     foreach ($attachmentsRS as $rowNumber => $attachmentsData) {
         /* Show an attachment icon based on the document's file type. */
         $attachmentIcon = strtolower(FileUtility::getAttachmentIcon($attachmentsRS[$rowNumber]['originalFilename']));
         $attachmentsRS[$rowNumber]['attachmentIcon'] = $attachmentIcon;
     }
     $careerPortalSettings = new CareerPortalSettings($this->_siteID);
     $careerPortalSettingsRS = $careerPortalSettings->getAll();
     if ($careerPortalSettingsRS['enabled'] == 1) {
         $careerPortalEnabled = true;
     } else {
         $careerPortalEnabled = false;
     }
     /* Add an MRU entry. */
     $_SESSION['CATS']->getMRU()->addEntry(DATA_ITEM_JOBORDER, $jobOrderID, $data['title']);
     if ($this->_accessLevel < ACCESS_LEVEL_DEMO) {
         $privledgedUser = false;
     } else {
         $privledgedUser = true;
     }
     /* Get extra fields. */
     $extraFieldRS = $jobOrders->extraFields->getValuesForShow($jobOrderID);
     $pipelineEntriesPerPage = $_SESSION['CATS']->getPipelineEntriesPerPage();
     $sessionCookie = $_SESSION['CATS']->getCookie();
     /* Get pipeline graph. */
     $graphs = new graphs();
     $pipelineGraph = $graphs->miniJobOrderPipeline(450, 250, array($jobOrderID));
     /* Get questionnaire information (if exists) */
     $questionnaireID = false;
     $questionnaireData = false;
     $careerPortalURL = false;
     $isPublic = false;
     if ($careerPortalEnabled && $data['public']) {
         $isPublic = true;
         if ($data['questionnaireID']) {
             $questionnaire = new Questionnaire($this->_siteID);
             $q = $questionnaire->get($data['questionnaireID']);
             if (is_array($q) && !empty($q)) {
                 $questionnaireID = $q['questionnaireID'];
                 $questionnaireData = $q;
             }
         }
     }
     $careerPortalSettings = new CareerPortalSettings($this->_siteID);
     $cpSettings = $careerPortalSettings->getAll();
     if (intval($cpSettings['enabled'])) {
         $careerPortalURL = CATSUtility::getAbsoluteURI() . 'careers/';
     }
     $this->_template->assign('active', $this);
     $this->_template->assign('isPublic', $isPublic);
     $this->_template->assign('questionnaireID', $questionnaireID);
     $this->_template->assign('questionnaireData', $questionnaireData);
     $this->_template->assign('careerPortalURL', $careerPortalURL);
     $this->_template->assign('data', $data);
     $this->_template->assign('extraFieldRS', $extraFieldRS);
     $this->_template->assign('attachmentsRS', $attachmentsRS);
     $this->_template->assign('pipelineEntriesPerPage', $pipelineEntriesPerPage);
     $this->_template->assign('pipelineGraph', $pipelineGraph);
     $this->_template->assign('jobOrderID', $jobOrderID);
     $this->_template->assign('isPopup', $isPopup);
     $this->_template->assign('careerPortalEnabled', $careerPortalEnabled);
     $this->_template->assign('privledgedUser', $privledgedUser);
     $this->_template->assign('sessionCookie', $_SESSION['CATS']->getCookie());
     if (!eval(Hooks::get('JO_SHOW'))) {
         return;
     }
     $this->_template->display('./modules/joborders/Show.tpl');
 }
예제 #4
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');
 }