Exemplo n.º 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');
 }
Exemplo n.º 2
0
 private function manageUsers()
 {
     /* Bail out if the user doesn't have SA permissions. */
     if ($this->_realAccessLevel < ACCESS_LEVEL_DEMO) {
         CommonErrors::fatal(COMMONERROR_PERMISSION, $this);
         return;
         //$this->fatal(ERROR_NO_PERMISSION);
     }
     $users = new Users($this->_siteID);
     $rs = $users->getAll();
     $license = $users->getLicenseData();
     foreach ($rs as $rowIndex => $row) {
         $rs[$rowIndex]['successfulDate'] = DateUtility::fixZeroDate($rs[$rowIndex]['successfulDate'], 'Never');
         $rs[$rowIndex]['unsuccessfulDate'] = DateUtility::fixZeroDate($rs[$rowIndex]['unsuccessfulDate'], 'Never');
         // FIXME: The last test here might be redundant.
         // FIXME: Put this in a private method. It is duplicated twice so far.
         $siteIDPosition = strpos($row['username'], '@' . $_SESSION['CATS']->getSiteID());
         if ($siteIDPosition !== false && substr($row['username'], $siteIDPosition) == '@' . $_SESSION['CATS']->getSiteID()) {
             $rs[$rowIndex]['username'] = str_replace('@' . $_SESSION['CATS']->getSiteID(), '', $row['username']);
         }
     }
     $this->_template->assign('active', $this);
     $this->_template->assign('subActive', 'User Management');
     $this->_template->assign('rs', $rs);
     $this->_template->assign('license', $license);
     $this->_template->display('./modules/settings/Users.tpl');
 }
Exemplo n.º 3
0
 /**
  * Formats SQL result set for display. This is factored out for code
  * clarity.
  *
  * @param array result set from listByView()
  * @return array formatted result set
  */
 private function _formatListByViewResults($resultSet)
 {
     if (empty($resultSet)) {
         return $resultSet;
     }
     foreach ($resultSet as $rowIndex => $row) {
         /* Get info strings for popup titles */
         $resultSet[$rowIndex]['jobOrderInfo'] = InfoString::make(DATA_ITEM_JOBORDER, $resultSet[$rowIndex]['jobOrderID'], $this->_siteID);
         $resultSet[$rowIndex]['companyInfo'] = InfoString::make(DATA_ITEM_COMPANY, $resultSet[$rowIndex]['companyID'], $this->_siteID);
         /* Truncate job order title. */
         if (strlen($resultSet[$rowIndex]['title']) > self::TRUNCATE_JOBORDER_TITLE) {
             $resultSet[$rowIndex]['title'] = substr($resultSet[$rowIndex]['title'], 0, self::TRUNCATE_JOBORDER_TITLE) . "...";
         }
         /* Truncate company name. */
         if (strlen($resultSet[$rowIndex]['companyName']) > self::TRUNCATE_CLIENT_NAME) {
             $resultSet[$rowIndex]['companyName'] = substr($resultSet[$rowIndex]['companyName'], 0, self::TRUNCATE_CLIENT_NAME) . "...";
         }
         /* Convert '00-00-00' dates to empty strings. */
         $resultSet[$rowIndex]['startDate'] = DateUtility::fixZeroDate($resultSet[$rowIndex]['startDate']);
         /* Hot jobs [can] have different title styles than normal
          * jobs.
          */
         if ($resultSet[$rowIndex]['isHot'] == 1) {
             $resultSet[$rowIndex]['linkClass'] = 'jobLinkHot';
         } else {
             $resultSet[$rowIndex]['linkClass'] = 'jobLinkCold';
         }
         $resultSet[$rowIndex]['recruiterAbbrName'] = StringUtility::makeInitialName($resultSet[$rowIndex]['recruiterFirstName'], $resultSet[$rowIndex]['recruiterLastName'], false, LAST_NAME_MAXLEN);
         $resultSet[$rowIndex]['ownerAbbrName'] = StringUtility::makeInitialName($resultSet[$rowIndex]['ownerFirstName'], $resultSet[$rowIndex]['ownerLastName'], false, LAST_NAME_MAXLEN);
         if ($resultSet[$rowIndex]['attachmentPresent'] == 1) {
             $resultSet[$rowIndex]['iconTag'] = '<img src="images/paperclip.gif" alt="" width="16" height="16" />';
         } else {
             $resultSet[$rowIndex]['iconTag'] = '&nbsp;';
         }
     }
     if (!eval(Hooks::get('JO_FORMAT_LIST_BY_VIEW_RESULTS'))) {
         return;
     }
     return $resultSet;
 }
