[ Index ]

PHP Cross Reference of Mambo 4.6.5

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

title

Body

[close]

/administrator/modules/ -> mod_popular.php (source)

   1  <?php
   2  /**
   3  * @package Mambo
   4  * @author Mambo Foundation Inc see README.php
   5  * @copyright (C) 2000 - 2009 Mambo Foundation Inc.
   6  * See COPYRIGHT.php for copyright notices and details.
   7  * @license GNU/GPL Version 2, see LICENSE.php
   8  *
   9  * Redistributions of files must retain the above copyright notice.
  10  *
  11  * Mambo is free software; you can redistribute it and/or
  12  * modify it under the terms of the GNU General Public License
  13  * as published by the Free Software Foundation; version 2 of the License.
  14  */
  15  
  16  /** ensure this file is being included by a parent file */
  17  defined( '_VALID_MOS' ) or die( 'Direct Access to this location is not allowed.' );
  18  
  19  $query = "SELECT a.hits, a.id, a.sectionid, a.title, a.created, u.name"
  20  . "\n FROM #__content AS a"
  21  . "\n LEFT JOIN #__users AS u ON u.id=a.created_by"
  22  . "\n WHERE a.state <> '-2'"
  23  . "\n ORDER BY hits DESC"
  24  . "\n LIMIT 10"
  25  ;
  26  $database->setQuery( $query );
  27  $rows = $database->loadObjectList();
  28  ?>
  29  
  30  <table class="adminlist">
  31  <tr>
  32      <th class="title">
  33      <?php echo T_('Most Popular Items'); ?>
  34      </th>
  35      <th class="title">
  36      <?php echo T_('Created'); ?>
  37      </th>
  38      <th class="title">
  39      <?php echo T_('Hits'); ?>
  40      </th>
  41  </tr>
  42  <?php
  43  if ($rows) {
  44      foreach ($rows as $row) {
  45          if ( $row->sectionid == 0 ) {
  46              $link = 'index2.php?option=com_typedcontent&amp;task=edit&amp;hidemainmenu=1&amp;id='. $row->id;
  47          } else {
  48              $link = 'index2.php?option=com_content&amp;task=edit&amp;hidemainmenu=1&amp;id='. $row->id;
  49          }
  50          ?>
  51          <tr>
  52              <td>
  53              <a href="<?php echo $link; ?>">
  54              <?php echo htmlspecialchars($row->title, ENT_QUOTES);?>
  55              </a>
  56              </td>
  57              <td>
  58              <?php echo $row->created;?>
  59              </td>
  60              <td>
  61              <?php echo $row->hits;?>
  62              </td>
  63          </tr>
  64          <?php
  65      }    
  66  } else {
  67      ?>
  68      <tr>
  69          <td colspan="3">Nothing to show</td>
  70      </tr>
  71      <?php
  72  }
  73  ?>
  74  </table>