Example #1
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');
 }
Example #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;
        }
    }