本文整理汇总了PHP中erLhcoreClassModelChat类的典型用法代码示例。如果您正苦于以下问题:PHP erLhcoreClassModelChat类的具体用法?PHP erLhcoreClassModelChat怎么用?PHP erLhcoreClassModelChat使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了erLhcoreClassModelChat类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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;
}
}
}
示例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;
}
}
示例3: __get
public function __get($var)
{
switch ($var) {
case 'chat':
$this->chat = erLhcoreClassModelChat::fetch($this->chat_id);
return $this->chat;
break;
default:
break;
}
}
示例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;
}
}
示例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;
}
}
示例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;
}
}
示例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;
}
示例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: 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();
}
}
示例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;
}
}
示例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();
示例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();
}
示例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);
//.........这里部分代码省略.........
示例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);
示例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);