Example #1
0
 private function displayPublicJobOrders()
 {
     $site = new Site(-1);
     $careerPortalSiteID = $site->getFirstSiteID();
     if (!eval(Hooks::get('RSS_SITEID'))) {
         return;
     }
     $jobOrders = new JobOrders($careerPortalSiteID);
     $rs = $jobOrders->getAll(JOBORDERS_STATUS_ACTIVE, -1, -1, -1, false, true);
     /* XML Headers */
     header('Content-type: text/xml');
     $indexName = CATSUtility::getIndexName();
     $stream = sprintf("<?xml version=\"1.0\" encoding=\"utf-8\"?>\n" . "<rss version=\"2.0\">\n" . "<channel>\n" . "<title>New Job Orders</title>\n" . "<description>CATS RSS Feed</description>\n" . "<link>%s</link>\n" . "<pubDate>%s</pubDate>\n", CATSUtility::getAbsoluteURI(), DateUtility::getRSSDate());
     foreach ($rs as $rowIndex => $row) {
         $uri = sprintf("%scareers/?p=showJob&amp;ID=%d", CATSUtility::getAbsoluteURI(), $row['jobOrderID']);
         // Fix URL if viewing from /rss without using globals or dirup '../'
         if (strpos($_SERVER['PHP_SELF'], '/rss/') !== false) {
             $uri = str_replace('/rss/', '/', $uri);
         }
         $stream .= sprintf("<item>\n" . "<title>%s (%s)</title>\n" . "<description>Located in %s.</description>\n" . "<link>%s</link>\n" . "</item>\n", $row['title'], $jobOrders->typeCodeToString($row['type']), StringUtility::makeCityStateString($row['city'], $row['state']), $uri);
     }
     $stream .= "</channel>\n</rss>\n";
     echo $stream;
 }
 public function __construct()
 {
     $this->_indexName = CATSUtility::getIndexName();
     $this->_indexURL = CATSUtility::getAbsoluteURI($this->_indexName);
     parent::__construct();
 }
Example #3
0
 private function careerPortalSettings()
 {
     if ($this->_realAccessLevel < ACCESS_LEVEL_DEMO && !$_SESSION['CATS']->hasUserCategory('careerportal')) {
         CommonErrors::fatal(COMMONERROR_PERMISSION, $this);
         return;
     }
     $careerPortalSettings = new CareerPortalSettings($this->_siteID);
     $careerPortalSettingsRS = $careerPortalSettings->getAll();
     $careerPortalTemplateNames = $careerPortalSettings->getDefaultTemplates();
     $careerPortalTemplateCustomNames = $careerPortalSettings->getCustomTemplates();
     $careerPortalURL = CATSUtility::getAbsoluteURI() . 'careers/';
     if (!eval(Hooks::get('SETTINGS_CAREER_PORTAL'))) {
         return;
     }
     $questionnaires = new Questionnaire($this->_siteID);
     $data = $questionnaires->getAll(true);
     $this->_template->assign('active', $this);
     $this->_template->assign('questionnaires', $data);
     $this->_template->assign('subActive', 'Administration');
     $this->_template->assign('careerPortalSettingsRS', $careerPortalSettingsRS);
     $this->_template->assign('careerPortalTemplateNames', $careerPortalTemplateNames);
     $this->_template->assign('careerPortalTemplateCustomNames', $careerPortalTemplateCustomNames);
     $this->_template->assign('careerPortalURL', $careerPortalURL);
     $this->_template->assign('sessionCookie', $_SESSION['CATS']->getCookie());
     $this->_template->display('./modules/settings/CareerPortalSettings.tpl');
 }