Exemplo n.º 4
0
 private function show()
 {
     /* Bail out if we don't have a valid contact ID. */
     if (!$this->isRequiredIDValid('contactID', $_GET)) {
         CommonErrors::fatal(COMMONERROR_BADINDEX, $this, 'Invalid contact ID.');
     }
     $contactID = $_GET['contactID'];
     $contacts = new Contacts($this->_siteID);
     $data = $contacts->get($contactID);
     /* Bail out if we got an empty result set. */
     if (empty($data)) {
         CommonErrors::fatal(COMMONERROR_BADINDEX, $this, 'The specified contact ID could not be found.');
     }
     /* 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 contacts [can] have different title styles than normal contacts. */
     if ($data['isHotContact'] == 1) {
         $data['titleClassContact'] = 'jobTitleHot';
     } else {
         $data['titleClassContact'] = 'jobTitleCold';
     }
     /* Hot companies [can] also have different title styles than normal companies. */
     if ($data['isHotCompany'] == 1) {
         $data['titleClassCompany'] = 'jobTitleHot';
     } else {
         $data['titleClassCompany'] = 'jobTitleCold';
     }
     $jobOrders = new JobOrders($this->_siteID);
     $jobOrdersRS = $jobOrders->getAll(JOBORDERS_STATUS_ALL, -1, -1, $contactID);
     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);
         }
     }
     $activityEntries = new ActivityEntries($this->_siteID);
     $activityRS = $activityEntries->getAllByDataItem($contactID, DATA_ITEM_CONTACT);
     if (!empty($activityRS)) {
         foreach ($activityRS as $rowIndex => $row) {
             if (empty($activityRS[$rowIndex]['notes'])) {
                 $activityRS[$rowIndex]['notes'] = '(No Notes)';
             }
             if (empty($activityRS[$rowIndex]['jobOrderID']) || empty($activityRS[$rowIndex]['regarding'])) {
                 $activityRS[$rowIndex]['regarding'] = 'General';
             }
             $activityRS[$rowIndex]['enteredByAbbrName'] = StringUtility::makeInitialName($activityRS[$rowIndex]['enteredByFirstName'], $activityRS[$rowIndex]['enteredByLastName'], false, LAST_NAME_MAXLEN);
         }
     }
     /* Get upcoming calendar entries. */
     $calendarRS = $contacts->getUpcomingEvents($contactID);
     if (!empty($calendarRS)) {
         foreach ($calendarRS as $rowIndex => $row) {
             $calendarRS[$rowIndex]['enteredByAbbrName'] = StringUtility::makeInitialName($calendarRS[$rowIndex]['enteredByFirstName'], $calendarRS[$rowIndex]['enteredByLastName'], false, LAST_NAME_MAXLEN);
         }
     }
     /* Add an MRU entry. */
     $_SESSION['CATS']->getMRU()->addEntry(DATA_ITEM_CONTACT, $contactID, $data['firstName'] . ' ' . $data['lastName']);
     /* Get extra fields. */
     $extraFieldRS = $contacts->extraFields->getValuesForShow($contactID);
     /* 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('isShortNotes', $isShortNotes);
     $this->_template->assign('jobOrdersRS', $jobOrdersRS);
     $this->_template->assign('extraFieldRS', $extraFieldRS);
     $this->_template->assign('calendarRS', $calendarRS);
     $this->_template->assign('activityRS', $activityRS);
     $this->_template->assign('contactID', $contactID);
     $this->_template->assign('privledgedUser', $privledgedUser);
     $this->_template->assign('sessionCookie', $_SESSION['CATS']->getCookie());
     if (!eval(Hooks::get('CONTACTS_SHOW'))) {
         return;
     }
     $this->_template->display('./modules/contacts/Show.tpl');
 }
Exemplo n.º 5
0
 private function considerForJobSearch($candidateIDArray = array())
 {
     /* Get list of candidates. */
     if (isset($_REQUEST['candidateIDArrayStored']) && $this->isRequiredIDValid('candidateIDArrayStored', $_REQUEST, true)) {
         $candidateIDArray = $_SESSION['CATS']->retrieveData($_REQUEST['candidateIDArrayStored']);
     } else {
         if ($this->isRequiredIDValid('candidateID', $_REQUEST)) {
             $candidateIDArray = array($_REQUEST['candidateID']);
         } else {
             if ($candidateIDArray === array()) {
                 $dataGrid = DataGrid::getFromRequest();
                 $candidateIDArray = $dataGrid->getExportIDs();
             }
         }
     }
     if (!is_array($candidateIDArray)) {
         CommonErrors::fatalModal(COMMONERROR_BADINDEX, $this, 'Invalid variable type.');
         return;
     }
     /* Validate each ID */
     foreach ($candidateIDArray as $index => $candidateID) {
         if (!$this->isRequiredIDValid($index, $candidateIDArray)) {
             echo '&' . $candidateID . '>';
             CommonErrors::fatalModal(COMMONERROR_BADINDEX, $this, 'Invalid candidate ID.');
             return;
         }
     }
     /* Bail out to prevent an error if the POST string doesn't even contain
      * a field named 'wildCardString' at all.
      */
     if (!isset($_POST['wildCardString']) && isset($_POST['mode'])) {
         CommonErrors::fatal(COMMONERROR_WILDCARDSTRING, $this, 'No wild card string specified.');
     }
     $query = $this->getTrimmedInput('wildCardString', $_POST);
     $mode = $this->getTrimmedInput('mode', $_POST);
     /* Execute the search. */
     $search = new SearchJobOrders($this->_siteID);
     switch ($mode) {
         case 'searchByJobTitle':
             $rs = $search->byTitle($query, 'title', 'ASC', true);
             $resultsMode = true;
             break;
         case 'searchByCompanyName':
             $rs = $search->byCompanyName($query, 'title', 'ASC', true);
             $resultsMode = true;
             break;
         default:
             $rs = $search->recentlyModified('DESC', true, 5);
             $resultsMode = false;
             break;
     }
     $pipelines = new Pipelines($this->_siteID);
     $pipelinesRS = $pipelines->getCandidatePipeline($candidateIDArray[0]);
     foreach ($rs as $rowIndex => $row) {
         if (ResultSetUtility::findRowByColumnValue($pipelinesRS, 'jobOrderID', $row['jobOrderID']) !== false && count($candidateIDArray) == 1) {
             $rs[$rowIndex]['inPipeline'] = true;
         } else {
             $rs[$rowIndex]['inPipeline'] = false;
         }
         /* Convert '00-00-00' dates to empty strings. */
         $rs[$rowIndex]['startDate'] = DateUtility::fixZeroDate($row['startDate']);
         if ($row['isHot'] == 1) {
             $rs[$rowIndex]['linkClass'] = 'jobLinkHot';
         } else {
             $rs[$rowIndex]['linkClass'] = 'jobLinkCold';
         }
         $rs[$rowIndex]['recruiterAbbrName'] = StringUtility::makeInitialName($row['recruiterFirstName'], $row['recruiterLastName'], false, LAST_NAME_MAXLEN);
         $rs[$rowIndex]['ownerAbbrName'] = StringUtility::makeInitialName($row['ownerFirstName'], $row['ownerLastName'], false, LAST_NAME_MAXLEN);
     }
     if (!eval(Hooks::get('CANDIDATE_ON_CONSIDER_FOR_JOB_SEARCH'))) {
         return;
     }
     $this->_template->assign('rs', $rs);
     $this->_template->assign('isFinishedMode', false);
     $this->_template->assign('isResultsMode', $resultsMode);
     $this->_template->assign('candidateIDArray', $candidateIDArray);
     $this->_template->assign('candidateIDArrayStored', $_SESSION['CATS']->storeData($candidateIDArray));
     $this->_template->display('./modules/candidates/ConsiderSearchModal.tpl');
 }