Misc: Implement maximum limits on multiple apps.

This commit is contained in:
Nate Jones
2015-03-22 08:17:04 +00:00
parent e13a8bb694
commit 6f4209e2f6
24 changed files with 1173 additions and 865 deletions

View File

@@ -67,7 +67,7 @@ else {
if (permission_exists('device_profile_view')) {
echo " <input type='button' class='btn' value='".$text['button-profiles']."' onclick=\"document.location.href='device_profiles.php';\">&nbsp;&nbsp;&nbsp;&nbsp;";
}
echo " <input type='text' class='txt' style='width: 150px' name='search' value='$search'>";
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";
@@ -75,6 +75,16 @@ else {
echo "</table>\n";
echo "<br />";
//get total devices count from the database
$sql = "select count(*) as num_rows from v_devices 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_devices = $row['num_rows'];
}
unset($sql, $prep_statement, $row);
//prepare to page the results
$sql = "select count(*) as num_rows from v_devices ";
if ($_GET['showall'] && permission_exists('device_show_all')) {
@@ -179,7 +189,9 @@ else {
echo th_order_by('device_description', $text['label-device_description'], $order_by, $order);
echo "<td class='list_control_icons'>\n";
if (permission_exists('device_add')) {
echo " <a href='device_edit.php' alt='".$text['button-add']."'>$v_link_label_add</a>\n";
if ($_SESSION['limit']['devices']['numeric'] == '' || ($_SESSION['limit']['devices']['numeric'] != '' && $total_devices < $_SESSION['limit']['devices']['numeric'])) {
echo " <a href='device_edit.php' alt='".$text['button-add']."'>".$v_link_label_add."</a>\n";
}
}
else {
echo " &nbsp;\n";
@@ -225,7 +237,9 @@ else {
echo " <td width='33.3%' align='center' nowrap='nowrap'>".$paging_controls."</td>\n";
echo " <td class='list_control_icons'>";
if (permission_exists('device_add')) {
echo " <a href='device_edit.php' alt='".$text['button-add']."'>$v_link_label_add</a>";
if ($_SESSION['limit']['devices']['numeric'] == '' || ($_SESSION['limit']['devices']['numeric'] != '' && $total_devices < $_SESSION['limit']['devices']['numeric'])) {
echo " <a href='device_edit.php' alt='".$text['button-add']."'>".$v_link_label_add."</a>";
}
}
echo " </td>\n";
echo " </tr>\n";