Merge pull request #1544 from moteus/dashboard_session_count

Fix. Display session count on User Dashboard.
This commit is contained in:
Nate 2016-04-12 10:10:52 -06:00
commit ab2c154446
1 changed files with 7 additions and 8 deletions

View File

@ -1092,14 +1092,13 @@
//channel count
if ($fp) {
$tmp = event_socket_request($fp, 'api show channels');
$tmp = explode("\n", $tmp);
$tmp = preg_replace('!\s+!', ' ', trim($tmp[3]));
$tmp = explode(' ', $tmp);
$tmp = $tmp[0];
$channels = (is_numeric($tmp)) ? $tmp : 0;
$hud[$n]['html'] .= "<tr class='tr_link_void'>\n";
$hud[$n]['html'] .= "<td valign='top' class='".$row_style[$c]." hud_text'>".$text['label-channels']."</td>\n";
$tmp = event_socket_request($fp, 'api status');
$matches = Array();
preg_match("/(\d+)\s+session\(s\)\s+\-\speak/", $tmp, $matches);
$channels = $matches[1] ? $matches[1] : 0;
$tr_link = "href='".PROJECT_PATH."/app/calls_active/calls_active.php'";
$hud[$n]['html'] .= "<tr ".$tr_link." style='cursor: pointer;'>\n";
$hud[$n]['html'] .= "<td valign='top' class='".$row_style[$c]." hud_text'><a href='javascript:void(0);'>".$text['label-channels']."</a></td>\n";
$hud[$n]['html'] .= "<td valign='top' class='".$row_style[$c]." hud_text' style='text-align: right;'>".$channels."</td>\n";
$hud[$n]['html'] .= "</tr>\n";
$c = ($c) ? 0 : 1;