本文整理汇总了PHP中erLhcoreClassModelDepartament::getList方法的典型用法代码示例。如果您正苦于以下问题:PHP erLhcoreClassModelDepartament::getList方法的具体用法?PHP erLhcoreClassModelDepartament::getList怎么用?PHP erLhcoreClassModelDepartament::getList使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类erLhcoreClassModelDepartament
的用法示例。
在下文中一共展示了erLhcoreClassModelDepartament::getList方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: is_numeric
$unreadTabEnabled = erLhcoreClassModelUserSetting::getSetting('enable_unread_list', 1);
$showAllPending = erLhcoreClassModelUserSetting::getSetting('show_all_pending', 1);
$showDepartmentsStats = $currentUser->hasAccessTo('lhuser', 'canseedepartmentstats');
if ($showDepartmentsStats == true) {
/**
* Departments stats
* */
$limitList = is_numeric($Params['user_parameters_unordered']['limitd']) ? (int) $Params['user_parameters_unordered']['limitd'] : 10;
$filter = array('ignore_fields' => erLhcoreClassChat::$chatListIgnoreField);
$filter['limit'] = $limitList;
if (is_array($Params['user_parameters_unordered']['departmentd']) && !empty($Params['user_parameters_unordered']['departmentd'])) {
erLhcoreClassChat::validateFilterIn($Params['user_parameters_unordered']['departmentd']);
$filter['filterin']['id'] = $Params['user_parameters_unordered']['departmentd'];
}
$filter['sort'] = 'pending_chats_counter DESC';
$departments = erLhcoreClassModelDepartament::getList($filter);
erLhcoreClassChat::prefillGetAttributes($departments, array('id', 'name', 'pending_chats_counter', 'active_chats_counter'), array(), array('remove_all' => true));
$ReturnMessages['departments_stats'] = array('list' => array_values($departments));
}
if ($activeTabEnabled == true) {
/**
* Active chats
* */
$limitList = is_numeric($Params['user_parameters_unordered']['limita']) ? (int) $Params['user_parameters_unordered']['limita'] : 10;
$filter = array('ignore_fields' => erLhcoreClassChat::$chatListIgnoreField);
if (is_array($Params['user_parameters_unordered']['actived']) && !empty($Params['user_parameters_unordered']['actived'])) {
erLhcoreClassChat::validateFilterIn($Params['user_parameters_unordered']['actived']);
$filter['filterin']['dep_id'] = $Params['user_parameters_unordered']['actived'];
}
$chats = erLhcoreClassChat::getActiveChats($limitList, 0, $filter);
erLhcoreClassChat::prefillGetAttributes($chats, array('time_created_front', 'department_name', 'plain_user_name'), array('department', 'time', 'status', 'user_id', 'user'));
示例2: validateStartChat
//.........这里部分代码省略.........
// Set attribute for futher
$inputForm->file_extension = strtolower(current($fileNameAray));
$inputForm->file_location = $_FILES['File']['tmp_name'];
} elseif (isset($_FILES['File'])) {
$Errors[] = erLhcoreClassSearchHandler::$lastError != '' ? erLhcoreClassSearchHandler::$lastError : erTranslationClassLhTranslation::getInstance()->getTranslation('chat/startchat', 'Invalid file');
}
}
}
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 = '';
}
}
if ($form->hasValidData('DepartmentIDDefined')) {
$inputForm->departament_id_array = $form->DepartmentIDDefined;
}
if ($form->hasValidData('DepartamentID') && erLhcoreClassModelDepartament::getCount(array('filter' => array('id' => $form->DepartamentID, 'disabled' => 0))) > 0) {
$chat->dep_id = $form->DepartamentID;
} elseif ($form->hasValidData('DepartamentID') && $form->DepartamentID == -1) {
$chat->dep_id == 0;
if (isset($additionalParams['theme']) && $additionalParams['theme'] !== false && $additionalParams['theme']->department_title != '') {
$Errors['department'] = erTranslationClassLhTranslation::getInstance()->getTranslation('chat/startchat', 'Please choose') . ' ' . htmlspecialchars($additionalParams['theme']->department_title) . '!';
} else {
$Errors['department'] = erTranslationClassLhTranslation::getInstance()->getTranslation('chat/startchat', 'Please choose department!');
}
} elseif ($chat->dep_id == 0 || erLhcoreClassModelDepartament::getCount(array('filter' => array('id' => $chat->dep_id, 'disabled' => 0))) == 0) {
// Perhaps extension overrides default department?
$response = erLhcoreClassChatEventDispatcher::getInstance()->dispatch('chat.validate_department', array('input_form' => $inputForm));
// There was no callbacks or file not found etc, we try to download from standard location
if ($response === false) {
$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!');
}
} else {
$chat->dep_id = $response['department_id'];
}
}
// Set chat attributes for transfer workflow logic
if ($chat->department !== false && $chat->department->department_transfer_id > 0) {
$chat->transfer_if_na = 1;
$chat->transfer_timeout_ts = time();
$chat->transfer_timeout_ac = $chat->department->transfer_timeout;
}
if ($chat->department !== false && $chat->department->inform_unread == 1) {
$chat->reinform_timeout = $chat->department->inform_unread_delay;
}
$inputForm->departament_id = $chat->dep_id;
if ($inputForm->priority !== false && is_numeric($inputForm->priority)) {
$chat->priority = (int) $inputForm->priority;
} else {
if ($chat->department !== false) {
$chat->priority = $chat->department->priority;
}
}
$stringParts = array();
if ($form->hasValidData('name_items') && !empty($form->name_items)) {
$valuesArray = array();
if ($form->hasValidData('value_items') && !empty($form->value_items)) {
$inputForm->value_items = $valuesArray = $form->value_items;
示例3: timezone_name_from_abbr
$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'] : '';
if ($chat->nick == '') {
示例4: array
<?php
$departmentNames = array();
$departmentList = array();
$departments = erLhcoreClassModelDepartament::getList($departmentParams);
foreach ($departments as $department) {
$departmentNames[$department->id] = $department->name;
$departmentList[] = array('id' => $department->id, 'name' => $department->name);
}
$dashboardOrder = (string) erLhcoreClassModelUserSetting::getSetting('dwo', '');
if ($dashboardOrder == '') {
$dashboardOrder = erLhcoreClassModelChatConfig::fetch('dashboard_order')->current_value;
}
$dashboardOrder = explode('|', $dashboardOrder);
$columnsTotal = count($dashboardOrder);
$columnSize = 12 / $columnsTotal;
?>
<div class="row" id="dashboard-body" ng-init='lhc.userDepartments=<?php
echo json_encode($departmentList, JSON_HEX_APOS);
?>
;lhc.userDepartmentsNames=<?php
echo json_encode($departmentNames, JSON_HEX_APOS);
?>
;lhc.setUpListNames(["actived","closedd","unreadd","pendingd","operatord","departmentd"])'>
<a class="dashboard-configuration" onclick="return lhc.revealModal({'url':WWW_DIR_JAVASCRIPT +'chat/dashboardwidgets'})" title="<?php
echo erTranslationClassLhTranslation::getInstance()->getTranslation('chat/syncadmininterface', 'Configure dashboard');
?>
"><i class="material-icons mr-0"></i></a>
<?php
for ($i = 0; $i < $columnsTotal; $i++) {
$widgets = array_filter(explode(',', $dashboardOrder[$i]));
示例5: catch
}
} catch (Exception $e) {
}
// Redirect user
erLhcoreClassModule::redirect('chat/chatwidgetchat', '/' . $chatID . '/' . $hash . $modeAppend . $modeAppendTheme . $sound);
exit;
}
$tpl = erLhcoreClassTemplate::getInstance('lhchat/chatwidget.tpl.php');
$tpl->set('referer', '');
$tpl->set('referer_site', '');
$tpl->set('theme', $theme);
$disabled_department = false;
if (is_array($Params['user_parameters_unordered']['department']) && erLhcoreClassModelChatConfig::fetch('hide_disabled_department')->current_value == 1) {
try {
erLhcoreClassChat::validateFilterIn($Params['user_parameters_unordered']['department']);
$departments = erLhcoreClassModelDepartament::getList(array('filterin' => array('id' => $Params['user_parameters_unordered']['department'])));
$disabledAll = true;
foreach ($departments as $department) {
if ($department->disabled == 0) {
$disabledAll = false;
}
}
// Disable only if all provided departments are disabled
if ($disabledAll == true) {
$disabled_department = true;
}
} catch (Exception $e) {
exit;
}
}
$tpl->set('disabled_department', $disabled_department);
示例6: foreach
</select>
</div>
</div>
<div class="col-md-6">
<div class="form-group">
<label><?php
echo erTranslationClassLhTranslation::getInstance()->getTranslation('system/htmlcode', 'Department');
?>
</label>
<select id="DepartmentID" multiple="multiple" size="5" class="form-control">
<option value="0"><?php
echo erTranslationClassLhTranslation::getInstance()->getTranslation('system/htmlcode', 'Any');
?>
</option>
<?php
foreach (erLhcoreClassModelDepartament::getList($departmentParams) as $departament) {
?>
<option value="<?php
echo $departament->id;
?>
"><?php
echo htmlspecialchars($departament->name);
?>
</option>
<?php
}
?>
</select>
</div>
</div>
示例7: getInstance
/**
* Gets pending chats
*/
public static function getInstance($identifier = 'default', $chathash = '')
{
if ($identifier == '' || $identifier == 'default') {
$identifier = 'default';
$items = self::getList(array('filter' => array('identifier' => $identifier)));
if (empty($items)) {
$chatboxData = erLhcoreClassModelChatConfig::fetch('chatbox_data');
$data = (array) $chatboxData->data;
$chatbox = new erLhcoreClassModelChatbox();
$chatbox->identifier = $identifier;
$chatbox->name = $data['chatbox_default_name'];
$chat = new erLhcoreClassModelChat();
$chat->status = erLhcoreClassModelChat::STATUS_CHATBOX_CHAT;
$chat->time = time();
$chat->setIP();
$chat->hash = erLhcoreClassChat::generateHash();
$chat->nick = $data['chatbox_default_opname'];
$chat->referrer = isset($_GET['URLReferer']) ? $_GET['URLReferer'] : '';
// Assign default department
$departments = erLhcoreClassModelDepartament::getList(array('filter' => array('disabled' => 0)));
$ids = array_keys($departments);
$id = array_shift($ids);
$chat->dep_id = $id;
// Store chat
erLhcoreClassChat::getSession()->save($chat);
$chatbox->chat_id = $chat->id;
$chatbox->saveThis();
return $chatbox;
} else {
return array_shift($items);
}
} else {
$chatboxData = erLhcoreClassModelChatConfig::fetch('chatbox_data');
$data = (array) $chatboxData->data;
$canCreate = $data['chatbox_auto_enabled'] == 1 ? true : false;
if ($canCreate == false) {
if (sha1($data['chatbox_secret_hash'] . sha1($data['chatbox_secret_hash'] . $identifier)) == $chathash) {
$canCreate = true;
}
}
if ($canCreate == true) {
$items = self::getList(array('filter' => array('identifier' => $identifier)));
if (empty($items)) {
$chatbox = new erLhcoreClassModelChatbox();
$chatbox->identifier = $identifier;
$chatbox->name = $data['chatbox_default_name'];
$chat = new erLhcoreClassModelChat();
$chat->status = erLhcoreClassModelChat::STATUS_CHATBOX_CHAT;
$chat->time = time();
$chat->setIP();
$chat->hash = erLhcoreClassChat::generateHash();
$chat->nick = $data['chatbox_default_opname'];
$chat->referrer = isset($_GET['URLReferer']) ? $_GET['URLReferer'] : '';
// Assign default department
$departments = erLhcoreClassModelDepartament::getList();
$ids = array_keys($departments);
$id = array_shift($ids);
$chat->dep_id = $id;
// Store chat
erLhcoreClassChat::getSession()->save($chat);
$chatbox->chat_id = $chat->id;
$chatbox->saveThis();
return $chatbox;
} else {
return array_shift($items);
}
} else {
$items = self::getList(array('filter' => array('identifier' => $identifier)));
if (!empty($items)) {
return array_shift($items);
}
}
return false;
}
}
示例8: 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')));
示例9: validateStartChat
//.........这里部分代码省略.........
} elseif ($form->hasValidData('Question')) {
$inputForm->question = trim($form->Question);
}
if ($form->hasValidData('Question') && trim($form->Question) != '' && strlen($form->Question) > (int) erLhcoreClassModelChatConfig::fetch('max_message_length')->current_value) {
$Errors[] = erTranslationClassLhTranslation::getInstance()->getTranslation('chat/startchat', 'Maximum') . ' ' . (int) erLhcoreClassModelChatConfig::fetch('max_message_length')->current_value . ' ' . erTranslationClassLhTranslation::getInstance()->getTranslation('chat/startchat', 'characters for a message');
}
}
if (isset($validationFields['AcceptTOS'])) {
if (!$form->hasValidData('AcceptTOS') || $form->AcceptTOS == false) {
$Errors[] = erTranslationClassLhTranslation::getInstance()->getTranslation('chat/startchat', 'You have to accept our Terms Of Service');
} else {
$inputForm->accept_tos = true;
}
}
// Validate phone
if (isset($validationFields['Phone'])) {
if (!$form->hasValidData('Phone') || ($form->Phone == '' || mb_strlen($form->Phone) < erLhcoreClassModelChatConfig::fetch('min_phone_length')->current_value) && ($start_data_fields['phone_require_option'] == 'required' && !isset($additionalParams['offline']) || isset($additionalParams['offline']) && isset($start_data_fields['offline_phone_require_option']) && $start_data_fields['offline_phone_require_option'] == 'required')) {
$Errors[] = erTranslationClassLhTranslation::getInstance()->getTranslation('chat/startchat', 'Please enter your phone');
} elseif ($form->hasValidData('Phone')) {
$chat->phone = $inputForm->phone = $form->Phone;
}
if ($form->hasValidData('Phone') && $form->Phone != '' && strlen($form->Phone) > 100) {
$Errors[] = erTranslationClassLhTranslation::getInstance()->getTranslation('chat/startchat', 'Maximum 100 characters for phone');
}
}
if ($form->hasValidData('operator') && erLhcoreClassModelUser::getUserCount(array('filter' => array('id' => $form->operator, 'disabled' => 0))) > 0) {
$inputForm->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 = '';
}
}
if ($form->hasValidData('DepartmentIDDefined')) {
$inputForm->departament_id_array = $form->DepartmentIDDefined;
}
if ($form->hasValidData('DepartamentID') && erLhcoreClassModelDepartament::getCount(array('filter' => array('id' => $form->DepartamentID, 'disabled' => 0))) > 0) {
$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!');
}
}
// Set chat attributes for transfer workflow logic
if ($chat->department !== false && $chat->department->department_transfer_id > 0) {
$chat->transfer_if_na = 1;
$chat->transfer_timeout_ts = time();
$chat->transfer_timeout_ac = $chat->department->transfer_timeout;
}
if ($chat->department !== false && $chat->department->inform_unread == 1) {
$chat->reinform_timeout = $chat->department->inform_unread_delay;
}
$inputForm->departament_id = $chat->dep_id;
if ($inputForm->priority !== false && is_numeric($inputForm->priority)) {
$chat->priority = (int) $inputForm->priority;
} else {
if ($chat->department !== false) {
$chat->priority = $chat->department->priority;
}
}
if ($form->hasValidData('name_items') && !empty($form->name_items)) {
$valuesArray = array();
if ($form->hasValidData('value_items') && !empty($form->value_items)) {
$inputForm->value_items = $valuesArray = $form->value_items;
}
if ($form->hasValidData('values_req') && !empty($form->values_req)) {
$inputForm->values_req = $form->values_req;
}
if ($form->hasValidData('value_types') && !empty($form->value_types)) {
$inputForm->value_types = $form->value_types;
}
if ($form->hasValidData('value_sizes') && !empty($form->value_sizes)) {
$inputForm->value_sizes = $form->value_sizes;
}
if ($form->hasValidData('value_show') && !empty($form->value_show)) {
$inputForm->value_show = $form->value_show;
}
if ($form->hasValidData('hattr') && !empty($form->hattr)) {
$inputForm->hattr = $form->hattr;
}
$inputForm->name_items = $form->name_items;
$stringParts = array();
foreach ($form->name_items as $key => $name_item) {
if (isset($inputForm->values_req[$key]) && $inputForm->values_req[$key] == 't' && ($inputForm->value_show[$key] == 'b' || $inputForm->value_show[$key] == (isset($additionalParams['offline']) ? 'off' : 'on')) && (!isset($valuesArray[$key]) || trim($valuesArray[$key]) == '')) {
$Errors[] = trim($name_item) . ' : ' . erTranslationClassLhTranslation::getInstance()->getTranslation('chat/startchat', 'is required');
}
$stringParts[] = array('key' => $name_item, 'value' => isset($valuesArray[$key]) ? trim($valuesArray[$key]) : '');
}
$chat->additional_data = json_encode($stringParts);
}
erLhcoreClassChatEventDispatcher::getInstance()->dispatch('chat.validate_start_chat', array('errors' => &$Errors, 'input_form' => &$inputForm, 'start_data_fields' => &$start_data_fields, 'chat' => &$chat, 'additional_params' => &$additionalParams));
return $Errors;
}
示例10: validateDepartaments
public static function validateDepartaments()
{
$departaments = erLhcoreClassModelDepartament::getList();
$departamentsCount = erLhcoreClassModelDepartament::getCount();
// Chats list
return array('list' => array_values($departaments), 'list_count' => $departamentsCount, 'error' => false);
}
示例11: array
<?php
$departmentParams = array();
$userDepartments = erLhcoreClassUserDep::parseUserDepartmetnsForFilter($currentUser->getUserID());
if ($userDepartments !== true) {
$departmentParams['filterin']['id'] = $userDepartments;
if (!$currentUser->hasAccessTo('lhchat', 'sees_all_online_visitors')) {
$filter['filterin']['dep_id'] = $userDepartments;
}
}
// Same sort as in widget
$departmentParams['sort'] = 'pending_chats_counter DESC';
erLhcoreClassChatExport::exportDepartmentStats(erLhcoreClassModelDepartament::getList($departmentParams));
exit;
示例12: array
<h4><span class="label label-success"><?php
echo erTranslationClassLhTranslation::getInstance()->getTranslation('chat/transferchat', 'Online');
?>
</span></h4>
<?php
$departments = erLhcoreClassModelDepartament::getList(array_merge($departments_filter['filter'], array('sort' => 'sort_priority ASC, name ASC')));
$onlineDepartments = erLhcoreClassChat::getLoggedDepartmentsIds(array_keys($departments), $departments_filter['explicit']);
foreach ($departments as $departament) {
if ($departament->id !== $departments_filter['dep_id'] && in_array($departament->id, $onlineDepartments)) {
?>
<div class="checkbox"><label><input type="radio" name="DepartamentID<?php
echo $departments_filter['chat_id'];
?>
" value="<?php
echo $departament->id;
?>
"/> <?php
echo htmlspecialchars($departament->name);
?>
</label></div>
<?php
}
}
?>
<h4><span class="label label-default"><?php
echo erTranslationClassLhTranslation::getInstance()->getTranslation('chat/transferchat', 'Offline');
?>
</span></h4>
<?php
foreach ($departments as $departament) {