本文整理汇总了PHP中erLhcoreClassModelUser类的典型用法代码示例。如果您正苦于以下问题:PHP erLhcoreClassModelUser类的具体用法?PHP erLhcoreClassModelUser怎么用?PHP erLhcoreClassModelUser使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了erLhcoreClassModelUser类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getTopTodaysOperators
/**
* Gets pending chats
*/
public static function getTopTodaysOperators($limit = 100, $offset = 0)
{
$time = time() - 24 * 3600;
$SQL = 'SELECT lh_chat.user_id,count(lh_chat.id) as assigned_chats FROM lh_chat WHERE time > :time AND user_id > 0 GROUP BY user_id';
$db = ezcDbInstance::get();
$stmt = $db->prepare($SQL);
$stmt->bindValue(':time', $time, PDO::PARAM_INT);
$stmt->setFetchMode(PDO::FETCH_ASSOC);
$stmt->execute();
$rows = $stmt->fetchAll();
$usersID = array();
foreach ($rows as $item) {
$usersID[] = $item['user_id'];
}
if (!empty($usersID)) {
$users = erLhcoreClassModelUser::getUserList(array('limit' => $limit, 'filterin' => array('id' => $usersID)));
}
$usersReturn = array();
foreach ($rows as $row) {
$usersReturn[$row['user_id']] = $users[$row['user_id']];
$usersReturn[$row['user_id']]->statistic_total_chats = $row['assigned_chats'];
$usersReturn[$row['user_id']]->statistic_total_messages = erLhcoreClassChat::getCount(array('filtergte' => array('time' => $time), 'filter' => array('user_id' => $row['user_id'])), 'lh_msg');
$usersReturn[$row['user_id']]->statistic_upvotes = erLhcoreClassChat::getCount(array('filtergte' => array('time' => $time), 'filter' => array('fbst' => 1, 'user_id' => $row['user_id'])));
$usersReturn[$row['user_id']]->statistic_downvotes = erLhcoreClassChat::getCount(array('filtergte' => array('time' => $time), 'filter' => array('fbst' => 2, 'user_id' => $row['user_id'])));
}
return $usersReturn;
}
示例2: __get
public function __get($var)
{
switch ($var) {
case 'user':
$this->user = erLhcoreClassModelUser::fetch($this->user_id);
return $this->user;
break;
default:
break;
}
}
示例3: loginBySSO
public static function loginBySSO($params)
{
$settings = (include 'extension/singlesignon/settings/settings.ini.php');
// Try to find operator by our logins
if (isset($params[$settings['attr_map']['username']][0])) {
$username = $params[$settings['attr_map']['username']][0];
if (erLhcoreClassModelUser::userExists($username)) {
$user = array_shift(erLhcoreClassModelUser::getUserList(array('limit' => 1, 'filter' => array('username'))));
erLhcoreClassUser::instance()->setLoggedUser($user->id);
} else {
$user = new erLhcoreClassModelUser();
foreach ($settings['attr_map'] as $attr => $ssoAttr) {
$user->{$attr} = $params[$settings['attr_map'][$attr]][0];
}
foreach ($settings['default_attributes'] as $attr => $value) {
$user->{$attr} = $value;
}
$user->password = sha1(erLhcoreClassModelForgotPassword::randomPassword() . rand(0, 1000) . microtime());
$user->saveThis();
// Set that users sees all pending chats
erLhcoreClassModelUserSetting::setSetting('show_all_pending', 1, $user->id);
// Set default departments
erLhcoreClassUserDep::addUserDepartaments($settings['default_departments'], $user->id, $user);
// Cleanup if previously existed
erLhcoreClassModelGroupUser::removeUserFromGroups($user->id);
// Assign user to default group
foreach ($settings['default_user_groups'] as $group_id) {
$groupUser = new erLhcoreClassModelGroupUser();
$groupUser->group_id = $group_id;
$groupUser->user_id = $user->id;
$groupUser->saveThis();
}
erLhcoreClassUser::instance()->setLoggedUser($user->id);
}
return true;
} else {
throw new Exception('Username field not found');
}
}
示例4: __get
public function __get($var)
{
switch ($var) {
case 'user':
try {
$this->user = erLhcoreClassModelUser::fetch($this->user_id);
} catch (Exception $e) {
$this->user = 'Not exist';
}
return $this->user;
break;
default:
break;
}
}
示例5: __get
public function __get($var)
{
switch ($var) {
case 'dep_group':
$this->dep_group = erLhcoreClassModelDepartamentGroup::fetch($this->dep_group_id);
return $this->dep_group;
break;
case 'user':
$this->user = erLhcoreClassModelUser::fetch($this->user_id);
return $this->user;
break;
default:
break;
}
}
示例6: __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;
}
}
示例7: __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;
default:
break;
}
}
示例8: __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;
}
}
示例9: __get
public function __get($var)
{
switch ($var) {
case 'file_path_server':
$this->file_path_server = $this->file_path . $this->name;
return $this->file_path_server;
break;
case 'security_hash':
$this->security_hash = md5($this->name . '_' . $this->chat_id);
return $this->security_hash;
break;
case 'chat':
$this->chat = false;
if ($this->chat_id > 0) {
try {
$this->chat = erLhcoreClassModelChat::fetch($this->chat_id);
} catch (Exception $e) {
$this->chat = new erLhcoreClassModelChat();
}
}
return $this->chat;
break;
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 'date_front':
$this->date_front = date(erLhcoreClassModule::$dateDateHourFormat, $this->date);
return $this->date_front;
break;
default:
break;
}
}
示例10: removeInstanceData
public function removeInstanceData()
{
foreach (erLhAbstractModelFormCollected::getList(array('limit' => 1000000)) as $item) {
$item->removeThis();
}
foreach (erLhAbstractModelWidgetTheme::getList(array('limit' => 1000000)) as $item) {
$item->removeThis();
}
foreach (erLhcoreClassChat::getList(array('limit' => 1000000)) as $item) {
$item->removeThis();
}
foreach (erLhcoreClassChat::getList(array('limit' => 1000000), 'erLhcoreClassModelChatFile', 'lh_chat_file') as $item) {
$item->removeThis();
}
foreach (erLhcoreClassModelUser::getUserList(array('limit' => 1000000)) as $item) {
$item->removeFile();
}
// Dispatch event for extensions
erLhcoreClassChatEventDispatcher::getInstance()->dispatch('instance.destroyed', array('instance' => $this));
return true;
}
示例11: __get
public function __get($var)
{
switch ($var) {
case 'ctime_front':
$this->ctime_front = date('Ymd') == date('Ymd', $this->ctime) ? date(erLhcoreClassModule::$dateHourFormat, $this->ctime) : date(erLhcoreClassModule::$dateDateHourFormat, $this->ctime);
return $this->ctime_front;
break;
case 'lactivity_front':
$this->lactivity_front = date('Ymd') == date('Ymd', $this->lactivity) ? date(erLhcoreClassModule::$dateHourFormat, $this->lactivity) : date(erLhcoreClassModule::$dateDateHourFormat, $this->lactivity);
return $this->lactivity_front;
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 'username_plain':
list($this->username_plain) = explode('@', $this->username);
return $this->username_plain;
break;
case 'username_plain_edit':
list($this->username_plain_edit) = explode('@', $this->username);
$subdomain = erLhcoreClassModule::getExtensionInstance('erLhcoreClassExtensionXmppservice')->settings['subdomain'];
if ($subdomain != '') {
$this->username_plain_edit = $this->str_lreplace('.' . $subdomain, '', $this->username_plain_edit);
}
return $this->username_plain_edit;
break;
default:
break;
}
}
示例12: validateStartChat
//.........这里部分代码省略.........
} else {
$chat->email = $inputForm->email = $_POST['Email'];
}
}
// Validate question
if (isset($validationFields['Question'])) {
if (!$form->hasValidData('keyUpStarted') && (!$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['question'] = erTranslationClassLhTranslation::getInstance()->getTranslation('chat/startchat', 'Please enter your message');
} 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['question'] = 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['accept_tos'] = 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['phone'] = 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;
}
/**
* 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 = '';
}
}
示例13: array
<?php
$tpl = erLhcoreClassTemplate::getInstance('lhuser/edit.tpl.php');
$UserData = erLhcoreClassUser::getSession()->load('erLhcoreClassModelUser', (int) $Params['user_parameters']['user_id']);
if (isset($_POST['Update_account']) || isset($_POST['Save_account'])) {
$definition = array('Password' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'unsafe_raw'), 'Password1' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'unsafe_raw'), 'Email' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'validate_email'), 'Name' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'unsafe_raw'), 'Surname' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'unsafe_raw'), 'Username' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'unsafe_raw'), 'JobTitle' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'unsafe_raw'), 'Skype' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'unsafe_raw'), 'XMPPUsername' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'unsafe_raw'), 'UserTimeZone' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'unsafe_raw'), 'UserDisabled' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'boolean'), 'HideMyStatus' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'boolean'), 'UserInvisible' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'boolean'), 'DefaultGroup' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'int', null, FILTER_REQUIRE_ARRAY));
if (!isset($_POST['csfr_token']) || !$currentUser->validateCSFRToken($_POST['csfr_token'])) {
erLhcoreClassModule::redirect('user/userlist');
exit;
}
$form = new ezcInputForm(INPUT_POST, $definition);
$Errors = array();
if (!$form->hasValidData('Username')) {
$Errors[] = erTranslationClassLhTranslation::getInstance()->getTranslation('user/account', 'Please enter a username!');
} elseif ($form->hasValidData('Username') && $form->Username != $UserData->username && !erLhcoreClassModelUser::userExists($form->Username)) {
$UserData->username = $form->Username;
} elseif ($form->hasValidData('Username') && $form->Username != $UserData->username) {
$Errors[] = erTranslationClassLhTranslation::getInstance()->getTranslation('user/account', 'User exists!');
}
if (!$form->hasValidData('Email')) {
$Errors[] = erTranslationClassLhTranslation::getInstance()->getTranslation('user/edit', 'Wrong email address');
}
if (!$form->hasValidData('Name') || $form->Name == '') {
$Errors[] = erTranslationClassLhTranslation::getInstance()->getTranslation('user/edit', 'Please enter a name');
}
if ($form->hasValidData('Surname') && $form->Surname != '') {
$UserData->surname = $form->Surname;
} else {
$UserData->surname = '';
}
if ($form->hasValidData('UserTimeZone') && $form->UserTimeZone != '') {
示例14: int
erLhcoreClassRole::getSession()->save($RoleOperators);
//Assing group role
$db->query("CREATE TABLE IF NOT EXISTS `lh_grouprole` (\n `id` int(11) NOT NULL AUTO_INCREMENT,\n `group_id` int(11) NOT NULL,\n `role_id` int(11) NOT NULL,\n PRIMARY KEY (`id`),\n KEY `group_id` (`role_id`,`group_id`),\n KEY `group_id_primary` (`group_id`)\n ) DEFAULT CHARSET=utf8;");
// Assign admin role to admin group
$GroupRole = new erLhcoreClassModelGroupRole();
$GroupRole->group_id = $GroupData->id;
$GroupRole->role_id = $Role->id;
erLhcoreClassRole::getSession()->save($GroupRole);
// Assign operators role to operators group
$GroupRoleOperators = new erLhcoreClassModelGroupRole();
$GroupRoleOperators->group_id = $GroupDataOperators->id;
$GroupRoleOperators->role_id = $RoleOperators->id;
erLhcoreClassRole::getSession()->save($GroupRoleOperators);
// Users
$db->query("CREATE TABLE IF NOT EXISTS `lh_users` (\n `id` int(11) NOT NULL AUTO_INCREMENT,\n `username` varchar(40) NOT NULL,\n `password` varchar(40) NOT NULL,\n `email` varchar(100) NOT NULL,\n `time_zone` varchar(100) NOT NULL,\n `name` varchar(100) NOT NULL,\n `surname` varchar(100) NOT NULL,\n `filepath` varchar(200) NOT NULL,\n `filename` varchar(200) NOT NULL,\n `job_title` varchar(100) NOT NULL,\n `xmpp_username` varchar(200) NOT NULL,\n `skype` varchar(50) NOT NULL,\n `disabled` tinyint(4) NOT NULL,\n `hide_online` tinyint(1) NOT NULL,\n `all_departments` tinyint(1) NOT NULL,\n `invisible_mode` tinyint(1) NOT NULL,\n `rec_per_req` tinyint(1) NOT NULL,\n PRIMARY KEY (`id`),\n KEY `hide_online` (`hide_online`),\n KEY `rec_per_req` (`rec_per_req`),\n KEY `email` (`email`),\n KEY `xmpp_username` (`xmpp_username`)\n ) DEFAULT CHARSET=utf8;");
$UserData = new erLhcoreClassModelUser();
$UserData->setPassword($form->AdminPassword);
$UserData->email = $form->AdminEmail;
$UserData->name = $form->AdminName;
$UserData->surname = $form->AdminSurname;
$UserData->username = $form->AdminUsername;
$UserData->all_departments = 1;
erLhcoreClassUser::getSession()->save($UserData);
// User departaments
$db->query("CREATE TABLE IF NOT EXISTS `lh_userdep` (\n\t\t\t\t `id` int(11) NOT NULL AUTO_INCREMENT,\n\t\t\t\t `user_id` int(11) NOT NULL,\n\t\t\t\t `dep_id` int(11) NOT NULL,\n\t\t\t\t `last_activity` int(11) NOT NULL,\n\t\t\t\t `hide_online` int(11) NOT NULL,\n\t\t\t\t `last_accepted` int(11) NOT NULL,\n\t\t\t\t `active_chats` int(11) NOT NULL,\n\t\t\t\t PRIMARY KEY (`id`),\n\t\t\t\t KEY `user_id` (`user_id`),\n\t\t\t\t KEY `last_activity_hide_online_dep_id` (`last_activity`,`hide_online`,`dep_id`),\n\t\t\t\t KEY `dep_id` (`dep_id`)\n\t\t\t\t) DEFAULT CHARSET=utf8;");
// Insert record to departament instantly
$db->query("INSERT INTO `lh_userdep` (`user_id`,`dep_id`,`last_activity`,`hide_online`,`last_accepted`,`active_chats`) VALUES ({$UserData->id},0,0,0,0,0)");
// Transfer chat
$db->query("CREATE TABLE IF NOT EXISTS `lh_transfer` (\n\t\t\t\t `id` int(11) NOT NULL AUTO_INCREMENT,\n\t\t\t\t `chat_id` int(11) NOT NULL,\n\t\t\t\t `dep_id` int(11) NOT NULL,\n\t\t\t\t `transfer_user_id` int(11) NOT NULL,\n\t\t\t\t `from_dep_id` int(11) NOT NULL,\n\t\t\t\t `transfer_to_user_id` int(11) NOT NULL,\n\t\t\t\t PRIMARY KEY (`id`),\n\t\t\t\t KEY `dep_id` (`dep_id`),\n\t\t\t\t KEY `transfer_user_id_dep_id` (`transfer_user_id`,`dep_id`),\n\t\t\t\t KEY `transfer_to_user_id` (`transfer_to_user_id`)\n\t\t\t\t) DEFAULT CHARSET=utf8;");
// Remember user table
$db->query("CREATE TABLE IF NOT EXISTS `lh_users_remember` (\n\t\t\t\t `id` int(11) NOT NULL AUTO_INCREMENT,\n\t\t\t\t `user_id` int(11) NOT NULL,\n\t\t\t\t `mtime` int(11) NOT NULL,\n\t\t\t\t PRIMARY KEY (`id`)\n\t\t\t\t) DEFAULT CHARSET=utf8;");
示例15: __get
public function __get($var)
{
switch ($var) {
case 'last_visit_front':
return $this->last_visit_front = date(erLhcoreClassModule::$dateDateHourFormat, $this->last_visit);
break;
case 'first_visit_front':
return $this->first_visit_front = date(erLhcoreClassModule::$dateDateHourFormat, $this->first_visit);
break;
case 'invitation':
$this->invitation = false;
if ($this->invitation_id > 0) {
try {
$this->invitation = erLhAbstractModelProactiveChatInvitation::fetch($this->invitation_id);
} catch (Exception $e) {
$this->invitation = false;
}
}
return $this->invitation;
break;
case 'has_message_from_operator':
return $this->message_seen == 0 && $this->operator_message != '';
break;
case 'notes_intro':
return $this->notes_intro = $this->notes != '' ? '[ ' . mb_substr($this->notes, 0, 50) . ' ]' . '<br/>' : '';
break;
case 'chat':
$this->chat = false;
if ($this->chat_id > 0) {
try {
$this->chat = erLhcoreClassModelChat::fetch($this->chat_id);
} catch (Exception $e) {
//
}
}
return $this->chat;
break;
case 'can_view_chat':
$this->can_view_chat = false;
$currentUser = erLhcoreClassUser::instance();
if ($this->operator_user_id == $currentUser->getUserID()) {
$this->can_view_chat = true;
// Faster way
} else {
if ($this->chat instanceof erLhcoreClassModelChat) {
$this->can_view_chat = erLhcoreClassChat::hasAccessToRead($this->chat);
}
}
return $this->can_view_chat;
break;
case 'operator_user':
$this->operator_user = false;
if ($this->operator_user_id > 0) {
try {
$this->operator_user = erLhcoreClassModelUser::fetch($this->operator_user_id);
} catch (Exception $e) {
}
}
return $this->operator_user;
break;
case 'operator_user_send':
$this->operator_user_send = $this->operator_user !== false;
return $this->operator_user_send;
break;
case 'operator_user_string':
$this->operator_user_string = (string) $this->operator_user;
return $this->operator_user_string;
break;
case 'time_on_site_front':
$this->time_on_site_front = gmdate(erLhcoreClassModule::$dateHourFormat, $this->time_on_site);
return $this->time_on_site_front;
break;
case 'tt_time_on_site_front':
$this->tt_time_on_site_front = null;
$diff = $this->tt_time_on_site;
$days = floor($diff / (3600 * 24));
$hours = floor(($diff - $days * 3600 * 24) / 3600);
$minits = floor(($diff - $hours * 3600 - $days * 3600 * 24) / 60);
$seconds = $diff - $hours * 3600 - $minits * 60 - $days * 3600 * 24;
if ($days > 0) {
$this->tt_time_on_site_front = $days . ' d.';
} elseif ($hours > 0) {
$this->tt_time_on_site_front = $hours . ' h.';
} elseif ($minits > 0) {
$this->tt_time_on_site_front = $minits . ' m.';
} elseif ($seconds >= 0) {
$this->tt_time_on_site_front = $seconds . ' s.';
}
return $this->tt_time_on_site_front;
break;
case 'last_visit_seconds_ago':
$this->last_visit_seconds_ago = time() - $this->last_visit;
return $this->last_visit_seconds_ago;
break;
case 'last_check_time_ago':
$this->last_check_time_ago = time() - $this->last_check_time;
return $this->last_check_time_ago;
break;
case 'visitor_tz_time':
$this->visitor_tz_time = '-';
//.........这里部分代码省略.........