Update device_profiles.php
This commit is contained in:
parent
cc3672a3fb
commit
02824a7849
|
|
@ -22,9 +22,13 @@
|
|||
Contributor(s):
|
||||
Mark J Crane <markjcrane@fusionpbx.com>
|
||||
*/
|
||||
|
||||
//includes
|
||||
require_once "root.php";
|
||||
require_once "resources/require.php";
|
||||
require_once "resources/check_auth.php";
|
||||
|
||||
//check permissions
|
||||
if (permission_exists('device_profile_view')) {
|
||||
//access granted
|
||||
}
|
||||
|
|
@ -44,30 +48,6 @@ else {
|
|||
$order = check_str($_GET["order"]);
|
||||
}
|
||||
|
||||
//additional includes
|
||||
require_once "resources/header.php";
|
||||
$document['title'] = $text['title-profiles'];
|
||||
require_once "resources/paging.php";
|
||||
|
||||
//show the content
|
||||
echo "<table width='100%' cellpadding='0' cellspacing='0' border='0'>\n";
|
||||
echo " <tr>\n";
|
||||
echo " <td width='100%' align='left' valign='top'>";
|
||||
echo " <b>".$text['header-profiles']."</b>";
|
||||
echo " <br /><br />";
|
||||
echo " ".$text['description-profiles'];
|
||||
echo " </td>\n";
|
||||
echo " <td align='right' nowrap='nowrap' valign='top'>\n";
|
||||
echo " <form method='get' action=''>\n";
|
||||
echo " <input type='button' class='btn' alt='".$text['button-back']."' onclick=\"document.location='devices.php'\" value='".$text['button-back']."'> ";
|
||||
echo " <input type='text' class='txt' style='width: 150px' name='search' value='".$search."'>";
|
||||
echo " <input type='submit' class='btn' name='submit' value='".$text['button-search']."'>";
|
||||
echo " </form>\n";
|
||||
echo " </td>\n";
|
||||
echo " </tr>\n";
|
||||
echo "</table>\n";
|
||||
echo "<br />";
|
||||
|
||||
//prepare to page the results
|
||||
$sql = "select count(*) as num_rows from v_device_profiles ";
|
||||
$sql .= "where (domain_uuid = '".$domain_uuid."' or domain_uuid is null) ";
|
||||
|
|
@ -92,7 +72,7 @@ else {
|
|||
list($paging_controls, $rows_per_page, $var3) = paging($num_rows, $param, $rows_per_page);
|
||||
$offset = $rows_per_page * $page;
|
||||
|
||||
//get the list
|
||||
//get the device profiles
|
||||
$sql = "select * from v_device_profiles ";
|
||||
$sql .= "where (domain_uuid = '".$domain_uuid."' or domain_uuid is null) ";
|
||||
if (strlen($search) > 0) {
|
||||
|
|
@ -110,14 +90,38 @@ else {
|
|||
$sql .= "limit ".$rows_per_page." offset ".$offset." ";
|
||||
$prep_statement = $db->prepare(check_sql($sql));
|
||||
$prep_statement->execute();
|
||||
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
|
||||
$result_count = count($result);
|
||||
$device_profiles = $prep_statement->fetchAll(PDO::FETCH_NAMED);
|
||||
unset ($prep_statement, $sql);
|
||||
|
||||
//set row styles
|
||||
$c = 0;
|
||||
$row_style["0"] = "row_style0";
|
||||
$row_style["1"] = "row_style1";
|
||||
|
||||
//additional includes
|
||||
require_once "resources/header.php";
|
||||
$document['title'] = $text['title-profiles'];
|
||||
require_once "resources/paging.php";
|
||||
|
||||
//show the content
|
||||
echo "<table width='100%' cellpadding='0' cellspacing='0' border='0'>\n";
|
||||
echo " <tr>\n";
|
||||
echo " <td width='100%' align='left' valign='top'>";
|
||||
echo " <b>".$text['header-profiles']."</b>";
|
||||
echo " <br /><br />";
|
||||
echo " ".$text['description-profiles'];
|
||||
echo " </td>\n";
|
||||
echo " <td align='right' nowrap='nowrap' valign='top'>\n";
|
||||
echo " <form method='get' action=''>\n";
|
||||
echo " <input type='button' class='btn' alt='".$text['button-back']."' onclick=\"document.location='devices.php'\" value='".$text['button-back']."'> ";
|
||||
echo " <input type='text' class='txt' style='width: 150px' name='search' value='".$search."'>";
|
||||
echo " <input type='submit' class='btn' name='submit' value='".$text['button-search']."'>";
|
||||
echo " </form>\n";
|
||||
echo " </td>\n";
|
||||
echo " </tr>\n";
|
||||
echo "</table>\n";
|
||||
echo "<br />";
|
||||
|
||||
echo "<table class='tr_hover' width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
|
||||
echo "<tr>\n";
|
||||
echo th_order_by('name', $text['label-profile_name'], $order_by, $order);
|
||||
|
|
@ -130,8 +134,8 @@ else {
|
|||
echo "</td>\n";
|
||||
echo "<tr>\n";
|
||||
|
||||
if ($result_count > 0) {
|
||||
foreach($result as $row) {
|
||||
if (is_array($device_profiles)) {
|
||||
foreach($device_profiles as $row) {
|
||||
$tr_link = (permission_exists('device_profile_edit')) ? "href='device_profile_edit.php?id=".$row['device_profile_uuid']."'" : null;
|
||||
echo "<tr ".$tr_link.">\n";
|
||||
echo " <td valign='top' class='".$row_style[$c]."'>";
|
||||
|
|
@ -151,7 +155,7 @@ else {
|
|||
echo "</tr>\n";
|
||||
$c = ($c == 0) ? 1 : 0;
|
||||
} //end foreach
|
||||
unset($sql, $result, $row_count);
|
||||
unset($sql, $device_profiles, $row_count);
|
||||
} //end if results
|
||||
|
||||
echo "<tr>\n";
|
||||
|
|
@ -174,4 +178,5 @@ else {
|
|||
|
||||
//include the footer
|
||||
require_once "resources/footer.php";
|
||||
|
||||
?>
|
||||
Loading…
Reference in New Issue