Example #4
0
 private function displayPublicJobOrders()
 {
     $site = new Site(-1);
     $careerPortalSiteID = $site->getFirstSiteID();
     if (!eval(Hooks::get('RSS_SITEID'))) {
         return;
     }
     $jobOrders = new JobOrders($careerPortalSiteID);
     $rs = $jobOrders->getAll(JOBORDERS_STATUS_ACTIVE, -1, -1, -1, false, true);
     // Log that this file was accessed
     // FIXME: Does this really need to involve two queries? Can we store
     //        the IDs in constants too?
     HTTPLogger::addHTTPLog(HTTPLogger::getHTTPLogTypeIDByName('xml'), $careerPortalSiteID);
     /* XML Headers */
     header('Content-type: text/xml');
     $indexName = CATSUtility::getIndexName();
     $availTemplates = XmlTemplate::getTemplates();
     if (isset($_GET['t'])) {
         $templateName = $_GET['t'];
         // Check if the template exists
         foreach ($availTemplates as $template) {
             if (!strcasecmp($template['xml_template_name'], $templateName)) {
                 $templateSections = XmlTemplate::loadTemplate($templateName);
             }
         }
     }
     // no template exists, load the default (which will always be first)
     if (!isset($templateSections)) {
         $templateSections = XmlTemplate::loadTemplate($templateName = $availTemplates[0]["xml_template_name"]);
     }
     // get the section bodies from the template into strings
     $templateHeader = $templateSections[XTPL_HEADER_STRING];
     $templateJob = $templateSections[XTPL_JOB_STRING];
     $templateFooter = $templateSections[XTPL_FOOTER_STRING];
     $tags = XmlTemplate::loadTemplateTags($templateHeader);
     foreach ($tags as $tag) {
         switch ($tag) {
             case 'date':
                 $templateHeader = XmlTemplate::replaceTemplateTags($tag, DateUtility::getRSSDate(), $templateHeader);
                 break;
             case 'siteURL':
                 $templateHeader = XmlTemplate::replaceTemplateTags($tag, CATSUtility::getAbsoluteURI(''), $templateHeader);
                 break;
         }
     }
     $stream = $templateHeader;
     $tags = XmlTemplate::loadTemplateTags($templateJob);
     $careerPortalSettings = new CareerPortalSettings($careerPortalSiteID);
     $settings = $careerPortalSettings->getAll();
     if ($settings['allowBrowse'] == 1) {
         // browse the jobs, adding a section body for each job
         foreach ($rs as $rowIndex => $row) {
             $txtJobPosting = $templateJob;
             foreach ($tags as $tag) {
                 switch ($tag) {
                     case 'siteURL':
                         $txtJobPosting = XmlTemplate::replaceTemplateTags($tag, substr(CATSUtility::getAbsoluteURI(''), 0, -4), $txtJobPosting);
                         break;
                     case 'jobTitle':
                         $txtJobPosting = XmlTemplate::replaceTemplateTags($tag, $row['title'], $txtJobPosting);
                         break;
                     case 'jobPostDate':
                         $txtJobPosting = XmlTemplate::replaceTemplateTags($tag, DateUtility::getRSSDate(strtotime($row['dateCreatedSort'])), $txtJobPosting);
                         break;
                     case 'jobURL':
                         $uri = sprintf("%scareers/?p=showJob&ID=%d&ref=%s", substr(CATSUtility::getAbsoluteURI(), 0, -4), $row['jobOrderID'], $templateName);
                         $txtJobPosting = XmlTemplate::replaceTemplateTags($tag, $uri, $txtJobPosting);
                         break;
                     case 'jobID':
                         $txtJobPosting = XmlTemplate::replaceTemplateTags($tag, $row['jobOrderID'], $txtJobPosting);
                         break;
                     case 'hiringCompany':
                         $txtJobPosting = XmlTemplate::replaceTemplateTags($tag, 'CATS (www.catsone.com)', $txtJobPosting);
                         break;
                     case 'jobCity':
                         $txtJobPosting = XmlTemplate::replaceTemplateTags($tag, $row['city'], $txtJobPosting);
                         break;
                     case 'jobState':
                         $txtJobPosting = XmlTemplate::replaceTemplateTags($tag, $row['state'], $txtJobPosting);
                         break;
                         // FIXME: Make this expandable to non-US?
                     // FIXME: Make this expandable to non-US?
                     case 'jobCountry':
                         $txtJobPosting = XmlTemplate::replaceTemplateTags($tag, "US", $txtJobPosting);
                         break;
                     case 'jobZipCode':
                         $txtJobPosting = XmlTemplate::replaceTemplateTags($tag, '', $txtJobPosting);
                         break;
                     case 'jobDescription':
                         $txtJobPosting = XmlTemplate::replaceTemplateTags($tag, $row['jobDescription'], $txtJobPosting);
                         break;
                 }
             }
             $stream .= $txtJobPosting;
         }
     }
     $stream .= $templateFooter;
     echo $stream;
 }
