[ Index ]

PHP Cross Reference of osCMax 2.0.4

title

Body

[close]

/admin/ -> banner_statistics.php (source)

   1  <?php
   2  /*

   3  $Id: banner_statistics.php 3 2006-05-27 04:59:07Z user $

   4  

   5    osCMax Power E-Commerce

   6    http://oscdox.com

   7  

   8    Copyright 2006 osCMax

   9  

  10    Released under the GNU General Public License

  11  */
  12  
  13    require ('includes/application_top.php');
  14  
  15    $type = (isset($HTTP_GET_VARS['type']) ? $HTTP_GET_VARS['type'] : '');
  16  
  17    $banner_extension = tep_banner_image_extension();
  18  
  19  // check if the graphs directory exists

  20    $dir_ok = false;
  21    if (function_exists('imagecreate') && tep_not_null($banner_extension)) {
  22      if (is_dir(DIR_WS_IMAGES . 'graphs')) {
  23        if (is_writeable(DIR_WS_IMAGES . 'graphs')) {
  24          $dir_ok = true;
  25        } else {
  26          $messageStack->add(ERROR_GRAPHS_DIRECTORY_NOT_WRITEABLE, 'error');
  27        }
  28      } else {
  29        $messageStack->add(ERROR_GRAPHS_DIRECTORY_DOES_NOT_EXIST, 'error');
  30      }
  31    }
  32  
  33    $banner_query = tep_db_query("select banners_title from " . TABLE_BANNERS . " where banners_id = '" . (int)$HTTP_GET_VARS['bID'] . "'");
  34    $banner = tep_db_fetch_array($banner_query);
  35  
  36    $years_array = array();
  37    $years_query = tep_db_query("select distinct year(banners_history_date) as banner_year from " . TABLE_BANNERS_HISTORY . " where banners_id = '" . (int)$HTTP_GET_VARS['bID'] . "'");
  38    while ($years = tep_db_fetch_array($years_query)) {
  39      $years_array[] = array('id' => $years['banner_year'],
  40                             'text' => $years['banner_year']);
  41    }
  42  
  43    $months_array = array();
  44    for ($i=1; $i<13; $i++) {
  45      $months_array[] = array('id' => $i,
  46                              'text' => strftime('%B', mktime(0,0,0,$i)));
  47    }
  48  
  49    $type_array = array(array('id' => 'daily',
  50                              'text' => STATISTICS_TYPE_DAILY),
  51                        array('id' => 'monthly',
  52                              'text' => STATISTICS_TYPE_MONTHLY),
  53                        array('id' => 'yearly',
  54                              'text' => STATISTICS_TYPE_YEARLY));
  55  ?>
  56  <!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN">
  57  <html <?php echo HTML_PARAMS; ?>>
  58  <head>
  59  <meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET; ?>">
  60  <title><?php echo TITLE; ?></title>
  61  <link rel="stylesheet" type="text/css" href="includes/stylesheet.css">
  62  </head>
  63  <body marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0" bgcolor="#FFFFFF">
  64  <!-- header //-->
  65  <?php require (DIR_WS_INCLUDES . 'header.php'); ?>
  66  <!-- header_eof //-->
  67  
  68  <!-- body //-->
  69  <table border="0" width="100%" cellspacing="2" cellpadding="2">
  70    <tr>
  71      <td width="<?php echo BOX_WIDTH; ?>" valign="top"><table border="0" width="<?php echo BOX_WIDTH; ?>" cellspacing="1" cellpadding="1" class="columnLeft">
  72  <!-- left_navigation //-->
  73  <?php require (DIR_WS_INCLUDES . 'column_left.php'); ?>
  74  <!-- left_navigation_eof //-->
  75      </table></td>
  76  <!-- body_text //-->
  77      <td width="100%" valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="2">
  78        <tr>
  79          <td width="100%"><table border="0" width="100%" cellspacing="0" cellpadding="0">
  80            <tr><?php echo tep_draw_form('year', FILENAME_BANNER_STATISTICS, '', 'get'); ?>
  81              <td class="pageHeading"><?php echo HEADING_TITLE; ?></td>
  82              <td class="pageHeading" align="right"><?php echo tep_draw_separator('pixel_trans.gif', '1', HEADING_IMAGE_HEIGHT); ?></td>
  83              <td class="main" align="right"><?php echo TITLE_TYPE . ' ' . tep_draw_pull_down_menu('type', $type_array, (tep_not_null($type) ? $type : 'daily'), 'onChange="this.form.submit();"'); ?><noscript><input type="submit" value="GO"></noscript><br>
  84  <?php
  85    switch ($type) {
  86      case 'yearly': break;
  87      case 'monthly':
  88        echo TITLE_YEAR . ' ' . tep_draw_pull_down_menu('year', $years_array, (isset($HTTP_GET_VARS['year']) ? $HTTP_GET_VARS['year'] : date('Y')), 'onChange="this.form.submit();"') . '<noscript><input type="submit" value="GO"></noscript>';
  89        break;
  90      default:
  91      case 'daily':
  92        echo TITLE_MONTH . ' ' . tep_draw_pull_down_menu('month', $months_array, (isset($HTTP_GET_VARS['month']) ? $HTTP_GET_VARS['month'] : date('n')), 'onChange="this.form.submit();"') . '<noscript><input type="submit" value="GO"></noscript><br>' . TITLE_YEAR . ' ' . tep_draw_pull_down_menu('year', $years_array, (isset($HTTP_GET_VARS['year']) ? $HTTP_GET_VARS['year'] : date('Y')), 'onChange="this.form.submit();"') . '<noscript><input type="submit" value="GO"></noscript>';
  93        break;
  94    }
  95  ?>
  96              </td>
  97            <?php echo tep_draw_hidden_field('page', $HTTP_GET_VARS['page']) . tep_draw_hidden_field('bID', $HTTP_GET_VARS['bID']) . tep_hide_session_id(); ?></form></tr>
  98          </table></td>
  99        </tr>
 100        <tr>
 101          <td><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td>
 102        </tr>
 103        <tr>
 104          <td align="center">
 105  <?php
 106    if (function_exists('imagecreate') && ($dir_ok == true) && tep_not_null($banner_extension)) {
 107      $banner_id = (int)$HTTP_GET_VARS['bID'];
 108  
 109      switch ($type) {
 110        case 'yearly':
 111          include (DIR_WS_INCLUDES . 'graphs/banner_yearly.php');
 112          echo tep_image(DIR_WS_IMAGES . 'graphs/banner_yearly-' . $banner_id . '.' . $banner_extension);
 113          break;
 114        case 'monthly':
 115          include (DIR_WS_INCLUDES . 'graphs/banner_monthly.php');
 116          echo tep_image(DIR_WS_IMAGES . 'graphs/banner_monthly-' . $banner_id . '.' . $banner_extension);
 117          break;
 118        default:
 119        case 'daily':
 120          include (DIR_WS_INCLUDES . 'graphs/banner_daily.php');
 121          echo tep_image(DIR_WS_IMAGES . 'graphs/banner_daily-' . $banner_id . '.' . $banner_extension);
 122          break;
 123      }
 124  ?>
 125            <table border="0" width="600" cellspacing="0" cellpadding="2">
 126              <tr class="dataTableHeadingRow">
 127               <td class="dataTableHeadingContent"><?php echo TABLE_HEADING_SOURCE; ?></td>
 128               <td class="dataTableHeadingContent" align="right"><?php echo TABLE_HEADING_VIEWS; ?></td>
 129               <td class="dataTableHeadingContent" align="right"><?php echo TABLE_HEADING_CLICKS; ?></td>
 130             </tr>
 131  <?php
 132      for ($i=0, $n=sizeof($stats); $i<$n; $i++) {
 133        echo '            <tr class="dataTableRow">' . "\n" .
 134             '              <td class="dataTableContent">' . $stats[$i][0] . '</td>' . "\n" .
 135             '              <td class="dataTableContent" align="right">' . number_format($stats[$i][1]) . '</td>' . "\n" .
 136             '              <td class="dataTableContent" align="right">' . number_format($stats[$i][2]) . '</td>' . "\n" .
 137             '            </tr>' . "\n";
 138      }
 139  ?>
 140            </table>
 141  <?php
 142    } else {
 143      include (DIR_WS_FUNCTIONS . 'html_graphs.php');
 144  
 145      switch ($type) {
 146        case 'yearly':
 147          echo tep_banner_graph_yearly($HTTP_GET_VARS['bID']);
 148          break;
 149        case 'monthly':
 150          echo tep_banner_graph_monthly($HTTP_GET_VARS['bID']);
 151          break;
 152        default:
 153        case 'daily':
 154          echo tep_banner_graph_daily($HTTP_GET_VARS['bID']);
 155          break;
 156      }
 157    }
 158  ?>
 159          </td>
 160        </tr>
 161        <tr>
 162          <td><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td>
 163        </tr>
 164        <tr>
 165          <td class="main" align="right"><?php echo '<a href="' . tep_href_link(FILENAME_BANNER_MANAGER, 'page=' . $HTTP_GET_VARS['page'] . '&bID=' . $HTTP_GET_VARS['bID']) . '">' . tep_image_button('button_back.gif', IMAGE_BACK) . '</a>'; ?></td>
 166        </tr>
 167      </table></td>
 168  <!-- body_text_eof //-->
 169    </tr>
 170  </table>
 171  <!-- body_eof //-->
 172  
 173  <!-- footer //-->
 174  <?php require (DIR_WS_INCLUDES . 'footer.php'); ?>
 175  <!-- footer_eof //-->
 176  <br>
 177  </body>
 178  </html>
 179  <?php require (DIR_WS_INCLUDES . 'application_bottom.php'); ?>


Generated: Fri Jan 1 13:43:16 2010 Cross-referenced by PHPXref 0.7