[ Index ]

PHP Cross Reference of Mambo 4.6.5

[ Variables ]     [ Functions ]     [ Classes ]     [ Constants ]     [ Statistics ]

title

Body

[close]

/administrator/components/com_statistics/ -> admin.statistics.html.php (source)

   1  <?php
   2  /**
   3  * @package Mambo
   4  * @subpackage Statistics
   5  * @author Mambo Foundation Inc see README.php
   6  * @copyright (C) 2000 - 2009 Mambo Foundation Inc.
   7  * See COPYRIGHT.php for copyright notices and details.
   8  * @license GNU/GPL Version 2, see LICENSE.php
   9  *
  10  * Redistributions of files must retain the above copyright notice.
  11  *
  12  * Mambo is free software; you can redistribute it and/or
  13  * modify it under the terms of the GNU General Public License
  14  * as published by the Free Software Foundation; version 2 of the License.
  15  */
  16  
  17  /** ensure this file is being included by a parent file */
  18  defined( '_VALID_MOS' ) or die( 'Direct Access to this location is not allowed.' );
  19  
  20  class HTML_statistics {
  21  	function show( &$browsers, &$platforms, $tldomains, $bstats, $pstats, $dstats, $sorts, $option ) {
  22          global $mosConfig_live_site;
  23  
  24          $tab = mosGetParam( $_REQUEST, 'tab', 'tab1' );
  25          $width = 400;    // width of 100%
  26          $tabs = new mosTabs(1);
  27          ?>
  28          <style type="text/css">
  29          .bar_1{ background-color: #8D1B1B; border: 2px ridge #B22222; }
  30          .bar_2{ background-color: #6740E1; border: 2px ridge #4169E1; }
  31          .bar_3{ background-color: #8D8D8D; border: 2px ridge #D2D2D2; }
  32          .bar_4{ background-color: #CC8500; border: 2px ridge #FFA500; }
  33          .bar_5{ background-color: #5B781E; border: 2px ridge #6B8E23; }
  34          </style>
  35          <table class="adminheading">
  36          <tr>
  37              <th class="browser"><?php echo T_('Browser, OS, Domain Statistics'); ?></th>
  38          </tr>
  39          </table>
  40          <form action="index2.php" method="post" name="adminForm">
  41          <?php
  42          $tabs->startPane("statsPane");
  43          $tabs->startTab(T_("Browsers"),"browsers-page");
  44          ?>
  45          <table class="adminlist">
  46          <tr>
  47              <th align="left">&nbsp;<?php echo T_('Browser'); ?> <?php echo $sorts['b_agent'];?></th>
  48              <th>&nbsp;</th>
  49              <th width="100" align="left">% <?php echo $sorts['b_hits'];?></th>
  50              <th width="100" align="left">#</th>
  51          </tr>
  52          <?php
  53          $c = 1;
  54          if (is_array($browsers) && count($browsers) > 0) {
  55              $k = 0;
  56              foreach ($browsers as $b) {
  57                  $f = $bstats->totalhits > 0 ? $b->hits / $bstats->totalhits : 0;
  58                  $w = $width * $f;
  59              ?>
  60              <tr class="row<?php echo $k;?>">
  61                  <td width="200" align="left">
  62                      &nbsp;<?php echo $b->agent; ?>&nbsp;
  63                  </td>
  64                  <td align="left" width="<?php echo $width+10;?>">
  65                      <div align="left">&nbsp;<img src="<?php echo $mosConfig_live_site; ?>/components/com_poll/images/blank.png" class="bar_<?php echo $c; ?>" height="6" width="<?php echo $w; ?>"></div>
  66                  </td>
  67                  <td align="left">
  68                      <?php printf( "%.2f%%", $f * 100 );?>
  69                  </td>
  70                  <td align="left">
  71                      <?php echo $b->hits;?>
  72                  </td>
  73              </tr>
  74              <?php
  75              $c = $c % 5 + 1;
  76              $k = 1 - $k;
  77              }
  78          }
  79          ?>
  80          <tr>
  81              <th colspan="4">&nbsp;</th>
  82          </tr>
  83          </table>
  84          <?php
  85          $tabs->endTab();
  86          $tabs->startTab(T_("OS Stats"),"os-page");
  87          ?>
  88          <table class="adminlist">
  89          <tr>
  90              <th align="left">&nbsp;<?php echo T_('Operating System'); ?> <?php echo $sorts['o_agent'];?></th>
  91              <th>&nbsp;</th>
  92              <th width="100" align="left">% <?php echo $sorts['o_hits'];?></th>
  93              <th width="100" align="left">#</th>
  94          </tr>
  95          <?php
  96          $c = 1;
  97          if (is_array($platforms) && count($platforms) > 0) {
  98              $k = 0;
  99              foreach ($platforms as $p) {
 100                  $f = $pstats->totalhits > 0 ? $p->hits / $pstats->totalhits : 0;
 101                  $w = $width * $f;
 102                  ?>
 103                  <tr class="row<?php echo $k;?>">
 104                      <td width="200" align="left">
 105                      &nbsp;<?php echo $p->agent; ?>&nbsp;
 106                      </td>
 107                      <td align="left" width="<?php echo $width+10;?>">
 108                      <div align="left">&nbsp;<img src="<?php echo $mosConfig_live_site; ?>/components/com_poll/images/blank.png" class="bar_<?php echo $c; ?>" height="6" width="<?php echo $w; ?>"></div>
 109                      </td>
 110                      <td align="left">
 111                      <?php printf( "%.2f%%", $f * 100 );?>
 112                      </td>
 113                      <td align="left">
 114                      <?php echo $p->hits;?>
 115                      </td>
 116                  </tr>
 117                  <?php
 118                  $c = $c % 5 + 1;
 119                  $k = 1 - $k;
 120              }
 121          }
 122          ?>
 123          <tr>
 124              <th colspan="4">&nbsp;</th>
 125          </tr>
 126          </table>
 127          <?php
 128          $tabs->endTab();
 129          $tabs->startTab(T_("Domain Stats"),"domain-page");
 130          ?>
 131          <table class="adminlist">
 132          <tr>
 133              <th align="left">&nbsp;<?php echo T_('Domain'); ?> <?php echo $sorts['d_agent'];?></th>
 134              <th>&nbsp;</th>
 135              <th width="100" align="left">% <?php echo $sorts['d_hits'];?></th>
 136              <th width="100" align="left">#</th>
 137          </tr>
 138          <?php
 139          $c = 1;
 140          if (is_array($tldomains) && count($tldomains) > 0) {
 141              $k = 0;
 142              foreach ($tldomains as $b) {
 143                  $f = $dstats->totalhits > 0 ? $b->hits / $dstats->totalhits : 0;
 144                  $w = $width * $f;
 145                  ?>
 146                  <tr class="row<?php echo $k;?>">
 147                      <td width="200" align="left">
 148                          &nbsp;<?php echo $b->agent; ?>&nbsp;
 149                      </td>
 150                      <td align="left" width="<?php echo $width+10;?>">
 151                          <div align="left">&nbsp;<img src="<?php echo $mosConfig_live_site; ?>/components/com_poll/images/blank.png" class="bar_<?php echo $c; ?>" height="6" width="<?php echo $w; ?>"></div>
 152                      </td>
 153                      <td align="left">
 154                          <?php printf( "%.2f%%", $f * 100 );?>
 155                      </td>
 156                      <td align="left">
 157                          <?php echo $b->hits;?>
 158                      </td>
 159                  </tr>
 160                  <?php
 161                  $c = $c % 5 + 1;
 162                  $k = 1 - $k;
 163              }
 164          }
 165          ?>
 166          <tr>
 167              <th colspan="4">&nbsp;</th>
 168          </tr>
 169          </table>
 170          <?php
 171          $tabs->endTab();
 172          $tabs->endPane();
 173          ?>
 174          <input type="hidden" name="option" value="<?php echo $option;?>" />
 175          <input type="hidden" name="tab" value="<?php echo $tab;?>" />
 176          </form>
 177          <?php
 178      }
 179  
 180  	function pageImpressions( &$rows, $pageNav, $option, $task ) {
 181          ?>
 182          <table cellpadding="4" cellspacing="0" border="0" width="100%" class="adminheading">
 183          <tr>
 184              <th width="100%" class="impressions"><?php echo T_('Page Impression Statistics'); ?></th>
 185          </tr>
 186          </table>
 187  
 188          <form action="index2.php" method="post" name="adminForm">
 189          <table class="adminlist">
 190          <tr>
 191              <th style="text-align:right">#</th>
 192              <th class="title"><?php echo T_('Title'); ?></th>
 193              <th align="center" nowrap="nowrap"><?php echo T_('Page Impressions'); ?></th>
 194          </tr>
 195          <?php
 196          $i = $pageNav->limitstart;
 197          $k = 0;
 198          if (is_array($rows)) {
 199              foreach ($rows as $row) {
 200                  ?>
 201                  <tr class="row<?php echo $k;?>">
 202                      <td align="right">
 203                          <?php echo ++$i; ?>
 204                      </td>
 205                      <td align="left">
 206                          &nbsp;<?php echo $row->title." (".$row->created.")"; ?>&nbsp;
 207                      </td>
 208                      <td align="center">
 209                          <?php echo $row->hits; ?>
 210                      </td>
 211                  </tr>
 212                  <?php
 213                  $k = 1 - $k;
 214              }
 215          }
 216          ?>
 217          </table>
 218          <?php echo $pageNav->getListFooter(); ?>
 219            <input type="hidden" name="option" value="<?php echo $option;?>" />
 220            <input type="hidden" name="task" value="<?php echo $task;?>" />
 221          </form>
 222          <?php
 223      }
 224  
 225  	function showSearches( &$rows, $pageNav, $option, $task ) {
 226          global $mainframe;
 227          ?>
 228          <form action="index2.php" method="post" name="adminForm">
 229          <table cellpadding="4" cellspacing="0" border="0" width="100%" class="adminheading">
 230              <tr>
 231                  <th width="100%" class="searchtext">
 232                  <?php echo T_('Search Engine Text :'); ?>
 233                  <span class="componentheading"><?php echo T_('logging is :'); ?>
 234                  <?php echo $mainframe->getCfg( 'enable_log_searches' ) ? '<strong><font color="green">'.T_('Enabled').'</font></strong>' : '<strong><font color="red">'.T_('Disabled').'</font></strong>' ?>
 235                  </span>
 236                  </th>
 237              </tr>
 238          </table>
 239  
 240          <table class="adminlist">
 241          <tr>
 242              <th style="text-align:right">#</th>
 243              <th class="title"><?php echo T_('Search Text'); ?></th>
 244              <th nowrap="nowrap"><?php echo T_('Times Requested'); ?></th>
 245              <th nowrap="nowrap"><?php echo T_('Results Returned'); ?></th>
 246          </tr>
 247          <?php
 248          $k = 0;
 249          for ($i=0, $n = count($rows); $i < $n; $i++) {
 250              $row =& $rows[$i];
 251              ?>
 252              <tr class="row<?php echo $k;?>">
 253                  <td align="right">
 254                  <?php echo $i+1+$pageNav->limitstart; ?>
 255                  </td>
 256                  <td align="left"><?php echo $row->search_term;?></td>
 257                  <td align="center"><?php echo $row->hits; ?></td>
 258                  <td align="center"><?php echo $row->returns; ?></td>
 259              </tr>
 260              <?php
 261              $k = 1 - $k;
 262          }
 263          ?>
 264      </table>
 265      <?php echo $pageNav->getListFooter(); ?>
 266        <input type="hidden" name="option" value="<?php echo $option;?>" />
 267        <input type="hidden" name="task" value="<?php echo $task;?>" />
 268      </form>
 269      <?php
 270      }
 271  }
 272  ?>