0,0 → 1,60 |
<?php |
|
include_once('includes/common.php'); |
Prolog(); |
|
if(array_key_exists('active', $_GET)) { |
$db->query_params("select acctid, calldate, linkdate, clid, src, dst, dcontext," |
. " channel, dstchannel, lastapp, lastdata," |
. " extract(epoch from date_trunc('second',current_timestamp-calldate)) as duration," |
. " extract(epoch from date_trunc('second',current_timestamp-linkdate)) as billsec," |
. " disposition, amaflags, accountcode, uniqueid, userfield," |
. " p1.person_name as src_name, e1.entry_title as src_title," |
. " p2.person_name as dst_name, e2.entry_title as dst_title" |
. " from activecalls r" |
. " left join telbook_entries e1 on r.src=e1.entry_value" |
. " left join telbook_persons p1 on p1.person_id=e1.entry_person" |
. " left join telbook_entries e2 on r.dst=e2.entry_value" |
. " left join telbook_persons p2 on p2.person_id=e2.entry_person" |
. " where acctid=$1 and duration is null", array($_GET['active'])); |
} |
elseif(array_key_exists('detail', $_GET)) { |
$cdr_detail = array(); |
$db->query_params("select r.*," |
. " p1.person_name as src_name, e1.entry_title as src_title," |
. " p2.person_name as dst_name, e2.entry_title as dst_title" |
. " from cdr r" |
. " left join telbook_entries e1 on r.src=e1.entry_value" |
. " left join telbook_persons p1 on p1.person_id=e1.entry_person" |
. " left join telbook_entries e2 on r.dst=e2.entry_value" |
. " left join telbook_persons p2 on p2.person_id=e2.entry_person" |
. " where acctid=$1", array($_GET['detail'])); |
} |
else { |
die("No ID to search"); |
} |
|
$cdr_detail = array(); |
$detail = $db->fetch_row(); |
|
for($i = 0; $i < $db->num_fields(); ++$i) { |
$col = $db->get_field_name($i); |
$cdr_detail['CDR_'.strtoupper($col)] = $detail[$col]; |
} |
|
$cdr_detail['CDR_STATUS'] = ($detail ? (array_key_exists('active', $_GET) |
? 'ACTIVE' : 'DONE') : 'NOT FOUND'); |
$cdr_detail['CDR_CALLDATE_F'] = FormatDateTime($detail['calldate']); |
$cdr_detail['CDR_DURATION_F'] = FormatDuration($detail['duration']); |
$cdr_detail['CDR_BILLSEC_F'] = FormatDuration($detail['billsec']); |
$cdr_detail['CDR_SRC_PERSON'] = $detail['src_name'] . ($detail['src_title'] ? '/' |
. $detail['src_title'] : ''); |
$cdr_detail['CDR_DST_PERSON'] = $detail['dst_name'] . ($detail['dst_title'] ? '/' |
. $detail['dst_title'] : ''); |
|
$g_display->add_variables($cdr_detail); |
$g_display->add_template('cdr_detail'); |
|
Epilog(); |
|
?> |
Property changes: |
Added: svn:mergeinfo |