Beispiel #1
0
 function AUIEO_SEND_HOOK_EMAIL($record)
 {
     $recruiter = $record["recruiter"];
     $sql = "select * from user where user_id='{$recruiter}'";
     $db = DatabaseConnection::getInstance();
     $arrAssoc = $db->getAllAssoc($sql);
     $emailAddress = $arrAssoc[0]["email"];
     $site_id = $arrAssoc[0]["site_id"];
     if ($emailAddress) {
         $obj = new JobOrders($site_id);
         $obj->load($record["id"]);
         $obj->sendTemplateEMail("My Joborder 2", $emailAddress);
     }
     $owner = $record["owner"];
     $sql = "select * from user where user_id='{$owner}'";
     $db = DatabaseConnection::getInstance();
     $arrAssoc = $db->getAllAssoc($sql);
     $emailAddress = $arrAssoc[0]["email"];
     $site_id = $arrAssoc[0]["site_id"];
     if ($emailAddress) {
         $obj = new JobOrders($site_id);
         $obj->load($record["id"]);
         $obj->sendTemplateEMail("My Joborder 2", $emailAddress);
     }
 }
Beispiel #2
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;
 }
Beispiel #3
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');
 }
Beispiel #4
0
 private function viewItemHistory()
 {
     /* 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);
     }
     /* Bail out if we don't have a valid data item type. */
     if (!$this->isRequiredIDValid('dataItemType', $_GET)) {
         CommonErrors::fatal(COMMONERROR_BADINDEX, $this, 'Invalid data item type.');
     }
     /* Bail out if we don't have a valid data item ID. */
     if (!$this->isRequiredIDValid('dataItemID', $_GET)) {
         CommonErrors::fatal(COMMONERROR_BADINDEX, $this, 'Invalid data item ID.');
     }
     $dataItemType = $_GET['dataItemType'];
     $dataItemID = $_GET['dataItemID'];
     switch ($dataItemType) {
         case DATA_ITEM_CANDIDATE:
             $candidates = new Candidates($this->_siteID);
             $data = $candidates->get($dataItemID);
             break;
         case DATA_ITEM_JOBORDER:
             $jobOrders = new JobOrders($this->_siteID);
             $data = $jobOrders->get($dataItemID);
             break;
         case DATA_ITEM_COMPANY:
             $companies = new Companies($this->_siteID);
             $data = $companies->get($dataItemID);
             break;
         case DATA_ITEM_CONTACT:
             $contacts = new Contacts($this->_siteID);
             $data = $contacts->get($dataItemID);
             break;
         default:
             CommonErrors::fatal(COMMONERROR_BADFIELDS, $this, 'Invalid data item type.');
             break;
     }
     /* Get revision information. */
     $history = new History($this->_siteID);
     $revisionRS = $history->getAll($dataItemType, $dataItemID);
     $this->_template->assign('active', $this);
     $this->_template->assign('subActive', 'Login Activity');
     $this->_template->assign('data', $data);
     $this->_template->assign('revisionRS', $revisionRS);
     $this->_template->display('./modules/settings/ItemHistory.tpl');
 }
