Example #1
0
 private function addActivityScheduleEvent()
 {
     /* Bail out if we don't have a valid candidate ID. */
     if (!$this->isRequiredIDValid('contactID', $_GET)) {
         CommonErrors::fatalModal(COMMONERROR_BADINDEX, $this, 'Invalid contact ID.');
     }
     $contactID = $_GET['contactID'];
     $contacts = new Contacts($this->_siteID);
     $contactData = $contacts->get($contactID);
     $regardingRS = $contacts->getJobOrdersArray($contactID);
     $calendar = new Calendar($this->_siteID);
     $calendarEventTypes = $calendar->getAllEventTypes();
     /* Are we in "Only Schedule Event" mode? */
     $onlyScheduleEvent = $this->isChecked('onlyScheduleEvent', $_GET);
     if (!eval(Hooks::get('CONTACTS_ADD_ACTIVITY_SCHEDULE_EVENT'))) {
         return;
     }
     if (SystemUtility::isSchedulerEnabled() && !$_SESSION['CATS']->isDemo()) {
         $allowEventReminders = true;
     } else {
         $allowEventReminders = false;
     }
     $this->_template->assign('contactID', $contactID);
     $this->_template->assign('regardingRS', $regardingRS);
     $this->_template->assign('allowEventReminders', $allowEventReminders);
     $this->_template->assign('userEmail', $_SESSION['CATS']->getEmail());
     $this->_template->assign('onlyScheduleEvent', $onlyScheduleEvent);
     $this->_template->assign('calendarEventTypes', $calendarEventTypes);
     $this->_template->assign('isFinishedMode', false);
     $this->_template->display('./modules/contacts/AddActivityScheduleEventModal.tpl');
 }
        include_once './lib/Candidates.php';
        $dataItem = new Candidates($siteID);
        break;
    case DATA_ITEM_COMPANY:
        include_once './lib/Companies.php';
        $dataItem = new Companies($siteID);
        break;
    case DATA_ITEM_CONTACT:
        include_once './lib/Contacts.php';
        $dataItem = new Contacts($siteID);
        break;
    default:
        $interface->outputXMLErrorPage(-1, 'Invalid data item type.');
        die;
        break;
}
$jobOrdersArray = $dataItem->getJobOrdersArray($dataItemID);
if (empty($jobOrdersArray)) {
    $interface->outputXMLErrorPage(-2, 'No job orders data.');
    die;
}
$output = "<data>\n" . "    <errorcode>0</errorcode>\n" . "    <errormessage></errormessage>\n";
foreach ($jobOrdersArray as $rowIndex => $row) {
    if (!isset($jobOrdersArray[$rowIndex]['isAssigned'])) {
        $jobOrdersArray[$rowIndex]['isAssigned'] = '0';
    }
    $output .= "    <joborder>\n" . "        <id>" . $jobOrdersArray[$rowIndex]['jobOrderID'] . "</id>\n" . "        <title>" . htmlspecialchars($jobOrdersArray[$rowIndex]['title']) . "</title>\n" . "        <companyname>" . htmlspecialchars($jobOrdersArray[$rowIndex]['companyName']) . "</companyname>\n" . "        <assigned>" . htmlspecialchars($jobOrdersArray[$rowIndex]['isAssigned']) . "</assigned>\n" . "    </joborder>\n";
}
$output .= "</data>\n";
/* Send back the XML data. */
$interface->outputXMLPage($output);