本文整理汇总了PHP中erLhcoreClassModelChat类的典型用法代码示例。如果您正苦于以下问题:PHP erLhcoreClassModelChat类的具体用法?PHP erLhcoreClassModelChat怎么用?PHP erLhcoreClassModelChat使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了erLhcoreClassModelChat类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: unansweredChatWorkflow
public static function unansweredChatWorkflow(erLhcoreClassModelChat &$chat)
{
$chat->na_cb_executed = 1;
$chat->updateThis();
// Execute callback if it exists
$extensions = erConfigClassLhConfig::getInstance()->getSetting('site', 'extensions');
$instance = erLhcoreClassSystem::instance();
erLhcoreClassChatEventDispatcher::getInstance()->dispatch('chat.unread_chat_workflow', array('chat' => &$chat));
foreach ($extensions as $ext) {
$callbackFile = $instance->SiteDir . '/extension/' . $ext . '/callbacks/unanswered_chat.php';
if (file_exists($callbackFile)) {
include $callbackFile;
}
}
}
开发者ID:Joeboyc2,项目名称:livehelperchat,代码行数:15,代码来源:lhchatworkflow.php
示例2: __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;
}
}
开发者ID:sirromas,项目名称:medical,代码行数:28,代码来源:erlhcoreclassmodelcobrowse.php
示例3: __get
public function __get($var)
{
switch ($var) {
case 'chat':
$this->chat = erLhcoreClassModelChat::fetch($this->chat_id);
return $this->chat;
break;
default:
break;
}
}
开发者ID:detain,项目名称:livehelperchat,代码行数:11,代码来源:erlhcoreclassmodelchatpaid.php
示例4: __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;
}
}
开发者ID:paisdelconocimiento,项目名称:glpi-smartcities,代码行数:17,代码来源:erlhcoreclassmodelcobrowse.php
示例5: __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;
}
}
开发者ID:Topspot,项目名称:livehelperchat,代码行数:41,代码来源:erlhcoreclassmodelchatfile.php
示例6: __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;
}
}
开发者ID:Adeelgill,项目名称:livehelperchat,代码行数:21,代码来源:erlhcoreclassmodelchatbox.php
示例7: 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;
}
开发者ID:sudogitguy,项目名称:livehelperchat,代码行数:17,代码来源:lhchat.php
示例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);
开发者ID:Adeelgill,项目名称:livehelperchat,代码行数:31,代码来源:fill.php
示例9: updateInitialChatAttributes
/**
* If user was redirected to contact form and he changed some default attributes we change then in intial chat
* */
public static function updateInitialChatAttributes(erLhcoreClassModelChat &$prefillChat, erLhcoreClassModelChat $currentChat)
{
$attributesPrefill = array('nick', 'email', 'phone');
$attrChanged = false;
foreach ($attributesPrefill as $attr) {
if ($prefillChat->{$attr} == '' && $currentChat->{$attr} != '') {
$prefillChat->{$attr} = $currentChat->{$attr};
$attrChanged = true;
}
}
if ($attrChanged) {
$prefillChat->saveThis();
}
}
开发者ID:yhchiu,项目名称:livehelperchat,代码行数:17,代码来源:lhchatvalidator.php
示例10: 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;
}
}
开发者ID:sudogitguy,项目名称:livehelperchat,代码行数:78,代码来源:lhchatbox.php
示例11: isset
}
// Leave a message functionality
$leaveamessage = (string) $Params['user_parameters_unordered']['leaveamessage'] == 'true' || isset($startDataFields['force_leave_a_message']) && $startDataFields['force_leave_a_message'] == true ? true : false;
$tpl->set('forceoffline', false);
$additionalParams = array();
if ((string) $Params['user_parameters_unordered']['offline'] == 'true' && $leaveamessage == true) {
$additionalParams['offline'] = true;
$tpl->set('forceoffline', true);
}
$tpl->set('leaveamessage', $leaveamessage);
if (isset($_POST['StartChat']) && $disabled_department === false) {
// Validate post data
$Errors = erLhcoreClassChatValidator::validateStartChat($inputData, $startDataFields, $chat, $additionalParams);
if (count($Errors) == 0 && !isset($_POST['switchLang'])) {
$chat->setIP();
erLhcoreClassModelChat::detectLocation($chat);
$statusGeoAdjustment = erLhcoreClassChat::getAdjustment(erLhcoreClassModelChatConfig::fetch('geoadjustment_data')->data_value, $inputData->vid);
if ($statusGeoAdjustment['status'] == 'hidden') {
// This should never happen
exit('Chat not available in your country');
}
if (isset($additionalParams['offline']) && $additionalParams['offline'] == true || $statusGeoAdjustment['status'] == 'offline') {
erLhcoreClassChatMail::sendMailRequest($inputData, $chat, array('chatprefill' => isset($chatPrefill) ? $chatPrefill : false));
if (isset($chatPrefill) && $chatPrefill instanceof erLhcoreClassModelChat) {
erLhcoreClassChatValidator::updateInitialChatAttributes($chatPrefill, $chat);
}
erLhcoreClassChatEventDispatcher::getInstance()->dispatch('chat.chat_offline_request', array('input_data' => $inputData, 'chat' => $chat, 'prefill' => array('chatprefill' => isset($chatPrefill) ? $chatPrefill : false)));
$Result['parent_messages'][] = 'lh_callback:offline_request_cb';
$tpl->set('request_send', true);
} else {
$chat->time = time();
开发者ID:paisdelconocimiento,项目名称:glpi-smartcities,代码行数:31,代码来源:chatwidget.php
示例12: assignChatOsTicketId
public function assignChatOsTicketId(erLhcoreClassModelChat &$chat, $ticketId)
{
/**
* Remember created issue id
* */
$variablesArray = $chat->chat_variables_array;
$variablesArray['os_ticket_id'] = $ticketId;
$chat->chat_variables = json_encode($variablesArray);
$chat->chat_variables_array = $variablesArray;
$chat->updateThis();
}
开发者ID:SetRandom,项目名称:osTicket,代码行数:11,代码来源:bootstrap.php
示例13: __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);
//.........这里部分代码省略.........
开发者ID:sudogitguy,项目名称:livehelperchat,代码行数:101,代码来源:erlhcoreclassmodelchatonlineuser.php
示例14: 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);
开发者ID:remdex,项目名称:livehelperchat,代码行数:31,代码来源:fillwidget.php
示例15: 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);
开发者ID:mdb-webdev,项目名称:livehelperchat,代码行数:31,代码来源:checkchatstatus.php
示例16: 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;
开发者ID:detain,项目名称:livehelperchat,代码行数:17,代码来源:fetchchatmessages.php
示例17: array
$validationFields = array();
$validationFields['Message'] = new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'unsafe_raw');
$form = new ezcInputForm(INPUT_POST, $validationFields);
$Errors = array();
if (!$form->hasValidData('Message') || $form->Message == '') {
$Errors[] = erTranslationClassLhTranslation::getInstance()->getTranslation('chat/startchat', 'Please enter your message');
} elseif ($form->hasValidData('Message')) {
$msg->msg = $form->Message;
}
if ($form->hasValidData('Message') && $form->Message != '' && mb_strlen($form->Message) > (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');
}
erLhcoreClassChatEventDispatcher::getInstance()->dispatch('chat.before_startchatwithoperator', array('errors' => &$Errors));
if (count($Errors) == 0) {
$currentUserData = $currentUser->getUserData();
$chat = new erLhcoreClassModelChat();
$chat->time = time();
$chat->status = erLhcoreClassModelChat::STATUS_OPERATORS_CHAT;
$chat->setIP();
$chat->hash = erLhcoreClassChat::generateHash();
$chat->referrer = '';
$chat->session_referrer = '';
$chat->nick = $currentUserData->name . ' ' . $currentUserData->surname;
$chat->user_id = $user->id;
// Assign chat to receiver operator, this way he will get permission to open chat
$chat->dep_id = erLhcoreClassUserDep::getDefaultUserDepartment();
// Set default department to chat creator, this way current user will get permission to open it
// Store chat
erLhcoreClassChat::getSession()->save($chat);
// Store User Message
$msg->chat_id = $chat->id;
开发者ID:detain,项目名称:livehelperchat,代码行数:31,代码来源:startchatwithoperator.php
示例18: 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;
开发者ID:detain,项目名称:livehelperchat,代码行数:17,代码来源:fetchchat.php
示例19: date_default_timezone_set
if ((string) $Params['user_parameters_unordered']['vid'] != '') {
$inputData->vid = (string) $Params['user_parameters_unordered']['vid'];
}
// Assign department instantly
if ($inputData->departament_id > 0) {
$tpl->set('department', $inputData->departament_id);
} else {
$tpl->set('department', false);
}
// Set time zone if script detected it
if ($userInstance->visitor_tz != '') {
erLhcoreClassModule::$defaultTimeZone = $userInstance->visitor_tz;
date_default_timezone_set(erLhcoreClassModule::$defaultTimeZone);
}
$tpl->set('playsound', (string) $Params['user_parameters_unordered']['playsound'] == 'true' && !isset($_POST['askQuestion']) && erLhcoreClassModelChatConfig::fetch('sound_invitation')->current_value == 1);
$chat = new erLhcoreClassModelChat();
$modeAppendTheme = '';
if (isset($Params['user_parameters_unordered']['theme']) && (int) $Params['user_parameters_unordered']['theme'] > 0) {
try {
$theme = erLhAbstractModelWidgetTheme::fetch($Params['user_parameters_unordered']['theme']);
$Result['theme'] = $theme;
$modeAppendTheme = '/(theme)/' . $theme->id;
} catch (Exception $e) {
}
} else {
$defaultTheme = erLhcoreClassModelChatConfig::fetch('default_theme_id')->current_value;
if ($defaultTheme > 0) {
try {
$theme = erLhAbstractModelWidgetTheme::fetch($defaultTheme);
$Result['theme'] = $theme;
$modeAppendTheme = '/(theme)/' . $theme->id;
开发者ID:p4prawin,项目名称:livechat,代码行数:31,代码来源:readoperatormessage.php
示例20: __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 = '-';
//.........这里部分代码省略.........
开发者ID:kenjiro7,项目名称:livehelperchat,代码行数:101,代码来源:erlhcoreclassmodelchatonlineuser.php
注:本文中的erLhcoreClassModelChat类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论