Add show all code donated by Chris Black

This commit is contained in:
Mark Crane 2015-03-06 17:15:09 +00:00
parent 0f40019abd
commit 669fb08d4e
9 changed files with 142 additions and 52 deletions

View File

@ -57,6 +57,9 @@
$apps[$x]['permissions'][$y]['name'] = "xml_cdr_mos";
$apps[$x]['permissions'][$y]['groups'][] = "admin";
$apps[$x]['permissions'][$y]['groups'][] = "superadmin";
$y++;
$apps[$x]['permissions'][$y]['name'] = "xml_cdr_all";
$apps[$x]['permissions'][$y]['groups'][] = "superadmin";
//schema details
$y = 0; //table array index

View File

@ -185,10 +185,10 @@
$text['label-average']['pt-pt'] = "Média";
$text['label-average']['fr-fr'] = "Moyenne";
$text['label-preset']['en-us'] = 'Quick Select';
$text['label-preset']['es-cl'] = 'Quick Select';
$text['label-preset']['pt-pt'] = 'Quick Select';
$text['label-preset']['fr-fr'] = 'Quick Select';
$text['label-preset']['en-us'] = 'Quick Select';
$text['label-preset']['es-cl'] = 'Quick Select';
$text['label-preset']['pt-pt'] = 'Quick Select';
$text['label-preset']['fr-fr'] = 'Quick Select';
$text['button-export']['en-us'] = 'Export';
$text['button-export']['es-cl'] = 'Exportación';
@ -563,35 +563,35 @@
$text['option-false']['pt-pt'] = "Não";
$text['option-false']['fr-fr'] = "Non";
$text['option-default']['en-us'] = "Default";
$text['option-default']['es-cl'] = "Default";
$text['option-default']['pt-pt'] = "Default";
$text['option-default']['fr-fr'] = "Default";
$text['option-default']['en-us'] = "Default";
$text['option-default']['es-cl'] = "Default";
$text['option-default']['pt-pt'] = "Default";
$text['option-default']['fr-fr'] = "Default";
$text['option-last_hour']['en-us'] = "Last Hour";
$text['option-last_hour']['es-cl'] = "Last Hour";
$text['option-last_hour']['pt-pt'] = "Last Hour";
$text['option-last_hour']['fr-fr'] = "Last Hour";
$text['option-last_hour']['en-us'] = "Last Hour";
$text['option-last_hour']['es-cl'] = "Last Hour";
$text['option-last_hour']['pt-pt'] = "Last Hour";
$text['option-last_hour']['fr-fr'] = "Last Hour";
$text['option-today']['en-us'] = "Today";
$text['option-today']['es-cl'] = "Today";
$text['option-today']['pt-pt'] = "Today";
$text['option-today']['fr-fr'] = "Today";
$text['option-today']['en-us'] = "Today";
$text['option-today']['es-cl'] = "Today";
$text['option-today']['pt-pt'] = "Today";
$text['option-today']['fr-fr'] = "Today";
$text['option-yesterday']['en-us'] = "Yesterday";
$text['option-yesterday']['es-cl'] = "Yesterday";
$text['option-yesterday']['pt-pt'] = "Yesterday";
$text['option-yesterday']['fr-fr'] = "Yesterday";
$text['option-yesterday']['en-us'] = "Yesterday";
$text['option-yesterday']['es-cl'] = "Yesterday";
$text['option-yesterday']['pt-pt'] = "Yesterday";
$text['option-yesterday']['fr-fr'] = "Yesterday";
$text['option-this_month']['en-us'] = "This Month";
$text['option-this_month']['es-cl'] = "This Month";
$text['option-this_month']['pt-pt'] = "This Month";
$text['option-this_month']['fr-fr'] = "This Month";
$text['option-this_month']['en-us'] = "This Month";
$text['option-this_month']['es-cl'] = "This Month";
$text['option-this_month']['pt-pt'] = "This Month";
$text['option-this_month']['fr-fr'] = "This Month";
$text['option-this_year']['en-us'] = "This Year";
$text['option-this_year']['es-cl'] = "This Year";
$text['option-this_year']['pt-pt'] = "This Year";
$text['option-this_year']['fr-fr'] = "This Year";
$text['option-this_year']['en-us'] = "This Year";
$text['option-this_year']['es-cl'] = "This Year";
$text['option-this_year']['pt-pt'] = "This Year";
$text['option-this_year']['fr-fr'] = "This Year";
$text['confirm-delete']['en-us'] = "Do you really want to delete this?";
$text['confirm-delete']['es-cl'] = "¿Realmente desea eliminar el número?";
@ -608,4 +608,13 @@
$text['message-delete']['pt-pt'] = "Remoção Efectuada";
$text['message-delete']['fr-fr'] = "Supprimé";
$text['button-show_all']['en-us'] = "Show All";
$text['button-show_all']['es-cl'] = "Mostrar Todos";
$text['button-show_all']['pt-pt'] = "Mostrar Todos";
$text['button-show_all']['fr-fr'] = "Montrer Tout";
$text['label-domain-name']['en-us'] = "Domain Name";
$text['label-domain-name']['es-cl'] = "Nombre de Dominio";
$text['label-domain-name']['pt-pt'] = "Nome de Domínio";
$text['label-domain-name']['fr-fr'] = "Nom de Domaine";
?>

