| 1 |
<?php /* $Id: reports.php 5361 2007-12-06 09:07:54Z p_lindheimer $ */ |
|---|
| 2 |
//Copyright (C) 2004 Coalescent Systems Inc. (info@coalescentsystems.ca) |
|---|
| 3 |
// |
|---|
| 4 |
//This program is free software; you can redistribute it and/or |
|---|
| 5 |
//modify it under the terms of the GNU General Public License |
|---|
| 6 |
//as published by the Free Software Foundation; either version 2 |
|---|
| 7 |
//of the License, or (at your option) any later version. |
|---|
| 8 |
// |
|---|
| 9 |
//This program is distributed in the hope that it will be useful, |
|---|
| 10 |
//but WITHOUT ANY WARRANTY; without even the implied warranty of |
|---|
| 11 |
//MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|---|
| 12 |
//GNU General Public License for more details. |
|---|
| 13 |
|
|---|
| 14 |
$quietmode = isset($_REQUEST['quietmode'])?$_REQUEST['quietmode']:''; |
|---|
| 15 |
|
|---|
| 16 |
$title="FreePBX: Call Detail Reports"; |
|---|
| 17 |
$message="Call Detail Reports"; |
|---|
| 18 |
|
|---|
| 19 |
include 'header.php'; |
|---|
| 20 |
|
|---|
| 21 |
// BUILD an SQL clause for any AMP User restrictions |
|---|
| 22 |
//session_register('AMP_SQL'); |
|---|
| 23 |
$low = $_SESSION["AMP_user"]->_extension_low; |
|---|
| 24 |
$high = $_SESSION["AMP_user"]->_extension_high; |
|---|
| 25 |
if ((!empty($low)) && (!empty($high))) { |
|---|
| 26 |
$channelfilter="OR (FIELD( SUBSTRING_INDEX( channel, '/', 1 ) , 'SIP', 'IAX2' ) > 0 AND SUBSTRING_INDEX(SUBSTRING(channel,2+LENGTH(SUBSTRING_INDEX( channel, '/', 1 ))),'-',1) BETWEEN $low and $high)"; |
|---|
| 27 |
$channelfilter.="OR (dstchannel<>'' AND FIELD( SUBSTRING_INDEX( dstchannel, '/', 1 ) , 'SIP', 'IAX2' ) > 0 AND SUBSTRING_INDEX(SUBSTRING(dstchannel,2+LENGTH(SUBSTRING_INDEX( dstchannel, '/', 1 ))),'-',1) BETWEEN $low and $high)"; |
|---|
| 28 |
|
|---|
| 29 |
$_SESSION["AMP_SQL"] = " AND ((src+0 BETWEEN $low AND $high) OR (dst+0 BETWEEN $low AND $high) OR (dst+0 BETWEEN 8$low AND 8$high) $channelfilter)"; |
|---|
| 30 |
} else { |
|---|
| 31 |
$_SESSION["AMP_SQL"] = ""; |
|---|
| 32 |
} |
|---|
| 33 |
|
|---|
| 34 |
$display=1; |
|---|
| 35 |
if (isset($_REQUEST['display'])) { |
|---|
| 36 |
$display=$_REQUEST['display']; |
|---|
| 37 |
} |
|---|
| 38 |
|
|---|
| 39 |
// setup menu |
|---|
| 40 |
$menu = array( |
|---|
| 41 |
1=>_("Call Logs"), |
|---|
| 42 |
2=>_("Compare Calls"), |
|---|
| 43 |
3=>_("Monthly Traffic"), |
|---|
| 44 |
4=>_("Daily load"), |
|---|
| 45 |
); |
|---|
| 46 |
|
|---|
| 47 |
echo "<div id=\"cdr\"><ul id=\"metanav\">"; |
|---|
| 48 |
foreach ($menu as $key=>$value) { |
|---|
| 49 |
echo "<li class=\"".(($display==$key) ? 'current':'')."\"><a href=\"reports.php?display=".$key."\">".$value."</a></li>"; |
|---|
| 50 |
} |
|---|
| 51 |
echo "</ul></div>"; |
|---|
| 52 |
|
|---|
| 53 |
// CDR viewer from www.areski.net. |
|---|
| 54 |
// Changes for -- AMP -- commented in: |
|---|
| 55 |
// cdr.php, defines.php, call-log.php, call-comp.php, graph_hourdetail.php, graph_statbar.php, graph_pie.php |
|---|
| 56 |
|
|---|
| 57 |
showview('reports', array('amp_conf'=>&$amp_conf, 'title'=>$title, 'display'=>$display, 'menu' => $menu)); |
|---|
| 58 |
?> |
|---|
| 59 |
</div> |
|---|
| 60 |
|
|---|
| 61 |
<!-- iframe width="100%" height="2000" frameborder="0" align="top" scrolling="auto" src="cdr/cdr.php?s=<?php echo $display; echo ($display=='1' ? '&posted=1' : '');?>"></iframe> --> |
|---|