本文整理汇总了PHP中erLhcoreClassModelChat::fetch方法的典型用法代码示例。如果您正苦于以下问题:PHP erLhcoreClassModelChat::fetch方法的具体用法?PHP erLhcoreClassModelChat::fetch怎么用?PHP erLhcoreClassModelChat::fetch使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类erLhcoreClassModelChat
的用法示例。
在下文中一共展示了erLhcoreClassModelChat::fetch方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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 'chat':
$this->chat = erLhcoreClassModelChat::fetch($this->chat_id);
return $this->chat;
break;
default:
break;
}
}
示例3: __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 'chat':
$this->chat = erLhcoreClassModelChat::fetch($this->chat_id);
return $this->chat;
break;
default:
break;
}
}
示例4: __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;
}
}
示例5: __get
public function __get($var)
{
switch ($var) {
case 'chat':
$this->chat = false;
if ($this->chat_id > 0) {
try {
$this->chat = erLhcoreClassModelChat::fetch($this->chat_id);
} catch (Exception $e) {
erLhcoreClassChatbox::getSession()->delete($this);
}
} else {
$this->chat = new erLhcoreClassModelChat();
$this->chat->hash = erLhcoreClassChat::generateHash();
}
return $this->chat;
break;
default:
break;
}
}
示例6: catch
$tpl->set('theme', $theme);
} catch (Exception $e) {
}
}
try {
if (is_numeric((string) $Params['user_parameters_unordered']['chatid']) && $Params['user_parameters_unordered']['chatid'] > 0) {
if ((string) $Params['user_parameters_unordered']['hash'] != '') {
$hash = $Params['user_parameters_unordered']['hash'];
}
if (is_numeric($Params['user_parameters_unordered']['chatid'])) {
$chat = erLhcoreClassModelChat::fetch($Params['user_parameters_unordered']['chatid']);
}
} else {
if ((string) $Params['user_parameters_unordered']['hash'] != '') {
list($chatID, $hash) = explode('_', $Params['user_parameters_unordered']['hash']);
$chat = erLhcoreClassModelChat::fetch($chatID);
}
}
erLhcoreClassChat::setTimeZoneByChat($chat);
if ($chat->hash == $hash) {
$survey = erLhAbstractModelSurvey::fetch($Params['user_parameters_unordered']['survey']);
if ($survey instanceof erLhAbstractModelSurvey) {
$surveyItem = erLhAbstractModelSurveyItem::getInstance($chat, $survey);
if (isset($_POST['Vote'])) {
$errors = erLhcoreClassSurveyValidator::validateSurvey($surveyItem, $survey);
if (empty($errors)) {
$surveyItem->saveOrUpdate();
erLhcoreClassChatEventDispatcher::getInstance()->dispatch('survey.filled', array('chat' => &$chat, 'survey' => $survey, 'survey_item' => &$surveyItem));
$tpl->set('just_stored', true);
} else {
$tpl->set('errors', $errors);
示例7: catch
$tpl->set('theme', $theme);
} catch (Exception $e) {
}
} else {
$defaultTheme = erLhcoreClassModelChatConfig::fetch('default_theme_id')->current_value;
if ($defaultTheme > 0) {
try {
$theme = erLhAbstractModelWidgetTheme::fetch($defaultTheme);
$tpl->set('theme', $theme);
} catch (Exception $e) {
}
}
}
$responseArray = array();
try {
$chat = erLhcoreClassModelChat::fetch($Params['user_parameters']['chat_id']);
if ($chat->hash == $Params['user_parameters']['hash']) {
// Main unasnwered chats callback
if ($chat->na_cb_executed == 0 && $chat->status == erLhcoreClassModelChat::STATUS_PENDING_CHAT && erLhcoreClassModelChatConfig::fetch('run_unaswered_chat_workflow')->current_value > 0) {
$delay = time() - erLhcoreClassModelChatConfig::fetch('run_unaswered_chat_workflow')->current_value * 60;
if ($chat->time < $delay) {
erLhcoreClassChatWorkflow::unansweredChatWorkflow($chat);
}
}
if ($chat->nc_cb_executed == 0 && $chat->status == erLhcoreClassModelChat::STATUS_PENDING_CHAT) {
$department = $chat->department;
if ($department !== false) {
$options = $department->inform_options_array;
$delay = time() - $department->inform_delay;
if ($chat->time < $delay) {
erLhcoreClassChatWorkflow::newChatInformWorkflow(array('department' => $department, 'options' => $options), $chat);
示例8: catch
$theme = erLhAbstractModelWidgetTheme::fetch($defaultTheme);
$Result['theme'] = $theme;
} catch (Exception $e) {
}
}
}
$tpl = erLhcoreClassTemplate::getInstance('lhsurvey/fill.tpl.php');
if (isset($Result['theme'])) {
$tpl->set('theme', $Result['theme']);
}
try {
if ((string) $Params['user_parameters_unordered']['hash'] != '') {
$hash = $Params['user_parameters_unordered']['hash'];
}
if (is_numeric($Params['user_parameters_unordered']['chatid'])) {
$chat = erLhcoreClassModelChat::fetch($Params['user_parameters_unordered']['chatid']);
}
erLhcoreClassChat::setTimeZoneByChat($chat);
if ($chat->hash == $hash) {
$survey = erLhAbstractModelSurvey::fetch($Params['user_parameters_unordered']['survey']);
$surveyItem = erLhAbstractModelSurveyItem::getInstance($chat, $survey);
if (isset($_POST['Vote'])) {
$errors = erLhcoreClassSurveyValidator::validateSurvey($surveyItem, $survey);
if (empty($errors)) {
$surveyItem->saveOrUpdate();
$tpl->set('just_stored', true);
} else {
$tpl->set('errors', $errors);
}
}
$tpl->set('chat', $chat);
示例9: array_shift
$inputData->departament_id = array_shift($Params['user_parameters_unordered']['department']);
} else {
$inputData->departament_id = 0;
}
if (is_array($Params['user_parameters_unordered']['department'])) {
erLhcoreClassChat::validateFilterIn($Params['user_parameters_unordered']['department']);
$inputData->departament_id_array = $Params['user_parameters_unordered']['department'];
}
$inputData->accept_tos = false;
$inputData->question = '';
$inputData->operator = (int) $Params['user_parameters_unordered']['operator'];
// Perhaps user was redirected to leave a message form because chat was not acceptend in some time interval
if ((string) $Params['user_parameters_unordered']['chatprefill'] != '') {
list($chatID, $hash) = explode('_', $Params['user_parameters_unordered']['chatprefill']);
try {
$chatPrefill = erLhcoreClassModelChat::fetch($chatID);
if ($chatPrefill->hash == $hash) {
$inputData->chatprefill = $Params['user_parameters_unordered']['chatprefill'];
$inputData->username = $chatPrefill->nick;
$inputData->departament_id = $chatPrefill->dep_id;
$inputData->email = $chatPrefill->email;
$inputData->phone = $chatPrefill->phone;
$inputData->accept_tos = true;
$inputData->question = erLhcoreClassChat::getFirstUserMessage($chatPrefill->id);
} else {
unset($chatPrefill);
}
} catch (Exception $e) {
// Do nothing
}
}
示例10: array
if (isset($_POST['chats']) && is_array($_POST['chats']) && count($_POST['chats']) > 0) {
$ReturnMessages = array();
$ReturnStatuses = array();
$tpl = erLhcoreClassTemplate::getInstance('lhchat/syncadmin.tpl.php');
$currentUser = erLhcoreClassUser::instance();
if (!isset($_SERVER['HTTP_X_CSRFTOKEN']) || !$currentUser->validateCSFRToken($_SERVER['HTTP_X_CSRFTOKEN'])) {
echo json_encode(array('error' => 'true', 'result' => 'Invalid CSRF Token'));
exit;
}
$db = ezcDbInstance::get();
while (true) {
$db->beginTransaction();
try {
foreach ($_POST['chats'] as $chat_id_list) {
list($chat_id, $MessageID) = explode(',', $chat_id_list);
$Chat = erLhcoreClassModelChat::fetch($chat_id);
$Chat->updateIgnoreColumns = array('last_msg_id');
if (isset($hasAccessToReadArray[$chat_id]) || erLhcoreClassChat::hasAccessToRead($Chat)) {
$hasAccessToReadArray[$chat_id] = true;
if ($Chat->last_msg_id > (int) $MessageID && count($Messages = erLhcoreClassChat::getPendingMessages($chat_id, $MessageID)) > 0) {
// If chat had flag that it contains unread messages set to 0
if ($Chat->has_unread_messages == 1 || $Chat->unread_messages_informed == 1) {
$Chat->has_unread_messages = 0;
$Chat->unread_messages_informed = 0;
$Chat->saveThis();
}
$newMessagesNumber = count($Messages);
$tpl->set('messages', $Messages);
$tpl->set('chat', $Chat);
$msgText = '';
if ($userOwner == 'true') {
示例11: __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 = '-';
//.........这里部分代码省略.........
示例12: canReopenDirectly
public static function canReopenDirectly($params = array())
{
if (($chatPart = CSCacheAPC::getMem()->getSession('chat_hash_widget_resume', true)) !== false) {
try {
$parts = explode('_', $chatPart);
$chat = erLhcoreClassModelChat::fetch($parts[0]);
if (($chat->last_user_msg_time > time() - 600 || $chat->last_user_msg_time == 0) && (!isset($params['reopen_closed']) || $params['reopen_closed'] == 1 || $params['reopen_closed'] == 0 && $chat->status != erLhcoreClassModelChat::STATUS_CLOSED_CHAT)) {
return array('id' => $parts[0], 'hash' => $parts[1]);
} else {
return false;
}
} catch (Exception $e) {
return false;
}
}
return false;
}
示例13: header
<?php
header('Access-Control-Allow-Origin: *');
header('Access-Control-Allow-Headers: Origin, X-Requested-With, Content-Type, Accept');
header('Content-Type: application/json');
try {
erLhcoreClassRestAPIHandler::validateRequest();
$chat = erLhcoreClassModelChat::fetch((int) $_GET['chat_id']);
if (erLhcoreClassRestAPIHandler::hasAccessToRead($chat) == true) {
erLhcoreClassRestAPIHandler::outputResponse(array('error' => false, 'chat' => erLhcoreClassModelChat::fetch((int) $_GET['chat_id'])));
} else {
throw new Exception(erTranslationClassLhTranslation::getInstance()->getTranslation('lhrestapi/validation', 'You do not have permission to read this chat!'));
}
} catch (Exception $e) {
echo json_encode(array('error' => true, 'result' => $e->getMessage()));
}
exit;
示例14: header
<?php
header('Access-Control-Allow-Origin: *');
header('Access-Control-Allow-Headers: Origin, X-Requested-With, Content-Type, Accept');
header('Content-Type: application/json');
try {
erLhcoreClassRestAPIHandler::validateRequest();
$chat = erLhcoreClassModelChat::fetch((int) $_GET['chat_id']);
if (erLhcoreClassRestAPIHandler::hasAccessToRead($chat) == true) {
erLhcoreClassRestAPIHandler::outputResponse(array('error' => false, 'messages' => erLhcoreClassChat::getPendingMessages($chat->id, isset($_GET['last_message_id']) ? (int) $_GET['last_message_id'] : 0)));
} else {
throw new Exception(erTranslationClassLhTranslation::getInstance()->getTranslation('lhrestapi/validation', 'You do not have permission to read this chat!'));
}
} catch (Exception $e) {
echo json_encode(array('error' => true, 'result' => $e->getMessage()));
}
exit;
示例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 '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 = '-';
if ($this->visitor_tz != '') {
$date = new DateTime(null, new DateTimeZone($this->visitor_tz));
$this->visitor_tz_time = $date->format(erLhcoreClassModule::$dateHourFormat);
//.........这里部分代码省略.........