Update call recordings with more details
- Use the view_call_recordings view - Add caller id name, number and destination - Add more to the search - Improve responsiveness - Remove count to improve speed
This commit is contained in:
parent
259dd1fbab
commit
afa57b26a4
|
|
@ -17,7 +17,7 @@
|
|||
|
||||
The Initial Developer of the Original Code is
|
||||
Mark J Crane <markjcrane@fusionpbx.com>
|
||||
Portions created by the Initial Developer are Copyright (C) 2018 - 2019
|
||||
Portions created by the Initial Developer are Copyright (C) 2018 - 2022
|
||||
the Initial Developer. All Rights Reserved.
|
||||
|
||||
Contributor(s):
|
||||
|
|
@ -76,25 +76,34 @@
|
|||
//add the search string
|
||||
if (isset($_GET["search"])) {
|
||||
$search = strtolower($_GET["search"]);
|
||||
$sql_search = "and (";
|
||||
$sql_search .= " lower(call_recording_name) like :search ";
|
||||
$sql_search .= " or lower(call_recording_path) like :search ";
|
||||
$sql_search .= ") ";
|
||||
$parameters['search'] = '%'.$search.'%';
|
||||
}
|
||||
|
||||
//set the time zone
|
||||
if (isset($_SESSION['domain']['time_zone']['name'])) {
|
||||
$time_zone = $_SESSION['domain']['time_zone']['name'];
|
||||
}
|
||||
else {
|
||||
$time_zone = date_default_timezone_get();
|
||||
}
|
||||
$parameters['time_zone'] = $time_zone;
|
||||
|
||||
//get the count
|
||||
$sql = "select count(call_recording_uuid) from v_call_recordings ";
|
||||
$sql .= "where true ";
|
||||
if ($_GET['show'] != "all" || !permission_exists('call_recording_all')) {
|
||||
$sql .= "and (domain_uuid = :domain_uuid or domain_uuid is null) ";
|
||||
$parameters['domain_uuid'] = $_SESSION['domain_uuid'];
|
||||
}
|
||||
if (isset($sql_search)) {
|
||||
$sql .= $sql_search;
|
||||
}
|
||||
$database = new database;
|
||||
$num_rows = $database->select($sql, $parameters, 'column');
|
||||
//$sql = "select count(*) ";
|
||||
//$sql .= "from view_call_recordings ";
|
||||
//$sql .= "where true ";
|
||||
//if ($_GET['show'] != "all" || !permission_exists('call_recording_all')) {
|
||||
// $sql .= "and (domain_uuid = :domain_uuid or domain_uuid is null) ";
|
||||
// $parameters['domain_uuid'] = $_SESSION['domain_uuid'];
|
||||
//}
|
||||
//if (isset($search)) {
|
||||
// $sql .= "and (";
|
||||
// $sql .= " lower(call_recording_name) like :search ";
|
||||
// $sql .= " or lower(call_recording_path) like :search ";
|
||||
// $sql .= ") ";
|
||||
// $parameters['search'] = '%'.$search.'%';
|
||||
//}
|
||||
//$database = new database;
|
||||
//$num_rows = $database->select($sql, $parameters, 'column');
|
||||
|
||||
//prepare to page the results
|
||||
$rows_per_page = ($_SESSION['domain']['paging']['numeric'] != '') ? $_SESSION['domain']['paging']['numeric'] : 50;
|
||||
|
|
@ -109,8 +118,31 @@
|
|||
$offset = $rows_per_page * $page;
|
||||
|
||||
//get the list
|
||||
$sql = str_replace('count(call_recording_uuid)', '*', $sql);
|
||||
$sql .= order_by($order_by, $order, 'call_recording_date', 'desc');
|
||||
$sql = "select r.domain_uuid, d.domain_name, r.call_recording_uuid, r.call_direction, ";
|
||||
$sql .= "r.call_recording_name, r.call_recording_path, r.call_recording_length, ";
|
||||
$sql .= "r.caller_id_name, r.caller_id_number, r.caller_destination, ";
|
||||
$sql .= "to_char(timezone(:time_zone, r.call_recording_date), 'DD Mon YYYY') as call_recording_date_formatted, \n";
|
||||
$sql .= "to_char(timezone(:time_zone, r.call_recording_date), 'HH12:MI:SS am') as call_recording_time_formatted \n";
|
||||
$sql .= "from view_call_recordings as r, v_domains as d ";
|
||||
//$sql .= "from v_call_recordings as r, v_domains as d ";
|
||||
$sql .= "where true ";
|
||||
if ($_GET['show'] != "all" || !permission_exists('call_recording_all')) {
|
||||
$sql .= "and (r.domain_uuid = :domain_uuid or r.domain_uuid is null) ";
|
||||
$parameters['domain_uuid'] = $_SESSION['domain_uuid'];
|
||||
}
|
||||
$sql .= "and r.domain_uuid = d.domain_uuid ";
|
||||
if (isset($search)) {
|
||||
$sql .= "and (";
|
||||
$sql .= " lower(r.call_direction) like :search ";
|
||||
$sql .= " or lower(r.caller_id_name) like :search ";
|
||||
$sql .= " or lower(r.caller_id_number) like :search ";
|
||||
$sql .= " or lower(r.caller_destination) like :search ";
|
||||
$sql .= " or lower(r.call_recording_name) like :search ";
|
||||
$sql .= " or lower(r.call_recording_path) like :search ";
|
||||
$sql .= ") ";
|
||||
$parameters['search'] = '%'.$search.'%';
|
||||
}
|
||||
$sql .= order_by($order_by, $order, 'r.call_recording_date', 'desc');
|
||||
$sql .= limit_offset($rows_per_page, $offset);
|
||||
$database = new database;
|
||||
$call_recordings = $database->select($sql, $parameters, 'all');
|
||||
|
|
@ -126,7 +158,7 @@
|
|||
|
||||
//show the content
|
||||
echo "<div class='action_bar' id='action_bar'>\n";
|
||||
echo " <div class='heading'><b>".$text['title-call_recordings']." (".$num_rows.")</b></div>\n";
|
||||
echo " <div class='heading'><b>".$text['title-call_recordings']." </b></div>\n";
|
||||
echo " <div class='actions'>\n";
|
||||
if (permission_exists('call_recording_download_add') && $call_recordings) {
|
||||
echo button::create(['type'=>'button','label'=>$text['button-download'],'icon'=>$_SESSION['theme']['button_icon_download'],'collapse'=>'hide-xs','onclick'=>"list_action_set('download'); list_form_submit('form_list');"]);
|
||||
|
|
@ -135,9 +167,17 @@
|
|||
echo button::create(['type'=>'button','label'=>$text['button-delete'],'icon'=>$_SESSION['theme']['button_icon_delete'],'id'=>'btn_delete','name'=>'btn_delete','style'=>'display: none; margin-left: 15px;','collapse'=>'hide-xs','onclick'=>"modal_open('modal-delete','btn_delete');"]);
|
||||
}
|
||||
echo "<form id='form_search' class='inline' method='get'>\n";
|
||||
if (permission_exists('call_recording_all')) {
|
||||
if ($_GET['show'] == 'all') {
|
||||
echo " <input type='hidden' name='show' value='all'>";
|
||||
}
|
||||
else {
|
||||
echo button::create(['type'=>'button','label'=>$text['button-show_all'],'icon'=>$_SESSION['theme']['button_icon_all'],'link'=>'?type='.urlencode($destination_type).'&show=all'.($search != '' ? "&search=".urlencode($search) : null)]);
|
||||
}
|
||||
}
|
||||
echo "<input type='text' class='txt list-search' name='search' id='search' value=\"".escape($search)."\" placeholder=\"".$text['label-search']."\" onkeydown=''>";
|
||||
echo button::create(['label'=>$text['button-search'],'icon'=>$_SESSION['theme']['button_icon_search'],'type'=>'submit','id'=>'btn_search','collapse'=>'hide-xs']);
|
||||
//echo button::create(['label'=>$text['button-reset'],'icon'=>$_SESSION['theme']['button_icon_reset'],'type'=>'button','id'=>'btn_reset','link'=>'call_recordings.php','style'=>($search == '' ? 'display: none;' : null),'collapse'=>'hide-xs']);
|
||||
echo button::create(['label'=>$text['button-reset'],'icon'=>$_SESSION['theme']['button_icon_reset'],'type'=>'button','id'=>'btn_reset','link'=>'call_recordings.php','style'=>($search == '' ? 'display: none;' : null),'collapse'=>'hide-xs']);
|
||||
if ($paging_controls_mini != '') {
|
||||
echo "<span style='margin-left: 15px;'>".$paging_controls_mini."</span>\n";
|
||||
}
|
||||
|
|
@ -159,7 +199,10 @@
|
|||
|
||||
echo "<table class='list'>\n";
|
||||
echo "<tr class='list-header'>\n";
|
||||
$col_count = 4;
|
||||
$col_count = 7;
|
||||
if ($_GET['show'] == "all" && permission_exists('call_recording_all')) {
|
||||
$col_count++;
|
||||
}
|
||||
if (permission_exists('call_recording_delete')) {
|
||||
echo " <th class='checkbox'>\n";
|
||||
echo " <input type='checkbox' id='checkbox_all' name='checkbox_all' onclick='list_all_toggle(); checkbox_on_change(this);' ".($call_recordings ?: "style='visibility: hidden;'").">\n";
|
||||
|
|
@ -169,14 +212,17 @@
|
|||
if ($_GET['show'] == "all" && permission_exists('call_recording_all')) {
|
||||
echo th_order_by('domain_name', $text['label-domain'], $order_by, $order, $param, "class='shrink'");
|
||||
}
|
||||
echo th_order_by('call_recording_name', $text['label-call_recording_name'], $order_by, $order, null, "class='pct-40'");
|
||||
echo th_order_by('caller_id_name', $text['label-caller_id_name'], $order_by, $order, null, "class='hide-sm-dn shrink'");
|
||||
echo th_order_by('caller_id_number', $text['label-caller_id_number'], $order_by, $order, null, "class='pct-10'");
|
||||
echo th_order_by('caller_destination', $text['label-caller_destination'], $order_by, $order, null, "class='hide-sm-dn shrink'");
|
||||
echo th_order_by('call_recording_name', $text['label-call_recording_name'], $order_by, $order, null, "class='pct-40 hide-sm-dn'");
|
||||
if (permission_exists('call_recording_play') || permission_exists('call_recording_download')) {
|
||||
echo "<th class='shrink center'>".$text['label-recording']."</th>\n";
|
||||
$col_count++;
|
||||
}
|
||||
echo th_order_by('call_recording_length', $text['label-call_recording_length'], $order_by, $order, null, "class='right'");
|
||||
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_length', $text['label-call_recording_length'], $order_by, $order, null, "class='right hide-sm-dn shrink'");
|
||||
echo th_order_by('call_recording_date', $text['label-call_recording_date'], $order_by, $order, null, "class='center'");
|
||||
echo th_order_by('call_direction', $text['label-call_direction'], $order_by, $order, null, "class='hide-sm-dn shrink'");
|
||||
if (permission_exists('xml_cdr_details')) {
|
||||
echo " <td class='action-button'> </td>\n";
|
||||
}
|
||||
|
|
@ -201,15 +247,12 @@
|
|||
echo " </td>\n";
|
||||
}
|
||||
if ($_GET['show'] == "all" && permission_exists('call_recording_all')) {
|
||||
if (strlen($_SESSION['domains'][$row['domain_uuid']]['domain_name']) > 0) {
|
||||
$domain = $_SESSION['domains'][$row['domain_uuid']]['domain_name'];
|
||||
}
|
||||
else {
|
||||
$domain = $text['label-global'];
|
||||
}
|
||||
echo " <td>".escape($domain)."</td>\n";
|
||||
echo " <td class='overflow hide-sm-dn shrink'>".escape($row['domain_name'])."</td>\n";
|
||||
}
|
||||
echo " <td class='overflow'>".escape($row['call_recording_name'])."</td>\n";
|
||||
echo " <td class='hide-sm-dn shrink'>".escape($row['caller_id_name'])."</td>\n";
|
||||
echo " <td class='overflow'>".escape($row['caller_id_number'])."</td>\n";
|
||||
echo " <td class='overflow hide-sm-dn shrink'>".escape($row['caller_destination'])."</td>\n";
|
||||
echo " <td class='hide-sm-dn nowrap'>".escape($row['call_recording_name'])."</td>\n";
|
||||
if (permission_exists('call_recording_play') || permission_exists('call_recording_download')) {
|
||||
echo " <td class='middle button center no-link no-wrap'>";
|
||||
if (file_exists($row['call_recording_path'].'/'.$row['call_recording_name'])) {
|
||||
|
|
@ -229,10 +272,9 @@
|
|||
}
|
||||
echo " </td>\n";
|
||||
}
|
||||
echo " <td class='right'>".($row['call_recording_length'] <= 59 ? '0:' : null).escape(str_pad($row['call_recording_length'], 2, '0', STR_PAD_LEFT))."</td>\n";
|
||||
$call_recording_date = explode(' ', $row['call_recording_date']);
|
||||
echo " <td class='no-wrap'>".escape($call_recording_date['0'])." <span class='hide-sm-dn'>".escape($call_recording_date[1])."</span></td>\n";
|
||||
echo " <td>".($row['call_direction'] != '' ? escape($text['label-'.$row['call_direction']]) : null)."</td>\n";
|
||||
echo " <td class='right overflow hide-sm-dn shrink'>".($row['call_recording_length'] <= 59 ? '0:' : null).escape(str_pad($row['call_recording_length'], 2, '0', STR_PAD_LEFT))."</td>\n";
|
||||
echo " <td class='center overflow'>".escape($row['call_recording_date_formatted'])." <span class='hide-sm-dn'>".escape($row['call_recording_time_formatted'])."</span></td>\n";
|
||||
echo " <td class='left hide-sm-dn shrink'>".($row['call_direction'] != '' ? escape($text['label-'.$row['call_direction']]) : null)."</td>\n";
|
||||
if (permission_exists('xml_cdr_details')) {
|
||||
echo " <td class='action-button'>\n";
|
||||
echo button::create(['type'=>'button','title'=>$text['button-view'],'icon'=>$_SESSION['theme']['button_icon_view'],'link'=>PROJECT_PATH.'/app/xml_cdr/xml_cdr_details.php?id='.urlencode($row['call_recording_uuid'])]);
|
||||
|
|
|
|||
Loading…
Reference in New Issue