include_once './lib/JobOrders.php';
$interface = new SecureAJAXInterface();
if (!isset($_REQUEST['joborderID']) || !isset($_REQUEST['page']) || !isset($_REQUEST['entriesPerPage']) || !isset($_REQUEST['sortBy']) || !isset($_REQUEST['sortDirection'])) {
    $interface->outputXMLErrorPage(-1, 'Invalid input.');
    die;
}
$siteID = $interface->getSiteID();
$jobOrderID = $_REQUEST['joborderID'];
$page = $_REQUEST['page'];
$entriesPerPage = $_REQUEST['entriesPerPage'];
$sortBy = $_REQUEST['sortBy'];
$sortDirection = $_REQUEST['sortDirection'];
$indexFile = $_REQUEST['indexFile'];
$isPopup = $_REQUEST['isPopup'] == 1 ? true : false;
$_SESSION['CATS']->setPipelineEntriesPerPage($entriesPerPage);
$jobOrders = new JobOrders($siteID);
$jobOrdersData = $jobOrders->get($jobOrderID);
/* Get an array of the pipeline data. */
$pipelines = new Pipelines($siteID);
$pipelinesRS = $pipelines->getJobOrderPipeline($jobOrderID);
/* Format pipeline data. */
foreach ($pipelinesRS as $rowIndex => $row) {
    if ($row['submitted'] == '1') {
        $pipelinesRS[$rowIndex]['highlightStyle'] = 'jobLinkSubmitted';
    } else {
        $pipelinesRS[$rowIndex]['highlightStyle'] = 'jobLinkCold';
    }
    $pipelinesRS[$rowIndex]['addedByAbbrName'] = StringUtility::makeInitialName($pipelinesRS[$rowIndex]['addedByFirstName'], $pipelinesRS[$rowIndex]['addedByLastName'], LAST_NAME_MAXLEN);
    if ($row['attachmentPresent'] == 1) {
        $pipelinesRS[$rowIndex]['iconTag'] = '<img src="images/paperclip.gif" alt="" width="16" height="16" />';
    } else {
Beispiel #6
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');
 }
Beispiel #7
0
 public function isModuleActionPermitted($module = false, $action = false)
 {
     if ($module === false && isset($_REQUEST["m"])) {
         $module = $_REQUEST["m"];
     }
     if ($action === false && isset($_REQUEST["a"])) {
         $action = $_REQUEST["a"];
     }
     /**
      * if module not set, it is home module. It is allowed
      */
     if ($module === false) {
         return true;
     }
     $data_item_type = 0;
     $actionMapping = array();
     switch ($module) {
         case 'candidates':
             $data_item_type = 100;
             $actionMapping = Candidates::actionMapping();
             break;
         case 'companies':
             $data_item_type = 200;
             $actionMapping = Companies::actionMapping();
             break;
         case 'contacts':
             $data_item_type = 300;
             $actionMapping = Contacts::actionMapping();
             break;
         case 'joborders':
             $data_item_type = 400;
             $actionMapping = JobOrders::actionMapping();
             break;
     }
     /**
      * if $data_item_type is 0, it indicates other modules. so it is allowed
      */
     if ($data_item_type <= 0) {
         return true;
     }
     $modulePermission = isset($this->permission[$data_item_type]) ? $this->permission[$data_item_type] : array();
     /**
      * checks whether any one operation is allowed
      */
     $isModulePermited = false;
     if ($modulePermission) {
         foreach ($modulePermission as $operation => $permission) {
             if ($permission > 0) {
                 $isModulePermited = true;
                 break;
             }
         }
     }
     /**
      * since all the operation is not allowed, don't allow
      */
     if ($isModulePermited === false) {
         return false;
     }
     /**
      * if $action is false, check whether default action exist in action mapping
      */
     if ($action === false) {
         if (isset($actionMapping["default"])) {
             $action = $actionMapping["default"];
         }
     }
     if (!isset($actionMapping[$action])) {
         return true;
     }
     $operation = $actionMapping[$action];
     /**
      * if the action allowed
      */
     if (isset($modulePermission[$operation]) && $modulePermission[$operation] > 0) {
         return true;
     }
     return false;
 }
Beispiel #8
0
    public function onApplyToJobOrder($siteID, $candidateID = false)
    {
        $jobOrders = new JobOrders($siteID);
        $careerPortalSettings = new CareerPortalSettings($siteID);

        if (!$this->isRequiredIDValid('ID', $_POST))
        {
            CommonErrors::fatal(COMMONERROR_BADINDEX, $this, 'Invalid job order ID.');
            return;
        }

        $jobOrderID = $_POST['ID'];

        $jobOrderData = $jobOrders->get($jobOrderID);
        if (!isset($jobOrderData['public']) || $jobOrderData['public'] == 0)
        {
            CommonErrors::fatal(COMMONERROR_BADINDEX, $this, 'The specified job order could not be found.');
            return;
        }

        $lastName       = $this->getTrimmedInput('lastName', $_POST);
        $middleName     = $this->getTrimmedInput('middleName', $_POST);
        $firstName      = $this->getTrimmedInput('firstName', $_POST);
        $email          = $this->getTrimmedInput('email', $_POST);
        $email2         = $this->getTrimmedInput('email2', $_POST);
        $address        = $this->getTrimmedInput('address', $_POST);
        $city           = $this->getTrimmedInput('city', $_POST);
        $state          = $this->getTrimmedInput('state', $_POST);
        $zip            = $this->getTrimmedInput('zip', $_POST);
        $source         = $this->getTrimmedInput('source', $_POST);
        $phone          = $this->getTrimmedInput('phone', $_POST);
        $phoneHome      = $this->getTrimmedInput('phoneHome', $_POST);
        $phoneCell      = $this->getTrimmedInput('phoneCell', $_POST);
        $bestTimeToCall = $this->getTrimmedInput('bestTimeToCall', $_POST);
        $keySkills      = $this->getTrimmedInput('keySkills', $_POST);
        $extraNotes     = $this->getTrimmedInput('extraNotes', $_POST);
        $employer       = $this->getTrimmedInput('employer', $_POST);

        $gender         = $this->getTrimmedInput('eeogender', $_POST);
        $race           = $this->getTrimmedInput('eeorace', $_POST);
        $veteran        = $this->getTrimmedInput('eeoveteran', $_POST);
        $disability     = $this->getTrimmedInput('eeodisability', $_POST);

        if (empty($firstName))
        {
            CommonErrors::fatal(COMMONERROR_MISSINGFIELDS, $this, 'First Name is a required field - please have your administrator edit your templates to include the first name field.');
        }

        if (empty($lastName))
        {
            CommonErrors::fatal(COMMONERROR_MISSINGFIELDS, $this, 'Last Name is a required field - please have your administrator edit your templates to include the last name field.');
        }

        if (empty($email))
        {
            CommonErrors::fatal(COMMONERROR_MISSINGFIELDS, $this, 'E-Mail address is a required field - please have your administrator edit your templates to include the email field.');
        }

        if (empty($source))
        {
            $source = 'Online Careers Website';
        }

        $users = new Users(CATS_ADMIN_SITE);
        $automatedUser = $users->getAutomatedUser();

        /* Find if another user with same e-mail exists. If so, update the user
         * to contain the new information.
         */
        $candidates = new Candidates($siteID);

        /**
         * Save basic information in a cookie in case the site is using registration to
         * process repeated postings, etc.
         */
        $fields = array('firstName', 'lastName', 'email', 'address', 'city', 'state', 'zip', 'phone',
            'phoneHome', 'phoneCell'
        );
        $storedVal = '';
        foreach ($fields as $field)
        {
            eval('$tmp = sprintf(\'"%s"="%s"\', $field, urlencode($' . $field . '));');
            $storedVal .= $tmp;
        }
        // Store their information for an hour only (about 1 session), if they return they can log in again and
        // specify "remember me" which stores it for 2 weeks.
        @setcookie($this->getCareerPortalCookieName($siteID), $storedVal, time()+60*60);

        if ($candidateID !== false)
        {
            $candidate = $candidates->get($candidateID);

            // Candidate exists and registered. Update their profile with new values (if provided)
            $candidates->update(
                $candidateID, $candidate['isActive'] ? true : false, $firstName, $middleName,
                $lastName, $email, $email2, $phoneHome, $phoneCell, $phone, $address, $city,
                $state, $zip, $source, $keySkills, '', $employer, '', '', '', $candidate['notes'],
                '', $bestTimeToCall, $automatedUser['userID'], $automatedUser['userID'], $gender,
                $race, $veteran, $disability
            );

            /* Update extra feilds */
            $candidates->extraFields->setValuesOnEdit($candidateID);
        }
        else
        {
            // Lookup the candidate by e-mail, use that candidate instead if found (but don't update profile)
            $candidateID = $candidates->getIDByEmail($email);
        }

        if ($candidateID === false || $candidateID < 0)
        {
            /* New candidate. */
            $candidateID = $candidates->add(
                $firstName,
                $middleName,
                $lastName,
                $email,
                $email2,
                $phoneHome,
                $phoneCell,
                $phone,
                $address,
                $city,
                $state,
                $zip,
                $source,
                $keySkills,
                '',
                $employer,
                '',
                '',
                '',
                'Candidate submitted these notes with first application: '
                . "\n\n" . $extraNotes,
                '',
                $bestTimeToCall,
                $automatedUser['userID'],
                $automatedUser['userID'],
                $gender,
                $race,
                $veteran,
                $disability
            );

            /* Update extra fields. */
            $candidates->extraFields->setValuesOnEdit($candidateID);
        }

        // If the candidate was added and a questionnaire exists for the job order
        if ($candidateID > 0 && ($questionnaireID = $jobOrderData['questionnaireID']))
        {
            $questionnaireLib = new Questionnaire($siteID);
            // Perform any actions specified by the questionnaire
            $questionnaireLib->doActions($questionnaireID, $candidateID, $_POST);
        }

        $fileUploaded = false;

        /* Upload resume (no questionnaire) */
        if (isset($_FILES['file']) && !empty($_FILES['file']['name']))
        {
            $attachmentCreator = new AttachmentCreator($siteID);
            $attachmentCreator->createFromUpload(
                DATA_ITEM_CANDIDATE, $candidateID, 'file', false, true
            );

            if ($attachmentCreator->isError())
            {
                CommonErrors::fatal(COMMONERROR_FILEERROR, $this, $attachmentCreator->getError());
                return;
            }

            $duplicatesOccurred = $attachmentCreator->duplicatesOccurred();

            $isTextExtractionError = $attachmentCreator->isTextExtractionError();
            $textExtractionErrorMessage = $attachmentCreator->getTextExtractionError();

            // FIXME: Show parse errors!

            $fileUploaded = true;
            $resumePath = $attachmentCreator->getNewFilePath();
        }
        /* Upload resume (with questionnaire) */
        else if (isset($_POST['file']) && !empty($_POST['file']))
        {
            $resumePath = '';

            $newFilePath = FileUtility::getUploadFilePath($siteID, 'careerportaladd', $_POST['file']);

            if ($newFilePath !== false)
            {
                $attachmentCreator = new AttachmentCreator($siteID);
                $attachmentCreator->createFromFile(
                    DATA_ITEM_CANDIDATE, $candidateID, $newFilePath, false, '', true, true
                );

                if ($attachmentCreator->isError())
                {
                    CommonErrors::fatal(COMMONERROR_FILEERROR, $this, $attachmentCreator->getError());
                    return;
                }

                $duplicatesOccurred = $attachmentCreator->duplicatesOccurred();

                $isTextExtractionError = $attachmentCreator->isTextExtractionError();
                $textExtractionErrorMessage = $attachmentCreator->getTextExtractionError();

                // FIXME: Show parse errors!

                $fileUploaded = true;
                $resumePath = $attachmentCreator->getNewFilePath();
            }
        }

        $pipelines = new Pipelines($siteID);
        $activityEntries = new ActivityEntries($siteID);

        /* Is the candidate already in the pipeline for this job order? */
        $rs = $pipelines->get($candidateID, $jobOrderID);
        if (count($rs) == 0)
        {
            /* Attempt to add the candidate to the pipeline. */
            if (!$pipelines->add($candidateID, $jobOrderID))
            {
                CommonErrors::fatal(COMMONERROR_RECORDERROR, $this, 'Failed to add candidate to pipeline.');
            }

            // FIXME: For some reason, pipeline entries like to disappear between
            //        the above add() and this get(). WTF?
            $rs = $pipelines->get($candidateID, $jobOrderID);
            if (isset($rs['candidateJobOrderID']))
                $pipelines->updateRatingValue($rs['candidateJobOrderID'], -1);

            $newApplication = true;
        }
        else
        {
            $newApplication = false;
        }

        /* Build activity note. */
        if (!$newApplication)
        {
            $activityNote = 'User re-applied through candidate portal';
        }
        else
        {
            $activityNote = 'User applied through candidate portal';
        }

        if ($fileUploaded)
        {
            if (!$duplicatesOccurred)
            {
                $activityNote .= ' <span style="font-weight: bold;">and'
                    . ' attached a new resume (<a href="' . $resumePath
                    . '">Download</a>)</span>';
            }
            else
            {
                $activityNote .= ' and attached an existing resume (<a href="'
                    . $resumePath . '">Download</a>)';
            }
        }

		if (!empty($extraNotes))
		{
        	$activityNote .= '; added these notes: ' . $extraNotes;
		}

        /* Add the activity note. */
        $activityID = $activityEntries->add(
            $candidateID,
            DATA_ITEM_CANDIDATE,
            ACTIVITY_OTHER,
            $activityNote,
            $automatedUser['userID'],
            $jobOrderID
        );

        /* Send an E-Mail describing what happened. */
        $emailTemplates = new EmailTemplates($siteID);
        $candidatesEmailTemplateRS = $emailTemplates->getByTag(
            'EMAIL_TEMPLATE_CANDIDATEAPPLY'
        );

        if (!isset($candidatesEmailTemplateRS['textReplaced']) ||
            empty($candidatesEmailTemplateRS['textReplaced']) ||
            $candidatesEmailTemplateRS['disabled'] == 1)
        {
            $candidatesEmailTemplate = '';
        }
        else
        {
            $candidatesEmailTemplate = $candidatesEmailTemplateRS['textReplaced'];
        }

        /* Replace e-mail template variables. */
        /* E-Mail #1 - to candidate */
        $stringsToFind = array(
            '%CANDFIRSTNAME%',
            '%CANDFULLNAME%',
            '%JBODOWNER%',
            '%JBODTITLE%',
            '%JBODCLIENT%'
        );
        $replacementStrings = array(
            $firstName,
            $firstName . ' ' . $lastName,
            $jobOrderData['ownerFullName'],
            $jobOrderData['title'],
            $jobOrderData['companyName']

            //'<a href="http://' . $_SERVER['HTTP_HOST'] . substr($_SERVER['REQUEST_URI'], 0, strpos($_SERVER['REQUEST_URI'], '?')) . '?m=candidates&amp;a=show&amp;candidateID=' . $candidateID . '">'.
              //  'http://' . $_SERVER['HTTP_HOST'] . substr($_SERVER['REQUEST_URI'], 0, strpos($_SERVER['REQUEST_URI'], '?')) . '?m=candidates&amp;a=show&amp;candidateID=' . $candidateID . '</a>'
        );
        $candidatesEmailTemplate = str_replace(
            $stringsToFind,
            $replacementStrings,
            $candidatesEmailTemplate
        );

        $emailContents = $candidatesEmailTemplate;

        if (!empty($emailContents))
        {
            if(!$candidates->isLoaded())
            {
                $candidates->load($candidateID);
            }
            $candidates->sendEMail(
                $automatedUser['userID'],
                $email,
                CAREERS_CANDIDATEAPPLY_SUBJECT,
                $emailContents
            );
        }

        /* E-Mail #2 - to owner */

        $candidatesEmailTemplateRS = $emailTemplates->getByTag(
            'EMAIL_TEMPLATE_CANDIDATEPORTALNEW'
        );

        if (!isset($candidatesEmailTemplateRS['textReplaced']) ||
            empty($candidatesEmailTemplateRS['textReplaced']) ||
            $candidatesEmailTemplateRS['disabled'] == 1)
        {
            $candidatesEmailTemplate = '';
        }
        else
        {
            $candidatesEmailTemplate = $candidatesEmailTemplateRS['textReplaced'];
        }

        // FIXME: This will break if 'http' is elsewhere in the URL.
        $uri = str_replace('employment', '', $_SERVER['REQUEST_URI']);
        $uri = str_replace('http://', 'http', $uri);
        $uri = str_replace('//', '/', $uri);
        $uri = str_replace('http', 'http://', $uri);
        $uri = str_replace('/careers', '', $uri);

        /* Replace e-mail template variables. */
        $stringsToFind = array(
            '%CANDFIRSTNAME%',
            '%CANDFULLNAME%',
            '%JBODOWNER%',
            '%CANDOWNER%',     // Because the candidate was just added, we assume
            '%JBODTITLE%',     // the candidate owner = job order owner.
            '%JBODCLIENT%',
            '%CANDCATSURL%',
            '%JBODID%',
            '%JBODCATSURL%'
        );
        $replacementStrings = array(
            $firstName,
            $firstName . ' ' . $lastName,
            $jobOrderData['ownerFullName'],
            $jobOrderData['ownerFullName'],
            $jobOrderData['title'],
            $jobOrderData['companyName'],
            '<a href="http://' . $_SERVER['HTTP_HOST'] . substr($uri, 0, strpos($uri, '?')) . '?m=candidates&amp;a=show&amp;candidateID=' . $candidateID . '">'.
                'http://' . $_SERVER['HTTP_HOST'] . substr($uri, 0, strpos($uri, '?')) . '?m=candidates&amp;a=show&amp;candidateID=' . $candidateID . '</a>',
            $jobOrderData['jobOrderID'],
            '<a href="http://' . $_SERVER['HTTP_HOST'] . substr($uri, 0, strpos($uri, '?')) . '?m=joborders&amp;a=show&amp;jobOrderID=' . $jobOrderData['jobOrderID'] . '">'.
                'http://' . $_SERVER['HTTP_HOST'] . substr($uri, 0, strpos($uri, '?')) . '?m=joborders&amp;a=show&amp;jobOrderID=' . $jobOrderData['jobOrderID'] . '</a>',
        );
        $candidatesEmailTemplate = str_replace(
            $stringsToFind,
            $replacementStrings,
            $candidatesEmailTemplate
        );

        $emailContents = $candidatesEmailTemplate;

        if (!empty($emailContents))
        {
            if(!$jobOrders->isLoaded())
            {
                $jobOrders->load($jobOrderID);
            }
            $jobOrders->sendEmail(
                $automatedUser['userID'],
                $jobOrderData['owner_email'],
                CAREERS_OWNERAPPLY_SUBJECT,
                $emailContents
            );


            if ($jobOrderData['owner_email'] != $jobOrderData['recruiter_email'])
            {
                $jobOrders->sendEmail(
                    $automatedUser['userID'],
                    $jobOrderData['recruiter_email'],
                    CAREERS_OWNERAPPLY_SUBJECT,
                    $emailContents
                );
            }
        }
    }
Beispiel #9
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;
 }
