mirror of
https://github.com/fusionpbx/fusionpbx.git
synced 2025-12-30 00:53:50 +00:00
List Views: Simplify action handling.
This commit is contained in:
@@ -52,28 +52,26 @@
|
||||
//get the search
|
||||
$search = strtolower($_REQUEST["search"]);
|
||||
|
||||
//toggle the devices
|
||||
if (permission_exists('device_edit')) {
|
||||
if ($action == 'toggle' && is_array($devices) && @sizeof($devices) != 0) {
|
||||
//toggle
|
||||
$obj = new device;
|
||||
$obj->toggle($devices);
|
||||
//redirect
|
||||
header('Location: devices.php'.($search != '' ? '?search='.urlencode($search) : null));
|
||||
exit;
|
||||
}
|
||||
}
|
||||
//process posted data by action
|
||||
if ($action != '' && is_array($devices) && @sizeof($devices) != 0) {
|
||||
$obj = new device;
|
||||
|
||||
//delete the devices
|
||||
if (permission_exists('device_delete')) {
|
||||
if ($action == 'delete' && is_array($devices) && @sizeof($devices) != 0) {
|
||||
//delete
|
||||
$obj = new device;
|
||||
$obj->delete($devices);
|
||||
//redirect
|
||||
header('Location: devices.php'.($search != '' ? '?search='.urlencode($search) : null));
|
||||
exit;
|
||||
switch ($action) {
|
||||
case 'toggle':
|
||||
if (permission_exists('device_edit')) {
|
||||
$obj->toggle($devices);
|
||||
}
|
||||
break;
|
||||
|
||||
case 'delete':
|
||||
if (permission_exists('device_delete')) {
|
||||
$obj->delete($devices);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
header('Location: devices.php'.($search != '' ? '?search='.urlencode($search) : null));
|
||||
exit;
|
||||
}
|
||||
|
||||
//get order and order by and sanatize the values
|
||||
|
||||
Reference in New Issue
Block a user