本文整理汇总了PHP中erLhcoreClassModelChatOnlineUser::fetch方法的典型用法代码示例。如果您正苦于以下问题:PHP erLhcoreClassModelChatOnlineUser::fetch方法的具体用法?PHP erLhcoreClassModelChatOnlineUser::fetch怎么用?PHP erLhcoreClassModelChatOnlineUser::fetch使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类erLhcoreClassModelChatOnlineUser
的用法示例。
在下文中一共展示了erLhcoreClassModelChatOnlineUser::fetch方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __get
public function __get($var)
{
switch ($var) {
case 'mtime_front':
return date('Ymd') == date('Ymd', $this->mtime) ? date(erLhcoreClassModule::$dateHourFormat, $this->mtime) : date(erLhcoreClassModule::$dateDateHourFormat, $this->mtime);
break;
case 'is_sharing':
return $this->finished == 0 && $this->mtime > time() - 3600;
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 'chat':
$this->chat = erLhcoreClassModelChat::fetch($this->chat_id);
return $this->chat;
break;
default:
break;
}
}
示例2: __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 'product':
$this->product = false;
if ($this->product_id > 0) {
try {
$this->product = erLhAbstractModelProduct::fetch($this->product_id, true);
} catch (Exception $e) {
}
}
return $this->product;
break;
case 'product_name':
//.........这里部分代码省略.........
示例3: array
<?php
if (is_numeric($Params['user_parameters']['chat_id'])) {
/*
* If online user mode we have to make different check
* */
$browse = false;
if ($Params['user_parameters_unordered']['cobrowsemode'] == 'onlineuser') {
$onlineUser = erLhcoreClassModelChatOnlineUser::fetch($Params['user_parameters']['chat_id']);
$browse = erLhcoreClassCoBrowse::getBrowseInstanceByOnlineUser($onlineUser);
} else {
$chat = erLhcoreClassChat::getSession()->load('erLhcoreClassModelChat', $Params['user_parameters']['chat_id']);
if (erLhcoreClassChat::hasAccessToRead($chat)) {
$browse = erLhcoreClassCoBrowse::getBrowseInstance($chat);
}
}
if ($browse instanceof erLhcoreClassModelCoBrowse) {
if ($browse->modifications != '') {
$changes = json_decode($browse->modifications);
$changes[] = array('url' => $browse->url);
$changes[] = array('lmsg' => $browse->mtime > 0 ? $browse->mtime_front : '');
$changes[] = array('finished' => array('status' => !$browse->is_sharing, 'text' => $browse->is_sharing == 0 ? erTranslationClassLhTranslation::getInstance()->getTranslation('cobrowse/browse', 'Screen sharing session has finished') : erTranslationClassLhTranslation::getInstance()->getTranslation('cobrowse/browse', 'Screen is shared')));
if ($browse->finished == 1) {
$changes[] = array('clear' => true);
}
array_unshift($changes, array('base' => $browse->url));
echo json_encode($changes);
$browse->modifications = '';
$browse->saveThis();
} else {
$changes = array();
示例4: die
if (is_numeric($Params['user_parameters_unordered']['clear_list']) && $Params['user_parameters_unordered']['clear_list'] == 1) {
if (!$currentUser->validateCSFRToken($Params['user_parameters_unordered']['csfr'])) {
die('Invalid CSRF Token');
exit;
}
erLhcoreClassModelChatOnlineUser::cleanAllRecords();
erLhcoreClassModule::redirect('chat/onlineusers');
exit;
}
if (is_numeric($Params['user_parameters_unordered']['deletevisitor']) && $Params['user_parameters_unordered']['deletevisitor'] > 0) {
if (!$currentUser->validateCSFRToken($Params['user_parameters_unordered']['csfr'])) {
die('Invalid CSRF Token');
exit;
}
try {
$visitor = erLhcoreClassModelChatOnlineUser::fetch($Params['user_parameters_unordered']['deletevisitor']);
$visitor->removeThis();
} catch (Exception $e) {
}
erLhcoreClassModule::redirect('chat/onlineusers');
exit;
}
$is_ajax = isset($Params['user_parameters_unordered']['method']) && $Params['user_parameters_unordered']['method'] == 'ajax';
$timeout = isset($Params['user_parameters_unordered']['timeout']) && is_numeric($Params['user_parameters_unordered']['timeout']) ? (int) $Params['user_parameters_unordered']['timeout'] : 30;
$maxrows = isset($Params['user_parameters_unordered']['maxrows']) && is_numeric($Params['user_parameters_unordered']['maxrows']) ? (int) $Params['user_parameters_unordered']['maxrows'] : 50;
$filter = array('offset' => 0, 'limit' => $maxrows, 'sort' => 'last_visit DESC', 'filtergt' => array('last_visit' => time() - $timeout));
$department = isset($Params['user_parameters_unordered']['department']) && is_numeric($Params['user_parameters_unordered']['department']) ? (int) $Params['user_parameters_unordered']['department'] : false;
if ($department !== false) {
$filter['filter']['dep_id'] = $department;
}
/**
示例5: catch
<?php
$tpl = erLhcoreClassTemplate::getInstance('lhxml/userinfo.tpl.php');
try {
$onlineUsers = erLhcoreClassModelChatOnlineUser::fetch((int) $Params['user_parameters']['user_id']);
$tpl->set('onlineUsers', $onlineUsers);
echo json_encode(array('user' => $tpl->fetch()));
} catch (Exception $e) {
echo json_encode(array('user' => '-'));
}
exit;
示例6: __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_front':
$this->wait_time_front = erLhcoreClassChat::formatSeconds($this->wait_time);
return $this->wait_time_front;
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 '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 'screenshot':
$this->screenshot = false;
if ($this->screenshot_id > 0) {
try {
$this->screenshot = erLhcoreClassModelChatFile::fetch($this->screenshot_id);
} catch (Exception $e) {
}
}
return $this->screenshot;
break;
case 'unread_time':
$diff = time() - $this->last_user_msg_time;
$hours = floor($diff / 3600);
$minits = floor(($diff - $hours * 3600) / 60);
$seconds = $diff - $hours * 3600 - $minits * 60;
$this->unread_time = array('hours' => $hours, 'minits' => $minits, 'seconds' => $seconds);
return $this->unread_time;
break;
case 'user_tz_identifier_time':
$date = new DateTime(null, new DateTimeZone($this->user_tz_identifier));
$this->user_tz_identifier_time = $date->format(erLhcoreClassModule::$dateHourFormat);
return $this->user_tz_identifier_time;
//.........这里部分代码省略.........
示例7: __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':
//.........这里部分代码省略.........
示例8: handleMessageFromOperator
/**
* handles messages from operator.
* Workflow sounds like that
* 1. Check that we can determine an operator
* 2. Check to what messages was send, to chat or online visitor
* 3. If message is send to online visitor check perphaps visitor has active chat
* 4. If active chat found, send a message
* 5. If active chat not found send message as proactive invitation
*
* @param array $params
*
*/
public static function handleMessageFromOperator($params)
{
try {
$parts = explode('.', $params['receiver']);
if (isset($parts[1])) {
$xmppUserLogin = $params['sender'] . '@' . $params['server'];
$xmppUser = erLhcoreClassModelXMPPAccount::findOne(array('filter' => array('username' => $xmppUserLogin)));
if ($xmppUser !== false) {
// It's message to online visitor
if (isset($parts[2]) && $parts[2] == 'chat') {
$chat = erLhcoreClassModelChat::fetch($parts[1]);
$user = $xmppUser->user;
// Messages to chat is only send if chat is not accepted or sender is chat owner
if ($chat->user_id == $user->id || $chat->user_id == 0) {
self::sendMessageToChat($chat, $xmppUser, $params['body']);
} else {
$xmppService = erLhcoreClassModule::getExtensionInstance('erLhcoreClassExtensionXmppservice');
$xmppService->sendMessageToOperatorAsUserByChat(array('xmpp_account_operator' => $xmppUser, 'chat' => $chat, 'msg' => '[[System Assistant]] Chat was already accepted by [' . $chat->user . '], your messages are now ignored'));
}
} else {
$visitorId = $parts[1];
$visitor = erLhcoreClassModelChatOnlineUser::fetch($visitorId);
// We do not have any active chat
if ($visitor->chat === false || !in_array($visitor->chat->status, array(erLhcoreClassModelChat::STATUS_ACTIVE_CHAT, erLhcoreClassModelChat::STATUS_PENDING_CHAT))) {
$visitor->operator_message = $params['body'];
$visitor->message_seen = 0;
$visitor->invitation_id = -1;
$visitor->operator_user_id = $xmppUser->user_id;
$visitor->saveThis();
// We have active chat
} else {
self::sendMessageToChat($visitor->chat, $xmppUser, $params['body']);
}
}
} else {
throw new Exception('Could not find a operator');
}
} else {
throw new Exception('Could not extract visitor ID');
}
} catch (Exception $e) {
throw $e;
}
}