Example #1
0
 /**
  * Generates a string of contact info used for the popup tooltips.
  *
  * @param integer contact ID
  * @param integer site ID
  * @return string info string
  */
 private static function _contact($contactID, $siteID)
 {
     $contacts = new Contacts($siteID);
     $infoRS = $contacts->get($contactID);
     if (empty($infoRS)) {
         return 'The specified contact could not be found.';
     }
     $infoString = sprintf('<span class="bold">Contact:</span>&nbsp;%s %s', htmlspecialchars($infoRS['firstName']), htmlspecialchars($infoRS['lastName']));
     if (!empty($infoRS['title'])) {
         $infoString .= sprintf('<br /><span class="bold">Title:</span>&nbsp;%s', htmlspecialchars($infoRS['title']));
     }
     if (!empty($infoRS['companyName'])) {
         $infoString .= sprintf('<br /><span class="bold">Company:</span>&nbsp;%s', htmlspecialchars($infoRS['companyName']));
     }
     if (!empty($infoRS['department'])) {
         $infoString .= sprintf('<br /><span class="bold">Department:</span>&nbsp;%s', htmlspecialchars($infoRS['department']));
     }
     if (!empty($infoRS['email1'])) {
         $infoString .= sprintf('<br /><span class="bold">Primary Email:</span>&nbsp;%s', htmlspecialchars($infoRS['email1']));
     }
     if (!empty($infoRS['email2'])) {
         $infoString .= sprintf('<br /><span class="bold">Secondary Email:</span>&nbsp;%s', htmlspecialchars($infoRS['email2']));
     }
     if (!empty($infoRS['phoneWork'])) {
         $infoString .= sprintf('<br /><span class="bold">Work Phone:</span>&nbsp;%s', htmlspecialchars($infoRS['phoneWork']));
     }
     if (!empty($infoRS['phoneCell'])) {
         $infoString .= sprintf('<br /><span class="bold">Cell Phone:</span>&nbsp;%s', htmlspecialchars($infoRS['phoneCell']));
     }
     if (!empty($infoRS['phoneOther'])) {
         $infoString .= sprintf('<br /><span class="bold">Other Phone:</span>&nbsp;%s', htmlspecialchars($infoRS['phoneOther']));
     }
     if (!empty($infoRS['address'])) {
         $infoString .= sprintf('<br /><span class="bold">Address:</span><br />&nbsp;&nbsp;%s', htmlspecialchars($infoRS['address']));
         if (!empty($infoRS['city'])) {
             $infoString .= sprintf('&nbsp;%s', htmlspecialchars($infoRS['city']));
         }
         if (!empty($infoRS['state'])) {
             $infoString .= sprintf('&nbsp;%s', htmlspecialchars($infoRS['state']));
         }
         if (!empty($infoRS['zip'])) {
             $infoString .= sprintf('&nbsp;%s', htmlspecialchars($infoRS['zip']));
         }
     }
     return $infoString;
 }
Example #2
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;
 }
Example #3
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');
 }
Example #4
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();
 }
 /**
  *   Update a new contact
  *
  *
  *   @param  mixed  $updated_since DateTime
  *   @return Result
  */
 public function updateContact(Contacts $contact)
 {
     $url = "/contacts/" . $contact->get('id');
     return $this->performPut($url, $contact->toJSON());
 }
Example #6
0
        $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. */
        if(empty($record))
        {
            CommonErrors::fatalModal(COMMONERROR_BADINDEX, $this, 'Invalid data item ID for the Site '.$siteID);
            return;
        }
        $AUIEO_NAME = $record["firstName"]." ".$record["lastName"];
        break;

    default:
        /* Bail out if record not found. */
        if(empty($record))
        {
            CommonErrors::fatalModal(COMMONERROR_BADINDEX, $this, 'Invalid data item type.');
            return;