Esempio n. 1
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;
 }
Esempio n. 2
0
 private function onDelete()
 {
     if ($this->_accessLevel < ACCESS_LEVEL_DELETE) {
         $this->listByView('Invalid user level for action.');
         return;
     }
     /* 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);
     $rs = $companies->get($companyID);
     if (empty($rs)) {
         $this->listByView('The specified company ID could not be found.');
         return;
     }
     if ($rs['defaultCompany'] == 1) {
         $this->listByView('Cannot delete internal postings company.');
         return;
     }
     if (!eval(Hooks::get('CLIENTS_ON_DELETE_PRE'))) {
         return;
     }
     $companies->delete($companyID);
     /* Delete the MRU entry if present. */
     $_SESSION['CATS']->getMRU()->removeEntry(DATA_ITEM_COMPANY, $companyID);
     if (!eval(Hooks::get('CLIENTS_ON_DELETE_POST'))) {
         return;
     }
     CATSUtility::transferRelativeURI('m=companies&a=listByView');
 }
Esempio n. 3
0
 /**
  * Generates a string of Company info used for the popup tooltips.
  *
  * @param integer company ID
  * @param integer site ID
  * @return string info string
  */
 private static function _company($companyID, $siteID)
 {
     $companies = new Companies($siteID);
     $infoRS = $companies->get($companyID);
     if (empty($infoRS)) {
         return 'The specified company could not be found.';
     }
     $infoString = sprintf('<span class="bold">Company:</span>&nbsp;%s', htmlspecialchars($infoRS['name']));
     if (!empty($infoRS['billingContactFullName'])) {
         $infoString .= sprintf('<br /><span class="bold">Billing Contact:</span>&nbsp;%s', htmlspecialchars($infoRS['billingContactFullName']));
     }
     if (!empty($infoRS['phone1'])) {
         $infoString .= sprintf('<br /><span class="bold">Primary Phone:</span>&nbsp;%s', htmlspecialchars($infoRS['phone1']));
     }
     if (!empty($infoRS['phone2'])) {
         $infoString .= sprintf('<br /><span class="bold">Secondary Phone:</span>&nbsp;%s', htmlspecialchars($infoRS['phone2']));
     }
     if (!empty($infoRS['faxNumber'])) {
         $infoString .= sprintf('<br /><span class="bold">Fax Number:</span>&nbsp;%s', htmlspecialchars($infoRS['faxNumber']));
     }
     if (!empty($infoRS['keyTechnologies'])) {
         $infoString .= sprintf('<br /><span class="bold">Key Technologies:</span>&nbsp;%s', htmlspecialchars($infoRS['keyTechnologies']));
     }
     return $infoString;
 }
Esempio n. 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');
 }
Esempio n. 5
0
 private function downloadVCard()
 {
     /* 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);
     $contact = $contacts->get($contactID);
     $companies = new Companies($this->_siteID);
     $company = $companies->get($contact['companyID']);
     /* Bail out if we got an empty result set. */
     if (empty($contact)) {
         CommonErrors::fatal(COMMONERROR_BADINDEX, $this, 'The specified contact ID could not be found.');
     }
     /* Create a new vCard. */
     $vCard = new VCard();
     $vCard->setName($contact['lastName'], $contact['firstName']);
     if (!empty($contact['phoneWork'])) {
         $vCard->setPhoneNumber($contact['phoneWork'], 'PREF;WORK;VOICE');
     }
     if (!empty($contact['phoneCell'])) {
         $vCard->setPhoneNumber($contact['phoneCell'], 'CELL;VOICE');
     }
     /* FIXME: Add fax to contacts and use setPhoneNumber('WORK;FAX') here */
     $addressLines = explode("\n", $contact['address']);
     $address1 = trim($addressLines[0]);
     if (isset($addressLines[1])) {
         $address2 = trim($addressLines[1]);
     } else {
         $address2 = '';
     }
     $vCard->setAddress($address1, $address2, $contact['city'], $contact['state'], $contact['zip']);
     if (!empty($contact['email1'])) {
         $vCard->setEmail($contact['email1']);
     }
     if (!empty($company['url'])) {
         $vCard->setURL($company['url']);
     }
     $vCard->setTitle($contact['title']);
     $vCard->setOrganization($company['name']);
     if (!eval(Hooks::get('CONTACTS_GET_VCARD'))) {
         return;
     }
     $vCard->printVCardWithHeaders();
 }
Esempio n. 6
0
        $AUIEO_MODULE = "candidates";
        $record=$dataItem->get($dataItemID);
        /* Bail out if record not found. */
        if(empty($record))
        {
            CommonErrors::fatalModal(COMMONERROR_BADINDEX, $this, 'Invalid data item ID for the Site '.$siteID);
            return;
        }
        $AUIEO_NAME = $record["firstName"]." ".$record["lastName"];
        break;

    case DATA_ITEM_COMPANY:
        include_once('./lib/Companies.php');
        $dataItem = new Companies($siteID);
        $AUIEO_MODULE = "companies";
        $record=$dataItem->get($dataItemID);
        /* Bail out if record not found. */
        if(empty($record))
        {
            CommonErrors::fatalModal(COMMONERROR_BADINDEX, $this, 'Invalid data item ID for the Site '.$siteID);
            return;
        }
        $AUIEO_NAME = $record["name"];
        break;

    case DATA_ITEM_CONTACT:
        include_once('./lib/Contacts.php');
        $dataItem = new Contacts($siteID);
        $AUIEO_MODULE = "contacts";
        $record=$dataItem->get($dataItemID);
        /* Bail out if record not found. */
