Registration search (#2151)

* Update status_registrations.php

* Update status_registrations_inc.php

* Update status_registrations_inc.php

* Update status_registrations_inc.php

* Update status_registrations_inc.php
This commit is contained in:
konradSC 2016-11-24 01:20:51 -05:00 committed by FusionPBX
parent a7c972ba2d
commit 19fa07c29a
2 changed files with 59 additions and 25 deletions

View File

@ -41,10 +41,25 @@ require_once "resources/check_auth.php";
$language = new text;
$text = $language->get();
//get the http values and set them as variables
$search = check_str($_GET["search"]);
//show the header
require_once "resources/header.php";
$document['title'] = $text['header-registrations'];
//show the search
echo "<table width='100%' border='0' cellspacing='0' cellpadding='0'>\n";
echo "<tr>\n";
echo " <form method='get' action=''>\n";
echo " <td style='vertical-align: top; text-align: right; white-space: nowrap;'>\n";
echo " <input type='text' class='txt' style='width: 150px' name='search' id='search' value='".$search."'>";
echo " <input type='submit' class='btn' name='submit' value='".$text['button-search']."'>";
echo " </td>\n";
echo " </form>\n";
echo "</tr>\n";
echo "</table>\n";
echo "<br />\n";
//set the variables
$profile = (isset($_REQUEST['profile']) && $_REQUEST['profile'] != '') ? $_REQUEST['profile'] : "internal";
$show = trim($_REQUEST["show"]);
@ -53,7 +68,7 @@ require_once "resources/check_auth.php";
?>
<script type="text/javascript">
var refresh = 1500;
var source_url = 'status_registrations_inc.php?profile=<?php echo $profile; ?>&show=<?php echo $show; ?>';
var source_url = 'status_registrations_inc.php?profile=<?php echo $profile; ?>&show=<?php echo $show; ?>&search_value=<?php echo $search; ?>';
var interval_timer_id;
function loadXmlHttp(url, id) {

View File

@ -38,11 +38,15 @@ require_once "resources/classes/status_registrations.php";
exit;
}
//Search
//$search_value = "1003";
//add multi-lingual support
$language = new text;
$text = $language->get();
//get the HTTP values and set as variables
$search_value = trim($_REQUEST["search_value"]);
$sip_profile_name = trim($_REQUEST["profile"]);
$show = trim($_REQUEST["show"]);
if ($show != "all") { $show = ''; }
@ -88,14 +92,24 @@ require_once "resources/classes/status_registrations.php";
echo $e->getMessage();
exit;
}
//get the registrations
$registrations = get_registrations($sip_profile_name);
//count the registrations
$registration_count = 0;
if (count($registrations) > 0) {
foreach ($registrations as $row) {
//search
$matches = preg_grep ("/$search_value/i",$row);
if ($matches != FALSE) {
$registration_count++;
}
}
}
//show the registrations
echo "<table width='100%' border='0' cellspacing='0' cellpadding='0'>\n";
echo "<tr>\n";
echo "<td width='100%'>\n";
echo " <b>".$text['header-registrations']." (".count($registrations).")</b>\n";
echo " <b>".$text['header-registrations']." (".$registration_count.")</b>\n";
echo "</td>\n";
echo "<td valign='middle' nowrap='nowrap' style='padding-right: 15px' id='refresh_state'>";
echo " <img src='resources/images/refresh_active.gif' style='width: 16px; height: 16px; border: none; margin-top: 3px; cursor: pointer;' onclick='refresh_stop();' alt=\"".$text['label-refresh_pause']."\" title=\"".$text['label-refresh_pause']."\">";
@ -114,6 +128,7 @@ require_once "resources/classes/status_registrations.php";
echo "</table>\n";
echo "<br />\n";
echo "<table width='100%' border='0' cellspacing='0' cellpadding='0'>\n";
echo "<tr>\n";
echo " <th>".$text['label-user']."</th>\n";
@ -135,6 +150,9 @@ require_once "resources/classes/status_registrations.php";
//display the array
if (count($registrations) > 0) {
foreach ($registrations as $row) {
//search
$matches = preg_grep ("/$search_value/i",$row);
if ($matches != FALSE) {
//set the user agent
$agent = $row['agent'];
@ -157,6 +175,7 @@ require_once "resources/classes/status_registrations.php";
if ($c==0) { $c=1; } else { $c=0; }
}
}
}
echo "</table>\n";
//close the connection and unset the variable