本文整理汇总了PHP中erLhcoreClassModelDepartament::getCount方法的典型用法代码示例。如果您正苦于以下问题:PHP erLhcoreClassModelDepartament::getCount方法的具体用法?PHP erLhcoreClassModelDepartament::getCount怎么用?PHP erLhcoreClassModelDepartament::getCount使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类erLhcoreClassModelDepartament
的用法示例。
在下文中一共展示了erLhcoreClassModelDepartament::getCount方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: timezone_name_from_abbr
if ($form->hasValidData('operator') && erLhcoreClassModelUser::getUserCount(array('filter' => array('id' => $form->operator, 'disabled' => 0))) > 0) {
$inputData->operator = $chat->user_id = $form->operator;
}
if ($form->hasValidData('user_timezone')) {
$timezone_name = timezone_name_from_abbr(null, $form->user_timezone * 3600, true);
if ($timezone_name !== false) {
$chat->user_tz_identifier = $timezone_name;
} else {
$chat->user_tz_identifier = '';
}
}
$chat->dep_id = $inputData->departament_id;
// Assign default department
if ($form->hasValidData('DepartamentID') && erLhcoreClassModelDepartament::getCount(array('filter' => array('id' => $form->DepartamentID, 'disabled' => 0))) > 0) {
$inputData->departament_id = $chat->dep_id = $form->DepartamentID;
} elseif ($chat->dep_id == 0 || erLhcoreClassModelDepartament::getCount(array('filter' => array('id' => $chat->dep_id, 'disabled' => 0))) == 0) {
$departments = erLhcoreClassModelDepartament::getList(array('limit' => 1, 'filter' => array('disabled' => 0)));
if (!empty($departments)) {
$department = array_shift($departments);
$chat->dep_id = $department->id;
} else {
$Errors[] = erTranslationClassLhTranslation::getInstance()->getTranslation('chat/startchat', 'Could not determine a default department!');
}
}
if (count($Errors) == 0) {
$chat->time = time();
$chat->status = 0;
$chat->setIP();
$chat->hash = erLhcoreClassChat::generateHash();
$chat->referrer = isset($_POST['URLRefer']) ? $_POST['URLRefer'] : '';
$chat->session_referrer = isset($_POST['r']) ? $_POST['r'] : '';
示例2: validateStartChat
/**
* Custom form fields validation
*/
public static function validateStartChat(&$inputForm, &$start_data_fields, &$chat, $additionalParams = array())
{
$validationFields = array();
// Dynamic form field
if ($inputForm->validate_start_chat == true) {
if (isset($start_data_fields['name_visible_in_popup']) && $start_data_fields['name_visible_in_popup'] == true && !isset($additionalParams['offline']) || isset($additionalParams['offline']) && isset($start_data_fields['offline_name_visible_in_popup']) && $start_data_fields['offline_name_visible_in_popup'] == true) {
$validationFields['Username'] = new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'unsafe_raw');
}
if (isset($start_data_fields['email_visible_in_popup']) && $start_data_fields['email_visible_in_popup'] == true || isset($additionalParams['offline'])) {
$validationFields['Email'] = new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'validate_email');
}
if (isset($start_data_fields['message_visible_in_popup']) && $start_data_fields['message_visible_in_popup'] == true && !isset($additionalParams['offline']) || isset($additionalParams['offline']) && isset($start_data_fields['offline_message_visible_in_popup']) && $start_data_fields['offline_message_visible_in_popup'] == true) {
$validationFields['Question'] = new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'unsafe_raw');
}
if (isset($start_data_fields['phone_visible_in_popup']) && $start_data_fields['phone_visible_in_popup'] == true && !isset($additionalParams['offline']) || isset($additionalParams['offline']) && isset($start_data_fields['offline_phone_visible_in_popup']) && $start_data_fields['offline_phone_visible_in_popup'] == true) {
$validationFields['Phone'] = new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'unsafe_raw');
}
if (isset($start_data_fields['tos_visible_in_popup']) && $start_data_fields['tos_visible_in_popup'] == true && !isset($additionalParams['offline']) || isset($additionalParams['offline']) && isset($start_data_fields['offline_tos_visible_in_popup']) && $start_data_fields['offline_tos_visible_in_popup'] == true) {
$validationFields['AcceptTOS'] = new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'boolean');
}
} else {
if (isset($start_data_fields['name_visible_in_page_widget']) && $start_data_fields['name_visible_in_page_widget'] == true && !isset($additionalParams['offline']) || isset($additionalParams['offline']) && isset($start_data_fields['offline_name_visible_in_page_widget']) && $start_data_fields['offline_name_visible_in_page_widget'] == true) {
$validationFields['Username'] = new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'unsafe_raw');
}
if (isset($start_data_fields['email_visible_in_page_widget']) && $start_data_fields['email_visible_in_page_widget'] == true || isset($additionalParams['offline'])) {
$validationFields['Email'] = new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'validate_email');
}
if (isset($start_data_fields['message_visible_in_page_widget']) && $start_data_fields['message_visible_in_page_widget'] == true && !isset($additionalParams['offline']) || isset($additionalParams['offline']) && isset($start_data_fields['offline_message_visible_in_page_widget']) && $start_data_fields['offline_message_visible_in_page_widget'] == true) {
$validationFields['Question'] = new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'unsafe_raw');
}
if (isset($start_data_fields['phone_visible_in_page_widget']) && $start_data_fields['phone_visible_in_page_widget'] == true && !isset($additionalParams['offline']) || isset($additionalParams['offline']) && isset($start_data_fields['offline_phone_visible_in_page_widget']) && $start_data_fields['offline_phone_visible_in_page_widget'] == true) {
$validationFields['Phone'] = new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'unsafe_raw');
}
if (isset($start_data_fields['tos_visible_in_page_widget']) && $start_data_fields['tos_visible_in_page_widget'] == true && !isset($additionalParams['offline']) || isset($additionalParams['offline']) && isset($start_data_fields['offline_tos_visible_in_page_widget']) && $start_data_fields['offline_tos_visible_in_page_widget'] == true) {
$validationFields['AcceptTOS'] = new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'boolean');
}
}
$validationFields['DepartamentID'] = new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'int', array('min_range' => -1));
$validationFields['DepartmentIDDefined'] = new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'int', array('min_range' => 1), FILTER_REQUIRE_ARRAY);
$validationFields['operator'] = new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'int', array('min_range' => 1));
$validationFields['user_timezone'] = new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'int');
$validationFields['keyUpStarted'] = new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'int', array('min_range' => 1));
$validationFields['name_items'] = new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'unsafe_raw', null, FILTER_REQUIRE_ARRAY);
$validationFields['values_req'] = new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'string', null, FILTER_REQUIRE_ARRAY);
$validationFields['value_items'] = new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'unsafe_raw', null, FILTER_REQUIRE_ARRAY);
$validationFields['value_types'] = new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'unsafe_raw', null, FILTER_REQUIRE_ARRAY);
$validationFields['value_sizes'] = new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'unsafe_raw', null, FILTER_REQUIRE_ARRAY);
$validationFields['value_show'] = new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'string', null, FILTER_REQUIRE_ARRAY);
$validationFields['hattr'] = new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'string', null, FILTER_REQUIRE_ARRAY);
// Captcha stuff
if (erLhcoreClassModelChatConfig::fetch('session_captcha')->current_value == 1) {
// Start session if required only
$currentUser = erLhcoreClassUser::instance();
$hashCaptcha = isset($_SESSION[$_SERVER['REMOTE_ADDR']]['form']) ? $_SESSION[$_SERVER['REMOTE_ADDR']]['form'] : null;
$nameField = 'captcha_' . $hashCaptcha;
$validationFields[$nameField] = new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'string');
} else {
$nameField = 'captcha_' . sha1(erLhcoreClassIPDetect::getIP() . $_POST['tscaptcha'] . erConfigClassLhConfig::getInstance()->getSetting('site', 'secrethash'));
$validationFields[$nameField] = new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'string');
}
// Custom start chat fields
$validationFields['value_items_admin'] = new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'unsafe_raw', null, FILTER_REQUIRE_ARRAY);
$validationFields['via_hidden'] = new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'unsafe_raw', null, FILTER_REQUIRE_ARRAY);
$form = new ezcInputForm(INPUT_POST, $validationFields);
$Errors = array();
if (erLhcoreClassModelChatBlockedUser::getCount(array('filter' => array('ip' => erLhcoreClassIPDetect::getIP()))) > 0) {
$Errors[] = erTranslationClassLhTranslation::getInstance()->getTranslation('chat/startchat', 'You do not have permission to chat! Please contact site owner.');
}
/**
* IP Ranges block
* */
$ignorable_ip = erLhcoreClassModelChatConfig::fetch('banned_ip_range')->current_value;
if ($ignorable_ip != '' && erLhcoreClassIPDetect::isIgnored(erLhcoreClassIPDetect::getIP(), explode(',', $ignorable_ip))) {
$Errors[] = erTranslationClassLhTranslation::getInstance()->getTranslation('chat/startchat', 'You do not have permission to chat! Please contact site owner.');
}
if (erLhcoreClassModelChatConfig::fetch('session_captcha')->current_value == 1) {
if (!$form->hasValidData($nameField) || $form->{$nameField} == '' || $form->{$nameField} < time() - 600 || $hashCaptcha != sha1($_SERVER['REMOTE_ADDR'] . $form->{$nameField} . erConfigClassLhConfig::getInstance()->getSetting('site', 'secrethash'))) {
$Errors['captcha'] = erTranslationClassLhTranslation::getInstance()->getTranslation("chat/startchat", "Your request was not processed as expected - but don't worry it was not your fault. Please re-submit your request. If you experience the same issue you will need to contact us via other means.");
}
} else {
// Captcha validation
if (!$form->hasValidData($nameField) || $form->{$nameField} == '' || $form->{$nameField} < time() - 600) {
$Errors['captcha'] = erTranslationClassLhTranslation::getInstance()->getTranslation("chat/startchat", "Your request was not processed as expected - but don't worry it was not your fault. Please re-submit your request. If you experience the same issue you will need to contact us via other means.");
}
}
if (isset($validationFields['Username'])) {
if (!$form->hasValidData('Username') || $form->Username == '' && ($start_data_fields['name_require_option'] == 'required' && !isset($additionalParams['offline']) || isset($additionalParams['offline']) && isset($start_data_fields['offline_name_require_option']) && $start_data_fields['offline_name_require_option'] == 'required')) {
$Errors['nick'] = erTranslationClassLhTranslation::getInstance()->getTranslation('chat/startchat', 'Please enter your name');
} elseif ($form->hasValidData('Username')) {
$chat->nick = $inputForm->username = $form->Username;
}
if ($form->hasValidData('Username') && $form->Username != '' && strlen($form->Username) > 50) {
$Errors['nick'] = erTranslationClassLhTranslation::getInstance()->getTranslation('chat/startchat', 'Maximum 50 characters');
}
}
if (isset($validationFields['Email'])) {
if (!$form->hasValidData('Email') && $start_data_fields['email_require_option'] == 'required' || !$form->hasValidData('Email') && isset($additionalParams['offline'])) {
//.........这里部分代码省略.........
示例3: validateStartChat
/**
* Custom form fields validation
*/
public static function validateStartChat(&$inputForm, &$start_data_fields, &$chat, $additionalParams = array())
{
$validationFields = array();
// Dynamic form field
if ($inputForm->validate_start_chat == true) {
if (isset($start_data_fields['name_visible_in_popup']) && $start_data_fields['name_visible_in_popup'] == true && !isset($additionalParams['offline']) || isset($additionalParams['offline']) && isset($start_data_fields['offline_name_visible_in_popup']) && $start_data_fields['offline_name_visible_in_popup'] == true) {
$validationFields['Username'] = new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'unsafe_raw');
}
if (isset($start_data_fields['email_visible_in_popup']) && $start_data_fields['email_visible_in_popup'] == true || isset($additionalParams['offline'])) {
$validationFields['Email'] = new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'validate_email');
}
if (isset($start_data_fields['message_visible_in_popup']) && $start_data_fields['message_visible_in_popup'] == true && !isset($additionalParams['offline']) || isset($additionalParams['offline']) && isset($start_data_fields['offline_message_visible_in_popup']) && $start_data_fields['offline_message_visible_in_popup'] == true) {
$validationFields['Question'] = new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'unsafe_raw');
}
if (isset($start_data_fields['phone_visible_in_popup']) && $start_data_fields['phone_visible_in_popup'] == true && !isset($additionalParams['offline']) || isset($additionalParams['offline']) && isset($start_data_fields['offline_phone_visible_in_popup']) && $start_data_fields['offline_phone_visible_in_popup'] == true) {
$validationFields['Phone'] = new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'unsafe_raw');
}
if (isset($start_data_fields['tos_visible_in_popup']) && $start_data_fields['tos_visible_in_popup'] == true && !isset($additionalParams['offline']) || isset($additionalParams['offline']) && isset($start_data_fields['offline_tos_visible_in_popup']) && $start_data_fields['offline_tos_visible_in_popup'] == true) {
$validationFields['AcceptTOS'] = new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'boolean');
}
} else {
if (isset($start_data_fields['name_visible_in_page_widget']) && $start_data_fields['name_visible_in_page_widget'] == true && !isset($additionalParams['offline']) || isset($additionalParams['offline']) && isset($start_data_fields['offline_name_visible_in_page_widget']) && $start_data_fields['offline_name_visible_in_page_widget'] == true) {
$validationFields['Username'] = new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'unsafe_raw');
}
if (isset($start_data_fields['email_visible_in_page_widget']) && $start_data_fields['email_visible_in_page_widget'] == true || isset($additionalParams['offline'])) {
$validationFields['Email'] = new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'validate_email');
}
if (isset($start_data_fields['message_visible_in_page_widget']) && $start_data_fields['message_visible_in_page_widget'] == true && !isset($additionalParams['offline']) || isset($additionalParams['offline']) && isset($start_data_fields['offline_message_visible_in_page_widget']) && $start_data_fields['offline_message_visible_in_page_widget'] == true) {
$validationFields['Question'] = new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'unsafe_raw');
}
if (isset($start_data_fields['phone_visible_in_page_widget']) && $start_data_fields['phone_visible_in_page_widget'] == true && !isset($additionalParams['offline']) || isset($additionalParams['offline']) && isset($start_data_fields['offline_phone_visible_in_page_widget']) && $start_data_fields['offline_phone_visible_in_page_widget'] == true) {
$validationFields['Phone'] = new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'unsafe_raw');
}
if (isset($start_data_fields['tos_visible_in_page_widget']) && $start_data_fields['tos_visible_in_page_widget'] == true && !isset($additionalParams['offline']) || isset($additionalParams['offline']) && isset($start_data_fields['offline_tos_visible_in_page_widget']) && $start_data_fields['offline_tos_visible_in_page_widget'] == true) {
$validationFields['AcceptTOS'] = new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'boolean');
}
}
$validationFields['DepartamentID'] = new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'int', array('min_range' => 1));
$validationFields['DepartmentIDDefined'] = new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'int', array('min_range' => 1), FILTER_REQUIRE_ARRAY);
$validationFields['operator'] = new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'int', array('min_range' => 1));
$validationFields['user_timezone'] = new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'int');
$validationFields['name_items'] = new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'unsafe_raw', null, FILTER_REQUIRE_ARRAY);
$validationFields['values_req'] = new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'string', null, FILTER_REQUIRE_ARRAY);
$validationFields['value_items'] = new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'unsafe_raw', null, FILTER_REQUIRE_ARRAY);
$validationFields['value_types'] = new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'unsafe_raw', null, FILTER_REQUIRE_ARRAY);
$validationFields['value_sizes'] = new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'unsafe_raw', null, FILTER_REQUIRE_ARRAY);
$validationFields['value_show'] = new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'string', null, FILTER_REQUIRE_ARRAY);
$validationFields['hattr'] = new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'string', null, FILTER_REQUIRE_ARRAY);
// Captcha stuff
if (erLhcoreClassModelChatConfig::fetch('session_captcha')->current_value == 1) {
// Start session if required only
$currentUser = erLhcoreClassUser::instance();
$hashCaptcha = isset($_SESSION[$_SERVER['REMOTE_ADDR']]['form']) ? $_SESSION[$_SERVER['REMOTE_ADDR']]['form'] : null;
$nameField = 'captcha_' . $hashCaptcha;
$validationFields[$nameField] = new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'string');
} else {
$nameField = 'captcha_' . sha1(erLhcoreClassIPDetect::getIP() . $_POST['tscaptcha'] . erConfigClassLhConfig::getInstance()->getSetting('site', 'secrethash'));
$validationFields[$nameField] = new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'string');
}
$form = new ezcInputForm(INPUT_POST, $validationFields);
$Errors = array();
if (erLhcoreClassModelChatBlockedUser::getCount(array('filter' => array('ip' => erLhcoreClassIPDetect::getIP()))) > 0) {
$Errors[] = erTranslationClassLhTranslation::getInstance()->getTranslation('chat/startchat', 'You do not have permission to chat! Please contact site owner.');
}
if (erLhcoreClassModelChatConfig::fetch('session_captcha')->current_value == 1) {
if (!$form->hasValidData($nameField) || $form->{$nameField} == '' || $form->{$nameField} < time() - 600 || $hashCaptcha != sha1($_SERVER['REMOTE_ADDR'] . $form->{$nameField} . erConfigClassLhConfig::getInstance()->getSetting('site', 'secrethash'))) {
$Errors[] = erTranslationClassLhTranslation::getInstance()->getTranslation('chat/startchat', 'Invalid captcha code, please enable Javascript!');
}
} else {
// Captcha validation
if (!$form->hasValidData($nameField) || $form->{$nameField} == '' || $form->{$nameField} < time() - 600) {
$Errors[] = erTranslationClassLhTranslation::getInstance()->getTranslation('chat/startchat', 'Invalid captcha code, please enable Javascript!');
}
}
if (isset($validationFields['Username'])) {
if (!$form->hasValidData('Username') || $form->Username == '' && ($start_data_fields['name_require_option'] == 'required' && !isset($additionalParams['offline']) || isset($additionalParams['offline']) && isset($start_data_fields['offline_name_require_option']) && $start_data_fields['offline_name_require_option'] == 'required')) {
$Errors[] = erTranslationClassLhTranslation::getInstance()->getTranslation('chat/startchat', 'Please enter your name');
} elseif ($form->hasValidData('Username')) {
$chat->nick = $inputForm->username = $form->Username;
}
if ($form->hasValidData('Username') && $form->Username != '' && strlen($form->Username) > 50) {
$Errors[] = erTranslationClassLhTranslation::getInstance()->getTranslation('chat/startchat', 'Maximum 50 characters');
}
}
if (isset($validationFields['Email'])) {
if (!$form->hasValidData('Email') && $start_data_fields['email_require_option'] == 'required' || !$form->hasValidData('Email') && isset($additionalParams['offline'])) {
$Errors[] = erTranslationClassLhTranslation::getInstance()->getTranslation('chat/startchat', 'Please enter a valid email address');
} elseif ($form->hasValidData('Email')) {
$chat->email = $inputForm->email = $form->Email;
} else {
$chat->email = $inputForm->email = $_POST['Email'];
}
}
// Validate question
if (isset($validationFields['Question'])) {
if (!$form->hasValidData('Question') || trim($form->Question) == '' && ($start_data_fields['message_require_option'] == 'required' && !isset($additionalParams['offline']) || isset($additionalParams['offline']) && isset($start_data_fields['offline_message_require_option']) && $start_data_fields['offline_message_require_option'] == 'required')) {
$Errors[] = erTranslationClassLhTranslation::getInstance()->getTranslation('chat/startchat', 'Please enter your message');
//.........这里部分代码省略.........
示例4: array
<?php
$tpl = erLhcoreClassTemplate::getInstance('lhdepartament/departaments.tpl.php');
/**
* Append user departments filter
* */
$departmentParams = array();
if ($currentUser->hasAccessTo('lhdepartment', 'manageall') !== true) {
$userDepartments = erLhcoreClassUserDep::parseUserDepartmetnsForFilter($currentUser->getUserID());
if ($userDepartments !== true) {
$departmentParams['filterin']['id'] = $userDepartments;
}
}
$pages = new lhPaginator();
$pages->serverURL = erLhcoreClassDesign::baseurl('departament/departaments');
$pages->items_total = erLhcoreClassModelDepartament::getCount($departmentParams);
$pages->setItemsPerPage(20);
$pages->paginate();
$items = array();
if ($pages->items_total > 0) {
$items = erLhcoreClassModelDepartament::getList(array_merge($departmentParams, array('offset' => $pages->low, 'limit' => $pages->items_per_page, 'sort' => 'id ASC')));
}
$tpl->set('items', $items);
$tpl->set('pages', $pages);
$Result['content'] = $tpl->fetch();
$Result['path'] = array(array('url' => erLhcoreClassDesign::baseurl('system/configuration'), 'title' => erTranslationClassLhTranslation::getInstance()->getTranslation('department/departments', 'System configuration')), array('url' => erLhcoreClassDesign::baseurl('department/departments'), 'title' => erTranslationClassLhTranslation::getInstance()->getTranslation('department/departments', 'Departments')));
示例5: validateDepartaments
public static function validateDepartaments()
{
$departaments = erLhcoreClassModelDepartament::getList();
$departamentsCount = erLhcoreClassModelDepartament::getCount();
// Chats list
return array('list' => array_values($departaments), 'list_count' => $departamentsCount, 'error' => false);
}