PageRenderTime 68ms CodeModel.GetById 34ms RepoModel.GetById 1ms app.codeStats 0ms

/report/dailyentries.php

https://bitbucket.org/3tierlogic/3tl.tabbuilder
PHP | 704 lines | 530 code | 109 blank | 65 comment | 80 complexity | 89fd36601a2d278cdd067544bead159d MD5 | raw file
  1. <?php
  2. require_once("timlib.php");
  3. // Connect to database
  4. require_once("db.php");
  5. $con = mysql_connect($dbhost, $dbuser, $dbpasswd); // connect to database
  6. if (!$con) { // error checking and handling
  7. die('Could not connect: ' . mysql_error());
  8. }
  9. mysql_select_db($dbname);
  10. $con_3tl = mysql_connect($dbhost_3tl, $dbuser_3tl, $dbpasswd_3tl); // connect to database
  11. if (!$con_3tl) { // error checking and handling
  12. die('Could not connect to 3TL: ' . mysql_error());
  13. }
  14. mysql_select_db($dbname_3tl);
  15. /* Load and clear sessions */
  16. session_start();
  17. $currentid = $_SESSION['companyid'];
  18. $campaignID = $_REQUEST['cID']; // get
  19. //$campaignName = $_REQUEST['cName']; // get
  20. //$//companyName = $_REQUEST['coName']; // get
  21. $campaignDesc = "";
  22. $campaignSdate = "";
  23. $campaignEdate = "";
  24. $campaignReentryPic = "";
  25. $maxDefaultDates = 7;
  26. $recentStartDate = "";
  27. $recentEndDate = "";
  28. // run a sql to get camp info for later html use.
  29. $sql_companyInfo = "SELECT cp_companyName FROM sp_company_info WHERE cp_companyID='".$currentid."'";
  30. $res_companyInfo = mysql_query($sql_companyInfo, $con);
  31. if (mysql_num_rows($res_companyInfo) == 1) {
  32. list($companyName) = mysql_fetch_array($res_companyInfo);
  33. }
  34. $sql_campInfo = "SELECT campaign_sid as cid, campaign_name as cname, campaign_description as cdesc, campaign_start_time as sdate, campaign_end_time as edate, campaign_is_check_reentry as creentry FROM sp_campaign_info s where campaign_sid ='".$campaignID."'";
  35. $res0 = mysql_query($sql_campInfo, $con);
  36. if (mysql_num_rows($res0) == 1) {
  37. list($camp_id, $camp_name, $camp_desc, $camp_sdate, $camp_edate, $camp_reentry) = mysql_fetch_array($res0);
  38. $campaignName = $camp_name;
  39. $campaignDesc = $camp_desc;
  40. if (strlen($campaignDesc) <= 0) {
  41. $campaignDesc ="*** No description available ***";
  42. }
  43. $campaignSdate = $camp_sdate;
  44. $campaignEdate = $camp_edate;
  45. //$campaignReentry = $camp_reentry;
  46. if ($camp_reentry == 1) {
  47. $campaignReentryPic = "images/singleentry.png";
  48. } else {
  49. $campaignReentryPic = "images/multipleentries.png";
  50. }
  51. }
  52. else{
  53. echo "Err: could not pull out campaign info for cid: ".$campaignID."<br/>";
  54. }
  55. // import from getprizereport.php
  56. //$sqlEndDate = $_REQUEST['edate']; //post
  57. // to control if to show all dates or the specified period.
  58. $default_date = 1; // defaults tolast few days
  59. if ( (!isset($_REQUEST['edate'])) || ($_REQUEST['edate'] == "") || (!isset($_REQUEST['sdate'])) || ($_REQUEST['sdate'] == "") ){
  60. $default_date = 1;
  61. } else {
  62. $default_date = 0;
  63. }
  64. if ( (!isset($_REQUEST['edate'])) || ($_REQUEST['edate'] == "") ){
  65. $sqlEndDate = "2100-12-31";
  66. } else {
  67. $sqlEndDate = $_REQUEST['edate'];
  68. }
  69. if( (!isset($_REQUEST['sdate'])) || ($_REQUEST['sdate'] == "") ){
  70. //$_POST['sdate'] = "";
  71. $_POST['sdate'] = "2000-01-01";
  72. $sqlStartDate = "2000-01-01";
  73. }
  74. else{
  75. $_POST['sdate'] = $_REQUEST['sdate'];
  76. $sqlStartDate = $_REQUEST['sdate'];
  77. }
  78. $sqlStartDate = $sqlStartDate." 00:00:00";
  79. $sqlEndDate = $sqlEndDate." 23:59:59";
  80. //$x_axis = "";
  81. //$y_axis = "";
  82. $displaygender_div = 0;
  83. $displayemail_div=0;
  84. $displayagerange_div=0;
  85. $displayzipcode_div=0;
  86. $displaycarrier_div = 0;
  87. $countDyn = 0;
  88. $displaydyn_div[$countDyn]=0;
  89. $dynstr_data[$countDyn] = "";
  90. $labels[$countDyn] = "";
  91. $zipCodeCountry = "CA"; //by default Canada
  92. // end of import from getprizereport.php
  93. //echo "ID: ".$currentid;
  94. if (!isset($currentid)) {
  95. /*echo "<script language = 'javascript'> alert('Your session has expire. Please login again');</script>" ;
  96. echo "<script language = 'javascript'> window.location.href = 'index.php'; </script>" ;*/
  97. header ( 'Location: http://platform.3tierlogic.com/tabbuilder/index1_3.php' );
  98. exit();
  99. }
  100. //***** Daily Visit chart
  101. $x_axis = "";
  102. $y_axis = "";
  103. $y2_axis = ""; // for distinct entries.
  104. $x_axis_last5 = "";
  105. $y_axis_last5 = "";
  106. $y2_axis_last5 = ""; //** Distinct entries
  107. $total_entry_last5 = 0;
  108. $total_uniqueentry_last5 = 0;
  109. $sql = "SELECT date_format(cpresult_create_time,'%Y-%m-%d'), count(*) as num FROM sp_campaign_result where campaign_sid='".$campaignID."' and cpresult_create_time between '".$sqlStartDate."' and '".$sqlEndDate."' group by date_format(cpresult_create_time,'%Y-%m-%d') order by date_format(cpresult_create_time,'%Y-%m-%d') ASC";
  110. $sql2 = "select dates, count(*) as num from ( SELECT date_format(cpresult_create_time,'%Y-%m-%d') as dates, cpresult_user_id as uid FROM sp_campaign_result f where f.campaign_sid='".$campaignID."' and cpresult_create_time between '".$sqlStartDate."' and '".$sqlEndDate."' group by date_format(f.cpresult_create_time,'%Y-%m-%d'), f.cpresult_user_id) s group by s.dates order by s.dates asc";
  111. /*
  112. echo "sql = ".$sql."<br/>";
  113. echo "sql2 = ".$sql2."<br/>";*/
  114. $res = mysql_query($sql, $con);
  115. $res2 = mysql_query($sql2, $con);
  116. $totalRecords = mysql_num_rows($res);
  117. //*** Calculate the height of the table. Keep up to 1000px
  118. $tableHeight = $totalRecords * 160;
  119. if ($tableHeight > 1000) {
  120. $tableHeight = 1100;
  121. }
  122. if ($totalRecords > 0) {
  123. //echo "total rows: ".$totalRecords."<br>";
  124. $index = 0;
  125. $total_entry = 0;
  126. $total_distinct_entry = 0;
  127. // get Y.
  128. while (list($currdate, $totalentries) = mysql_fetch_array($res)) {
  129. //echo "date:".$currdate."- entries: ".$totalentries."<br>";
  130. //$newcurrdate = date('m/d', strtotime($currdate));
  131. $newcurrdate = $currdate;
  132. $x_axis = $x_axis . "'".$newcurrdate."',";
  133. $y_axis = $y_axis . $totalentries.",";
  134. //***** Get the last x days data defined by maxDefaultDates above
  135. if ((($totalRecords - $index) - $maxDefaultDates) <= 0) {
  136. $x_axis_last5 = $x_axis_last5 . "'".$newcurrdate."',";
  137. $y_axis_last5 = $y_axis_last5 . $totalentries.",";
  138. $total_entry_last5 += $totalentries;
  139. //** Capture the start date
  140. if ($recentStartDate == "") {
  141. $recentStartDate = $currdate;
  142. }
  143. //** Capture the end date
  144. if (($recentEndDate == "") && (($index+1) == $totalRecords)) {
  145. $recentEndDate = $currdate;
  146. }
  147. }
  148. // create array to store sql and sql2 results.
  149. $array_sql[$index][0] = $newcurrdate;
  150. $array_sql[$index][1] = $totalentries;
  151. $total_entry += $totalentries;
  152. $index++;
  153. }
  154. $array_sql[$index][0] = "Total";
  155. $array_sql[$index][1] = $total_entry;
  156. $index = 0;
  157. // get y2.
  158. while ( list($d, $dis) = mysql_fetch_array($res2)){
  159. $y2_axis = $y2_axis . $dis.",";
  160. //***** Get the last x days data defined by maxDefaultDates above
  161. if ((($totalRecords - $index) - $maxDefaultDates) <= 0) {
  162. $y2_axis_last5 = $y2_axis_last5 . $dis.",";
  163. $total_uniqueentry_last5 += $dis;
  164. }
  165. $array_sql[$index][2] = $dis;
  166. $total_distinct_entry += $dis;
  167. $index++;
  168. }
  169. $array_sql[$index][2] = $total_distinct_entry;
  170. $x_axis = substr($x_axis, 0, -1);
  171. $y_axis = substr($y_axis, 0, -1);
  172. $y2_axis = substr($y2_axis, 0, -1);
  173. $x_axis_last5 = substr($x_axis_last5, 0, -1);
  174. $y_axis_last5 = substr($y_axis_last5, 0, -1);
  175. $y2_axis_last5 = substr($y2_axis_last5, 0, -1);
  176. //** By default, if no dates are specified, display last x dates defined by maxDefaultDates
  177. if ($default_date == 1) {
  178. $x_axis = $x_axis_last5;
  179. $y_axis = $y_axis_last5;
  180. $y2_axis = $y2_axis_last5;
  181. }
  182. //echo $recentStartDate.":".$recentEndDate."<br>";
  183. }
  184. ?>
  185. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  186. <html xmlns="http://www.w3.org/1999/xhtml" dir="ltr">
  187. <head profile="http://gmpg.org/xfn/11">
  188. <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
  189. <title>3 Tier Logic - Report V1.3</title>
  190. <link href="style.css" rel="stylesheet" type="text/css" />
  191. <!--[if IE]>
  192. <script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script>
  193. <![endif]-->
  194. <!--[if IE 6]>
  195. <script src="js/belatedPNG.js"></script>
  196. <script>
  197. DD_belatedPNG.fix('*');
  198. </script>
  199. <![endif]-->
  200. <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
  201. <link href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.1/themes/base/jquery-ui.css" rel="stylesheet" type="text/css" />
  202. <script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.1/jquery-ui.min.js"></script>
  203. <!-- Charts JS library: START -->
  204. <script type="text/javascript" src="js/highcharts.js"></script>
  205. <script type="text/javascript" src="js/themes/gray.js"></script>
  206. <script type="text/javascript" src="js/modules/exporting.js"></script>
  207. <!-- Charts JS library: END -->
  208. <!-- date Picker start -->
  209. <!--<style type="text/css">@import "css/redmond.datepick.css";</style>
  210. <script src="js/CalendarControl/CalendarControl.js" language="javascript"></script>
  211. <script type="text/javascript" src="js/jquery.datepick.js"></script>-->
  212. <!-- date picker end-->
  213. <script src="js/jquery.bxSlider.min.js" type="text/javascript"></script>
  214. <script type="text/javascript">
  215. $(document).ready(function(){
  216. $('#slider1').bxSlider({
  217. auto: true,
  218. pager: false,
  219. controls: false,
  220. pause: 5000
  221. });
  222. });
  223. </script>
  224. <script type="text/javascript">
  225. function viewEnties(td){
  226. var tord = td.substring(0,1);
  227. //alert(tord);
  228. var r = "r"+td.substring(1);
  229. var date = document.getElementById(r).innerHTML;
  230. //alert(date);
  231. var campid = "<?php echo $campaignID; ?>";
  232. //alert(campid);
  233. var detailPage = "detail.php";
  234. var sdate = <?php echo '\''.$_POST['sdate'].'\''; ?>;
  235. var edate = <?php echo '\''.$sqlEndDate.'\''; ?>;
  236. //var url = detailPage + "?campid=" + campid + "&date=" + date + "&tord=" + tord;
  237. var url = detailPage + "?campid=" + campid + "&date=" + date + "&tord=" + tord + "&sdate=" + sdate + "&edate=" + edate + "";
  238. //alert(url);
  239. // window.open(url);
  240. window.location.href = url; // to try colorbox.
  241. }
  242. var chart;
  243. var chart_gender;
  244. $(document).ready(function() {
  245. $('tr').hover(
  246. function () {
  247. $(this).addClass('hover');
  248. },
  249. function () {
  250. $(this).removeClass('hover');
  251. }
  252. );
  253. chart = new Highcharts.Chart({
  254. chart: {
  255. renderTo: 'containergraph',
  256. defaultSeriesType: 'line',
  257. marginRight: 130,
  258. marginBottom: 25,
  259. zoomType: 'x'
  260. },
  261. title: {
  262. text: '<?=$campaignName?>',
  263. x: -20 //center
  264. },
  265. subtitle: {
  266. text: 'Prepared for: <?=$companyName?>',
  267. x: -20
  268. },
  269. xAxis: {
  270. //categories: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']
  271. categories: [<?=$x_axis?>],
  272. },
  273. yAxis: {
  274. title: {
  275. text: 'Total Entries'
  276. },
  277. plotLines: [{
  278. value: 0,
  279. width: 1,
  280. color: '#808080'
  281. }]
  282. },
  283. tooltip: {
  284. formatter: function() {
  285. return '<b>'+ this.series.name +'</b><br/>'+
  286. this.x +': '+ this.y +' entries';
  287. }
  288. },
  289. legend: {
  290. layout: 'vertical',
  291. align: 'right',
  292. verticalAlign: 'top',
  293. x: -10,
  294. y: 100,
  295. borderWidth: 0
  296. },
  297. series: [
  298. {
  299. name: 'Total Entries',
  300. data: [<?=$y_axis?>]
  301. },
  302. /*{
  303. name: 'Distinct Entries',
  304. data: [<?=$y2_axis?>]
  305. }*/]
  306. });
  307. });
  308. </script>
  309. <script type="text/javascript">
  310. $(function() {
  311. $('#popupDatepicker_start').datepicker({dateFormat: 'yy-mm-dd'});
  312. $('#popupDatepicker_end').datepicker({dateFormat: 'yy-mm-dd'});
  313. });
  314. function showDate(state) {
  315. //alert(state);
  316. var sdate = "";
  317. var edate = "";
  318. switch(state) {
  319. case 0:
  320. sdate = document.getElementById('popupDatepicker_start').value;
  321. edate = document.getElementById('popupDatepicker_end').value;
  322. break;
  323. case 1:
  324. sdate = '2000-01-01';
  325. edate = '2100-12-31';
  326. break;
  327. case 2:
  328. sdate = '<?php echo $recentStartDate ?>';
  329. edate = '<?php echo $recentEndDate ?>';
  330. break;
  331. default:
  332. sdate = '2000-01-01';
  333. edate = '2100-12-31';
  334. }
  335. //alert('The date chosen is ' + sdate + " " + edate);
  336. // get every necessary param.
  337. var cid = "<?php echo $campaignID; ?>";
  338. var caname = "<?php echo $campaignName; ?>";
  339. var coname = "<?php echo $companyName; ?>";
  340. // build url.
  341. var url = '';
  342. url += 'dailyentries.php';
  343. var params = '?cID='+cid+'&cName='+caname+'&coName='+coname+'&sdate='+sdate+'&edate='+edate;
  344. url += params;
  345. //alert(url);
  346. // go to self with new params.
  347. window.location.href = url;
  348. }
  349. </script>
  350. <style type="text/css">
  351. @import "DTmedia/css/demo_page.css";
  352. @import "DTmedia/css/demo_table.css";
  353. </style>
  354. <script class="jsbin" src="http://datatables.net/download/build/jquery.dataTables.js"></script>
  355. <script type="text/javascript">
  356. $(document).ready(function(){
  357. $('#example').dataTable({
  358. "bJQueryUI": true,
  359. <!--"sPaginationType": "full_numbers",-->
  360. "bPaginate": false,
  361. "bFilter": false,
  362. "bLengthChange": false,
  363. "bScrollInfinite": true,
  364. "bScrollCollapse": true,
  365. "sScrollY": "<?php echo $tableHeight ?>px"
  366. });
  367. $(".panel").slideToggle("slow");
  368. $(".flip").click(function(){
  369. $(".panel").slideToggle("slow");
  370. });
  371. });
  372. </script>
  373. <link rel="stylesheet" href="colorbox.css" />
  374. <script src="colorbox/jquery.colorbox.js"></script>
  375. <script>
  376. $(document).ready(function(){
  377. $(".picspopup").colorbox({iframe:true, width:"90%", height:"90%"});
  378. });
  379. </script>
  380. <style>
  381. div.panel{
  382. height:auto;
  383. display:none;
  384. }
  385. table#user-list tr.hover {
  386. color: #fff;
  387. background-color: #4c95e6;
  388. }
  389. #containergraph {
  390. float: left
  391. width: 33.3%;
  392. /* Min-height: */
  393. min-height: 400px;
  394. height: auto !important;
  395. height: 400px;
  396. }
  397. </style>
  398. </head>
  399. <body class="normalpage">
  400. <section id="page">
  401. <div id="bodywrap">
  402. <section id="top">
  403. <nav>
  404. <h1 id="sitename">
  405. <a href="#">3 Tier Logic Inc.</a></h1>
  406. <ul id="sitenav">
  407. <li class="current"><a href="#">Entries Summary</a></li>
  408. <li><a href="main.php">Report Dashboard</a></li>
  409. <li><a href="../editor/dashboard.php">Back to Tab Editor</a></li>
  410. </ul>
  411. </nav>
  412. <header id="normalheader"></header>
  413. </section>
  414. <section id="contentwrap">
  415. <div id="contents">
  416. <div id="topcolumns">
  417. <div class="col">
  418. <!-- <img src="../images/design.png" width="61" height="60" alt="graph" class="imgright"> -->
  419. <h2>Campaign Info</h2>
  420. <p>
  421. <b>Company Name: </b> <?=$companyName?><br>
  422. <b>Campaign Name: </b> <?=$campaignName?><br>
  423. <b>Start date: </b> <?=$campaignSdate?><br>
  424. <b>End date: </b><?=$campaignEdate?><br>
  425. <b>Entry requirement: </b><img src="<?=$campaignReentryPic?>" /><br>
  426. <p class="flip"><b>Description: (Click to view/hide)</b></p><div class="panel"><?=$campaignDesc?></div><br>
  427. </p>
  428. </div>
  429. <div class="col">
  430. <h2>Filter by date</h2>
  431. <table cellpadding="0" cellspacing="0">
  432. <tr>
  433. <td><b>Start Date:</b>&nbsp;</td>
  434. <td><input name='startdate' type='text' id='popupDatepicker_start'></input></td>
  435. </tr>
  436. <tr>
  437. <td><b>End Date:</b>&nbsp;</td>
  438. <td><input name='enddate' type='text' id='popupDatepicker_end'></input></td>
  439. </tr>
  440. <tr>
  441. <td colspan="2" align="right"><br /><input type='button' value='submit' onclick='showDate(0)'></input></td>
  442. </tr>
  443. </table>
  444. </div>
  445. <div class="col">
  446. <h2>Quick Links</h2>
  447. <p>
  448. <ul>
  449. <li><img src="images/rightarrow.png" border="0" width="10" height="10" />&nbsp;&nbsp;<a href="#" onclick='showDate(1)'>View all entries</a></li><br/>
  450. <?php if ($totalRecords > 0) { ?>
  451. <li><img src="images/rightarrow.png" border="0" width="10" height="10" />&nbsp;&nbsp;<a href="#" onclick="showDate(2)">View last <?php echo $maxDefaultDates ?> days' entries</a></li><br/>
  452. <?php
  453. $checkbox = "OpenCheckBox";
  454. $dropdown = "OpenDropDown";
  455. $opentext = "OpenText";
  456. $pos_opentext = 1;
  457. $cType = "";
  458. for ($i = 0; $i < $count_fields; $i++){
  459. $pos_checkbox = strpos($fieldNames[$i], $checkbox);
  460. $pos_dropdown = strpos($fieldNames[$i], $dropdown);
  461. if (($pos_checkbox === 0) || ($pos_dropdown === 0)) {
  462. if ($pos_checkbox === 0) $cType = $checkbox;
  463. if ($pos_dropdown === 0) $cType = $dropdown;
  464. } else {
  465. $cType = $fieldNames[$i];
  466. }
  467. $pos_opentext = strpos($fieldNames[$i], $opentext);
  468. //echo "pos_opentext: ".$pos_opentext."-".$fieldNames[$i]."<br>";
  469. if( (strtolower($fieldNames[$i]) == "firstname") || (strtolower($fieldNames[$i]) == "lastname") || (strtolower($fieldNames[$i]) == "email") || (strtolower($fieldNames[$i]) == "mobilephone") || (strtolower($fieldNames[$i]) == "phonenumber") || (strtolower($fieldNames[$i]) == "address") || (strtolower($fieldNames[$i]) == "city") || (strtolower($fieldNames[$i]) == "state") || (strtolower($fieldNames[$i]) == "zipcode") || (strtolower($fieldNames[$i]) == "birthdaymonth") || (strtolower($fieldNames[$i]) == "birthdayday") || ($pos_opentext === 0) ){
  470. continue;
  471. }
  472. echo '<li><img src="images/rightarrow.png" border="0" width="10" height="10" />&nbsp;&nbsp;<a class="picspopup" href="quickchart_'.$cType.'.php?cid='.$campaignID.'&sdate='.$sqlStartDate.'&edate='.$sqlEndDate.'&ctype='.$fieldNames[$i].'&c='.$zipCodeCountry.'">View "'.$fieldLabelNames[$i].'" stats</a></li><br>';
  473. }
  474. }
  475. ?>
  476. <li><img src="images/rightarrow.png" border="0" width="10" height="10" />&nbsp;&nbsp;<a href="dailyugcentries.php?cID=<?=$campaignID?>">View UGC Report</a></li><br/>
  477. <li><img src="images/rightarrow.png" border="0" width="10" height="10" />&nbsp;&nbsp;<a href="dailyvotes.php?cID=<?=$campaignID?>">View UGC Vote Report</a></li><br/>
  478. </ul>
  479. </p>
  480. </div>
  481. <div class="clear"></div>
  482. <!-- ****** Display Charts here **** -->
  483. <div id="containergraph" style="width: 900px; height: 400px; margin: auto;"></div>
  484. <br /><br />
  485. <?php
  486. echo "<div id='tableContainer'>";
  487. if($index > 0){
  488. echo "<h2>Campaign summary from ".$sqlStartDate." to ".$sqlEndDate." </h2>";
  489. echo "<table cellpadding='0' cellspacing='0' width='60%'>";
  490. echo "<tr>";
  491. //echo "<h4>total days: ".mysql_num_rows($res)."</h4>";
  492. if ($index <= 1) {
  493. echo "<td width='60%'><h4>Campaign duration: </h4></td><td width='40%'>".$index." day</td>";
  494. } else {
  495. echo "<td width='60%'><h4>Campaign duration: </h4></td><td width='40%'>".$index." days</td>";
  496. }
  497. echo "</tr>";
  498. echo "<tr><td width='60%'><h4>Total entries: </h4></td><td width='40%'>".$total_entry."</td></tr>";
  499. //echo "<tr><td width='60%'><h4>Total unique entries: </h4></td><td width='40%'>".$total_distinct_entry."</td></tr>";
  500. echo "<tr><td width='60%'><h4>Total entries in the ".$maxDefaultDates." last days: </h4></td><td width='40%'>".$total_entry_last5."</td></tr>";
  501. //echo "<tr><td width='60%'><h4>Total unique entries in the last ".$maxDefaultDates." days: </h4></td><td width='40%'>".$total_uniqueentry_last5."</td></tr>";
  502. echo "<table>";
  503. echo "<br><br>";
  504. echo "<table cellpadding='0' cellspacing='0' border='2' class='display' id='example'>"; //id='user-list'>";
  505. //echo "<thead><tr><th>Day</th><th>Date</th><th>Total Entries</th><th>Distinct Entries</th></tr></thead>";
  506. echo "<thead><tr><th>Day</th><th>Date</th><th>Total Entries</th></tr></thead>";
  507. echo "<tbody>";
  508. $i = 0;
  509. //while (list($currdate, $totalentries) = mysql_fetch_array($res)) {
  510. while($i <= $index){
  511. //echo "date:".$currdate."- entries: ".$totalentries."<br>";
  512. if($i % 2 != 0){
  513. echo "<tr class='odd gradeX'>";
  514. }else{
  515. echo "<tr class='odd gradeA'>";
  516. }
  517. //echo "<td class='center'>".$currdate."</td>";
  518. echo "<td class='center'>".($i+1)."</td>";
  519. echo "<td class='center'> ".$array_sql[$i][0]."</td>";
  520. //echo '<td class="center"> <a id="t'.$i.'" href="javascript: viewEnties(\'t'.$i.'\')" >'.$array_sql[$i][1].'</a></td>';
  521. echo '<td class="center"> <a class="picspopup" id="t'.$i.'" href='.getDetailURL("t".$i, $array_sql[$i][0], $campaignID, $_POST['sdate'], $sqlEndDate).'>'.$array_sql[$i][1].'</a></td>';
  522. //echo "postsdate = ".$_POST['sdate']." sqlenddate = ".$sqlEndDate."<br/>";
  523. //echo '<td class="center"> <a id="d'.$i.'" href="javascript: viewEnties(\'d'.$i.'\')" >'.$array_sql[$i][2].'</a></td>';
  524. //echo '<td class="center"> <a class="picspopup" id="d'.$i.'" href="javascript: viewEnties(\'d'.$i.'\')" >'.$array_sql[$i][2].'</a></td>';
  525. //echo '<td class="center"> <a class="picspopup" id="t'.$i.'" href='.getDetailURL("d".$i, $array_sql[$i][0], $campaignID, $_POST['sdate'], $sqlEndDate).'>'.$array_sql[$i][2].'</a></td>';
  526. echo "</tr>";
  527. $i++;
  528. }
  529. echo "</tbody>";
  530. echo "</table>";
  531. }
  532. echo "</div>";
  533. if ($displaygender_div == 1) {
  534. echo "<div id='container2' style='width: 900px; height: 400px; margin: 0 auto'></div>";
  535. }
  536. ?>
  537. <div class="clear"></div>
  538. </div>
  539. </div>
  540. </section>
  541. </div>
  542. <footer id="pagefooter">
  543. <div id="bottom">
  544. <div class="block1">
  545. <h2>Meet The Team</h2>
  546. <div class="teamimg">
  547. <? include("team.php")?>
  548. </div>
  549. </div>
  550. <div class="block2">
  551. <h2>Latest Project</h2>
  552. <div class="projectthmb">
  553. <?
  554. $sql = "SELECT ID, post_date, post_content, post_title FROM 3tierweb.tier_posts WHERE post_type='post' and post_parent='0' and post_status='publish' order by post_date desc Limit 4";
  555. $res = mysql_query($sql, $con_3tl);
  556. if (mysql_num_rows($res) > 0) {
  557. ?>
  558. <ul id="slider1">
  559. <?
  560. $picon = "";
  561. while(list($pid, $pdate, $pcontent, $ptitle) = mysql_fetch_array($res)) {
  562. $sql_icon = "SELECT guid FROM 3tierweb.tier_posts where post_type='attachment' and (post_mime_type='image/jpeg' or post_mime_type='image/png') and post_parent='".$pid."' order by post_date desc";
  563. $res_icon = mysql_query($sql_icon, $con_3tl);
  564. if (mysql_num_rows($res_icon) > 0) {
  565. list($picon) = mysql_fetch_array($res_icon);
  566. }
  567. echo "<li><a href='http://www5.3tierlogic.com/?p=".$pid."' target='_blank'><img src='".$picon."' width='240' height='150' /></a><p style='font:Verdana, Geneva, sans-serif; color:#FFF; font-size:10px '>".$ptitle."</p></li>";
  568. //echo "<li><a href='http://www5.3tierlogic.com/?p=".$pid."' target='_blank'>".$ptitle."</a></li>";
  569. }
  570. ?>
  571. </ul>
  572. <?
  573. } else {
  574. ?>
  575. <a href="portfolio"><img src="images/latstproject.jpg" width="240" height="150" alt="project"></a>
  576. <?
  577. }
  578. ?>
  579. </div>
  580. </div>
  581. <div class="block3">
  582. <h2>About</h2>
  583. <p>3 Tier Logic is a full service digital marketing and technology services company that enables organizations to grow their customer and prospect communities through anywhere-anytime communications. </p>
  584. </div>
  585. <div class="clear"></div>
  586. </div>
  587. <div id="credits">
  588. <p>
  589. <span class="copyright">
  590. &copy; 2012 | 3 Tier Logic Inc | All Rights Reserved </span></p>
  591. </div>
  592. </footer>
  593. </section>
  594. </body>
  595. </html>