blob: 76367e153e079f4349f946b303dfa3aa26083995 [file] [log] [blame]
<?php
require_once("/home/data/httpd/eclipse-php-classes/system/app.class.php");
require_once("/home/data/httpd/eclipse-php-classes/people/ldapperson.class.php");
require_once("/home/data/httpd/eclipse-php-classes/menu/menu.class.php");
require_once("/home/data/httpd/eclipse-php-classes/system/dbconnection_rw.class.php");
#*****************************************************************************
#
# adReports.php
#
# Author: Nathan Gervais
# Date: 2010-12-14
#
# Description: Reporting tool for ad campaigns
#
# HISTORY: Jan 2, 2008 Dons first public release
#
#****************************************************************************
$App = new App();
$App->runStdWebAppCacheable();
$ErrorMessage = "";
$LDAPPerson = new LDAPPerson();
$LDAPPerson = $LDAPPerson->redirectIfNotLoggedIn();
####################### CONNECTIONS
# Connect to databases
$dbc_RW = new DBConnectionRW();
// echo "ERROR FROM NEW CONNECTION: " . mysql_error() . "<br>";
$dbh_RW = $dbc_RW->connect();
// echo "ERROR FROM CONNECT: " . mysql_error() . "<br>";
include("../html/header.php");
$Menu = new Menu("en");
include("../modules/menu.php");
$_campaignKey = $_GET['campaignKey'];
$_week = $_GET['week'];
$startdate = strtotime($_week);
$enddate = strtotime('next sunday', $startdate);
$startdate = date("Y-m-d H:i:s", $startdate);
$enddate = date("Y-m-d H:i:s", $enddate);
$query = "SELECT count(*) FROM CampaignImpressions WHERE TimeImpressed > '$startdate' AND TimeImpressed < '$enddate' AND CampaignKey ='$_campaignKey'";
$countallresult = mysql_query($query, $dbh_RW);
$rr = mysql_fetch_array($countallresult);
$result['all'] = $rr[0];
$queryhome = "SELECT count(*) FROM CampaignImpressions WHERE TimeImpressed > '$startdate' AND TimeImpressed < '$enddate' AND CampaignKey ='$_campaignKey' AND Source = '/'";
$counthomeresult = mysql_query($queryhome, $dbh_RW);
$rr = mysql_fetch_array($counthomeresult);
$result['home'] = $rr[0];
$querydownload = "SELECT count(*) FROM CampaignImpressions WHERE TimeImpressed > '$startdate' AND TimeImpressed < '$enddate' AND CampaignKey ='$_campaignKey' AND Source = 'Download Page'";
$countdownloadresult = mysql_query($querydownload, $dbh_RW);
$rr = mysql_fetch_array($countdownloadresult);
$result['download'] = $rr[0];
$querymirror = "SELECT count(*) FROM CampaignImpressions WHERE TimeImpressed > '$startdate' AND TimeImpressed < '$enddate' AND CampaignKey ='$_campaignKey' AND Source LIKE '/downloads/download.php%'";
$countmirrorresult = mysql_query($querymirror, $dbh_RW);
$rr = mysql_fetch_array($countmirrorresult);
$result['mirror'] = $rr[0];
echo "<h3>Weekly Detail for ". $_campaignKey . " for the week of ". $_week . "</h3>";
echo $startdate . ' - ' . $enddate;
?>
<link rel="stylesheet" type="text/css" href="style.css">
<table>
<tr>
<th>Locations</th>
<th>Impressions</th>
<th>%</th>
</tr>
<tr>
<td>All</td>
<td><?php print $result['all'];?></td>
<td>100%</td>
</tr>
<tr>
<td>Homepage</td>
<td><?php print $result['home'];?></td>
<td><?php printf("%01.2f", ($result['home']/$result['all'])*100);?></td>
</tr>
<tr>
<td>Downloads Page</td>
<td><?php print $result['download'];?></td>
<td><?php printf("%01.2f", ($result['download']/$result['all'])*100);?></td>
</tr>
<tr>
<td>Mirror Select Page</td>
<td><?php print $result['mirror'];?></td>
<td><?php printf("%01.2f", ($result['mirror']/$result['all'])*100);?></td>
</tr>
</table>