当前位置: 首页>>代码示例>>PHP>>正文


PHP Companies::getDepartments方法代码示例

本文整理汇总了PHP中Companies::getDepartments方法的典型用法代码示例。如果您正苦于以下问题:PHP Companies::getDepartments方法的具体用法?PHP Companies::getDepartments怎么用?PHP Companies::getDepartments使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Companies的用法示例。


在下文中一共展示了Companies::getDepartments方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: onEdit

 private function onEdit()
 {
     if ($this->_accessLevel < ACCESS_LEVEL_EDIT) {
         $this->listByView('Invalid user level for action.');
         return;
     }
     $companies = new Companies($this->_siteID);
     /* Bail out if we don't have a valid company ID. */
     if (!$this->isRequiredIDValid('companyID', $_POST)) {
         $this->listByView('Invalid company ID.');
         return;
     }
     /* Bail out if we don't have a valid owner user ID. */
     if (!$this->isOptionalIDValid('owner', $_POST)) {
         $this->listByView('Invalid owner user ID.');
         return;
     }
     /* Bail out if we don't have a valid billing contact ID. */
     if (!$this->isOptionalIDValid('billingContact', $_POST)) {
         $this->listByView('Invalid billing contact ID.');
         return;
     }
     $formattedPhone1 = StringUtility::extractPhoneNumber($this->getTrimmedInput('phone1', $_POST));
     if (!empty($formattedPhone1)) {
         $phone1 = $formattedPhone1;
     } else {
         $phone1 = $this->getTrimmedInput('phone1', $_POST);
     }
     $formattedPhone2 = StringUtility::extractPhoneNumber($this->getTrimmedInput('phone2', $_POST));
     if (!empty($formattedPhone2)) {
         $phone2 = $formattedPhone2;
     } else {
         $phone2 = $this->getTrimmedInput('phone2', $_POST);
     }
     $formattedFaxNumber = StringUtility::extractPhoneNumber($this->getTrimmedInput('faxNumber', $_POST));
     if (!empty($formattedFaxNumber)) {
         $faxNumber = $formattedFaxNumber;
     } else {
         $faxNumber = $this->getTrimmedInput('faxNumber', $_POST);
     }
     $url = $this->getTrimmedInput('url', $_POST);
     if (!empty($url)) {
         $formattedURL = StringUtility::extractURL($url);
         if (!empty($formattedURL)) {
             $url = $formattedURL;
         }
     }
     /* Hot company? */
     $isHot = $this->isChecked('isHot', $_POST);
     $companyID = $_POST['companyID'];
     $owner = $_POST['owner'];
     $billingContact = $_POST['billingContact'];
     /* Change ownership email? */
     if ($this->isChecked('ownershipChange', $_POST) && $owner > 0) {
         $companyDetails = $companies->get($companyID);
         $users = new Users($this->_siteID);
         $ownerDetails = $users->get($_POST['owner']);
         if (!empty($ownerDetails)) {
             $emailAddress = $ownerDetails['email'];
             /* Get the change status email template. */
             $emailTemplates = new EmailTemplates($this->_siteID);
             $statusChangeTemplateRS = $emailTemplates->getByTag('EMAIL_TEMPLATE_OWNERSHIPASSIGNCLIENT');
             if (empty($statusChangeTemplateRS) || empty($statusChangeTemplateRS['textReplaced'])) {
                 $statusChangeTemplate = '';
             } else {
                 $statusChangeTemplate = $statusChangeTemplateRS['textReplaced'];
             }
             /* Replace e-mail template variables. */
             $stringsToFind = array('%CLNTOWNER%', '%CLNTNAME%', '%CLNTCATSURL%');
             $replacementStrings = array($ownerDetails['fullName'], $companyDetails['name'], '<a href="http://' . $_SERVER['HTTP_HOST'] . substr($_SERVER['REQUEST_URI'], 0, strpos($_SERVER['REQUEST_URI'], '?')) . '?m=companies&amp;a=show&amp;companyID=' . $companyID . '">' . 'http://' . $_SERVER['HTTP_HOST'] . substr($_SERVER['REQUEST_URI'], 0, strpos($_SERVER['REQUEST_URI'], '?')) . '?m=companies&amp;a=show&amp;companyID=' . $companyID . '</a>');
             $statusChangeTemplate = str_replace($stringsToFind, $replacementStrings, $statusChangeTemplate);
             $email = $statusChangeTemplate;
         } else {
             $email = '';
             $emailAddress = '';
         }
     } else {
         $email = '';
         $emailAddress = '';
     }
     $name = $this->getTrimmedInput('name', $_POST);
     $address = $this->getTrimmedInput('address', $_POST);
     $city = $this->getTrimmedInput('city', $_POST);
     $state = $this->getTrimmedInput('state', $_POST);
     $zip = $this->getTrimmedInput('zip', $_POST);
     $keyTechnologies = $this->getTrimmedInput('keyTechnologies', $_POST);
     $notes = $this->getTrimmedInput('notes', $_POST);
     /* Departments list editor. */
     $departmentsCSV = $this->getTrimmedInput('departmentsCSV', $_POST);
     /* Bail out if any of the required fields are empty. */
     if (empty($name)) {
         $this->listByView('Required fields are missing.');
         return;
     }
     if (!eval(Hooks::get('CLIENTS_ON_EDIT_PRE'))) {
         return;
     }
     $departments = $companies->getDepartments($companyID);
     $departmentsDifferences = ListEditor::getDifferencesFromList($departments, 'name', 'departmentID', $departmentsCSV);
     $companies->updateDepartments($companyID, $departmentsDifferences);
//.........这里部分代码省略.........
开发者ID:rankinp,项目名称:OpenCATS,代码行数:101,代码来源:CompaniesUI.php

示例2: SecureAJAXInterface

 *
 * 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: getCompanyLocationAndDepartments.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;
}
/* Get departments. */
$departmentsRS = $companies->getDepartments($companyID);
$departmentsString = htmlspecialchars(ListEditor::getStringFromList($departmentsRS, 'name'));
/* 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" . "    <departments>" . $departmentsString . "</departments>\n" . "</data>\n");
开发者ID:PublicityPort,项目名称:OpenCATS,代码行数:31,代码来源:getCompanyLocationAndDepartments.php

示例3: onEdit

 private function onEdit()
 {
     if ($this->_accessLevel < ACCESS_LEVEL_EDIT) {
         CommonErrors::fatal(COMMONERROR_PERMISSION, $this, 'Invalid user level for action.');
     }
     /* Bail out if we don't have a valid contact ID. */
     if (!$this->isRequiredIDValid('contactID', $_POST)) {
         CommonErrors::fatal(COMMONERROR_BADINDEX, $this, 'Invalid contact ID.');
     }
     /* Bail out if we don't have a valid company ID. */
     if (!$this->isRequiredIDValid('companyID', $_POST)) {
         CommonErrors::fatal(COMMONERROR_BADINDEX, $this, 'Invalid company ID.');
     }
     /* Bail out if we don't have a valid owner user ID. */
     if (!$this->isOptionalIDValid('owner', $_POST)) {
         CommonErrors::fatal(COMMONERROR_BADINDEX, $this, 'Invalid owner user ID.');
     }
     $contactID = $_POST['contactID'];
     $companyID = $_POST['companyID'];
     $owner = $_POST['owner'];
     $formattedPhoneWork = StringUtility::extractPhoneNumber($this->getTrimmedInput('phoneWork', $_POST));
     if (!empty($formattedPhoneWork)) {
         $phoneWork = $formattedPhoneWork;
     } else {
         $phoneWork = $this->getTrimmedInput('phoneWork', $_POST);
     }
     $formattedPhoneCell = StringUtility::extractPhoneNumber($this->getTrimmedInput('phoneCell', $_POST));
     if (!empty($formattedPhoneCell)) {
         $phoneCell = $formattedPhoneCell;
     } else {
         $phoneCell = $this->getTrimmedInput('phoneCell', $_POST);
     }
     $formattedPhoneOther = StringUtility::extractPhoneNumber($this->getTrimmedInput('phoneOther', $_POST));
     if (!empty($formattedPhoneOther)) {
         $phoneOther = $formattedPhoneOther;
     } else {
         $phoneOther = $this->getTrimmedInput('phoneOther', $_POST);
     }
     $contacts = new Contacts($this->_siteID);
     if ($this->isChecked('ownershipChange', $_POST) && $owner > 0) {
         $contactDetails = $contacts->get($contactID);
         $users = new Users($this->_siteID);
         $ownerDetails = $users->get($owner);
         if (!empty($ownerDetails)) {
             $emailAddress = $ownerDetails['email'];
             /* Get the change status email template. */
             $emailTemplates = new EmailTemplates($this->_siteID);
             $statusChangeTemplateRS = $emailTemplates->getByTag('EMAIL_TEMPLATE_OWNERSHIPASSIGNCONTACT');
             if (empty($statusChangeTemplateRS) || empty($statusChangeTemplateRS['textReplaced'])) {
                 $statusChangeTemplate = '';
             } else {
                 $statusChangeTemplate = $statusChangeTemplateRS['textReplaced'];
             }
             /* Replace e-mail template variables. */
             $stringsToFind = array('%CONTOWNER%', '%CONTFIRSTNAME%', '%CONTFULLNAME%', '%CONTCLIENTNAME%', '%CONTCATSURL%');
             $replacementStrings = array($ownerDetails['fullName'], $contactDetails['firstName'], $contactDetails['firstName'] . ' ' . $contactDetails['lastName'], $contactDetails['companyName'], '<a href="http://' . $_SERVER['HTTP_HOST'] . substr($_SERVER['REQUEST_URI'], 0, strpos($_SERVER['REQUEST_URI'], '?')) . '?m=contacts&amp;a=show&amp;contactID=' . $contactID . '">' . 'http://' . $_SERVER['HTTP_HOST'] . substr($_SERVER['REQUEST_URI'], 0, strpos($_SERVER['REQUEST_URI'], '?')) . '?m=contacts&amp;a=show&amp;contactID=' . $contactID . '</a>');
             $statusChangeTemplate = str_replace($stringsToFind, $replacementStrings, $statusChangeTemplate);
             $email = $statusChangeTemplate;
         } else {
             $email = '';
             $emailAddress = '';
         }
     } else {
         $email = '';
         $emailAddress = '';
     }
     $firstName = $this->getTrimmedInput('firstName', $_POST);
     $lastName = $this->getTrimmedInput('lastName', $_POST);
     $title = $this->getTrimmedInput('title', $_POST);
     $department = $this->getTrimmedInput('department', $_POST);
     $reportsTo = $this->getTrimmedInput('reportsTo', $_POST);
     $email1 = $this->getTrimmedInput('email1', $_POST);
     $email2 = $this->getTrimmedInput('email2', $_POST);
     $address = $this->getTrimmedInput('address', $_POST);
     $city = $this->getTrimmedInput('city', $_POST);
     $state = $this->getTrimmedInput('state', $_POST);
     $zip = $this->getTrimmedInput('zip', $_POST);
     $notes = $this->getTrimmedInput('notes', $_POST);
     $isHot = $this->isChecked('isHot', $_POST);
     $leftCompany = $this->isChecked('leftCompany', $_POST);
     /* Departments list editor. */
     $departmentsCSV = $this->getTrimmedInput('departmentsCSV', $_POST);
     /* Bail out if any of the required fields are empty. */
     if (empty($firstName) || empty($lastName) || empty($title)) {
         CommonErrors::fatal(COMMONERROR_MISSINGFIELDS, $this, 'Required fields are missing.');
     }
     if (!eval(Hooks::get('CONTACTS_ON_EDIT_PRE'))) {
         return;
     }
     /* Update departments. */
     $companies = new Companies($this->_siteID);
     $departments = $companies->getDepartments($companyID);
     $departmentsDifferences = ListEditor::getDifferencesFromList($departments, 'name', 'departmentID', $departmentsCSV);
     $companies->updateDepartments($companyID, $departmentsDifferences);
     if (!$contacts->update($contactID, $companyID, $firstName, $lastName, $title, $department, $reportsTo, $email1, $email2, $phoneWork, $phoneCell, $phoneOther, $address, $city, $state, $zip, $isHot, $leftCompany, $notes, $owner, $email, $emailAddress)) {
         CommonErrors::fatal(COMMONERROR_RECORDERROR, $this, 'Failed to update contact.');
     }
     /* Update extra fields. */
     $contacts->extraFields->setValuesOnEdit($contactID);
     if (!eval(Hooks::get('CONTACTS_ON_EDIT_POST'))) {
//.........这里部分代码省略.........
开发者ID:rankinp,项目名称:OpenCATS,代码行数:101,代码来源:ContactsUI.php

示例4: edit

 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');
 }
开发者ID:PublicityPort,项目名称:OpenCATS,代码行数:96,代码来源:JobOrdersUI.php


注:本文中的Companies::getDepartments方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。