Example #5
0
    function generateEEOReportPreview()
    {
        $modePeriod = $this->getTrimmedInput('period', $_GET);
        $modeStatus = $this->getTrimmedInput('status', $_GET);

        $statistics = new Statistics($this->_siteID);
        $EEOReportStatistics = $statistics->getEEOReport($modePeriod, $modeStatus);

        //print_r($EEOReportStatistics);

        switch ($modePeriod)
        {
            case 'week':
                $labelPeriod = ' Last Week';
                break;

            case 'month':
                $labelPeriod = ' Last Month';
                break;

            default:
                $labelPeriod = '';
                break;
        }

        switch ($modeStatus)
        {
            case 'rejected':
                $labelStatus = ' Rejected';
                break;

            case 'placed':
                $labelStatus = ' Placed';
                break;

            default:
                $labelStatus = '';
                break;
        }

        /* Produce the URL to the ethic statistics graph. */
        $labels = array();
        $data = array();

        $rsEthnicStatistics = $EEOReportStatistics['rsEthnicStatistics'];

        foreach ($rsEthnicStatistics as $index => $line)
        {
            $labels[] = $line['EEOEthnicType'];
            $data[] = $line['numberOfCandidates'];
        }

        $urlEthnicGraph = CATSUtility::getAbsoluteURI(
            sprintf("%s?m=graphs&a=generic&title=%s&labels=%s&data=%s&width=%s&height=%s",
                CATSUtility::getIndexName(),
                urlencode('Number of Candidates'.$labelStatus.' by Ethnic Type'.$labelPeriod),
                urlencode(implode(',', $labels)),
                urlencode(implode(',', $data)),
                400,
                240
            ));


        /* Produce the URL to the veteran status statistics graph. */
        $labels = array();
        $data = array();

        $rsVeteranStatistics = $EEOReportStatistics['rsVeteranStatistics'];

        foreach ($rsVeteranStatistics as $index => $line)
        {
            $labels[] = $line['EEOVeteranType'];
            $data[] = $line['numberOfCandidates'];
        }

        $urlVeteranGraph = CATSUtility::getAbsoluteURI(
            sprintf("%s?m=graphs&a=generic&title=%s&labels=%s&data=%s&width=%s&height=%s",
                CATSUtility::getIndexName(),
                urlencode('Number of Candidates'.$labelStatus.' by Veteran Status'.$labelPeriod),
                urlencode(implode(',', $labels)),
                urlencode(implode(',', $data)),
                400,
                240
            ));

        /* Produce the URL to the gender statistics graph. */
        $labels = array();
        $data = array();

        $rsGenderStatistics = $EEOReportStatistics['rsGenderStatistics'];

        $labels[] = 'Male ('.$rsGenderStatistics['numberOfCandidatesMale'].')';
        $data[] = $rsGenderStatistics['numberOfCandidatesMale'];

        $labels[] = 'Female ('.$rsGenderStatistics['numberOfCandidatesFemale'].')';
        $data[] = $rsGenderStatistics['numberOfCandidatesFemale'];

        $urlGenderGraph = CATSUtility::getAbsoluteURI(
            sprintf("%s?m=graphs&a=genericPie&title=%s&labels=%s&data=%s&width=%s&height=%s&legendOffset=%s",
                CATSUtility::getIndexName(),
                urlencode('Number of Candidates by Gender'),
                urlencode(implode(',', $labels)),
                urlencode(implode(',', $data)),
                320,
                300,
                1.575
            ));

        if ($rsGenderStatistics['numberOfCandidatesMale'] == 0 && $rsGenderStatistics['numberOfCandidatesFemale'] == 0)
        {
            $urlGenderGraph = "images/noDataByGender.png";
        }

        /* Produce the URL to the disability statistics graph. */
        $labels = array();
        $data = array();

        $rsDisabledStatistics = $EEOReportStatistics['rsDisabledStatistics'];

        $labels[] = 'Disabled ('.$rsDisabledStatistics['numberOfCandidatesDisabled'].')';
        $data[] = $rsDisabledStatistics['numberOfCandidatesDisabled'];

        $labels[] = 'Non Disabled ('.$rsDisabledStatistics['numberOfCandidatesNonDisabled'].')';
        $data[] = $rsDisabledStatistics['numberOfCandidatesNonDisabled'];

        $urlDisabilityGraph = CATSUtility::getAbsoluteURI(
            sprintf("%s?m=graphs&a=genericPie&title=%s&labels=%s&data=%s&width=%s&height=%s&legendOffset=%s",
                CATSUtility::getIndexName(),
                urlencode('Number of Candidates by Disability Status'),
                urlencode(implode(',', $labels)),
                urlencode(implode(',', $data)),
                320,
                300,
                1.575
            ));

        if ($rsDisabledStatistics['numberOfCandidatesNonDisabled'] == 0 && $rsDisabledStatistics['numberOfCandidatesDisabled'] == 0)
        {
            $urlDisabilityGraph = "images/noDataByDisability.png";
        }

        $EEOSettings = new EEOSettings($this->_siteID);
        $EEOSettingsRS = $EEOSettings->getAll();

        $this->_template->assign('EEOReportStatistics', $EEOReportStatistics);
        $this->_template->assign('urlEthnicGraph', $urlEthnicGraph);
        $this->_template->assign('urlVeteranGraph', $urlVeteranGraph);
        $this->_template->assign('urlGenderGraph', $urlGenderGraph);
        $this->_template->assign('urlDisabilityGraph', $urlDisabilityGraph);
        $this->_template->assign('modePeriod', $modePeriod);
        $this->_template->assign('modeStatus', $modeStatus);
        $this->_template->assign('EEOSettingsRS', $EEOSettingsRS);
        $this->_template->assign('active', $this);
        $this->_template->assign('subActive', '');
        $this->_template->display('./modules/reports/EEOReport.php');
    }
