Add a fax server count.

This commit is contained in:
markjcrane 2015-09-04 22:59:13 -06:00
parent 0d8cb2c36d
commit 0c43e85123
2 changed files with 41 additions and 40 deletions

View File

@ -33,8 +33,10 @@ else {
echo "access denied";
exit;
}
require_once "resources/header.php";
require_once "resources/paging.php";
//additional includes
require_once "resources/header.php";
require_once "resources/paging.php";
//add multi-lingual support
$language = new text;
@ -44,18 +46,7 @@ require_once "resources/paging.php";
$order_by = check_str($_GET["order_by"]);
$order = check_str($_GET["order"]);
//show the content
echo "<table width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
echo " <tr>\n";
echo " <td align='left'>\n";
echo " <span class=\"title\">".$text['title-fax']."</span>";
echo " <br /><br />\n";
echo " ".$text['description']."\n";
echo " </td>\n";
echo " </tr>\n";
echo "</table>\n";
echo "<br />\n";
//get the fax extensions
if (if_group("superadmin") || if_group("admin")) {
//show all fax extensions
$sql = "select count(*) as num_rows from v_fax ";
@ -109,9 +100,20 @@ require_once "resources/paging.php";
$prep_statement = $db->prepare(check_sql($sql));
$prep_statement->execute();
$result = $prep_statement->fetchAll(PDO::FETCH_ASSOC);
$result_count = count($result);
unset ($prep_statement, $sql);
//show the content
echo "<table width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
echo " <tr>\n";
echo " <td align='left'>\n";
echo " <span class=\"title\">".$text['title-fax']." (".$num_rows.")</span>";
echo " <br /><br />\n";
echo " ".$text['description']."\n";
echo " </td>\n";
echo " </tr>\n";
echo "</table>\n";
echo "<br />\n";
$c = 0;
$row_style["0"] = "row_style0";
$row_style["1"] = "row_style1";
@ -130,7 +132,7 @@ require_once "resources/paging.php";
echo "</td>\n";
echo "</tr>\n";
if ($result_count > 0) {
if ($num_rows > 0) {
foreach($result as $row) {
//remove the backslash
$row['fax_email'] = str_replace("\\", "", $row['fax_email']);
@ -182,7 +184,7 @@ require_once "resources/paging.php";
//alternate the CSS class
if ($c==0) { $c=1; } else { $c=0; }
} //end foreach
unset($sql, $result, $row_count);
unset($sql, $result);
} //end if results
echo "<tr>\n";

View File

@ -172,24 +172,6 @@ else {
require_once "resources/header.php";
require_once "resources/paging.php";
//show the header
echo "<table width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
echo " <tr>\n";
echo " <td align='left' valign='top'>\n";
if ($_REQUEST['box'] == 'inbox' && permission_exists('fax_inbox_view')) {
echo " <b>".$text['header-inbox'].": <span style='color: #000;'>".$fax_name." (".$fax_extension.")</span></b>\n";
}
if ($_REQUEST['box'] == 'sent' && permission_exists('fax_sent_view')) {
echo " <b>".$text['header-sent'].": <span style='color: #000;'>".$fax_name." (".$fax_extension.")</span></b>\n";
}
echo " </td>\n";
echo " <td width='70%' align='right' valign='top'>\n";
echo " <input type='button' class='btn' name='' alt='back' onclick=\"window.location='fax.php'\" value='".$text['button-back']."'>\n";
echo " </td>\n";
echo " </tr>\n";
echo "</table>\n";
echo "<br>\n";
//prepare to page the results
$sql = "select count(*) as num_rows from v_fax_files ";
$sql .= "where fax_uuid = '$fax_uuid' ";
@ -234,10 +216,27 @@ 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);
$fax_files = $prep_statement->fetchAll(PDO::FETCH_NAMED);
unset ($prep_statement, $sql);
//show the header
echo "<table width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
echo " <tr>\n";
echo " <td align='left' valign='top'>\n";
if ($_REQUEST['box'] == 'inbox' && permission_exists('fax_inbox_view')) {
echo " <b>".$text['header-inbox'].": <span style='color: #000;'>".$fax_name." (".$fax_extension.")</span></b>\n";
}
if ($_REQUEST['box'] == 'sent' && permission_exists('fax_sent_view')) {
echo " <b>".$text['header-sent'].": <span style='color: #000;'>".$fax_name." (".$fax_extension.")</span></b>\n";
}
echo " </td>\n";
echo " <td width='70%' align='right' valign='top'>\n";
echo " <input type='button' class='btn' name='' alt='back' onclick=\"window.location='fax.php'\" value='".$text['button-back']."'>\n";
echo " </td>\n";
echo " </tr>\n";
echo "</table>\n";
echo "<br>\n";
//show the table and content
$c = 0;
$row_style["0"] = "row_style0";
@ -255,8 +254,8 @@ else {
echo th_order_by('fax_date', $text['label-fax_date'], $order_by, $order, "&id=".$_GET['id']."&box=".$_GET['box']."&page=".$_GET['page']);
echo "<td style='width: 25px;' class='list_control_icons'>&nbsp;</td>\n";
echo "</tr>\n";
if ($result_count > 0) {
foreach($result as $row) {
if ($num_rows > 0) {
foreach($fax_files as $row) {
$file = basename($row['fax_file_path']);
if (strtolower(substr($file, -3)) == "tif" || strtolower(substr($file, -3)) == "pdf") {
$file_name = substr($file, 0, (strlen($file) -4));
@ -382,7 +381,7 @@ else {
echo "</tr>\n";
$c = ($c) ? 0 : 1;
} //end foreach
unset($sql, $result, $row_count);
unset($sql, $fax_files);
} //end if results
//show the paging controls