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
+24 -31
View File
@@ -50,40 +50,33 @@
$extensions = $_POST['extensions'];
}
//toggle the call forward feature
if (permission_exists('call_forward')) {
if ($action == 'toggle_call_forward' && is_array($extensions) && @sizeof($extensions) != 0) {
//toggle
$obj = new call_forward;
$obj->toggle($extensions);
//redirect
header('Location: calls.php'.($search != '' ? '?search='.urlencode($search) : null));
exit;
}
}
//process posted data by action
if ($action != '' && is_array($extensions) && @sizeof($extensions) != 0) {
switch ($action) {
case 'toggle_call_forward':
if (permission_exists('call_forward')) {
$obj = new call_forward;
$obj->toggle($extensions);
}
break;
//toggle the follow me feature
if (permission_exists('follow_me')) {
if ($action == 'toggle_follow_me' && is_array($extensions) && @sizeof($extensions) != 0) {
//toggle
$obj = new follow_me;
$obj->toggle($extensions);
//redirect
header('Location: calls.php'.($search != '' ? '?search='.urlencode($search) : null));
exit;
}
}
case 'toggle_follow_me':
if (permission_exists('follow_me')) {
$obj = new follow_me;
$obj->toggle($extensions);
}
break;
//toggle the do not disturb feature
if (permission_exists('do_not_disturb')) {
if ($action == 'toggle_do_not_disturb' && is_array($extensions) && @sizeof($extensions) != 0) {
//toggle
$obj = new do_not_disturb;
$obj->toggle($extensions);
//redirect
header('Location: calls.php'.($search != '' ? '?search='.urlencode($search) : null));
exit;
case 'toggle_do_not_disturb':
if (permission_exists('do_not_disturb')) {
$obj = new do_not_disturb;
$obj->toggle($extensions);
}
break;
}
header('Location: calls.php'.($search != '' ? '?search='.urlencode($search) : null));
exit;
}
//get order and order by