isOnline() public static method

public static isOnline ( $dep_id = false, $exclipic = false, $params = [] )
 public function __get($var)
 {
     switch ($var) {
         case 'is_online':
             $this->is_online = erLhcoreClassChat::isOnline($this->id);
             return $this->is_online;
             break;
         case 'is_online_exclipic':
             $this->is_online_exclipic = erLhcoreClassChat::isOnline($this->id, true);
             return $this->is_online_exclipic;
             break;
         case 'inform_options_array':
             $this->inform_options_array = $this->inform_options != '' ? unserialize($this->inform_options) : array();
             return $this->inform_options_array;
             break;
         case 'can_delete':
             $this->can_delete = erLhcoreClassChat::getCount(array('filter' => array('dep_id' => $this->id))) == 0;
             return $this->can_delete;
             break;
         case 'department_transfer':
             $this->department_transfer = false;
             if ($this->department_transfer_id > 0) {
                 try {
                     $this->department_transfer = self::fetch($this->department_transfer_id, true);
                 } catch (Exception $e) {
                 }
             }
             return $this->department_transfer;
             break;
         case 'start_hour_front':
             return floor($this->start_hour / 100);
             break;
         case 'start_minutes_front':
             return $this->start_hour - $this->start_hour_front * 100;
             break;
         case 'end_hour_front':
             return floor($this->end_hour / 100);
             break;
         case 'end_minutes_front':
             return $this->end_hour - $this->end_hour_front * 100;
             break;
         default:
             break;
     }
 }
        include erLhcoreClassDesign::designtpl('lhchat/getstatus/widget_geo_adjustment.tpl.php');
        if ($exitTemplate == true) {
            return;
        }
        ?>

<?php 
        if (isset($errors)) {
            ?>
		<?php 
            include erLhcoreClassDesign::designtpl('lhkernel/validation_error.tpl.php');
        }
        ?>