Beispiel #10
0
                                    <?php endif; ?>
                                </td>
                                
                                <td style="vertical-align:top;">
                                    <?php echo($this->pipelineGraph);  ?>
                                </td>
                                
                            </tr>
                        </table>
                    </td>
                </tr>
            </table>
<?php
$objRole=Users::getInstance()->getRole();
$allowDelete=$objRole->getModulePermission(400, JobOrders::actionMapping("delete"));
$allowEdit=$objRole->getModulePermission(400,  JobOrders::actionMapping("edit"));
if (!isset($this->isPopup)): ?>
            <div id="actionbar">
                <span style="float:left;">
                    <?php if ($allowEdit && $this->accessLevel >= ACCESS_LEVEL_EDIT): ?>
                        <a id="edit_link" href="<?php echo(CATSUtility::getIndexName()); ?>?m=joborders&amp;a=edit&amp;jobOrderID=<?php echo($this->jobOrderID); ?>">
                            <img src="images/actions/edit.gif" width="16" height="16" class="absmiddle" alt="edit" border="0" />&nbsp;Edit
                        </a>
                        &nbsp;&nbsp;&nbsp;&nbsp;
                    <?php endif; ?>
                    <?php if ($allowDelete && $this->accessLevel >= ACCESS_LEVEL_DELETE): ?>
                        <a id="delete_link" href="<?php echo(CATSUtility::getIndexName()); ?>?m=joborders&amp;a=delete&amp;jobOrderID=<?php echo($this->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>
                        &nbsp;&nbsp;&nbsp;&nbsp;
                    <?php endif; ?>