Example #6
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 #7
0
 function testSettings()
 {
     /* Log in and make sure no errors occurred. */
     if (!$this->login()) {
         /* Abort. */
         return false;
     }
     /* Click on the Settings tab. */
     $this->assertClickLink('Settings');
     $this->runPageLoadAssertions(false);
     /* Test the main Settings page (My Profile). */
     $this->assertTitle('CATS - Settings');
     $this->assertPattern('/<h2>Settings: My Profile<\\/h2>/');
     /* Test View Profile. */
     $this->assertClickLink('View Profile');
     $this->assertPattern('/' . TESTER_LOGIN . '/');
     $this->assertPattern('/' . TESTER_FIRSTNAME . '\\s+' . TESTER_LASTNAME . '/');
     $this->runPageLoadAssertions(false);
     $this->back();
     /* Test Change Password. */
     $this->assertClickLink('Change Password');
     $this->runPageLoadAssertions(false);
     $this->assertField('currentPassword');
     $this->assertField('newPassword');
     $this->assertField('retypeNewPassword');
     $this->assertField('changePassword');
     /* FIXME: Test change password functionality. */
     /* Click on the Administration sub-tab. */
     $this->assertClickLink('Administration');
     $this->runPageLoadAssertions(false);
     /* Click on the My Profile sub-tab. */
     $this->assertClickLink('My Profile');
     $this->runPageLoadAssertions(false);
     $this->back();
     /* Click on the User Management sub-tab. */
     $this->assertClickLink('User Management');
     $this->runPageLoadAssertions(false);
     $this->assertClickLink(TESTER_LASTNAME);
     $this->runPageLoadAssertions(false);
     $this->back();
     /* Click on Add User. */
     $this->assertClickLinkById('add_link');
     $this->runPageLoadAssertions(false);
     /* Test the Add User page. */
     $this->assertField('firstName');
     $this->assertField('lastName');
     $this->assertField('username');
     $this->assertField('password');
     $this->assertField('retypePassword');
     $this->assertField('accessLevel');
     /* Try to add a user with only a first name and make sure that we
      * receive a fatal error.
      */
     $this->setField('firstName', 'Test User');
     $this->assertClickSubmit('Add User');
     $this->runPageLoadAssertions(true);
     $this->back();
     /* Try to add a user with all required fields (and only the required
      * fields) filled in.
      */
     $this->setField('firstName', 'Test User');
     $this->setField('lastName', 'ATxyz');
     $this->setField('username', 'testuser109');
     $this->setField('password', 'testpass109');
     $this->setField('retypePassword', 'testpass109');
     $this->setField('accessLevel', 'Delete (Default)');
     $this->assertClickSubmit('Add User');
     $this->runPageLoadAssertions(false);
     /* We should now be on the User Details page for the user that we just
      * added. Verify that the user was added correctly.
      */
     $this->assertPattern('/Test\\s+User\\s+ATxyz/');
     $this->assertPattern('/Username:/');
     $this->assertPattern('/E-Mail:/');
     $this->assertPattern('/Access Level:/');
     $this->assertPattern('/Last Successful Login:/');
     $this->assertPattern('/Last Failed Login:/');
     /* Get the user ID. */
     $matchResult = preg_match('/userID=(?P<userID>\\d+)/', $this->getUrl(), $matches);
     $this->assertTrue($matchResult, 'URL should contain userID=');
     $userID = $matches['userID'];
     $this->assertClickLinkById('edit_link');
     $this->runPageLoadAssertions(false);
     $this->assertField('firstName');
     $this->assertField('lastName');
     $this->assertField('username');
     $this->assertField('accessLevel');
     /* Try to remove the first name and save the contact. Make sure that
      * we receive a fatal error.
      */
     $this->setField('firstName', '');
     $this->assertClickSubmit('Save');
     $this->runPageLoadAssertions(true);
     $this->back();
     /* Change a few things and save the form. */
     $this->setField('username', 'SavePattern223');
     $this->assertClickSubmit('Save');
     $this->runPageLoadAssertions(false);
     $this->assertPattern('/SavePattern223/');
     /* Test login activity pages. */
     $this->assertClickLink('Administration');
     $this->assertClickLink('Login Activity');
     $this->runPageLoadAssertions(false);
     $this->assertGET(CATSUtility::getAbsoluteURI('index.php?m=settings&a=loginActivity&view=successful'), 'Manually loading successful login activity page should succeed');
     $this->runPageLoadAssertions(false);
     $this->assertGET(CATSUtility::getAbsoluteURI('index.php?m=settings&a=loginActivity&view=unsuccessful'), 'Manually loading unsuccessful login activity page should succeed');
     $this->runPageLoadAssertions(false);
     /* Delete the user. */
     $this->deleteUser($userID);
     /* We're done; log out. */
     $this->logout();
 }