<?php 
        if ($leaveamessage == false || ($forceoffline === false && erLhcoreClassChat::isOnline($department, false, array('ignore_user_status' => (int) erLhcoreClassModelChatConfig::fetch('ignore_user_status')->current_value, 'online_timeout' => (int) erLhcoreClassModelChatConfig::fetch('sync_sound_settings')->data['online_timeout']))) === true) {
            ?>

<h4><?php 
            echo erTranslationClassLhTranslation::getInstance()->getTranslation('chat/startchat', 'Fill out this form to start a chat');
            ?>
</h4>

<form id="form-start-chat" method="post" action="<?php 
            echo erLhcoreClassDesign::baseurl('chat/startchat');
            $department !== false ? print '/(department)/' . $department : '';
            $input_data->priority !== false ? print '/(priority)/' . $input_data->priority : '';
            $input_data->vid !== false ? print '/(vid)/' . htmlspecialchars($input_data->vid) : '';
            $input_data->hash_resume !== false ? print '/(hash_resume)/' . htmlspecialchars($input_data->hash_resume) : '';
            echo $append_mode_theme;
            ?>
             $msg->chat_id = $chat->id;
             $msg->user_id = -1;
             $msg->time = time();
             erLhcoreClassChat::getSession()->save($msg);
             // We do not store last msg time for chat here, because in any case none of opeators has opened it
             $contactRedirected = true;
             if ($chat->status_sub != erLhcoreClassModelChat::STATUS_SUB_CONTACT_FORM) {
                 $chat->status_sub = erLhcoreClassModelChat::STATUS_SUB_CONTACT_FORM;
                 $chat->updateThis();
             }
         } else {
             erLhcoreClassChatWorkflow::autoAssign($chat, $department);
         }
     }
 }
 if (erLhcoreClassChat::isOnline($chat->dep_id, false, array('online_timeout' => (int) erLhcoreClassModelChatConfig::fetch('sync_sound_settings')->data['online_timeout']))) {
     $tpl->set('is_online', true);
 } else {
     $tpl->set('is_online', false);
 }
 if ($chat->chat_initiator == erLhcoreClassModelChat::CHAT_INITIATOR_PROACTIVE) {
     $tpl->set('is_proactive_based', true);
 } else {
     $tpl->set('is_proactive_based', false);
 }
 if ($chat->status == erLhcoreClassModelChat::STATUS_ACTIVE_CHAT) {
     $activated = 'true';
     $tpl->set('is_activated', true);
     $ott = $chat->user !== false ? $chat->user->name_support . ' ' . erTranslationClassLhTranslation::getInstance()->getTranslation('chat/chat', 'is typing now...') : erTranslationClassLhTranslation::getInstance()->getTranslation('chat/chat', 'Operator is typing now...');
 } else {
     $tpl->set('is_activated', false);
 public function __get($var)
 {
     switch ($var) {
         case 'is_online':
             $this->is_online = erLhcoreClassChat::isOnline($this->id);
             return $this->is_online;
             break;
         case 'is_online_exclipic':
             $this->is_online_exclipic = erLhcoreClassChat::isOnline($this->id, true);
             return $this->is_online_exclipic;
             break;
         case 'inform_options_array':
             $this->inform_options_array = $this->inform_options != '' ? unserialize($this->inform_options) : array();
             return $this->inform_options_array;
             break;
         case 'can_delete':
             $this->can_delete = erLhcoreClassChat::getCount(array('filter' => array('dep_id' => $this->id))) == 0;
             return $this->can_delete;
             break;
         case 'department_transfer':
             $this->department_transfer = false;
             if ($this->department_transfer_id > 0) {
                 try {
                     $this->department_transfer = self::fetch($this->department_transfer_id, true);
                 } catch (Exception $e) {
                 }
             }
             return $this->department_transfer;
             break;
         case 'start_hour_front':
             return floor($this->start_hour / 100);
             break;
         case 'start_minutes_front':
             return $this->start_hour - $this->start_hour_front * 100;
             break;
         case 'end_hour_front':
             return floor($this->end_hour / 100);
             break;
         case 'end_minutes_front':
             return $this->end_hour - $this->end_hour_front * 100;
             break;
         case 'mod_start_hour_front':
         case 'tud_start_hour_front':
         case 'wed_start_hour_front':
         case 'thd_start_hour_front':
         case 'frd_start_hour_front':
         case 'sad_start_hour_front':
         case 'sud_start_hour_front':
             $startHourName = str_replace('_start_hour_front', '', $var) . '_start_hour';
             return $this->{$startHourName} != -1 ? floor($this->{$startHourName} / 100) : '';
             break;
         case 'mod_start_minutes_front':
         case 'tud_start_minutes_front':
         case 'wed_start_minutes_front':
         case 'thd_start_minutes_front':
         case 'frd_start_minutes_front':
         case 'sad_start_minutes_front':
         case 'sud_start_minutes_front':
             $startHourName = str_replace('_start_minutes_front', '', $var) . '_start_hour';
             $startHourFrontName = str_replace('_start_minutes_front', '', $var) . '_start_hour_front';
             return $this->{$startHourName} != -1 ? $this->{$startHourName} - $this->{$startHourFrontName} * 100 : '';
             break;
         case 'mod_end_hour_front':
         case 'tud_end_hour_front':
         case 'wed_end_hour_front':
         case 'thd_end_hour_front':
         case 'frd_end_hour_front':
         case 'sad_end_hour_front':
         case 'sud_end_hour_front':
             $endHourName = str_replace('_end_hour_front', '', $var) . '_end_hour';
             return $this->{$endHourName} != -1 ? floor($this->{$endHourName} / 100) : '';
             break;
         case 'mod_end_minutes_front':
         case 'tud_end_minutes_front':
         case 'wed_end_minutes_front':
         case 'thd_end_minutes_front':
         case 'frd_end_minutes_front':
         case 'sad_end_minutes_front':
         case 'sud_end_minutes_front':
             $endHourName = str_replace('_end_minutes_front', '', $var) . '_end_hour';
             $endHourFrontName = str_replace('_end_minutes_front', '', $var) . '_end_hour_front';
             return $this->{$endHourName} != -1 ? $this->{$endHourName} - $this->{$endHourFrontName} * 100 : '';
             break;
         default:
             break;
     }
 }
<?php

header('content-type: application/json; charset=utf-8');
header('Access-Control-Allow-Origin: *');
header('Access-Control-Allow-Headers: Origin, X-Requested-With, Content-Type, Accept');
$json = json_encode(array('isonline' => erLhcoreClassChat::isOnline((int) $Params['user_parameters']['department_id'], true, array('online_timeout' => (int) erLhcoreClassModelChatConfig::fetch('sync_sound_settings')->data['online_timeout']))));
if (isset($_GET['callback'])) {
    echo $_GET['callback'] . '(' . $json . ')';
} else {
    echo $json;
}
exit;
    
    <select class="form-control" name="DepartamentID" id="id_DepartamentID">
        <?php 
    if (isset($theme) && $theme !== false && $theme->department_select != '') {
        ?>
            <option value="-1"><?php 
        echo htmlspecialchars($theme->department_select);
        ?>
</option>
        <?php 
    }
    ?>
        <?php 
    $departments = erLhcoreClassDepartament::sortByStatus($departments);
    foreach ($departments as $departament) {
        $isOnline = erLhcoreClassChat::isOnline($departament->id, false, array('ignore_user_status' => (int) erLhcoreClassModelChatConfig::fetch('ignore_user_status')->current_value, 'online_timeout' => (int) erLhcoreClassModelChatConfig::fetch('sync_sound_settings')->data['online_timeout']));
        ?>
            <?php 
        if ($departament->visible_if_online == 1 && $isOnline === true || $departament->visible_if_online == 0) {
            ?>
            <option data-attr-online="<?php 
            if ($isOnline === false) {
                ?>
false<?php 
            } else {
                ?>
true<?php 
            }
            ?>
" <?php 
            if ($isOnline === false) {
示例#7
0
<?php

header('content-type: application/json; charset=utf-8');
header('Access-Control-Allow-Origin: *');
header('Access-Control-Allow-Headers: Origin, X-Requested-With, Content-Type, Accept');
$json = json_encode(array('isonline' => erLhcoreClassChat::isOnline(false, false, array('online_timeout' => (int) erLhcoreClassModelChatConfig::fetch('sync_sound_settings')->data['online_timeout']))));
if (isset($_GET['callback'])) {
    echo $_GET['callback'] . '(' . $json . ')';
} else {
    echo $json;
}
exit;
示例#8
0
<?php

header('content-type: application/json; charset=utf-8');
header('Access-Control-Allow-Origin: *');
header('Access-Control-Allow-Headers: Origin, X-Requested-With, Content-Type, Accept');
erLhcoreClassRestAPIHandler::outputResponse(array('isonline' => erLhcoreClassChat::isOnline(false, false, array('online_timeout' => (int) erLhcoreClassModelChatConfig::fetch('sync_sound_settings')->data['online_timeout']))));
exit;