Esempio n. 7
0
 private function edit()
 {
     /* Bail out if we don't have a valid candidate ID. */
     if (!$this->isRequiredIDValid('jobOrderID', $_GET)) {
         CommonErrors::fatal(COMMONERROR_BADINDEX, $this, 'Invalid job order ID.');
     }
     $jobOrderID = $_GET['jobOrderID'];
     $jobOrders = new JobOrders($this->_siteID);
     $data = $jobOrders->getForEditing($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.');
     }
     $users = new Users($this->_siteID);
     $usersRS = $users->getSelectList();
     $companies = new Companies($this->_siteID);
     $companiesRS = $companies->getSelectList();
     $contactsRS = $companies->getContactsArray($data['companyID']);
     /* Add an MRU entry. */
     $_SESSION['CATS']->getMRU()->addEntry(DATA_ITEM_JOBORDER, $jobOrderID, $data['title']);
     $emailTemplates = new EmailTemplates($this->_siteID);
     $statusChangeTemplateRS = $emailTemplates->getByTag('EMAIL_TEMPLATE_OWNERSHIPASSIGNJOBORDER');
     if ($statusChangeTemplateRS['disabled'] == 1) {
         $emailTemplateDisabled = true;
     } else {
         $emailTemplateDisabled = false;
     }
     if ($this->_accessLevel == ACCESS_LEVEL_DEMO) {
         $canEmail = false;
     } else {
         $canEmail = true;
     }
     $companies = new Companies($this->_siteID);
     $defaultCompanyID = $companies->getDefaultCompany();
     if ($defaultCompanyID !== false) {
         $defaultCompanyRS = $companies->get($defaultCompanyID);
     } else {
         $defaultCompanyRS = array();
     }
     /* Get departments. */
     $departmentsRS = $companies->getDepartments($data['companyID']);
     $departmentsString = ListEditor::getStringFromList($departmentsRS, 'name');
     /* Date format for DateInput()s. */
     if ($_SESSION['CATS']->isDateDMY()) {
         $data['startDateMDY'] = DateUtility::convert('-', $data['startDate'], DATE_FORMAT_DDMMYY, DATE_FORMAT_MMDDYY);
     } else {
         $data['startDateMDY'] = $data['startDate'];
     }
     /* Get extra fields. */
     $extraFieldRS = $jobOrders->extraFields->getValuesForEdit($jobOrderID);
     /* Check if career portal is enabled */
     $careerPortalSettings = new CareerPortalSettings($this->_siteID);
     $careerPortalSettingsRS = $careerPortalSettings->getAll();
     $careerPortalEnabled = intval($careerPortalSettingsRS['enabled']) ? true : false;
     /* Get questionnaire information (if exists) */
     $questionnaireID = false;
     $questionnaireData = false;
     $isPublic = false;
     $questionnaire = new Questionnaire($this->_siteID);
     $questionnaires = $questionnaire->getAll(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;
             }
         }
     }
     $this->_template->assign('extraFieldRS', $extraFieldRS);
     $this->_template->assign('careerPortalEnabled', $careerPortalEnabled);
     $this->_template->assign('questionnaireID', $questionnaireID);
     $this->_template->assign('questionnaireData', $questionnaireData);
     $this->_template->assign('questionnaires', $questionnaires);
     $this->_template->assign('isPublic', $isPublic);
     $this->_template->assign('defaultCompanyID', $defaultCompanyID);
     $this->_template->assign('defaultCompanyRS', $defaultCompanyRS);
     $this->_template->assign('canEmail', $canEmail);
     $this->_template->assign('emailTemplateDisabled', $emailTemplateDisabled);
     $this->_template->assign('active', $this);
     $this->_template->assign('data', $data);
     $this->_template->assign('usersRS', $usersRS);
     $this->_template->assign('companiesRS', $companiesRS);
     $this->_template->assign('departmentsRS', $departmentsRS);
     $this->_template->assign('departmentsString', $departmentsString);
     $this->_template->assign('contactsRS', $contactsRS);
     $this->_template->assign('jobOrderID', $jobOrderID);
     $this->_template->assign('isHrMode', $_SESSION['CATS']->isHrMode());
     $this->_template->assign('sessionCookie', $_SESSION['CATS']->getCookie());
     if (!eval(Hooks::get('JO_EDIT'))) {
         return;
     }
     $this->_template->display('./modules/joborders/Edit.tpl');
 }
Esempio n. 8
0
<?php

require_once 'config.php';
require_once 'companies.php';
$conn = db_connect();
$operation = isset($_POST["operation"]) ? $_POST["operation"] : null;
if ($operation == 'read') {
    $id = $_POST["id"];
    $call = Companies::get($id);
    echo json_encode($call);
} else {
    if ($operation == 'update') {
        $id = $_POST["id"];
        $attrs['description'] = $_POST["description"];
        $call = Companies::update($id, $attrs);
        if ($call['success'] == true) {
            echo 'success';
        } else {
            echo $call['message'];
        }
    }
}
db_disconnect($conn);