You are on page 1of 9

<?

php
include ("secure.php");
include ("../appVars.php");
include ("../db.php");
include ("../sharedFunctions.php");
// set menus
$menuSelected1 = "Consumers";
$menuSelected2 = "Consumer Calls";
// set page url
$pageURL = substr($_SERVER[SCRIPT_NAME],strrpos($_SERVER[SCRIPT_NAME],"/")+1);
// create date/time objects for default start and end
$month = date("m");
$day = date("d");
$year = date("Y");
$startdate = date("Y-m-d",mktime(0,0,0,$month,$day-30,$year));
$enddate = date("Y-m-d",mktime(0,0,0,$month,$day+1,$year));
// get variables
$sort_type = (isset($_GET['sort_type'])) ? ($_GET['sort_type']) : "datetimedown"
;
$start_date = (isset($_GET['startdate'])) ? ($_GET['startdate']) : "$startdate";
$end_date = (isset($_GET['enddate'])) ? ($_GET['enddate']) : "$enddate";
// set time period variables
$startdatelong = date("l, d F Y",strtotime($start_date));
$enddatelong = date("l, d F Y",strtotime($end_date));
// set sort order
if($sort_type == "datetimeup")
$sort_order = "ORDER by callConsDateTime ASC";
else if($sort_type == "datetimedown")
$sort_order = "ORDER by callConsDateTime DESC";
else if($sort_type == "requestidup")
$sort_order = "ORDER by requestID ASC";
else if($sort_type == "requestiddown")
$sort_order = "ORDER by requestID DESC";
else if($sort_type == "companyidup")
$sort_order = "ORDER by companyID ASC";
else if($sort_type == "companyiddown")
$sort_order = "ORDER by companyID DESC";
else if($sort_type == "consphoneup")
$sort_order = "ORDER by callConsPhone ASC";
else if($sort_type == "consphonedown")
$sort_order = "ORDER by callConsPhone DESC";
else if($sort_type == "dialstatusup")
$sort_order = "ORDER by callConsDialStatus ASC";
else if($sort_type == "dialstatusdown")
$sort_order = "ORDER by callConsDialStatus DESC";
else if($sort_type == "callstatusup")
$sort_order = "ORDER by callConsStatus ASC";
else if($sort_type == "callstatusdown")
$sort_order = "ORDER by callConsStatus DESC";
else if($sort_type == "durationup")
$sort_order = "ORDER by callConsDuration ASC";
else if($sort_type == "durationdown")
$sort_order = "ORDER by callConsDuration DESC";
else if($sort_type == "costup")
$sort_order = "ORDER by callConsCost ASC";
else if($sort_type == "costdown")
$sort_order = "ORDER by callConsCost DESC";
else if($sort_type == "locationup")
$sort_order = "ORDER by callConsCalledLocation ASC";
else if($sort_type == "locationdown")
$sort_order = "ORDER by callConsCalledLocation DESC";
else if($sort_type == "errorup")
$sort_order = "ORDER by callConsError ASC";
else if($sort_type == "errordown")
$sort_order = "ORDER by callConsError DESC";
$result = mysql_query("SELECT callConsID, callConsDateTime, requestID, company
ID, callConsPhone, callConsDialStatus, callConsStatus, callConsDuration, CONCAT(
callConsCalledCity, ', ', callConsCalledState, ' ', callConsCalledZipcode) as ca
llConsCalledLocation, callConsRecordingURL FROM CallsConsumers WHERE callConsDat
eTime BETWEEN '$start_date' AND '$end_date' $sort_order" );
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.or
g/TR/html4/loose.dtd">
<html>
<head>
<title>Seva Call Admin - <?php print $menuSelected1; ?> - <?php print $menuSel
ected2; ?></title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link rel="stylesheet" type="text/css" href="../css/stylesheet.css">
<link rel="stylesheet" type="text/css" href="css/stylesheet.css">
<link rel="stylesheet" type="text/css" href="css/tabs.css">
<link rel="stylesheet" type="text/css" href="css/datefield1.css">
<link rel="stylesheet" type="text/css" href="css/datefield2.css">
<link rel="stylesheet" type="text/css" href="../yui/build/fonts/fonts-min.css"
/>
<link rel="stylesheet" type="text/css" href="../yui/build/button/assets/skins/
sam/button.css" />
<link rel="stylesheet" type="text/css" href="../yui/build/container/assets/ski
ns/sam/container.css" />
<link rel="stylesheet" type="text/css" href="../yui/build/calendar/assets/skin
s/sam/calendar.css" />
<script type="text/javascript" src="../yui/build/yahoo-dom-event/yahoo-dom-eve
nt.js"></script>
<script type="text/javascript" src="../yui/build/dragdrop/dragdrop-min.js"></s
cript>
<script type="text/javascript" src="../yui/build/element/element-beta-min.js">
</script>
<script type="text/javascript" src="../yui/build/button/button-min.js"></scrip
t>
<script type="text/javascript" src="../yui/build/container/container-min.js"><
/script>
<script type="text/javascript" src="../yui/build/calendar/calendar-min.js"></s
cript>
<style type="text/css">
/* date range box style */
.daterange {
position:relative;
top:0px;
left:13px;
white-space:nowrap;
border:1px solid black;
background-color:#eee;
width:27em;
padding:5px;
}
</style>
</head>
<body class="yui-skin-sam, admin">
<?php
include ("header.php");
?>
<!--- Page Content Start --->
<form action="viewAction.php<?php print "?".$_SERVER['QUERY_STRING']; ?>" method
="post">
<input <?php print $disabled; ?> type="hidden" name="scriptName" value="<?php pr
int $pageURL; ?>">
<p class="headerText1"><?php print $menuSelected2; ?></p>
<table width="962" align="center" border="0">
<tr><td>
<table width="300" class="daterange">
<tr>
<td>
<?php
include ("sharedDateControl.php");
?>
<!--BEGIN SOURCE CODE FOR EXAMPLE =============================== -->
<script type="text/javascript">
YAHOO.util.Event.onDOMReady(function(){
var dialog, calendar;
calendar = new YAHOO.widget.Calendar("cal", {
iframe:false, // Turn iframe off, since container has ifr
ame support.
hide_blank_weeks:true // Enable, to demonstrate how we handle cha
nging height, using changeContent
});
function okHandler() {
if (calendar.getSelectedDates().length > 0) {
var selDate = calendar.getSelectedDates()[0];
// Pretty Date Output, using Calendar's Locale values: Friday,
8 February 2008
var wStr = calendar.cfg.getProperty("WEEKDAYS_LONG")[selDate.g
etDay()];
var dStr = selDate.getDate();
var mStr = calendar.cfg.getProperty("MONTHS_LONG")[selDate.get
Month()];
var yStr = selDate.getFullYear();
YAHOO.util.Dom.get("startdate").value = wStr + ", " + dStr + "
" + mStr + " " + yStr;
} else {
YAHOO.util.Dom.get("startdate").value = "";
}
this.hide();
}
function cancelHandler() {
this.hide();
}
dialog = new YAHOO.widget.Dialog("container", {
context:["show", "tl", "bl"],
buttons:[ {text:"Select", isDefault:true, handler: okHandler},
{text:"Cancel", handler: cancelHandler}],
width:"16em", // Sam Skin dialog needs to have a width defined (7*2
em + 2*1em = 16em).
draggable:false,
close:true
});
calendar.render();
dialog.render();
// Using dialog.hide() instead of visible:false is a workaround for an
IE6/7 container known issue with border-collapse:collapse.
dialog.hide();
calendar.renderEvent.subscribe(function() {
// Tell Dialog it's contents have changed, Currently used by contain
er for IE6/Safari2 to sync underlay size
dialog.fireEvent("changeContent");
});
YAHOO.util.Event.on("show", "click", function() {
dialog.show();
if (YAHOO.env.ua.opera && document.documentElement) {
// Opera needs to force a repaint
document.documentElement.style += "";
}
});
});
</script>
<div class="datefield">
<label for="date"><font face="arial" size="2"><b>Start Date: </b></font>
</label><input type="text" id="startdate" name="startDate" value="<?php print "$
startdatelong"; ?>" /><button type="button" id="show" title="Show Calendar"><img
src="../yui/examples/calendar/assets/calbtn.gif" width="18" height="18" alt="Ca
lendar" ></button>
</div>
<div id="container">
<div class="hd">Calendar</div>
<div class="bd">
<div id="cal"></div>
</div>
</div>
<!--END SOURCE CODE FOR EXAMPLE =============================== -->
<!--BEGIN SOURCE CODE FOR EXAMPLE =============================== -->
<script type="text/javascript">
YAHOO.util.Event.onDOMReady(function(){
var dialog2, calendar2;
calendar2 = new YAHOO.widget.Calendar("cal2", {
iframe:false, // Turn iframe off, since container has ifram
e support.
hide_blank_weeks:true // Enable, to demonstrate how we handle chang
ing height, using changeContent
});
function okHandler2() {
if (calendar2.getSelectedDates().length > 0) {
var selDate2 = calendar2.getSelectedDates()[0];
// Pretty Date Output, using Calendar's Locale values: Friday, 8 F
ebruary 2008
var wStr2 = calendar2.cfg.getProperty("WEEKDAYS_LONG")[selDate2.ge
tDay()];
var dStr2 = selDate2.getDate();
var mStr2 = calendar2.cfg.getProperty("MONTHS_LONG")[selDate2.getM
onth()];
var yStr2 = selDate2.getFullYear();
YAHOO.util.Dom.get("enddate").value = wStr2 + ", " + dStr2 + " " +
mStr2 + " " + yStr2;
} else {
YAHOO.util.Dom.get("enddate").value = "";
}
this.hide();
}
function cancelHandler2() {
this.hide();
}
dialog2 = new YAHOO.widget.Dialog("container2", {

context:["show2", "tl", "b1"],


buttons:[ {text:"Select", isDefault:true, handler: okHandler2},
{text:"Cancel", handler: cancelHandler2}],
width:"16em", // Sam Skin dialog needs to have a width defined (7*2
em + 2*1em = 16em).
draggable:false,
close:true
});
calendar2.render();
dialog2.render();
// Using dialog.hide() instead of visible:false is a workaround for an
IE6/7 container known issue with border-collapse:collapse.
dialog2.hide();
calendar2.renderEvent.subscribe(function() {
// Tell Dialog it's contents have changed, Currently used by contain
er for IE6/Safari2 to sync underlay size
dialog2.fireEvent("changeContent");
});
YAHOO.util.Event.on("show2", "click", function() {
dialog2.show();
if (YAHOO.env.ua.opera && document.documentElement) {
// Opera needs to force a repaint
document.documentElement.style += "";
}
});
});
</script>
<div class="datefield2">
<label for="callActionDate"><font face="arial" size="2"><b>End Date: </b
></font></label><input type="text" id="enddate" name="endDate" value="<?php prin
t "$enddatelong"; ?>" /><button type="button" id="show2" title="Show Calendar"><
img src="../yui/examples/calendar/assets/calbtn.gif" width="18" height="18" alt=
"Calendar" ></button>
</div>
<div id="container2">
<div class="hd">Calendar</div>
<div class="bd">
<div id="cal2"></div>
</div>
</div>
<!--END SOURCE CODE FOR EXAMPLE =============================== -->
<div align="center"><input type="submit" name="adjust" value="Adjust Date
Range"></div>
</td>
</tr>
</table>
</td>
<td align="right" valign="bottom">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="helpVie
wIncomingCalls.php"><img src="../images/help.gif" width="20" height="19" border=
"0"></a></td>
</tr>
</table>
</form>
<br />
<table width="950" align="center">
<tr>
<td align="center">
<table border="1" width="930" align="center" cellpadding="1" cellspacing="
0">
<tr height="25" bgcolor="#003366" background="../images/tableHeader.png"
bgcolor="#003366">
<td align="center" width="95"><a href="<?php if ($sort_type == "dateti
meup") print $pageURL.setUrlVariables('sort_type','datetimedown'); else print $p
ageURL.setUrlVariables('sort_type','datetimeup'); ?>" class="adminTableHeader">D
ate/Time</a>&nbsp;<?php if ($sort_type == "datetimeup") print '<img src="../imag
es/tableuparrow.gif">'; else if ($sort_type == "datetimedown") print '<img src="
../images/tabledownarrow.gif">';?></td>
<td align="center" width="65"><a href="<?php if ($sort_type ==
"requestidup") print $pageURL.setUrlVariables('sort_type','requestiddown'); els
e print $pageURL.setUrlVariables('sort_type','requestidup'); ?>" class="adminTab
leHeader">Req. ID</a>&nbsp;<?php if ($sort_type == "requestidup") print '<img sr
c="../images/tableuparrow.gif">'; else if ($sort_type == "requestiddown") print
'<img src="../images/tabledownarrow.gif">';?></td>
<td align="center" width="100"><a href="<?php if ($sort_type =
= "companyidup") print $pageURL.setUrlVariables('sort_type','companyiddown'); el
se print $pageURL.setUrlVariables('sort_type','companyidup'); ?>" class="adminTa
bleHeader">Company ID</a>&nbsp;<?php if ($sort_type == "companyidup") print '<im
g src="../images/tableuparrow.gif">'; else if ($sort_type == "companyiddown") pr
int '<img src="../images/tabledownarrow.gif">';?></td>
<td align="center" width="110"><a href="<?php if ($sort_type =
= "consphoneup") print $pageURL.setUrlVariables('sort_type','consphonedown'); el
se print $pageURL.setUrlVariables('sort_type','consphoneup'); ?>" class="adminTa
bleHeader">Called Number</a>&nbsp;<?php if ($sort_type == "consphoneup") print '
<img src="../images/tableuparrow.gif">'; else if ($sort_type == "consphonedown")
print '<img src="../images/tabledownarrow.gif">';?></td>
<td align="center" width="100"><a href="<?php if ($sort_type == "dials
tatusup") print $pageURL.setUrlVariables('sort_type','dialstatusdown'); else pri
nt $pageURL.setUrlVariables('sort_type','dialstatusup'); ?>" class="adminTableHe
ader">Dial Status</a>&nbsp;<?php if ($sort_type == "dialstatusup") print '<img s
rc="../images/tableuparrow.gif">'; else if ($sort_type == "dialstatusdown") prin
t '<img src="../images/tabledownarrow.gif">';?></td>
<td align="center" width="100"><a href="<?php if ($sort_type =
= "callstatusup") print $pageURL.setUrlVariables('sort_type','callstatusdown');
else print $pageURL.setUrlVariables('sort_type','callstatusup'); ?>" class="admi
nTableHeader">Call Status</a>&nbsp;<?php if ($sort_type == "callstatusup") print
'<img src="../images/tableuparrow.gif">'; else if ($sort_type == "callstatusdow
n") print '<img src="../images/tabledownarrow.gif">';?></td>
<td align="center" width="75"><a href="<?php if ($sort_type ==
"durationup") print $pageURL.setUrlVariables('sort_type','durationdown'); else
print $pageURL.setUrlVariables('sort_type','durationup'); ?>" class="adminTableH
eader">Duration</a>&nbsp;<?php if ($sort_type == "durationup") print '<img src="
../images/tableuparrow.gif">'; else if ($sort_type == "durationdown") print '<im
g src="../images/tabledownarrow.gif">';?></td>
<td align="center" width="125"><a href="<?php if ($sort_type =
= "locationup") print $pageURL.setUrlVariables('sort_type','locationdown'); else
print $pageURL.setUrlVariables('sort_type','locationup'); ?>" class="adminTable
Header">Location</a>&nbsp;<?php if ($sort_type == "locationup") print '<img src=
"../images/tableuparrow.gif">'; else if ($sort_type == "locationdown") print '<i
mg src="../images/tabledownarrow.gif">';?></td>
<td align="center" width="75"><a href="#" class="adminTableHea
der">Recording</a></td>
</tr>
<?php
$currCount = 0;
$ncols = mysql_num_fields($result); /* How many fields */
while( $row = mysql_fetch_row ($result) )
{
$callConsID = $row[0];
$callConsDateTime = $row[1];
$requestID = $row[2];
$companyID = $row[3];
$callConsPhone = $row[4];
$callConsDialStatus = $row[5];
$callConsStatus = strtolower($row[6]);
$callConsDuration = $row[7];
$callConsCalledLocation = $row[8];
$callConsRecordingURL = $row[9];
// highlight rows that require action, call in, call out, tech review
if (($actdate < $today) && (($status == "Call Back In") || ($status == "Call B
ack Out") || ($status == "Tech Review") || ($status == "Follow Up")))
print "<tr bgcolor='#FF7A7A'>\n";
elseif (($status == "Call Back In") || ($status == "Call Back Out") || ($statu
s == "Tech Review") || ($status == "Follow Up"))
print "<tr bgcolor='#ffffbf'>\n";
else
{
if ($currCount%2 == 0)
print "<tr class='alt2'>\n";
else
print "<tr class='alt1'>\n";
}
for ( $i=0; $i < $ncols; $i++ )
{
$column_name = mysql_field_name($result, $i); /* field name */
$column_value = $row[$i]; /* field value */
if (( $column_name == "callConsPhone" ) && ($column_value != ""))
{
print "\t<td align='center'>".substr($column_value,0,3)."-".substr($column
_value,3,3)."-".substr($column_value,6,4)."</td>\n";
}
elseif ( $column_name == "callConsRecordingURL" )
{
if ( $column_value == "" )
print "\t<td align='center'></td>\n";
else
print "\t<td align='center'><a href='".$callConsRecordingURL."'><img src
='../images/speaker.gif'></a></td>\n";
}
elseif ( $column_name == "callConsDateTime" )
{
$time = strtotime($callConsDateTime);
print "\t<td align='center'>";
echo date("d M y",$time);
print "<br>";
echo date("h:i a",$time);
print "</td>\n";
}
elseif ( $column_name == "callConsStatus" )
{
if ( $column_value == "" )
print "\t<td align='center'>-</td>\n";
else
print "\t<td align='center'>$callConsStatus</td>\n";
}
elseif ( $column_name == "requestID" )
{
print "\t<td align='center'>";
print "<a href='consumersRequestView.php?requestID=$requestID'>$requestID"
;
print "</a>";
print "</td>\n";
}
elseif ( $column_name != "callConsID" )
{
if ( $column_value == "" )
print "\t<td align='center'>-</td>\n";
else
print "\t<td align='center'>$column_value</td>\n";
}
}
print "</tr>\n";
$currCount++;
}
?>
</table>
</td>
</tr>
</table>
<br /><br />
<!--- Page Content End --->
<?php
include ("footer.php");
?>

You might also like