Beispiel #11
0
 private function administrativeHideShow()
 {
     if ($this->_accessLevel < ACCESS_LEVEL_MULTI_SA) {
         CommonErrors::fatal(COMMONERROR_PERMISSION, $this, 'Invalid user level for action.');
     }
     /* Bail out if we don't have a valid joborder ID. */
     if (!$this->isRequiredIDValid('jobOrderID', $_GET)) {
         CommonErrors::fatal(COMMONERROR_BADINDEX, $this, 'Invalid Job Order ID.');
     }
     /* Bail out if we don't have a valid status ID. */
     if (!$this->isRequiredIDValid('state', $_GET, true)) {
         CommonErrors::fatal(COMMONERROR_BADINDEX, $this, 'Invalid state ID.');
     }
     $jobOrderID = $_GET['jobOrderID'];
     // FIXME: Checkbox?
     (bool) ($state = $_GET['state']);
     $joborders = new JobOrders($this->_siteID);
     $joborders->administrativeHideShow($jobOrderID, $state);
     CATSUtility::transferRelativeURI('m=joborders&a=show&jobOrderID=' . $jobOrderID);
 }
Beispiel #12
0
 /**
  * Creates and returns output to be written to a CSV / etc. file.
  *
  * @return string formatted output
  */
 public function getFormattedOutput()
 {
     switch ($this->_dataItemType) {
         case DATA_ITEM_CANDIDATE:
             $dataItem = new Candidates($this->_siteID);
             break;
         case DATA_ITEM_JOBORDER:
             $dataItem = new JobOrders($this->_siteID);
             break;
         default:
             return false;
             break;
     }
     $this->_rs = $dataItem->getExport($this->_IDs);
     if (empty($this->_rs)) {
         return false;
     }
     /* Column names. */
     $outputString = implode($this->_separator, array_keys($this->_rs[0])) . "\r\n";
     foreach ($this->_rs as $rowIndex => $row) {
         foreach ($row as $key => $value) {
             /* Escape any double-quotes and place the value inside
              * double quotes.
              */
             $this->_rs[$rowIndex][$key] = '"' . str_replace('"', '""', $value) . '"';
         }
         $outputString .= implode($this->_separator, $this->_rs[$rowIndex]) . "\r\n";
     }
     return $outputString;
 }
