* * The Initial Developer of the Original Code is Cognizo Technologies, Inc. * Portions created by the Initial Developer are Copyright (C) 2005 - 2007 * (or from the year in which this file was created to the year 2007) by * Cognizo Technologies, Inc. All Rights Reserved. * * * $Id: getCompanyContacts.php 1892 2007-02-20 06:44:04Z will $ */ include_once './lib/Companies.php'; $interface = new SecureAJAXInterface(); if (!$interface->isRequiredIDValid('companyID', false)) { $interface->outputXMLErrorPage(-1, 'Invalid company ID.'); die; } $siteID = $interface->getSiteID(); $companyID = $_REQUEST['companyID']; /* Get an array of the company's contacts data. */ $companies = new Companies($siteID); $contactsArray = $companies->getContactsArray($companyID); if (empty($contactsArray)) { $interface->outputXMLErrorPage(-2, 'No contacts data.'); die; } $output = "<data>\n" . " <errorcode>0</errorcode>\n" . " <errormessage></errormessage>\n"; foreach ($contactsArray as $rowIndex => $row) { $output .= " <contact>\n" . " <id>" . $contactsArray[$rowIndex]['contactID'] . "</id>\n" . " <firstname>" . $contactsArray[$rowIndex]['firstName'] . "</firstname>\n" . " <lastname>" . $contactsArray[$rowIndex]['lastName'] . "</lastname>\n" . " </contact>\n"; } $output .= "</data>\n"; /* Send back the XML data. */ $interface->outputXMLPage($output);
private function edit() { /* 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->getForEditing($companyID); /* Bail out if we got an empty result set. */ if (empty($data)) { $this->listByView('The specified company ID could not be found.'); return; } /* Get the company's contacts data. */ $contactsRS = $companies->getContactsArray($companyID); $users = new Users($this->_siteID); $usersRS = $users->getSelectList(); /* Add an MRU entry. */ $_SESSION['CATS']->getMRU()->addEntry(DATA_ITEM_COMPANY, $companyID, $data['name']); /* Get extra fields. */ $extraFieldRS = $companies->extraFields->getValuesForEdit($companyID); /* Get departments. */ $departmentsRS = $companies->getDepartments($companyID); $departmentsString = ListEditor::getStringFromList($departmentsRS, 'name'); $emailTemplates = new EmailTemplates($this->_siteID); $statusChangeTemplateRS = $emailTemplates->getByTag('EMAIL_TEMPLATE_OWNERSHIPASSIGNCLIENT'); if (!isset($statusChangeTemplateRS['disabled']) || $statusChangeTemplateRS['disabled'] == 1) { $emailTemplateDisabled = true; } else { $emailTemplateDisabled = false; } if ($this->_accessLevel == ACCESS_LEVEL_DEMO) { $canEmail = false; } else { $canEmail = true; } if (!eval(Hooks::get('CLIENTS_EDIT'))) { return; } $this->_template->assign('canEmail', $canEmail); $this->_template->assign('active', $this); $this->_template->assign('data', $data); $this->_template->assign('usersRS', $usersRS); $this->_template->assign('extraFieldRS', $extraFieldRS); $this->_template->assign('contactsRS', $contactsRS); $this->_template->assign('departmentsRS', $departmentsRS); $this->_template->assign('departmentsString', $departmentsString); $this->_template->assign('emailTemplateDisabled', $emailTemplateDisabled); $this->_template->assign('companyID', $companyID); $this->_template->display('./modules/companies/Edit.tpl'); }
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'); }