|
ZenCart_Documentation
1.5.0
http://www.collinsharper.com
|
00001 <?php 00002 // 00003 // +----------------------------------------------------------------------+ 00004 // |zen-cart Open Source E-commerce | 00005 // +----------------------------------------------------------------------+ 00006 // | Copyright (c) 2003 The zen-cart developers | 00007 // | | 00008 // | http://www.zen-cart.com/index.php | 00009 // | | 00010 // | Portions Copyright (c) 2003 osCommerce | 00011 // +----------------------------------------------------------------------+ 00012 // | This source file is subject to version 2.0 of the GPL license, | 00013 // | that is bundled with this package in the file LICENSE, and is | 00014 // | available through the world-wide-web at the following url: | 00015 // | http://www.zen-cart.com/license/2_0.txt. | 00016 // | If you did not receive a copy of the zen-cart license and are unable | 00017 // | to obtain it through the world-wide-web, please send a note to | 00018 // | [email protected] so we can mail you a copy immediately. | 00019 // +----------------------------------------------------------------------+ 00020 // $Id: banner_statistics.php 1969 2005-09-13 06:57:21Z drbyte $ 00021 // 00022 00023 00024 require('includes/application_top.php'); 00025 00026 $type = (isset($_GET['type']) ? $_GET['type'] : ''); 00027 00028 $banner_extension = zen_banner_image_extension(); 00029 00030 // check if the graphs directory exists 00031 $dir_ok = false; 00032 if (function_exists('imagecreate') && zen_not_null($banner_extension)) { 00033 if (is_dir(DIR_WS_IMAGES . 'graphs')) { 00034 if (is_writeable(DIR_WS_IMAGES . 'graphs')) { 00035 $dir_ok = true; 00036 } else { 00037 $messageStack->add(ERROR_GRAPHS_DIRECTORY_NOT_WRITEABLE, 'error'); 00038 } 00039 } else { 00040 $messageStack->add(ERROR_GRAPHS_DIRECTORY_DOES_NOT_EXIST, 'error'); 00041 } 00042 } 00043 00044 $banner = $db->Execute("select banners_title 00045 from " . TABLE_BANNERS . " 00046 where banners_id = '" . (int)$_GET['bID'] . "'"); 00047 00048 $years_array = array(); 00049 $years = $db->Execute("select distinct year(banners_history_date) as banner_year 00050 from " . TABLE_BANNERS_HISTORY . " 00051 where banners_id = '" . (int)$_GET['bID'] . "'"); 00052 while (!$years->EOF) { 00053 $years_array[] = array('id' => $years->fields['banner_year'], 00054 'text' => $years->fields['banner_year']); 00055 $years->MoveNext(); 00056 } 00057 00058 $months_array = array(); 00059 for ($i=1; $i<13; $i++) { 00060 $months_array[] = array('id' => $i, 00061 'text' => strftime('%B', mktime(0,0,0,$i))); 00062 } 00063 00064 $type_array = array(array('id' => 'daily', 00065 'text' => STATISTICS_TYPE_DAILY), 00066 array('id' => 'monthly', 00067 'text' => STATISTICS_TYPE_MONTHLY), 00068 array('id' => 'yearly', 00069 'text' => STATISTICS_TYPE_YEARLY)); 00070 ?> 00071 <!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN"> 00072 <html <?php echo HTML_PARAMS; ?>> 00073 <head> 00074 <meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET; ?>"> 00075 <title><?php echo TITLE; ?></title> 00076 <link rel="stylesheet" type="text/css" href="includes/stylesheet.css"> 00077 <link rel="stylesheet" type="text/css" href="includes/cssjsmenuhover.css" media="all" id="hoverJS"> 00078 <script language="javascript" src="includes/menu.js"></script> 00079 <script type="text/javascript"> 00080 <!-- 00081 function init() 00082 { 00083 cssjsmenu('navbar'); 00084 if (document.getElementById) 00085 { 00086 var kill = document.getElementById('hoverJS'); 00087 kill.disabled = true; 00088 } 00089 } 00090 // --> 00091 </script> 00092 </head> 00093 <body onload="init()"> 00094 <!-- header //--> 00095 <?php require(DIR_WS_INCLUDES . 'header.php'); ?> 00096 <!-- header_eof //--> 00097 00098 <!-- body //--> 00099 <table border="0" width="100%" cellspacing="2" cellpadding="2"> 00100 <tr> 00101 <!-- body_text //--> 00102 <td width="100%" valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="2"> 00103 <tr> 00104 <td width="100%"><table border="0" width="100%" cellspacing="0" cellpadding="0"> 00105 <tr><?php echo zen_draw_form('year', FILENAME_BANNER_STATISTICS, '', 'get'); ?> 00106 <td class="pageHeading"><?php echo HEADING_TITLE; ?></td> 00107 <td class="pageHeading" align="right"><?php echo zen_draw_separator('pixel_trans.gif', '1', HEADING_IMAGE_HEIGHT); ?></td> 00108 <td class="main" align="right"><?php echo TITLE_TYPE . ' ' . zen_draw_pull_down_menu('type', $type_array, (zen_not_null($type) ? $type : 'daily'), 'onChange="this.form.submit();"'); ?><noscript><input type="submit" value="GO"></noscript><br> 00109 <?php 00110 switch ($type) { 00111 case 'yearly': break; 00112 case 'monthly': 00113 echo TITLE_YEAR . ' ' . zen_draw_pull_down_menu('year', $years_array, (isset($_GET['year']) ? $_GET['year'] : date('Y')), 'onChange="this.form.submit();"') . '<noscript><input type="submit" value="GO"></noscript>'; 00114 break; 00115 default: 00116 case 'daily': 00117 echo TITLE_MONTH . ' ' . zen_draw_pull_down_menu('month', $months_array, (isset($_GET['month']) ? $_GET['month'] : date('n')), 'onChange="this.form.submit();"') . '<noscript><input type="submit" value="GO"></noscript><br>' . TITLE_YEAR . ' ' . zen_draw_pull_down_menu('year', $years_array, (isset($_GET['year']) ? $_GET['year'] : date('Y')), 'onChange="this.form.submit();"') . '<noscript><input type="submit" value="GO"></noscript>'; 00118 break; 00119 } 00120 ?> 00121 </td> 00122 <?php echo zen_hide_session_id() . zen_draw_hidden_field('page', $_GET['page']) . zen_draw_hidden_field('bID', $_GET['bID']); ?></form></tr> 00123 </table></td> 00124 </tr> 00125 <tr> 00126 <td><?php echo zen_draw_separator('pixel_trans.gif', '1', '10'); ?></td> 00127 </tr> 00128 <tr> 00129 <td class="main" align="right"><?php echo '<a href="' . zen_href_link(FILENAME_BANNER_MANAGER, 'page=' . $_GET['page'] . '&bID=' . $_GET['bID']) . '">' . zen_image_button('button_back.gif', IMAGE_BACK) . '</a>'; ?></td> 00130 </tr> 00131 <tr> 00132 <td align="center"> 00133 <?php 00134 if (function_exists('imagecreate') && ($dir_ok == true) && zen_not_null($banner_extension)) { 00135 $banner_id = (int)$_GET['bID']; 00136 00137 switch ($type) { 00138 case 'yearly': 00139 include(DIR_WS_INCLUDES . 'graphs/banner_yearly.php'); 00140 echo zen_image(DIR_WS_IMAGES . 'graphs/banner_yearly-' . $banner_id . '.' . $banner_extension); 00141 break; 00142 case 'monthly': 00143 include(DIR_WS_INCLUDES . 'graphs/banner_monthly.php'); 00144 echo zen_image(DIR_WS_IMAGES . 'graphs/banner_monthly-' . $banner_id . '.' . $banner_extension); 00145 break; 00146 default: 00147 case 'daily': 00148 include(DIR_WS_INCLUDES . 'graphs/banner_daily.php'); 00149 echo zen_image(DIR_WS_IMAGES . 'graphs/banner_daily-' . $banner_id . '.' . $banner_extension); 00150 break; 00151 } 00152 ?> 00153 <table border="0" width="600" cellspacing="0" cellpadding="2"> 00154 <tr class="dataTableHeadingRow"> 00155 <td class="dataTableHeadingContent"><?php echo TABLE_HEADING_SOURCE; ?></td> 00156 <td class="dataTableHeadingContent" align="right"><?php echo TABLE_HEADING_VIEWS; ?></td> 00157 <td class="dataTableHeadingContent" align="right"><?php echo TABLE_HEADING_CLICKS; ?></td> 00158 </tr> 00159 <?php 00160 for ($i=0, $n=sizeof($stats); $i<$n; $i++) { 00161 echo ' <tr class="dataTableRow">' . "\n" . 00162 ' <td class="dataTableContent">' . $stats[$i][0] . '</td>' . "\n" . 00163 ' <td class="dataTableContent" align="right">' . number_format($stats[$i][1]) . '</td>' . "\n" . 00164 ' <td class="dataTableContent" align="right">' . number_format($stats[$i][2]) . '</td>' . "\n" . 00165 ' </tr>' . "\n"; 00166 } 00167 ?> 00168 </table> 00169 <?php 00170 } else { 00171 include(DIR_WS_FUNCTIONS . 'html_graphs.php'); 00172 00173 switch ($type) { 00174 case 'yearly': 00175 echo zen_banner_graph_yearly($_GET['bID']); 00176 break; 00177 case 'monthly': 00178 echo zen_banner_graph_monthly($_GET['bID']); 00179 break; 00180 default: 00181 case 'daily': 00182 echo zen_banner_graph_daily($_GET['bID']); 00183 break; 00184 } 00185 } 00186 ?> 00187 </td> 00188 </tr> 00189 <tr> 00190 <td><?php echo zen_draw_separator('pixel_trans.gif', '1', '10'); ?></td> 00191 </tr> 00192 <tr> 00193 <td class="main" align="right"><?php echo '<a href="' . zen_href_link(FILENAME_BANNER_MANAGER, 'page=' . $_GET['page'] . '&bID=' . $_GET['bID']) . '">' . zen_image_button('button_back.gif', IMAGE_BACK) . '</a>'; ?></td> 00194 </tr> 00195 </table></td> 00196 <!-- body_text_eof //--> 00197 </tr> 00198 </table> 00199 <!-- body_eof //--> 00200 00201 <!-- footer //--> 00202 <?php require(DIR_WS_INCLUDES . 'footer.php'); ?> 00203 <!-- footer_eof //--> 00204 <br> 00205 </body> 00206 </html> 00207 <?php require(DIR_WS_INCLUDES . 'application_bottom.php'); ?>