コード例 #1
0
ファイル: ContactsUI.php プロジェクト: rankinp/OpenCATS
 private function edit()
 {
     /* 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);
     $data = $contacts->getForEditing($contactID);
     /* Bail out if we got an empty result set. */
     if (empty($data)) {
         CommonErrors::fatal(COMMONERROR_BADINDEX, $this, 'The specified contact ID could not be found.');
     }
     $companies = new Companies($this->_siteID);
     $companiesRS = $companies->getSelectList();
     $users = new Users($this->_siteID);
     $usersRS = $users->getSelectList();
     /* Add an MRU entry. */
     $_SESSION['CATS']->getMRU()->addEntry(DATA_ITEM_CONTACT, $contactID, $data['firstName'] . ' ' . $data['lastName']);
     /* Get extra fields. */
     $extraFieldRS = $contacts->extraFields->getValuesForEdit($contactID);
     /* Get departments. */
     $departmentsRS = $companies->getDepartments($data['companyID']);
     $departmentsString = ListEditor::getStringFromList($departmentsRS, 'name');
     $emailTemplates = new EmailTemplates($this->_siteID);
     $statusChangeTemplateRS = $emailTemplates->getByTag('EMAIL_TEMPLATE_OWNERSHIPASSIGNCONTACT');
     if (!isset($statusChangeTemplateRS['disabled']) || $statusChangeTemplateRS['disabled'] == 1) {
         $emailTemplateDisabled = true;
     } else {
         $emailTemplateDisabled = false;
     }
     $reportsToRS = $contacts->getAll(-1, $data['companyID']);
     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();
     }
     if (!eval(Hooks::get('CONTACTS_EDIT'))) {
         return;
     }
     $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('companiesRS', $companiesRS);
     $this->_template->assign('extraFieldRS', $extraFieldRS);
     $this->_template->assign('departmentsRS', $departmentsRS);
     $this->_template->assign('departmentsString', $departmentsString);
     $this->_template->assign('usersRS', $usersRS);
     $this->_template->assign('reportsToRS', $reportsToRS);
     $this->_template->assign('contactID', $contactID);
     $this->_template->assign('sessionCookie', $_SESSION['CATS']->getCookie());
     $this->_template->display('./modules/contacts/Edit.tpl');
 }
コード例 #2
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');
 }