* basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the * License for the specific language governing rights and limitations * under the License. * * The Original Code is "CATS Standard Edition". * * 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: getCompanyLocation.php 2359 2007-04-21 22:49:17Z 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 location data. */ $companies = new Companies($siteID); $locationArray = $companies->getLocationArray($companyID); if (empty($locationArray)) { $interface->outputXMLErrorPage(-2, 'No location data.'); die; } /* Send back the XML data. */ $interface->outputXMLPage("<data>\n" . " <errorcode>0</errorcode>\n" . " <errormessage></errormessage>\n" . " <address>" . $locationArray['address'] . "</address>\n" . " <city>" . $locationArray['city'] . "</city>\n" . " <state>" . $locationArray['state'] . "</state>\n" . " <zip>" . $locationArray['zip'] . "</zip>\n" . "</data>\n");
private function add() { $users = new Users($this->_siteID); $usersRS = $users->getSelectList(); $companies = new Companies($this->_siteID); $companiesRS = $companies->getSelectList(); $jobOrders = new JobOrders($this->_siteID); /* Do we have any companies yet? */ if (empty($companiesRS)) { $noCompanies = true; } else { $noCompanies = false; } if (!$this->isRequiredIDValid('selected_company_id', $_GET)) { $selectedCompanyID = false; } else { $selectedCompanyID = $_GET['selected_company_id']; } if ($_SESSION['CATS']->isHrMode()) { $companies = new Companies($this->_siteID); $selectedCompanyID = $companies->getDefaultCompany(); } /* Do we have a selected_company_id? */ if ($selectedCompanyID === false) { $selectedCompanyContacts = array(); $selectedCompanyLocation = array(); $selectedDepartmentsString = ''; $defaultCompanyID = $companies->getDefaultCompany(); if ($defaultCompanyID !== false) { $defaultCompanyRS = $companies->get($defaultCompanyID); } else { $defaultCompanyRS = array(); } $companyRS = array(); } else { $selectedCompanyContacts = $companies->getContactsArray($selectedCompanyID); $selectedCompanyLocation = $companies->getLocationArray($selectedCompanyID); $departmentsRS = $companies->getDepartments($selectedCompanyID); $selectedDepartmentsString = ListEditor::getStringFromList($departmentsRS, 'name'); $defaultCompanyID = false; $defaultCompanyRS = array(); $companyRS = $companies->get($selectedCompanyID); } /* Should we prepopulate the blank JO with the contents of another JO? */ if (isset($_GET['typeOfAdd']) && $this->isRequiredIDValid('jobOrderID', $_GET) && $_GET['typeOfAdd'] == 'existing') { $jobOrderID = $_GET['jobOrderID']; $jobOrderSourceRS = $jobOrders->get($jobOrderID); $jobOrderSourceExtraFields = $jobOrders->extraFields->getValuesForEdit($jobOrderID); $this->_template->assign('jobOrderSourceRS', $jobOrderSourceRS); $this->_template->assign('jobOrderSourceExtraFields', $jobOrderSourceExtraFields); } else { $this->_template->assign('jobOrderSourceRS', false); $this->_template->assign('jobOrderSourceExtraFields', false); } /* Get extra fields. */ $extraFieldRS = $jobOrders->extraFields->getValuesForAdd(); /* Get questionnaires to attach (if public) */ $questionnaire = new Questionnaire($this->_siteID); $questionnaires = $questionnaire->getAll(false); $careerPortalSettings = new CareerPortalSettings($this->_siteID); $careerPortalSettingsRS = $careerPortalSettings->getAll(); $careerPortalEnabled = intval($careerPortalSettingsRS['enabled']) ? true : false; $this->_template->assign('careerPortalEnabled', $careerPortalEnabled); $this->_template->assign('questionnaires', $questionnaires); $this->_template->assign('extraFieldRS', $extraFieldRS); $this->_template->assign('defaultCompanyID', $defaultCompanyID); $this->_template->assign('defaultCompanyRS', $defaultCompanyRS); $this->_template->assign('active', $this); $this->_template->assign('subActive', 'Add Job Order'); $this->_template->assign('usersRS', $usersRS); $this->_template->assign('userID', $this->_userID); $this->_template->assign('companiesRS', $companiesRS); $this->_template->assign('companyRS', $companyRS); $this->_template->assign('noCompanies', $noCompanies); $this->_template->assign('selectedCompanyID', $selectedCompanyID); $this->_template->assign('selectedCompanyContacts', $selectedCompanyContacts); $this->_template->assign('selectedCompanyLocation', $selectedCompanyLocation); $this->_template->assign('selectedDepartmentsString', $selectedDepartmentsString); $this->_template->assign('isHrMode', $_SESSION['CATS']->isHrMode()); $this->_template->assign('sessionCookie', $_SESSION['CATS']->getCookie()); if (!eval(Hooks::get('JO_ADD'))) { return; } $this->_template->display('./modules/joborders/Add.tpl'); }