2013-08-23 10:14:51 +02:00
|
|
|
<?php
|
|
|
|
|
/*
|
|
|
|
|
FusionPBX
|
|
|
|
|
Version: MPL 1.1
|
|
|
|
|
|
|
|
|
|
The contents of this file are subject to the Mozilla Public License Version
|
|
|
|
|
1.1 (the "License"); you may not use this file except in compliance with
|
|
|
|
|
the License. You may obtain a copy of the License at
|
|
|
|
|
http://www.mozilla.org/MPL/
|
|
|
|
|
|
|
|
|
|
Software distributed under the License is distributed on an "AS IS" basis,
|
|
|
|
|
WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
|
|
|
|
for the specific language governing rights and limitations under the
|
|
|
|
|
License.
|
|
|
|
|
|
|
|
|
|
The Original Code is FusionPBX
|
|
|
|
|
|
|
|
|
|
The Initial Developer of the Original Code is
|
|
|
|
|
Mark J Crane <markjcrane@fusionpbx.com>
|
|
|
|
|
Portions created by the Initial Developer are Copyright (C) 2008-2012
|
|
|
|
|
the Initial Developer. All Rights Reserved.
|
|
|
|
|
|
|
|
|
|
Contributor(s):
|
|
|
|
|
Mark J Crane <markjcrane@fusionpbx.com>
|
|
|
|
|
|
|
|
|
|
Call Block is written by Gerrit Visser <gerrit308@gmail.com>
|
|
|
|
|
*/
|
|
|
|
|
require_once "root.php";
|
|
|
|
|
require_once "resources/require.php";
|
|
|
|
|
|
2015-01-08 07:13:24 +01:00
|
|
|
//check permissions
|
|
|
|
|
require_once "resources/check_auth.php";
|
2019-07-02 05:10:31 +02:00
|
|
|
if (!permission_exists('call_block_view')) {
|
|
|
|
|
echo "access denied"; exit;
|
2015-01-08 07:13:24 +01:00
|
|
|
}
|
2013-08-23 10:14:51 +02:00
|
|
|
|
|
|
|
|
//add multi-lingual support
|
2015-01-18 11:06:08 +01:00
|
|
|
$language = new text;
|
|
|
|
|
$text = $language->get();
|
2013-08-23 10:14:51 +02:00
|
|
|
|
|
|
|
|
//additional includes
|
|
|
|
|
require_once "resources/header.php";
|
|
|
|
|
require_once "resources/paging.php";
|
|
|
|
|
|
|
|
|
|
//get variables used to control the order
|
2019-07-02 05:10:31 +02:00
|
|
|
$order_by = $_GET["order_by"] != '' ? $_GET["order_by"] : 'call_block_number';
|
2013-08-23 10:14:51 +02:00
|
|
|
$order = $_GET["order"];
|
|
|
|
|
|
|
|
|
|
//show the content
|
2019-07-02 05:10:31 +02:00
|
|
|
echo "<b>".$text['title-call-block']."</b>\n";
|
|
|
|
|
echo "<br /><br />\n";
|
|
|
|
|
echo $text['description-call-block']."\n";
|
|
|
|
|
echo "<br /><br />\n";
|
2013-08-23 10:14:51 +02:00
|
|
|
|
2015-01-08 07:13:24 +01:00
|
|
|
//prepare to page the results
|
2019-07-02 05:10:31 +02:00
|
|
|
$sql = "select count(*) from v_call_block ";
|
2019-05-28 22:36:42 +02:00
|
|
|
$sql .= "where domain_uuid = :domain_uuid ";
|
2019-07-02 05:10:31 +02:00
|
|
|
$parameters['domain_uuid'] = $_SESSION['domain_uuid'];
|
2019-05-28 22:36:42 +02:00
|
|
|
$database = new database;
|
|
|
|
|
$num_rows = $database->select($sql, $parameters, 'column');
|
2019-07-02 05:10:31 +02:00
|
|
|
unset($parameters);
|
2013-08-23 10:14:51 +02:00
|
|
|
|
2015-01-08 07:13:24 +01:00
|
|
|
//prepare to page the results
|
2016-03-29 07:02:11 +02:00
|
|
|
$rows_per_page = ($_SESSION['domain']['paging']['numeric'] != '') ? $_SESSION['domain']['paging']['numeric'] : 50;
|
2015-01-08 07:13:24 +01:00
|
|
|
$param = "";
|
|
|
|
|
$page = $_GET['page'];
|
|
|
|
|
if (strlen($page) == 0) { $page = 0; $_GET['page'] = 0; }
|
|
|
|
|
list($paging_controls, $rows_per_page, $var3) = paging($num_rows, $param, $rows_per_page);
|
|
|
|
|
$offset = $rows_per_page * $page;
|
|
|
|
|
|
|
|
|
|
//get the list
|
|
|
|
|
$sql = "select * from v_call_block ";
|
2019-05-28 22:36:42 +02:00
|
|
|
$sql .= "where domain_uuid = :domain_uuid ";
|
2019-07-02 05:10:31 +02:00
|
|
|
$sql .= order_by($order_by, $order);
|
|
|
|
|
$sql .= limit_offset($rows_per_page, $offset);
|
|
|
|
|
$parameters['domain_uuid'] = $_SESSION['domain_uuid'];
|
2019-05-28 22:36:42 +02:00
|
|
|
$database = new database;
|
|
|
|
|
$result = $database->select($sql, $parameters, 'all');
|
2019-07-02 05:10:31 +02:00
|
|
|
unset($parameters);
|
2015-01-08 07:13:24 +01:00
|
|
|
|
|
|
|
|
//table headers
|
2013-08-23 10:14:51 +02:00
|
|
|
$c = 0;
|
|
|
|
|
$row_style["0"] = "row_style0";
|
|
|
|
|
$row_style["1"] = "row_style1";
|
2014-06-22 03:10:24 +02:00
|
|
|
echo "<table class='tr_hover' width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
|
2013-08-23 10:14:51 +02:00
|
|
|
echo "<tr>\n";
|
2013-09-27 12:21:43 +02:00
|
|
|
echo th_order_by('call_block_number', $text['label-number'], $order_by, $order);
|
|
|
|
|
echo th_order_by('call_block_name', $text['label-name'], $order_by, $order);
|
2014-06-21 02:58:16 +02:00
|
|
|
echo th_order_by('call_block_count', $text['label-count'], $order_by, $order, '', "style='text-align: center;'");
|
2013-08-23 10:14:51 +02:00
|
|
|
echo th_order_by('date_added', $text['label-date-added'], $order_by, $order);
|
2013-09-27 12:21:43 +02:00
|
|
|
echo th_order_by('call_block_action', $text['label-action'], $order_by, $order);
|
|
|
|
|
echo th_order_by('call_block_enabled', $text['label-enabled'], $order_by, $order);
|
2014-02-26 05:02:56 +01:00
|
|
|
echo "<td class='list_control_icons'>";
|
2013-08-23 10:14:51 +02:00
|
|
|
if (permission_exists('call_block_add')) {
|
2014-02-26 05:02:56 +01:00
|
|
|
echo "<a href='call_block_edit.php' alt='".$text['button-add']."'>$v_link_label_add</a>";
|
2013-08-23 10:14:51 +02:00
|
|
|
}
|
|
|
|
|
echo "</td>\n";
|
2014-06-22 03:10:24 +02:00
|
|
|
echo "</tr>\n";
|
2013-08-23 10:14:51 +02:00
|
|
|
|
2015-01-08 07:13:24 +01:00
|
|
|
//show the results
|
2019-05-28 22:36:42 +02:00
|
|
|
if (is_array($result)) {
|
2013-08-23 10:14:51 +02:00
|
|
|
foreach($result as $row) {
|
2019-07-02 05:10:31 +02:00
|
|
|
$tr_link = (permission_exists('call_block_edit')) ? "href='call_block_edit.php?id=".escape($row['call_block_uuid'])."'" : null;
|
2014-06-22 03:10:24 +02:00
|
|
|
echo "<tr ".$tr_link.">\n";
|
2014-06-21 02:58:16 +02:00
|
|
|
echo " <td valign='top' class='".$row_style[$c]."'>";
|
|
|
|
|
if (permission_exists('call_block_edit')) {
|
2019-07-02 05:10:31 +02:00
|
|
|
echo "<a ".$tr_link."'>".escape($row['call_block_number'])."</a>";
|
2014-06-21 02:58:16 +02:00
|
|
|
}
|
|
|
|
|
else {
|
2018-06-05 20:30:25 +02:00
|
|
|
echo escape($row['call_block_number']);
|
2014-06-21 02:58:16 +02:00
|
|
|
}
|
|
|
|
|
echo " </td>\n";
|
2018-06-05 20:30:25 +02:00
|
|
|
echo " <td valign='top' class='".$row_style[$c]."'>".escape($row['call_block_name'])."</td>\n";
|
|
|
|
|
echo " <td valign='top' class='".$row_style[$c]."' style='text-align: center;'>".escape($row['call_block_count'])."</td>\n";
|
2013-08-23 10:14:51 +02:00
|
|
|
if (defined('TIME_24HR') && TIME_24HR == 1) {
|
|
|
|
|
$tmp_date_added = date("j M Y H:i:s", $row['date_added']);
|
|
|
|
|
} else {
|
|
|
|
|
$tmp_date_added = date("j M Y h:i:sa", $row['date_added']);
|
|
|
|
|
}
|
2014-06-21 02:58:16 +02:00
|
|
|
echo " <td valign='top' class='".$row_style[$c]."'>".$tmp_date_added."</td>\n";
|
2018-06-05 20:30:25 +02:00
|
|
|
echo " <td valign='top' class='".$row_style[$c]."'>".escape($row['call_block_action'])."</td>\n";
|
|
|
|
|
echo " <td valign='top' class='".$row_style[$c]."'>".$text['label-'.escape($row['call_block_enabled'])]."</td>\n";
|
2014-02-26 05:02:56 +01:00
|
|
|
echo " <td class='list_control_icons'>";
|
2013-08-23 10:14:51 +02:00
|
|
|
if (permission_exists('call_block_edit')) {
|
2018-06-05 20:30:25 +02:00
|
|
|
echo "<a href='call_block_edit.php?id=".escape($row['call_block_uuid'])."' alt='".$text['button-edit']."'>$v_link_label_edit</a>";
|
2013-08-23 10:14:51 +02:00
|
|
|
}
|
|
|
|
|
if (permission_exists('call_block_delete')) {
|
2018-06-05 20:30:25 +02:00
|
|
|
echo "<a href='call_block_delete.php?id=".escape($row['call_block_uuid'])."' alt='".$text['button-delete']."' onclick=\"return confirm('".$text['confirm-delete']."')\">$v_link_label_delete</a>";
|
2013-08-23 10:14:51 +02:00
|
|
|
};
|
2014-02-26 05:02:56 +01:00
|
|
|
echo " </td>";
|
2013-08-23 10:14:51 +02:00
|
|
|
echo "</tr>\n";
|
2019-07-02 05:10:31 +02:00
|
|
|
$c = $c == 1 ? 0 : 1;
|
2013-08-23 10:14:51 +02:00
|
|
|
} //end foreach
|
|
|
|
|
unset($sql, $result, $row_count);
|
|
|
|
|
} //end if results
|
|
|
|
|
|
2015-01-08 07:13:24 +01:00
|
|
|
//complete the content
|
2019-07-02 05:10:31 +02:00
|
|
|
echo "</table>\n";
|
2014-02-26 05:02:56 +01:00
|
|
|
if (permission_exists('call_block_add')) {
|
2019-07-02 05:10:31 +02:00
|
|
|
echo "<div style='float: right;'>\n";
|
|
|
|
|
echo " <a href='call_block_edit.php' alt=\"".$text['button-add']."\">".$v_link_label_add."</a>";
|
|
|
|
|
echo "</div>\n";
|
2014-02-26 05:02:56 +01:00
|
|
|
}
|
2019-07-02 05:10:31 +02:00
|
|
|
echo "<br />\n";
|
|
|
|
|
echo "<div align='center'>".$paging_controls."</div>\n";
|
2013-08-23 10:14:51 +02:00
|
|
|
|
|
|
|
|
//include the footer
|
|
|
|
|
require_once "resources/footer.php";
|
2015-01-08 07:13:24 +01:00
|
|
|
|
2018-05-08 16:50:57 +02:00
|
|
|
?>
|