Example #8
0
     <?php if ($this->accessLevel >= ACCESS_LEVEL_MULTI_SA): ?>
         <?php if ($this->data['is_admin_hidden'] == 1): ?>
             <a href="<?php echo(CATSUtility::getIndexName()); ?>?m=joborders&amp;a=administrativeHideShow&amp;jobOrderID=<?php echo($this->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>
             <?php else: ?>
             <a href="<?php echo(CATSUtility::getIndexName()); ?>?m=joborders&amp;a=administrativeHideShow&amp;jobOrderID=<?php echo($this->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>
         <?php endif; ?>
         &nbsp;&nbsp;&nbsp;&nbsp;
     <?php endif; ?>
 </span>
 <span style="float:right;">
     <?php if (!empty($this->data['public']) && $this->careerPortalEnabled): ?>
         <a id="public_link" href="<?php echo(CATSUtility::getAbsoluteURI()); ?>careers/<?php echo(CATSUtility::getIndexName()); ?>?p=showJob&amp;ID=<?php echo($this->jobOrderID); ?>">
             <img src="images/public.gif" width="16" height="16" class="absmiddle" alt="Online Application" border="0" />&nbsp;Online Application
         </a>
         &nbsp;&nbsp;&nbsp;&nbsp;
     <?php endif; ?>
     <?php /* TODO: Make report available for every site. */ ?>
     <a id="report_link" href="<?php echo(CATSUtility::getIndexName()); ?>?m=reports&amp;a=customizeJobOrderReport&amp;jobOrderID=<?php echo($this->jobOrderID); ?>">
         <img src="images/reportsSmall.gif" width="16" height="16" class="absmiddle" alt="report" border="0" />&nbsp;Generate Report
     </a>
     <?php if ($this->privledgedUser): ?>
         &nbsp;&nbsp;&nbsp;&nbsp;
         <a id="history_link" href="<?php echo(CATSUtility::getIndexName()); ?>?m=settings&amp;a=viewItemHistory&amp;dataItemType=400&amp;dataItemID=<?php echo($this->jobOrderID); ?>">
             <img src="images/icon_clock.gif" width="16" height="16" class="absmiddle"  border="0" />&nbsp;View History
         </a>
     <?php endif; ?>
 </span>
Example #9
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;
        }
    }