Beispiel #13
0
 /**
  * Processes an Add Activity / Change Status form and displays
  * candidates/AddActivityChangeStatusModal.tpl. This is factored out
  * for code clarity.
  *
  * @param boolean from joborders module perspective
  * @param integer "regarding" job order ID or -1
  * @param string module directory
  * @return void
  */
 private function _addActivityChangeStatus($isJobOrdersMode, $regardingID, $directoryOverride = '')
 {
     $notificationHTML = '';
     $pipelines = new Pipelines($this->_siteID);
     $statusRS = $pipelines->getStatusesForPicking();
     /* Module directory override for fatal() calls. */
     if ($directoryOverride != '') {
         $moduleDirectory = $directoryOverride;
     } else {
         $moduleDirectory = $this->_moduleDirectory;
     }
     /* Bail out if we don't have a valid candidate ID. */
     if (!$this->isRequiredIDValid('candidateID', $_POST)) {
         CommonErrors::fatalModal(COMMONERROR_BADINDEX, $this, 'Invalid candidate ID.');
     }
     /* Do we have a valid status ID. */
     if (!$this->isOptionalIDValid('statusID', $_POST)) {
         $statusID = -1;
     } else {
         $statusID = $_POST['statusID'];
     }
     $candidateID = $_POST['candidateID'];
     if (!eval(Hooks::get('CANDIDATE_ON_ADD_ACTIVITY_CHANGE_STATUS_PRE'))) {
         return;
     }
     if ($this->isChecked('addActivity', $_POST)) {
         /* Bail out if we don't have a valid job order ID. */
         if (!$this->isOptionalIDValid('activityTypeID', $_POST)) {
             CommonErrors::fatalModal(COMMONERROR_BADINDEX, $this, 'Invalid activity type ID.');
         }
         $activityTypeID = $_POST['activityTypeID'];
         $activityNote = $this->getTrimmedInput('activityNote', $_POST);
         $activityNote = htmlspecialchars($activityNote);
         // FIXME: Move this to a highlighter-method? */
         if (strpos($activityNote, 'Status change: ') === 0) {
             foreach ($statusRS as $data) {
                 $activityNote = StringUtility::replaceOnce($data['status'], '<span style="color: #ff6c00;">' . $data['status'] . '</span>', $activityNote);
             }
         }
         /* Add the activity entry. */
         $activityEntries = new ActivityEntries($this->_siteID);
         $activityID = $activityEntries->add($candidateID, DATA_ITEM_CANDIDATE, $activityTypeID, $activityNote, $this->_userID, $regardingID);
         $activityTypes = $activityEntries->getTypes();
         $activityTypeDescription = ResultSetUtility::getColumnValueByIDValue($activityTypes, 'typeID', $activityTypeID, 'type');
         $activityAdded = true;
     } else {
         $activityAdded = false;
         $activityNote = '';
         $activityTypeDescription = '';
     }
     if ($regardingID <= 0 || $statusID == -1) {
         $statusChanged = false;
         $oldStatusDescription = '';
         $newStatusDescription = '';
     } else {
         $data = $pipelines->get($candidateID, $regardingID);
         /* Bail out if we got an empty result set. */
         if (empty($data)) {
             $this->fatalModal('The specified pipeline entry could not be found.');
         }
         $validStatus = ResultSetUtility::findRowByColumnValue($statusRS, 'statusID', $statusID);
         /* If the status is invalid or unchanged, don't mess with it. */
         if ($validStatus === false || $statusID == $data['status']) {
             $oldStatusDescription = '';
             $newStatusDescription = '';
             $statusChanged = false;
         } else {
             $oldStatusDescription = $data['status'];
             $newStatusDescription = ResultSetUtility::getColumnValueByIDValue($statusRS, 'statusID', $statusID, 'status');
             if ($oldStatusDescription != $newStatusDescription) {
                 $statusChanged = true;
             } else {
                 $statusChanged = false;
             }
         }
         if ($statusChanged && $this->isChecked('triggerEmail', $_POST)) {
             $customMessage = $this->getTrimmedInput('customMessage', $_POST);
             // FIXME: Actually validate the e-mail address?
             if (empty($data['candidateEmail'])) {
                 $email = '';
                 $notificationHTML = '<p><span class="bold">Error:</span> An e-mail notification' . ' could not be sent to the candidate because the candidate' . ' does not have a valid e-mail address.</p>';
             } else {
                 if (empty($customMessage)) {
                     $email = '';
                     $notificationHTML = '<p><span class="bold">Error:</span> An e-mail notification' . ' will not be sent because the message text specified was blank.</p>';
                 } else {
                     if ($this->_accessLevel == ACCESS_LEVEL_DEMO) {
                         $email = '';
                         $notificationHTML = '<p><span class="bold">Error:</span> Demo users can not send' . ' E-Mails.  No E-Mail was sent.</p>';
                     } else {
                         $email = $data['candidateEmail'];
                         $notificationHTML = '<p>An e-mail notification has been sent to the candidate.</p>';
                     }
                 }
             }
         } else {
             $email = '';
             $customMessage = '';
             $notificationHTML = '<p>No e-mail notification has been sent to the candidate.</p>';
         }
         /* Set the pipeline entry's status, but don't send e-mails for now. */
         $pipelines->setStatus($candidateID, $regardingID, $statusID, $email, $customMessage);
         /* If status = placed, and open positions > 0, reduce number of open positions by one. */
         if ($statusID == PIPELINE_STATUS_PLACED && is_numeric($data['openingsAvailable']) && $data['openingsAvailable'] > 0) {
             $jobOrders = new JobOrders($this->_siteID);
             $jobOrders->updateOpeningsAvailable($regardingID, $data['openingsAvailable'] - 1);
         }
     }
     if ($this->isChecked('scheduleEvent', $_POST)) {
         /* Bail out if we received an invalid date. */
         $trimmedDate = $this->getTrimmedInput('dateAdd', $_POST);
         if (empty($trimmedDate) || !DateUtility::validate('-', $trimmedDate, DATE_FORMAT_MMDDYY)) {
             CommonErrors::fatalModal(COMMONERROR_MISSINGFIELDS, $this, 'Invalid date.');
         }
         /* Bail out if we don't have a valid event type. */
         if (!$this->isRequiredIDValid('eventTypeID', $_POST)) {
             CommonErrors::fatalModal(COMMONERROR_BADINDEX, $this, 'Invalid event type ID.');
         }
         /* Bail out if we don't have a valid time format ID. */
         if (!isset($_POST['allDay']) || $_POST['allDay'] != '0' && $_POST['allDay'] != '1') {
             CommonErrors::fatalModal(COMMONERROR_MISSINGFIELDS, $this, 'Invalid time format ID.');
         }
         $eventTypeID = $_POST['eventTypeID'];
         if ($_POST['allDay'] == 1) {
             $allDay = true;
         } else {
             $allDay = false;
         }
         $publicEntry = $this->isChecked('publicEntry', $_POST);
         $reminderEnabled = $this->isChecked('reminderToggle', $_POST);
         $reminderEmail = $this->getTrimmedInput('sendEmail', $_POST);
         $reminderTime = $this->getTrimmedInput('reminderTime', $_POST);
         $duration = $this->getTrimmedInput('duration', $_POST);
         /* Is this a scheduled event or an all day event? */
         if ($allDay) {
             $date = DateUtility::convert('-', $trimmedDate, DATE_FORMAT_MMDDYY, DATE_FORMAT_YYYYMMDD);
             $hour = 12;
             $minute = 0;
             $meridiem = 'AM';
         } else {
             /* Bail out if we don't have a valid hour. */
             if (!isset($_POST['hour'])) {
                 CommonErrors::fatalModal(COMMONERROR_MISSINGFIELDS, $this, 'Invalid hour.');
             }
             /* Bail out if we don't have a valid minute. */
             if (!isset($_POST['minute'])) {
                 CommonErrors::fatalModal(COMMONERROR_MISSINGFIELDS, $this, 'Invalid minute.');
             }
             /* Bail out if we don't have a valid meridiem value. */
             if (!isset($_POST['meridiem']) || $_POST['meridiem'] != 'AM' && $_POST['meridiem'] != 'PM') {
                 $this->fatalModal('Invalid meridiem value.', $moduleDirectory);
             }
             $hour = $_POST['hour'];
             $minute = $_POST['minute'];
             $meridiem = $_POST['meridiem'];
             /* Convert formatted time to UNIX timestamp. */
             $time = strtotime(sprintf('%s:%s %s', $hour, $minute, $meridiem));
             /* Create MySQL date string w/ 24hr time (YYYY-MM-DD HH:MM:SS). */
             $date = sprintf('%s %s', DateUtility::convert('-', $trimmedDate, DATE_FORMAT_MMDDYY, DATE_FORMAT_YYYYMMDD), date('H:i:00', $time));
         }
         $description = $this->getTrimmedInput('description', $_POST);
         $title = $this->getTrimmedInput('title', $_POST);
         /* Bail out if any of the required fields are empty. */
         if (empty($title)) {
             CommonErrors::fatalModal(COMMONERROR_MISSINGFIELDS, $this);
             return;
             /*$this->fatalModal(
                   'Required fields are missing.', $moduleDirectory
               );*/
         }
         if ($regardingID > 0) {
             $eventJobOrderID = $regardingID;
         } else {
             $eventJobOrderID = -1;
         }
         $calendar = new Calendar($this->_siteID);
         $eventID = $calendar->addEvent($eventTypeID, $date, $description, $allDay, $this->_userID, $candidateID, DATA_ITEM_CANDIDATE, $eventJobOrderID, $title, $duration, $reminderEnabled, $reminderEmail, $reminderTime, $publicEntry, $_SESSION['CATS']->getTimeZoneOffset());
         if ($eventID <= 0) {
             $this->fatalModal('Failed to add calendar event.', $moduleDirectory);
         }
         /* Extract the date parts from the specified date. */
         $parsedDate = strtotime($date);
         $formattedDate = date('l, F jS, Y', $parsedDate);
         $calendar = new Calendar($this->_siteID);
         $calendarEventTypes = $calendar->getAllEventTypes();
         $eventTypeDescription = ResultSetUtility::getColumnValueByIDValue($calendarEventTypes, 'typeID', $eventTypeID, 'description');
         $eventHTML = sprintf('<p>An event of type <span class="bold">%s</span> has been scheduled on <span class="bold">%s</span>.</p>', htmlspecialchars($eventTypeDescription), htmlspecialchars($formattedDate));
         $eventScheduled = true;
     } else {
         $eventHTML = '<p>No event has been scheduled.</p>';
         $eventScheduled = false;
     }
     if (isset($_GET['onlyScheduleEvent'])) {
         $onlyScheduleEvent = true;
     } else {
         $onlyScheduleEvent = false;
     }
     if (!$statusChanged && !$activityAdded && !$eventScheduled) {
         $changesMade = false;
     } else {
         $changesMade = true;
     }
     if (!eval(Hooks::get('CANDIDATE_ON_ADD_ACTIVITY_CHANGE_STATUS_POST'))) {
         return;
     }
     $this->_template->assign('candidateID', $candidateID);
     $this->_template->assign('regardingID', $regardingID);
     $this->_template->assign('oldStatusDescription', $oldStatusDescription);
     $this->_template->assign('newStatusDescription', $newStatusDescription);
     $this->_template->assign('statusChanged', $statusChanged);
     $this->_template->assign('activityAdded', $activityAdded);
     $this->_template->assign('activityDescription', $activityNote);
     $this->_template->assign('activityType', $activityTypeDescription);
     $this->_template->assign('eventScheduled', $eventScheduled);
     $this->_template->assign('eventHTML', $eventHTML);
     $this->_template->assign('notificationHTML', $notificationHTML);
     $this->_template->assign('onlyScheduleEvent', $onlyScheduleEvent);
     $this->_template->assign('changesMade', $changesMade);
     $this->_template->assign('isFinishedMode', true);
     $this->_template->assign('isJobOrdersMode', $isJobOrdersMode);
     $this->_template->display('./modules/candidates/AddActivityChangeStatusModal.tpl');
 }
