Example #1
0
 public function unclaimedSessions()
 {
     $user = $this->getIdentity();
     if (empty($user->id)) {
         return;
     }
     $unclaimed = \Support\Models\ChatSessions::unclaimed();
     $is_online = \Support\Models\Operators::isOnline($user);
     echo $this->outputJson($this->getJsonResponse(array('alert' => $is_online ? true : false, 'count' => count($unclaimed), 'result' => $this->theme->renderView('Support/Admin/Views::livechat/fragment_unclaimed_sessions.php'))));
 }
Example #2
0
 protected function preAdmin()
 {
     parent::preAdmin();
     if (class_exists('\\Minify\\Factory')) {
         \Minify\Factory::registerPath($this->dir . "/src/");
         $files = array('Support/Assets/js/poller.js', 'Support/Assets/js/admin.js');
         foreach ($files as $file) {
             \Minify\Factory::js($file);
         }
         $files = array('Support/Assets/css/admin.css');
         foreach ($files as $file) {
             \Minify\Factory::css($file);
         }
     }
     if ($op = \Support\Models\Operators::isOnline($this->auth->getIdentity())) {
         if (\Dsc\System::instance()->get('input')->get('ping', null, 'int') != 1) {
             $op->markActive();
         }
     }
     \Dsc\System::instance()->getDispatcher()->addListener(\Support\Listeners\Users::instance());
     \Support\Models\ChatSessions::throttledCleanup();
 }
Example #3
0
 public function openSessions()
 {
     $sessions = \Support\Models\ChatSessions::fetchForAdmin($this->id);
     return count($sessions);
 }
<?php

foreach ($visitors = \Dsc\Mongo\Collections\Sessions::fetchActiveVisitors() as $visitor) {
    $chat_session = \Support\Models\ChatSessions::fetchForSession($visitor->session_id);
    $class = null;
    if (!empty($chat_session->id)) {
        if ($chat_session->status == 'claimed') {
            $class = "list-group-item-success";
        } elseif ($chat_session->status == 'open-request') {
            $class = "list-group-item-danger";
        }
    }
    ?>
            
<div class="list-group-item <?php 
    echo $class;
    ?>
">
    <div class="row">
        <div class="col-xs-10">
            <?php 
    if (!empty($chat_session->user_name)) {
        ?>
                <div><?php 
        echo $chat_session->user_name;
        ?>
, <small><?php 
        echo $chat_session->user_email;
        ?>
</small></div>
            <?php 
Example #5
0
<div class="pull-left">
    <div class="clearfix">
        <a class="btn btn-default" href="./admin/support/live-chat"> Live Chat </a>
        &nbsp;
        <span id="unclaimed-sessions" class="poller" data-action="SupportGetUnclaimedSessions">
            <?php 
echo $this->renderView('Support/Admin/Views::livechat/fragment_unclaimed_sessions.php');
?>
        </div>
    </div>
</div>

<?php 
/* ?>foreach active admin session, display a tab, right-justified */
foreach ($chat_sessions = \Support\Models\ChatSessions::fetchForAdmin($this->auth->getIdentity()->id) as $chat_session) {
    ?>
    <?php 
    $this->app->set('chat_session', $chat_session);
    $this->app->set('messages', $chat_session->messages);
    echo $this->renderView('Support/Admin/Views::livechatajax/tab.php');
}
?>

<script>
jQuery(document).ready(function(){
    jQuery('.poller').poller();
});
    
SupportGetUnclaimedSessions = function(){
    jQuery.get( "./admin/support/live-chat/unclaimed-sessions?ping=1", function( data ) {
        var current_count = jQuery('#unclaimed-sessions-alert').attr('data-count');
<?php

$unclaimed = \Support\Models\ChatSessions::unclaimed();
?>
Unclaimed Sessions: <span id="unclaimed-sessions-alert" data-count="<?php 
echo count($unclaimed);
?>
" class="alert <?php 
echo empty($unclaimed) ? 'alert-info' : 'alert-danger';
?>
"><?php 
echo count($unclaimed);
?>
</span>