View File

@ -38,6 +38,7 @@
else {
include "root.php";
require_once "resources/require.php";
require_once "resources/pdo.php";
}
//set debug

View File

@ -125,6 +125,9 @@ else {
echo " <table cellpadding='0' cellspacing='0' border='0'>\n";
echo " <tr>\n";
echo " <td style='vertical-align: top;'>\n";
if (permission_exists('xml_cdr_all')) {
echo " <input type='button' class='btn' value='".$text['button-show_all']."' onclick=\"window.location='xml_cdr.php?showall=true';\">\n";
}
if (permission_exists('xml_cdr_search_advanced')) {
echo " <input type='button' class='btn' value='".$text['button-advanced_search']."' onclick=\"window.location='xml_cdr_search.php';\">\n";
}
@ -371,6 +374,12 @@ else {
echo "<th style='width: 30px; text-align: center; padding: 0px;'><input type='checkbox' onchange=\"(this.checked) ? check('all') : check('none');\"></th>";
}
echo "<th>&nbsp;</th>\n";
if ($_GET['showall'] && permission_exists('xml_cdr_all')) {
echo th_order_by('domain_name', $text['label-domain-name'], $order_by, $order, null, null, $param);
//echo " <th class='vncell' valign='top' nowrap='nowrap' width='30%'>\n";
//echo " ".$text['label-domain-name']."\n";
//echo " </th>\n";
}
echo th_order_by('caller_id_name', $text['label-cid-name'], $order_by, $order, null, null, $param);
echo th_order_by('caller_id_number', $text['label-source'], $order_by, $order, null, null, $param);
echo th_order_by('destination_number', $text['label-destination'], $order_by, $order, null, null, $param);
@ -473,7 +482,14 @@ else {
unset($recording_file_path);
}
$tr_link = (if_group("admin") || if_group("superadmin") || if_group("cdr")) ? "href='xml_cdr_details.php?uuid=".$row['uuid']."'" : null;
//$tr_link = (if_group("admin") || if_group("superadmin") || if_group("cdr")) ? "href='xml_cdr_details.php?uuid=".$row['uuid']."'" : null;
if ((if_group("admin") || if_group("superadmin") || if_group("cdr")) && $_GET['showall']) {
$tr_link .= "href='xml_cdr_details.php?uuid=".$row['uuid']."&showall=true'";
} elseif (if_group("admin") || if_group("superadmin") || if_group("cdr")) {
$tr_link .= "href='xml_cdr_details.php?uuid=".$row['uuid']."'";
} else {
$tr_link = null;
}
echo "<tr ".$tr_link.">\n";
if (permission_exists('xml_cdr_delete')) {
echo " <td valign='top' class='".$row_style[$c]." tr_link_void' style='text-align: center; vertical-align: middle; padding: 0px;'>";
@ -518,7 +534,11 @@ else {
else {
echo " <td class='".$row_style[$c]."'>&nbsp;</td>";
}
if ($_GET['showall'] && permission_exists('xml_cdr_all')) {
echo " <td valign='top' class='".$row_style[$c]."'>";
echo $row['domain_name'].'&nbsp;';
echo " </td>\n";
}
echo " <td valign='top' class='".$row_style[$c]."'>";
echo $row['caller_id_name'].'&nbsp;';
echo " </td>\n";
@ -627,7 +647,7 @@ else {
}
echo " <td valign='top' class='".$row_style[$c]."' nowrap='nowrap'>";
if (if_group("admin") || if_group("superadmin") || if_group("cdr")) {
echo "<a href='xml_cdr_details.php?uuid=".$row['uuid']."'>".$hangup_cause."</a>";
echo "<a $tr_link>".$hangup_cause."</a>";
}
else {
echo $hangup_cause;
@ -635,7 +655,7 @@ else {
echo " </td>\n";
if (if_group("admin") || if_group("superadmin") || if_group("cdr")) {
echo " <td class='list_control_icons tr_link_void'>";
echo " <a href='xml_cdr_details.php?uuid=".$row['uuid']."' title='".$text['button-view']."'>$v_link_label_view</a>";
echo " <a $tr_link title='".$text['button-view']."'>$v_link_label_view</a>"; //CJB
if (permission_exists('xml_cdr_delete')) {
echo "<a href='xml_cdr_delete.php?id[]=".$row['uuid']."&rec[]=".(($recording_file_path != '') ? base64_encode($recording_file_path) : null)."' alt='".$text['button-delete']."' onclick=\"return confirm('".$text['confirm-delete']."')\">".$v_link_label_delete."</a>";
}

View File

@ -46,8 +46,11 @@ else {
//get the cdr string from the database
$sql = "select * from v_xml_cdr ";
$sql .= "where domain_uuid = '$domain_uuid' ";
$sql .= "and uuid = '$uuid' ";
if ($_GET['showall'] && permission_exists('xml_cdr_all')) {
if ($sql_where) { $sql .= "where uuid = '$uuid' "; }
} else {
$sql .= "where uuid = '$uuid' and domain_uuid = '$domain_uuid' ";
}
$row = $db->query($sql)->fetch();
$start_stamp = trim($row["start_stamp"]);
$xml_string = trim($row["xml"]);

View File

@ -61,8 +61,11 @@ require_once "resources/require.php";
$sql .= "v_extensions ";
$sql .= "where ";
$sql .= "enabled = 'true' ";
$sql .= "and domain_uuid = '".$_SESSION['domain_uuid']."' ";
if ($_GET['showall'] && permission_exists('xml_cdr_all')) {
$sql .= " ";
} else {
$sql .= "and domain_uuid = '".$_SESSION['domain_uuid']."' ";
}
if (!(if_group("admin") || if_group("superadmin"))) {
if (count($_SESSION['user']['extension']) > 0) {
$sql .= "and (";
@ -109,8 +112,13 @@ require_once "resources/require.php";
$sql .= "hangup_cause ";
$sql .= "from v_xml_cdr ";
$sql .= "where ";
$sql .= "domain_uuid = '".$_SESSION['domain_uuid']."' ";
$sql .= "and ( ";
if ($_GET['showall'] && permission_exists('xml_cdr_all')) {
$sql .= " ";
} else {
$sql .= " domain_uuid = '".$_SESSION['domain_uuid']."' ";
$sql .= " and ";
}
$sql .= "( ";
$sql .= " caller_id_number in ('".$ext_list."') or ";
$sql .= " destination_number in ('".$ext_list."') ";
$sql .= ") ";
@ -260,6 +268,9 @@ require_once "resources/require.php";
echo " </tr>";
echo " <tr>";
echo " <td colspan='4' style='padding-top: 8px;' align='right'>";
if (permission_exists('xml_cdr_all')) {
echo " <input type='button' class='btn' value='".$text['button-show_all']."' onclick=\"window.location='xml_cdr_extension_summary.php?showall=true';\">\n";
}
echo " <input type='button' class='btn' value='".$text['button-reset']."' onclick=\"document.location.href='xml_cdr_extension_summary.php';\">\n";
echo " <input type='submit' class='btn' name='submit' value='".$text['button-update']."'>\n";
echo " </td>";

View File

@ -200,6 +200,9 @@ else {
$param .= "&remote_media_ip=".$remote_media_ip;
$param .= "&network_addr=".$network_addr;
$param .= "&bridge_uuid=".$bridge_uuid;
if ($_GET['showall'] && permission_exists('xml_cdr_all')) {
$param .= "&showall=" . $_GET['showall'];
}
if (isset($order_by)) {
$param .= "&order_by=".$order_by."&order=".$order;
}
@ -277,7 +280,16 @@ else {
$sql .= "rtp_audio_in_mos, ";
}
$sql .= "(answer_epoch - start_epoch) as tta ";
$sql .= "from v_xml_cdr where domain_uuid = '".$domain_uuid."' ".$sql_where;
if ($_GET['showall'] && permission_exists('xml_cdr_all')) {
$sql .= ", domain_name ";
}
$sql .= "from v_xml_cdr ";
if ($_GET['showall'] && permission_exists('xml_cdr_all')) {
if ($sql_where) { $sql .= "where "; }
} else {
$sql .= "where domain_uuid = '".$domain_uuid."' ";
}
$sql .= $sql_where;
if (strlen($order_by)> 0) { $sql .= " order by ".$order_by." ".$order." "; }
if ($rows_per_page == 0) {
$sql .= " limit ".$_SESSION['cdr']['limit']['numeric']." offset 0 ";

View File

@ -47,6 +47,9 @@ else {
echo "<tr>\n";
echo " <td width='30%' align='left' valign='top' nowrap='nowrap'><b>".$text['label-call-statistics']."</b></td>\n";
echo " <td width='70%' align='right' valign='top'>\n";
if (permission_exists('xml_cdr_all')) {
echo " <input type='button' class='btn' value='".$text['button-show_all']."' onclick=\"window.location='xml_cdr_statistics.php?showall=true';\">\n";
}
echo " <input type='button' class='btn' name='' alt='".$text['button-back']."' onclick=\"window.location='xml_cdr.php'\" value='".$text['button-back']."'>\n";
echo " <input type='button' class='btn' value='".$text['button-extension_summary']."' onclick=\"document.location.href='xml_cdr_extension_summary.php';\">\n";
echo " <input type='button' class='btn' value='".$text['button-download_csv']."' onclick=\"document.location.href='xml_cdr_statistics_csv.php';\">\n";

View File

@ -57,7 +57,11 @@ else {
}
else {
//superadmin or admin
$sql_where = "where domain_uuid = '$domain_uuid' ";
if ($_GET['showall'] && permission_exists('xml_cdr_all')) {
$sql_where = "";
} else {
$sql_where = "where domain_uuid = '$domain_uuid' ";
}
}
//create the sql query to get the xml cdr records
@ -74,11 +78,15 @@ else {
function get_call_volume_between($start, $end, $where) {
global $db;
if (strlen($where) == 0) {
$where = "where domain_uuid = '".$_SESSION['domain_uuid']."' ";
if ($_GET['showall'] && permission_exists('xml_cdr_all')) {
$where = "where ";
} else {
$where = "where domain_uuid = '".$_SESSION['domain_uuid']."' ";
}
}
$sql = " select count(*) as count from v_xml_cdr ";
$sql .= $where;
$sql .= "and start_epoch BETWEEN ".$start." AND ".$end." ";
$sql .= " start_epoch BETWEEN ".$start." AND ".$end." ";
$prep_statement = $db->prepare(check_sql($sql));
$prep_statement->execute();
$result = $prep_statement->fetchAll(PDO::FETCH_ASSOC);
@ -98,11 +106,15 @@ else {
function get_call_seconds_between($start, $end, $where) {
global $db;
if (strlen($where) == 0) {
$where = "where domain_uuid = '".$_SESSION['domain_uuid']."' ";
if ($_GET['showall'] && permission_exists('xml_cdr_all')) {
$where .= "where ";
} else {
$where = "where domain_uuid = '".$_SESSION['domain_uuid']."' ";
}
}
$sql = " select sum(billsec) as seconds from v_xml_cdr ";
$sql .= $where;
$sql .= "and start_epoch BETWEEN ".$start." AND ".$end." ";
$sql .= "start_epoch BETWEEN ".$start." AND ".$end." ";
$prep_statement = $db->prepare(check_sql($sql));
$prep_statement->execute();
$result = $prep_statement->fetchAll(PDO::FETCH_ASSOC);
@ -145,8 +157,12 @@ else {
$stats[$i]['avg_min'] = ($stats[$i]['volume'] - $stats[$i]['missed']) / 60;
//answer / seizure ratio
$where = "where domain_uuid = '".$_SESSION['domain_uuid']."' ";
$where .= "and billsec = '0' ";
if ($_GET['showall'] && permission_exists('xml_cdr_all')) {
$where .= "where ";
} else {
$where = "where domain_uuid = '".$_SESSION['domain_uuid']."' and ";
}
$where .= "billsec = '0' ";
$where .= "and direction = 'inbound' ";
$stats[$i]['missed'] = get_call_volume_between($stats[$i]['start_epoch'], $stats[$i]['stop_epoch'], $where);
$stats[$i]['asr'] = (($stats[$i]['volume'] - $stats[$i]['missed']) / ($stats[$i]['volume']) * 100);
@ -169,8 +185,12 @@ else {
$stats[$i]['minutes'] = $stats[$i]['seconds'] / 60;
$stats[$i]['avg_sec'] = $stats[$i]['seconds'] / $stats[$i]['volume'];
$stats[$i]['avg_min'] = ($stats[$i]['volume'] - $stats[$i]['missed']) / (60*24);
$where = "where domain_uuid = '".$_SESSION['domain_uuid']."' ";
$where .= "and billsec = '0' ";
if ($_GET['showall'] && permission_exists('xml_cdr_all')) {
$where .= "where ";
} else {
$where = "where domain_uuid = '".$_SESSION['domain_uuid']."' and ";
}
$where .= "billsec = '0' ";
$where .= "and direction = 'inbound' ";
$stats[$i]['missed'] = get_call_volume_between($stats[$i]['start_epoch'], $stats[$i]['stop_epoch'], $where);
$stats[$i]['asr'] = (($stats[$i]['volume'] - $stats[$i]['missed']) / ($stats[$i]['volume']) * 100);
@ -190,8 +210,12 @@ else {
$stats[$i]['minutes'] = $stats[$i]['seconds'] / 60;
$stats[$i]['avg_sec'] = $stats[$i]['seconds'] / $stats[$i]['volume'];
$stats[$i]['avg_min'] = ($stats[$i]['volume'] - $stats[$i]['missed']) / (60*24*7);
$where = "where domain_uuid = '".$_SESSION['domain_uuid']."' ";
$where .= "and billsec = '0' ";
if ($_GET['showall'] && permission_exists('xml_cdr_all')) {
$where .= "where ";
} else {
$where = "where domain_uuid = '".$_SESSION['domain_uuid']."' and ";
}
$where .= "billsec = '0' ";
$where .= "and direction = 'inbound' ";
$stats[$i]['missed'] = get_call_volume_between($stats[$i]['start_epoch'], $stats[$i]['stop_epoch'], $where);
$stats[$i]['asr'] = (($stats[$i]['volume'] - $stats[$i]['missed']) / ($stats[$i]['volume']) * 100);
@ -211,8 +235,12 @@ else {
$stats[$i]['minutes'] = $stats[$i]['seconds'] / 60;
$stats[$i]['avg_sec'] = $stats[$i]['seconds'] / $stats[$i]['volume'];
$stats[$i]['avg_min'] = ($stats[$i]['volume'] - $stats[$i]['missed']) / (60*24*30);
$where = "where domain_uuid = '".$_SESSION['domain_uuid']."' ";
$where .= "and billsec = '0' ";
if ($_GET['showall'] && permission_exists('xml_cdr_all')) {
$where .= "where ";
} else {
$where = "where domain_uuid = '".$_SESSION['domain_uuid']."' and";
}
$where .= " billsec = '0' ";
$where .= "and direction = 'inbound' ";
$stats[$i]['missed'] = get_call_volume_between($stats[$i]['start_epoch'], $stats[$i]['stop_epoch'], $where);
$stats[$i]['asr'] = (($stats[$i]['volume'] - $stats[$i]['missed']) / ($stats[$i]['volume']) * 100);