diff --git a/app/call_flows/call_flows.php b/app/call_flows/call_flows.php index 4325a70f24..a0f382a08f 100644 --- a/app/call_flows/call_flows.php +++ b/app/call_flows/call_flows.php @@ -27,6 +27,7 @@ //includes require_once "root.php"; require_once "resources/require.php"; + require_once "resources/paging.php"; //check permissions require_once "resources/check_auth.php"; @@ -42,8 +43,48 @@ $language = new text; $text = $language->get(); -//set the page title - $document['title'] = $text['title-call_flows']; +//get posted data + if (is_array($_POST['call_flows'])) { + $action = $_POST['action']; + $search = $_POST['search']; + $call_flows = $_POST['call_flows']; + } + +//copy the call flows + if (permission_exists('call_flow_add')) { + if ($action == 'copy' && is_array($call_flows) && @sizeof($call_flows) != 0) { + //copy + $obj = new call_flows; + $obj->copy($call_flows); + //redirect + header('Location: call_flows.php'.($search != '' ? '?search='.urlencode($search) : null)); + exit; + } + } + +//toggle the call flows + if (permission_exists('call_flow_edit')) { + if ($action == 'toggle' && is_array($call_flows) && @sizeof($call_flows) != 0) { + //toggle + $obj = new call_flows; + $obj->toggle($call_flows); + //redirect + header('Location: call_flows.php'.($search != '' ? '?search='.urlencode($search) : null)); + exit; + } + } + +//delete the call flows + if (permission_exists('call_flow_delete')) { + if ($action == 'delete' && is_array($call_flows) && @sizeof($call_flows) != 0) { + //delete + $obj = new call_flows; + $obj->delete($call_flows); + //redirect + header('Location: call_flows.php'.($search != '' ? '?search='.urlencode($search) : null)); + exit; + } + } //get variables used to control the order $order_by = $_GET["order_by"]; @@ -57,172 +98,152 @@ $sql_search .= "or lower(call_flow_extension) like :search "; $sql_search .= "or lower(call_flow_feature_code) like :search "; $sql_search .= "or lower(call_flow_context) like :search "; - //$sql_search .= "or lower(call_flow_status) like :search "; $sql_search .= "or lower(call_flow_pin_number) like :search "; $sql_search .= "or lower(call_flow_label) like :search "; - //$sql_search .= "or lower(call_flow_sound) like :search "; - //$sql_search .= "or lower(call_flow_app) like :search "; - //$sql_search .= "or lower(call_flow_data) like :search "; $sql_search .= "or lower(call_flow_alternate_label) like :search "; - //$sql_search .= "or lower(call_flow_alternate_sound) like :search "; - //$sql_search .= "or lower(call_flow_alternate_app) like :search "; - //$sql_search .= "or lower(call_flow_alternate_data) like :search "; $sql_search .= "or lower(call_flow_description) like :search "; $sql_search .= ") "; $parameters['search'] = '%'.$search.'%'; } -//additional includes - require_once "resources/header.php"; - require_once "resources/paging.php"; - //prepare to page the results - $sql = "select count(call_flow_uuid) from v_call_flows "; + $sql = "select count(*) from v_call_flows "; $sql .= "where domain_uuid = :domain_uuid "; $sql .= $sql_search; $parameters['domain_uuid'] = $_SESSION['domain_uuid']; $database = new database; $num_rows = $database->select($sql, $parameters, 'column'); - unset($sql); //prepare to page the results $rows_per_page = ($_SESSION['domain']['paging']['numeric'] != '') ? $_SESSION['domain']['paging']['numeric'] : 50; - $param = ""; + $param = "&search=".$search; $page = $_GET['page']; if (strlen($page) == 0) { $page = 0; $_GET['page'] = 0; } - list($paging_controls, $rows_per_page, $var3) = paging($num_rows, $param, $rows_per_page); + list($paging_controls, $rows_per_page) = paging($num_rows, $param, $rows_per_page); + list($paging_controls_mini, $rows_per_page) = paging($num_rows, $param, $rows_per_page, true); $offset = $rows_per_page * $page; //get the list - $sql = "select * from v_call_flows "; - $sql .= "where domain_uuid = :domain_uuid "; - $sql .= $sql_search; - $sql .= order_by($order_by, $order); + $sql = str_replace('count(*)', '*', $sql); + $sql .= order_by($order_by, $order, 'call_flow_name', 'asc'); $sql .= limit_offset($rows_per_page, $offset); $database = new database; $call_flows = $database->select($sql, $parameters, 'all'); unset($sql, $parameters); -//alternate the row style - $c = 0; - $row_style["0"] = "row_style0"; - $row_style["1"] = "row_style1"; +//create token + $object = new token; + $token = $object->create($_SERVER['PHP_SELF']); + +//include header + $document['title'] = $text['title-call_flows']; + require_once "resources/header.php"; //show the content - echo "
| ".$text['title-call_flows']." | \n"; - echo "|
| \n";
- echo " ".$text['description-call_flows']." \n"; - echo " | \n";
- echo " |
| \n"; + echo " \n"; + echo " | \n"; + } + echo th_order_by('call_flow_name', $text['label-call_flow_name'], $order_by, $order); echo th_order_by('call_flow_extension', $text['label-call_flow_extension'], $order_by, $order); echo th_order_by('call_flow_feature_code', $text['label-call_flow_feature_code'], $order_by, $order); - //echo th_order_by('call_flow_context', $text['label-call_flow_context'], $order_by, $order); - //echo th_order_by('call_flow_pin_number', $text['label-call_flow_pin_number'], $order_by, $order); - //echo th_order_by('call_flow_label', $text['label-call_flow_label'], $order_by, $order); - //echo th_order_by('call_flow_sound', $text['label-call_flow_sound'], $order_by, $order); - //echo th_order_by('call_flow_app', $text['label-call_flow_app'], $order_by, $order); - //echo th_order_by('call_flow_data', $text['label-call_flow_data'], $order_by, $order); - //echo th_order_by('call_flow_alternate_label', $text['label-call_flow_alternate_label'], $order_by, $order); - //echo th_order_by('call_flow_alternate_sound', $text['label-call_flow_alternate_sound'], $order_by, $order); - //echo th_order_by('call_flow_alternate_app', $text['label-call_flow_alternate_app'], $order_by, $order); - //echo th_order_by('call_flow_alternate_data', $text['label-call_flow_alternate_data'], $order_by, $order); + echo th_order_by('call_flow_status', $text['label-call_flow_status'], $order_by, $order); if (permission_exists('call_flow_context')) { echo th_order_by('call_flow_context', $text['label-call_flow_context'], $order_by, $order); } - echo th_order_by('call_flow_description', $text['label-call_flow_description'], $order_by, $order); - echo ""; - if (permission_exists('call_flow_add')) { - echo "$v_link_label_add"; + echo th_order_by('call_flow_description', $text['label-call_flow_description'], $order_by, $order, null, "class='hide-sm-dn'"); + if (permission_exists('call_flow_edit') && $_SESSION['theme']['list_row_edit_button']['boolean'] == 'true') { + echo " | \n"; } - else { - echo " \n"; - } - echo "\n"; - echo " | ||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| "; - if ($row['call_flow_status'] != "false") { - echo escape($row['call_flow_label']); + echo " | ||||||||||||||||||||||
| \n"; + echo " \n"; + echo " \n"; + echo " | \n"; + } + echo "".escape($row['call_flow_name'])." | \n"; + echo "".escape($row['call_flow_extension'])." | \n"; + echo "".escape($row['call_flow_feature_code'])." | \n"; + $status_label = $row['call_flow_status'] != 'false' ? $row['call_flow_label'] : $row['call_flow_alternate_label']; + if (permission_exists('call_flow_edit')) { + echo ""; + echo button::create(['type'=>'submit','class'=>'link','label'=>escape($status_label),'title'=>$text['button-toggle'],'onclick'=>"list_self_check('checkbox_".$x."'); list_action_set('toggle'); list_form_submit('form_list')"]); } else { - echo escape($row['call_flow_alternate_label']); + echo " | "; + echo escape($status_label); } - echo " \n"; echo " | \n"; - //echo "".escape($row['call_flow_name'])." | \n"; - echo "".escape($row['call_flow_extension'])." | \n"; - echo "".escape($row['call_flow_feature_code'])." | \n"; if (permission_exists('call_flow_context')) { - echo "".escape($row['call_flow_context'])." | \n"; + echo "".escape($row['call_flow_context'])." | \n"; } - //echo "".escape($row['call_flow_pin_number'])." | \n"; - //echo "".escape($row['call_flow_label'])." | \n"; - //echo "".escape($row['call_flow_sound'])." | \n"; - //echo "".escape($row['call_flow_app'])." | \n"; - //echo "".escape($row['call_flow_data'])." | \n"; - //echo "".escape($row['call_flow_alternate_label'])." | \n"; - //echo "".escape($row['call_flow_alternate_sound'])." | \n"; - //echo "".escape($row['call_flow_alternate_app'])." | \n"; - //echo "".escape($row['call_flow_alternate_data'])." | \n"; - echo "".escape($row['call_flow_description'])." | \n"; - echo ""; - if (permission_exists('call_flow_edit')) { - echo "$v_link_label_edit"; + echo " | \n"; + if (permission_exists('call_flow_edit') && $_SESSION['theme']['list_row_edit_button']['boolean'] == 'true') { + echo ""; + echo button::create(['type'=>'button','title'=>$text['button-edit'],'icon'=>$_SESSION['theme']['button_icon_edit'],'link'=>$list_row_url]); + echo " | \n"; } - if (permission_exists('call_flow_delete')) { - echo "$v_link_label_delete"; - } - echo " \n"; echo "
\n";
- echo "
| \n";
- echo "||||||||||||||||||||||