Beispiel #14
0
 /**
  * Updates a Data Item's modified timestamp.
  *
  * @param integer Data Item ID.
  * @param flag Data Item type flag.
  * @return void
  */
 private function _updateDataItemModified($dataItemID, $dataItemType)
 {
     switch ($dataItemType) {
         case DATA_ITEM_CANDIDATE:
             $dataItem = new Candidates($this->_siteID);
             break;
         case DATA_ITEM_COMPANY:
             $dataItem = new Companies($this->_siteID);
             break;
         case DATA_ITEM_CONTACT:
             $dataItem = new Contacts($this->_siteID);
             break;
         case DATA_ITEM_JOBORDER:
             $dataItem = new JobOrders($this->_siteID);
             break;
         default:
             return;
             break;
     }
     $dataItem->updateModified($dataItemID);
 }
Beispiel #15
0
 /**
  * Generates a string of Job Order info used for the popup tooltips.
  *
  * @param integer job order ID
  * @param integer site ID
  * @return string info string
  */
 private static function _joborder($jobOrderID, $siteID)
 {
     $jobOrders = new JobOrders($siteID);
     $infoRS = $jobOrders->get($jobOrderID);
     if (empty($infoRS)) {
         return 'The specified job order could not be found.';
     }
     $infoString = sprintf('<span class="bold">Job Order:</span>&nbsp;%s', htmlspecialchars($infoRS['title']));
     if (!empty($infoRS['type'])) {
         $infoRS['type'] = $jobOrders->typeCodeToString($infoRS['type']);
         $infoString .= sprintf('<br /><span class="bold">Type:</span>&nbsp;%s', htmlspecialchars($infoRS['type']));
     }
     if (!empty($infoRS['openings'])) {
         $infoString .= sprintf('<br /><span class="bold">Openings:</span>&nbsp;%s', htmlspecialchars($infoRS['openings']));
     }
     if (!empty($infoRS['salary'])) {
         $infoString .= sprintf('<br /><span class="bold">Salary:</span>&nbsp;%s', htmlspecialchars($infoRS['salary']));
     }
     if (!empty($infoRS['maxRate'])) {
         $infoString .= sprintf('<br /><span class="bold">Max Rate:</span>&nbsp;%s', htmlspecialchars($infoRS['maxRate']));
     }
     if (!empty($infoRS['recruiterFullName'])) {
         $infoString .= sprintf('<br /><span class="bold">Recruiter:</span>&nbsp;%s', htmlspecialchars($infoRS['recruiterFullName']));
     }
     if (!empty($infoRS['startDate'])) {
         $infoString .= sprintf('<br /><span class="bold">Start Date:</span>&nbsp;%s', htmlspecialchars($infoRS['startDate']));
     }
     return $infoString;
 }
