Portions created by the Initial Developer are Copyright (C) 2008-2012 the Initial Developer. All Rights Reserved. Contributor(s): Mark J Crane */ include "root.php"; require_once "resources/require.php"; require_once "resources/check_auth.php"; if (permission_exists('follow_me') || permission_exists('call_forward') || permission_exists('do_not_disturb')) { //access granted } else { echo "access denied"; exit; } //get the https values and set as variables $order_by = check_str($_GET["order_by"]); $order = check_str($_GET["order"]); //handle search term $search = check_str($_GET["search"]); if (strlen($search) > 0) { $sql_mod = "and ( "; $sql_mod .= "extension like '%".$search."%' "; $sql_mod .= "or description like '%".$search."%' "; $sql_mod .= ") "; } //add multi-lingual support $language = new text; $text = $language->get($_SESSION['domain']['language']['code'], 'app/calls'); //begin the content require_once "resources/header.php"; require_once "resources/paging.php"; //define select count query $sql = "select count(extension_uuid) as count from v_extensions "; $sql .= "where domain_uuid = '".$domain_uuid."' "; $sql .= "and enabled = 'true' "; if (!(if_group("admin") || if_group("superadmin"))) { if (count($_SESSION['user']['extension']) > 0) { $sql .= "and ("; $x = 0; foreach($_SESSION['user']['extension'] as $row) { if ($x > 0) { $sql .= "or "; } $sql .= "extension = '".$row['user']."' "; $x++; } $sql .= ")"; } else { //used to hide any results when a user has not been assigned an extension $sql .= "and extension = 'disabled' "; } } $sql .= $sql_mod; //add search mod from above //execute select count query $prep_statement = $db->prepare(check_sql($sql)); $prep_statement->execute(); $row = $prep_statement->fetch(PDO::FETCH_NAMED); $result_count = $row['count']; unset ($prep_statement, $row); if ($is_included == 'true') { $rows_per_page = 10; if ($result_count > 10) { echo "\n"; } } else { $rows_per_page = 150; } $param = "&search=".$search; $page = $_GET['page']; if (strlen($page) == 0) { $page = 0; $_GET['page'] = 0; } list($paging_controls_mini, $rows_per_page, $var_3) = paging($result_count, $param, $rows_per_page, true); list($paging_controls, $rows_per_page, $var_3) = paging($result_count, $param, $rows_per_page); $offset = $rows_per_page * $page; //rework select data query $sql = str_replace('count(extension_uuid) as count', '*', $sql); $sql .= " limit ".$rows_per_page." offset ".$offset." "; //execute select data query $prep_statement = $db->prepare(check_sql($sql)); $prep_statement->execute(); $result = $prep_statement->fetchAll(PDO::FETCH_NAMED); unset ($prep_statement, $sql); $c = 0; $row_style["0"] = "row_style0"; $row_style["1"] = "row_style1"; if ($is_included != "true") { echo "\n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo "
".$text['title']."
\n"; echo " ".$text['description-2']."\n"; echo " ".$text['description-3']."\n"; echo "
\n"; echo " "; echo " "; if ($paging_controls_mini != '') { echo "".$paging_controls_mini."\n"; } echo "
\n"; echo "
"; } echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; if ($result_count > 0) { foreach($result as $row) { $tr_url = PROJECT_PATH."/app/calls/call_edit.php?id=".$row['extension_uuid']; $tr_link = (permission_exists('call_forward') || permission_exists('follow_me') || permission_exists('do_not_disturb')) ? "href='".$tr_url."'" : null; echo "\n"; echo " \n"; echo " \n"; echo " \n"; echo "\n"; if ($c==0) { $c=1; } else { $c=0; } } //end foreach unset($sql, $result, $row_count); } //end if results echo "
".$text['table-extension']."".$text['table-tools']."".$text['table-description']."
".$row['extension']."\n"; if (permission_exists('call_forward')) { echo "".$text['label-call-forward']."   "; } if (permission_exists('follow_me')) { echo "".$text['label-follow-me']."   "; } if (permission_exists('do_not_disturb')) { echo "".$text['label-dnd'].""; } echo " ".$row['description']." 
"; echo "
"; if (strlen($paging_controls) > 0 && ($is_included != "true")) { echo "
".$paging_controls."
\n"; echo "

\n"; } if ($is_included != "true") { require_once "resources/footer.php"; } ?>