Misc: Implement maximum limits on multiple apps.

This commit is contained in:
Nate Jones
2015-03-22 08:17:04 +00:00
parent 0e67783602
commit fcb53fd7f9
24 changed files with 1173 additions and 865 deletions
+6 -1
View File
@@ -415,4 +415,9 @@
$text['message-message']['pt-pt'] = "Mensagem";
$text['message-message']['fr-fr'] = "Message";
?>
$text['message-maximum_ivr_menus']['en-us'] = "Maximum IVR Menus:";
$text['message-maximum_ivr_menus']['es-cl'] = "Máxima IVR Menús Animales:";
$text['message-maximum_ivr_menus']['pt-pt'] = "Menus Máxima IVR de Estimação:";
$text['message-maximum_ivr_menus']['fr-fr'] = "Menus Maximale SVI Admis:";
?>
+20
View File
@@ -52,6 +52,26 @@ else {
$action = "add";
}
//get total ivr menu count from the database, check limit, if defined
if ($action == 'add') {
if ($_SESSION['limit']['ivr_menus']['numeric'] != '') {
$sql = "select count(*) as num_rows from v_ivr_menus where domain_uuid = '".$_SESSION['domain_uuid']."' ";
$prep_statement = $db->prepare($sql);
if ($prep_statement) {
$prep_statement->execute();
$row = $prep_statement->fetch(PDO::FETCH_ASSOC);
$total_ivr_menus = $row['num_rows'];
}
unset($prep_statement, $row);
if ($total_ivr_menus >= $_SESSION['limit']['ivr_menus']['numeric']) {
$_SESSION['message_mood'] = 'negative';
$_SESSION['message'] = $text['message-maximum_ivr_menus'].' '.$_SESSION['limit']['ivr_menus']['numeric'];
header('Location: ivr_menus.php');
return;
}
}
}
//get http post values and set them to php variables
if (count($_POST) > 0) {
//get ivr menu
+9 -2
View File
@@ -76,6 +76,9 @@ else {
$ivr->where = $where;
$num_rows = $ivr->count();
//use total ivr menu count from the database
$total_ivr_menus = $num_rows;
//prepare to page the results
$rows_per_page = 150;
$param = "";
@@ -107,7 +110,9 @@ else {
echo th_order_by('ivr_menu_description', $text['label-description'], $order_by[0]['name'], $order_by[0]['order']);
echo "<td class='list_control_icons'>";
if (permission_exists('ivr_menu_add')) {
echo "<a href='ivr_menu_edit.php' alt='".$text['button-add']."'>$v_link_label_add</a>";
if ($_SESSION['limit']['ivr_menus']['numeric'] == '' || ($_SESSION['limit']['ivr_menus']['numeric'] != '' && $total_ivr_menus < $_SESSION['limit']['ivr_menus']['numeric'])) {
echo "<a href='ivr_menu_edit.php' alt='".$text['button-add']."'>".$v_link_label_add."</a>";
}
}
echo "</td>\n";
echo "</tr>\n";
@@ -151,7 +156,9 @@ else {
echo " <td width='33.3%' align='center' nowrap>$paging_controls</td>\n";
echo " <td class='list_control_icons'>";
if (permission_exists('ivr_menu_add')) {
echo "<a href='ivr_menu_edit.php' alt='".$text['button-add']."'>$v_link_label_add</a>";
if ($_SESSION['limit']['ivr_menus']['numeric'] == '' || ($_SESSION['limit']['ivr_menus']['numeric'] != '' && $total_ivr_menus < $_SESSION['limit']['ivr_menus']['numeric'])) {
echo "<a href='ivr_menu_edit.php' alt='".$text['button-add']."'>".$v_link_label_add."</a>";
}
}
echo " </td>\n";
echo " </tr>\n";