Beispiel #16
0
 /**
  * Removes a company and all associated records from the system.
  *
  * @param integer Company ID
  * @return void
  */
 public function delete($companyID)
 {
     /* Delete the company. */
     $sql = sprintf("DELETE FROM\n                company\n            WHERE\n                company_id = %s\n            AND\n                site_id = %s", $companyID, $this->_siteID);
     $this->_db->query($sql);
     $history = new History($this->_siteID);
     $history->storeHistoryDeleted(DATA_ITEM_COMPANY, $companyID);
     /* Find associated contacts. */
     $sql = sprintf("SELECT\n                contact_id AS contactID\n            FROM\n                contact\n            WHERE\n                company_id = %s\n            AND\n                site_id = %s", $companyID, $this->_siteID);
     $contactsRS = $this->_db->getAllAssoc($sql);
     /* Find associated job orders. */
     $sql = sprintf("SELECT\n                joborder_id AS jobOrderID\n            FROM\n                joborder\n            WHERE\n                company_id = %s\n            AND\n                site_id = %s", $companyID, $this->_siteID);
     $jobOrdersRS = $this->_db->getAllAssoc($sql);
     /* Find associated attachments. */
     $attachments = new Attachments($this->_siteID);
     $attachmentsRS = $attachments->getAll(DATA_ITEM_COMPANY, $companyID);
     /* Delete associated contacts. */
     $contacts = new Contacts($this->_siteID);
     foreach ($contactsRS as $rowIndex => $row) {
         $contacts->delete($row['contactID']);
     }
     /* Delete associated job orders. */
     $jobOrders = new JobOrders($this->_siteID);
     foreach ($jobOrdersRS as $rowIndex => $row) {
         $jobOrders->delete($row['jobOrderID']);
     }
     /* Delete associated attachments. */
     foreach ($attachmentsRS as $rowNumber => $row) {
         $attachments->delete($row['attachmentID']);
     }
     /* Delete from saved lists. */
     $sql = sprintf("DELETE FROM\n                saved_list_entry\n            WHERE\n                data_item_id = %s\n            AND\n                site_id = %s\n            AND\n                data_item_type = %s", $this->_db->makeQueryInteger($companyID), $this->_siteID, DATA_ITEM_COMPANY);
     $this->_db->query($sql);
     /* Delete extra fields. */
     $this->extraFields->deleteValueByDataItemID($companyID);
 }
