Portions created by the Initial Developer are Copyright (C) 2017 the Initial Developer. All Rights Reserved. Contributor(s): Mark J Crane */ //includes require_once "root.php"; require_once "resources/require.php"; //check permissions require_once "resources/check_auth.php"; if (permission_exists('call_recording_view')) { //access granted } else { echo "access denied"; exit; } //add multi-lingual support $language = new text; $text = $language->get(); //get the action if (strlen($_REQUEST["search"]) == 0 && is_array($_POST["call_recordings"])) { $call_recordings = $_POST["call_recordings"]; foreach($call_recordings as $row) { if ($row['action'] === 'download') { $action = 'download'; break; } if ($row['action'] === 'delete') { $action = 'delete'; break; } } } //download recordings if (permission_exists('call_recording_download_add')) { if ($action == "download") { //download $obj = new call_recording_downloads; $obj->save($call_recordings); //direct the user to the downloads header("Location: ".PROJECT_PATH."/app/call_recording_downloads/call_recording_downloads.php"); } } //delete the recordings if (permission_exists('call_recording_delete')) { if ($action === "delete") { //set the array $call_recordings = $_POST["call_recordings"]; //download $obj = new call_recordings; $obj->delete($call_recordings); //delete message messages::add($text['message-delete']); } } //additional includes require_once "resources/header.php"; require_once "resources/paging.php"; //get variables used to control the order $order_by = check_str($_REQUEST["order_by"]); $order = check_str($_REQUEST["order"]); //set the defaults if (strlen($order_by) == 0) { $order_by = 'call_recording_date'; $order = 'desc'; } //add the search term $search = strtolower(check_str($_REQUEST["search"])); if (strlen($search) > 0) { $sql_search = "and ("; $sql_search .= "lower(call_recording_name) like '%".$search."%' "; $sql_search .= "or lower(call_recording_path) like '%".$search."%' "; $sql_search .= "or lower(call_direction) like '%".$search."%' "; $sql_search .= "or lower(call_recording_description) like '%".$search."%' "; $sql_search .= ") "; } //prepare to page the results $sql = "select count(call_recording_uuid) as num_rows from v_call_recordings "; $sql .= "where domain_uuid = '".$_SESSION["domain_uuid"]."' "; $sql .= $sql_search; $prep_statement = $db->prepare($sql); if ($prep_statement) { $prep_statement->execute(); $row = $prep_statement->fetch(PDO::FETCH_ASSOC); if ($row['num_rows'] > 0) { $num_rows = $row['num_rows']; } else { $num_rows = '0'; } } //prepare to page the results $rows_per_page = ($_SESSION['domain']['paging']['numeric'] != '') ? $_SESSION['domain']['paging']['numeric'] : 50; $param = ""; $page = $_REQUEST['page']; if (strlen($page) == 0) { $page = 0; $_REQUEST['page'] = 0; } list($paging_controls, $rows_per_page, $var3) = paging($num_rows, $param, $rows_per_page); $offset = $rows_per_page * $page; //get the list $sql = "select * from v_call_recordings "; $sql .= "where domain_uuid = '".$_SESSION["domain_uuid"]."' "; $sql .= $sql_search; $sql .= "order by $order_by $order "; $sql .= "limit $rows_per_page offset $offset "; $prep_statement = $db->prepare(check_sql($sql)); $prep_statement->execute(); $result = $prep_statement->fetchAll(PDO::FETCH_NAMED); unset ($prep_statement, $sql); //alternate the row style $c = 0; $row_style["0"] = "row_style0"; $row_style["1"] = "row_style1"; //define the checkbox_toggle function echo "\n"; //show the content echo "
\n"; echo "\n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo "
".$text['title-call_recordings']."\n"; if (permission_exists('call_recording_download_add')) { echo " \n"; echo "       "; } echo " \n"; echo " \n"; echo "
\n"; echo " ".$text['title_description-call_recording']."

\n"; echo "
\n"; //echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo " \n"; echo th_order_by('call_recording_name', $text['label-call_recording_name'], $order_by, $order); echo "\n"; //echo th_order_by('call_recording_path', $text['label-play'], $order_by, $order); echo th_order_by('call_recording_length', $text['label-call_recording_length'], $order_by, $order); echo th_order_by('call_recording_date', $text['label-call_recording_date'], $order_by, $order); echo th_order_by('call_direction', $text['label-call_direction'], $order_by, $order); echo th_order_by('call_recording_description', $text['label-call_recording_description'], $order_by, $order); //echo th_order_by('call_recording_base64', $text['label-call_recording_base64'], $order_by, $order); echo " \n"; echo "\n"; if (is_array($result)) { $x = 0; foreach($result as $row) { //if (permission_exists('call_recording_play') && $recording_file_path != '') { // echo "\n"; //} if (permission_exists('call_recording_edit')) { $tr_link = "href='call_recording_edit.php?id=".$row['call_recording_uuid']."'"; } echo "\n"; echo " \n"; echo " \n"; echo " \n"; //echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; //echo " \n"; echo " \n"; echo "\n"; $x++; if ($c==0) { $c=1; } else { $c=0; } } //end foreach unset($sql, $result, $row_count); } //end if results echo "\n"; echo "\n"; echo "\n"; echo "
\n"; echo " \n"; echo " ".$text['label-recording'].""; if (permission_exists('call_recording_add')) { echo " $v_link_label_add"; } else { echo " \n"; } echo "
".$row['call_recording_name']." \n"; //echo " ".$text['label-download']." ".$v_link_label_download."\n"; //echo " ".$row['call_recording_length']." ".$row['call_recording_date']." ".$row['call_direction']." ".$row['call_recording_description']." ".$row['call_recording_base64']." "; if (permission_exists('xml_cdr_details')) { echo " $v_link_label_view"; } if (permission_exists('call_recording_edit')) { echo "\n"; } echo "
\n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo "
 $paging_controls"; if (permission_exists('call_recording_add')) { echo "$v_link_label_add"; } else { echo " "; } echo "
\n"; echo "
"; echo "
\n"; echo "

"; //include the footer require_once "resources/footer.php"; ?>