PageRenderTime 70ms CodeModel.GetById 34ms RepoModel.GetById 0ms app.codeStats 0ms

/report/dailyugcentries.php

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