List Views: Simplify action handling.

This commit is contained in:
Nate
2019-11-30 11:12:41 -07:00
parent b993ab8197
commit bfb17507f1
30 changed files with 590 additions and 720 deletions
+18 -20
View File
@@ -46,28 +46,26 @@
$access_controls = $_POST['access_controls'];
}
//copy the access controls
if (permission_exists('access_control_add')) {
if ($action == 'copy' && is_array($access_controls) && @sizeof($access_controls) != 0) {
//copy
$obj = new access_controls;
$obj->copy($access_controls);
//redirect
header('Location: access_controls.php'.($search != '' ? '?search='.urlencode($search) : null));
exit;
}
}
//process posted data by action
if ($action != '' && is_array($access_controls) && @sizeof($access_controls) != 0) {
$obj = new access_controls;
//delete the access controls
if (permission_exists('access_control_delete')) {
if ($action == 'delete' && is_array($access_controls) && @sizeof($access_controls) != 0) {
//delete
$obj = new access_controls;
$obj->delete($access_controls);
//redirect
header('Location: access_controls.php'.($search != '' ? '?search='.urlencode($search) : null));
exit;
switch ($action) {
case 'copy':
if (permission_exists('access_control_add')) {
$obj->copy($access_controls);
}
break;
case 'delete':
if (permission_exists('access_control_delete')) {
$obj->delete($access_controls);
}
break;
}
header('Location: access_controls.php'.($search != '' ? '?search='.urlencode($search) : null));
exit;
}
//get variables used to control the order