Beispiel #17
0
 /**
  * Returns link HTML for a data item.
  *
  * @param flag Data Item type flag.
  * @param integer Data Item ID.
  * @param boolean Show name / data item title?
  * @return string Link HTML (<a href="...">...</a>).
  */
 private function getHTMLOfLink($dataItemID, $dataItemType, $showTitle = true)
 {
     $string = '<a href="' . CATSUtility::getIndexName();
     switch ($dataItemType) {
         case DATA_ITEM_CANDIDATE:
             $candidates = new Candidates($this->_siteID);
             $string .= '?m=candidates&amp;a=show&amp;candidateID=' . $dataItemID . '">';
             $string .= '<img src="images/mru/candidate.gif" alt="" style="border: none;" title="Candidate" />';
             if ($showTitle) {
                 $data = $candidates->get($dataItemID);
                 if (!isset($data['firstName'])) {
                     $string = '<img src="images/mru/company.gif" alt="" style="border: none;" /> (Candidate Deleted)<a>';
                 } else {
                     $string .= '&nbsp;' . $data['firstName'] . ' ' . $data['lastName'];
                 }
             }
             $image = 'images/mru/candidate.gif';
             break;
         case DATA_ITEM_COMPANY:
             $companies = new Companies($this->_siteID);
             $string .= '?m=companies&amp;a=show&amp;companyID=' . $dataItemID . '">';
             $string .= '<img src="images/mru/company.gif" alt="" style="border: none;" title="Company" />';
             if ($showTitle) {
                 $data = $companies->get($dataItemID);
                 if (!isset($data['name'])) {
                     $string = '<img src="images/mru/company.gif" alt="" style="border: none;" /> (Company Deleted)<a>';
                 } else {
                     $string .= '&nbsp;' . $data['name'];
                 }
             }
             break;
         case DATA_ITEM_CONTACT:
             $contacts = new Contacts($this->_siteID);
             $string .= '?m=contacts&amp;a=show&amp;contactID=' . $dataItemID . '">';
             $string .= '<img src="images/mru/contact.gif" alt="" style="border: none;" title="Contact" />';
             if ($showTitle) {
                 $data = $contacts->get($dataItemID);
                 if (!isset($data['firstName'])) {
                     $string = '<img src="images/mru/contact.gif" alt="" style="border: none;" /> (Contact Deleted)<a>';
                 } else {
                     $string .= '&nbsp;' . $data['firstName'] . ' ' . $data['lastName'];
                 }
             }
             break;
         case DATA_ITEM_JOBORDER:
             $jobOrders = new JobOrders($this->_siteID);
             $string .= '?m=joborders&amp;a=show&amp;jobOrderID=' . $dataItemID . '">';
             $string .= '<img src="images/mru/job_order.gif" alt="" style="border: none;" title="Job Order" />';
             if ($showTitle) {
                 $data = $jobOrders->get($dataItemID);
                 if (!isset($data['title'])) {
                     $string = '<img src="images/mru/job_order.gif" alt="" style="border: none;" /> (Job Order Deleted)<a>';
                 } else {
                     $string .= '&nbsp;' . $data['title'];
                 }
             }
             break;
     }
     $string .= '</a>';
     return $string;
 }
Beispiel #18
0
 public function copyto()
 {
     if ($this->_accessLevel < ACCESS_LEVEL_EDIT)
     {
         CommonErrors::fatal(COMMONERROR_PERMISSION, $this);
         return;
         //$this->fatal(ERROR_NO_PERMISSION);
     }
     if($this->_moduleName=="candidates")
     {
         $module = new Candidates($this->_siteID);
     }
     else if($this->_moduleName=="companies")
     {
         $module = new Companies($this->_siteID);
     }
     else if($this->_moduleName=="joborders")
     {
         $module = new JobOrders($this->_siteID);
     }
     /* Bail out if we don't have a valid candidate ID. */
     if (!isset($module))
     {
         CommonErrors::fatalModal(COMMONERROR_BADINDEX, $this, "Invalid Module: {$this->_moduleName}.");
         return;
     }
     /* Bail out if we don't have a valid candidate ID. */
     if (!$this->isRequiredIDValid('dataItemID', $_GET))
     {
         CommonErrors::fatalModal(COMMONERROR_BADINDEX, $this, "Invalid {$this->_moduleName} ID.");
         return;
     }
     /* Update the candidate record. */
     $updateSuccess = $module->copyRecord(
         $_GET['dataItemID'],
         $_GET["siteID"]
     );
     if (!$updateSuccess)
     {
         CommonErrors::fatal(COMMONERROR_RECORDERROR, $this, "Failed to update {$this->_moduleName}.");
     }
     $this->_template->assign('active', $this);
     $this->_template->display('./modules/Settings/copystatus.php');
 }