本文整理汇总了PHP中erLhcoreClassModelDepartament类的典型用法代码示例。如果您正苦于以下问题:PHP erLhcoreClassModelDepartament类的具体用法?PHP erLhcoreClassModelDepartament怎么用?PHP erLhcoreClassModelDepartament使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了erLhcoreClassModelDepartament类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __get
public function __get($var)
{
switch ($var) {
case 'user':
$this->user = false;
if ($this->user_id > 0) {
try {
$this->user = erLhcoreClassModelUser::fetch($this->user_id);
} catch (Exception $e) {
$this->user = false;
}
}
return $this->user;
break;
case 'department':
$this->department = false;
if ($this->department_id > 0) {
try {
$this->department = erLhcoreClassModelDepartament::fetch($this->department_id, true);
} catch (Exception $e) {
$this->department = false;
}
}
return $this->department;
break;
case 'msg_to_user':
$this->msg_to_user = str_replace(array_keys($this->replaceData), array_values($this->replaceData), $this->msg);
// If not all variables were replaced fallback to fallback message
if (preg_match('/\\{[a-zA-Z0-9_]+\\}/i', $this->msg_to_user)) {
$this->msg_to_user = str_replace(array_keys($this->replaceData), array_values($this->replaceData), $this->fallback_msg);
}
return $this->msg_to_user;
break;
case 'message_title':
if ($this->title != '') {
$this->message_title = $this->title;
} else {
$this->message_title = $this->msg_to_user;
}
return $this->message_title;
break;
default:
break;
}
}
示例2: __get
public function __get($var)
{
switch ($var) {
case 'user':
$this->user = erLhcoreClassModelUser::fetch($this->user_id);
return $this->user;
break;
case 'lastactivity_ago':
$this->lastactivity_ago = $this->user->lastactivity_ago;
return $this->lastactivity_ago;
break;
case 'name_support':
$this->name_support = $this->user->name_support;
return $this->name_support;
break;
case 'name_official':
$this->name_official = $this->user->name_official;
return $this->name_official;
break;
case 'departments_names':
$this->departments_names = array();
$ids = $this->user->departments_ids;
if ($ids != '') {
$parts = explode(',', $ids);
sort($parts);
foreach ($parts as $depId) {
if ($depId == 0) {
$this->departments_names[] = '∞';
} elseif ($depId > 0) {
try {
$dep = erLhcoreClassModelDepartament::fetch($depId, true);
$this->departments_names[] = $dep->name;
} catch (Exception $e) {
}
}
}
}
return $this->departments_names;
break;
default:
break;
}
}
示例3: __get
public function __get($var)
{
switch ($var) {
case 'left_menu':
$this->left_menu = '';
return $this->left_menu;
break;
case 'departament':
$this->departament = erLhcoreClassModelDepartament::fetch($this->departament_id);
return $this->departament;
break;
case 'name_department':
$this->name_department = $this->name . ' (' . $this->departament . ')';
return $this->name_department;
break;
default:
break;
}
}
示例4: validateStartChat
//.........这里部分代码省略.........
/**
* File for offline form
* */
$inputForm->has_file = false;
if (isset($additionalParams['offline']) && ($inputForm->validate_start_chat == true && isset($start_data_fields['offline_file_visible_in_popup']) && $start_data_fields['offline_file_visible_in_popup'] == true || $inputForm->validate_start_chat == false && isset($start_data_fields['offline_file_visible_in_page_widget']) && $start_data_fields['offline_file_visible_in_page_widget'] == true)) {
$fileData = erLhcoreClassModelChatConfig::fetch('file_configuration');
$data = (array) $fileData->data;
if ($_FILES['File']['error'] != 4) {
// No file was provided
if (isset($_FILES['File']) && erLhcoreClassSearchHandler::isFile('File', '/\\.(' . $data['ft_us'] . ')$/i', $data['fs_max'] * 1024)) {
$inputForm->has_file = true;
// Just extract file extension
$fileNameAray = explode('.', $_FILES['File']['name']);
end($fileNameAray);
// 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;
示例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: 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]));
示例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: 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>
示例9: 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) {
示例10: array
$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', 'Domains')));
}
if ($_POST['inpu'] == 2) {
$_SESSION['var'] = 2;
$tpl = erLhcoreClassTemplate::getInstance('lhdepartament/departaments.tpl.php');
$departmentParams = array();
$items = array();
$items = erLhcoreClassModelDepartament::getListTips();
$tpl->set('items', $items);
$Result['content'] = $tpl->fetch();
$Result['path'] = array(array('url' => erLhcoreClassDesign::baseurl('system/configuration'), 'title' => erTranslationClassLhTranslation::getInstance()->getTranslation('departament/departaments', 'System configuration')), array('url' => erLhcoreClassDesign::baseurl('departament/departaments'), 'title' => erTranslationClassLhTranslation::getInstance()->getTranslation('departament/departaments', 'Tips')));
}
示例11: __get
public function __get($var)
{
switch ($var) {
case 'time_created_front':
$this->time_created_front = date('Ymd') == date('Ymd', $this->time) ? date(erLhcoreClassModule::$dateHourFormat, $this->time) : date(erLhcoreClassModule::$dateDateHourFormat, $this->time);
return $this->time_created_front;
break;
case 'user_closed_ts_front':
$this->user_closed_ts_front = date('Ymd') == date('Ymd', $this->user_closed_ts) ? date(erLhcoreClassModule::$dateHourFormat, $this->user_closed_ts) : date(erLhcoreClassModule::$dateDateHourFormat, $this->user_closed_ts);
return $this->user_closed_ts_front;
break;
case 'is_operator_typing':
$this->is_operator_typing = $this->operator_typing > time() - 60;
// typing is considered if status did not changed for 30 seconds
return $this->is_operator_typing;
break;
case 'is_user_typing':
$this->is_user_typing = $this->user_typing > time() - 10;
// typing is considered if status did not changed for 30 seconds
return $this->is_user_typing;
break;
case 'wait_time_seconds':
$this->wait_time_seconds = time() - $this->time;
return $this->wait_time_seconds;
case 'wait_time_front':
$this->wait_time_front = erLhcoreClassChat::formatSeconds($this->wait_time);
return $this->wait_time_front;
break;
case 'wait_time_pending':
$this->wait_time_pending = erLhcoreClassChat::formatSeconds(time() - $this->time);
return $this->wait_time_pending;
break;
case 'chat_duration_front':
$this->chat_duration_front = erLhcoreClassChat::formatSeconds($this->chat_duration);
return $this->chat_duration_front;
break;
case 'user_name':
return $this->user_name = (string) $this->user;
break;
case 'plain_user_name':
$this->plain_user_name = false;
if ($this->user !== false) {
$this->plain_user_name = (string) $this->user->name_support;
}
return $this->plain_user_name;
break;
case 'user':
$this->user = false;
if ($this->user_id > 0) {
try {
$this->user = erLhcoreClassModelUser::fetch($this->user_id, true);
} catch (Exception $e) {
$this->user = false;
}
}
return $this->user;
break;
case 'operator_typing_user':
$this->operator_typing_user = false;
if ($this->operator_typing_id > 0) {
try {
$this->operator_typing_user = erLhcoreClassModelUser::fetch($this->operator_typing_id);
} catch (Exception $e) {
$this->operator_typing_user = false;
}
}
return $this->operator_typing_user;
break;
case 'online_user':
$this->online_user = false;
if ($this->online_user_id > 0) {
try {
$this->online_user = erLhcoreClassModelChatOnlineUser::fetch($this->online_user_id);
} catch (Exception $e) {
$this->online_user = false;
}
}
return $this->online_user;
break;
case 'department':
$this->department = false;
if ($this->dep_id > 0) {
try {
$this->department = erLhcoreClassModelDepartament::fetch($this->dep_id, true);
} catch (Exception $e) {
}
}
return $this->department;
break;
case 'department_name':
return $this->department_name = (string) $this->department;
break;
case 'number_in_queue':
$this->number_in_queue = 1;
if ($this->status == self::STATUS_PENDING_CHAT) {
$this->number_in_queue = erLhcoreClassChat::getCount(array('filterlt' => array('id' => $this->id), 'filter' => array('dep_id' => $this->dep_id, 'status' => self::STATUS_PENDING_CHAT))) + 1;
}
return $this->number_in_queue;
break;
case 'screenshot':
//.........这里部分代码省略.........
示例12: 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;
}
示例13: validateDepartaments
public static function validateDepartaments()
{
$departaments = erLhcoreClassModelDepartament::getList();
$departamentsCount = erLhcoreClassModelDepartament::getCount();
// Chats list
return array('list' => array_values($departaments), 'list_count' => $departamentsCount, 'error' => false);
}
示例14: 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;
示例15: __get
public function __get($var)
{
switch ($var) {
case 'survey':
$this->survey = '';
return $this->survey;
break;
case 'ftime_front':
$this->ftime_front = date('Ymd') == date('Ymd', $this->ftime) ? date(erLhcoreClassModule::$dateHourFormat, $this->ftime) : date(erLhcoreClassModule::$dateDateHourFormat, $this->ftime);
return $this->ftime_front;
break;
case 'user':
try {
$this->user = erLhcoreClassModelUser::fetch($this->user_id, true);
} catch (Exception $e) {
$this->user = false;
}
return $this->user;
break;
case 'is_filled':
return !is_null($this->id);
break;
case 'department':
$this->department = false;
if ($this->dep_id > 0) {
try {
$this->department = erLhcoreClassModelDepartament::fetch($this->dep_id, true);
} catch (Exception $e) {
}
}
return $this->department;
break;
case 'department_name':
return $this->department_name = (string) $this->department;
break;
case 'average_stars':
return round($this->virtual_total_stars / $this->virtual_chats_number, 2);
break;
default:
break;
}
}