[ Index ]

PHP Cross Reference of Mambo 4.6.5

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

title

Body

[close]

/modules/ -> mod_archive.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  global $mosConfig_offset;
  20  
  21  $count = intval( $params->get( 'count', 10 ) );
  22  $moduleclass_sfx     = $params->get( 'moduleclass_sfx' ); 
  23  $now                 = date( 'Y-m-d H:i:s', time() + $mosConfig_offset * 60 * 60 );
  24  
  25  $query = "SELECT MONTH(created) AS created_month, created, id, sectionid, title, YEAR(created) AS created_year"
  26  . "\n FROM #__content"
  27  . "\n WHERE ( state='-1' AND checked_out='0' AND sectionid > '0' )"
  28  . "\n GROUP BY created_year DESC, created_month DESC LIMIT $count";
  29  $database->setQuery( $query );
  30  $rows = $database->loadObjectList();
  31  
  32  if (is_array($rows)) {
  33  ?>
  34  <ul>
  35  <?php
  36  foreach ( $rows as $row ) {
  37      $created_month     = mosFormatDate ( $row->created, "%m" );
  38      $month_name     = mosFormatDate ( $row->created, "%B" );
  39      $created_year     = mosFormatDate ( $row->created, "%Y" );
  40      $link            = sefRelToAbs( 'index.php?option=com_content&amp;task=archivecategory&amp;year='. $created_year .'&amp;month='. $created_month .'&amp;module=1' );
  41      $text            = $month_name .', '. $created_year;
  42      ?>
  43      <li>
  44      <a href="<?php echo $link; ?>">
  45      <?php echo $text; ?>
  46      </a>
  47      </li>
  48      <?php
  49  }
  50  ?>
  51  </ul>
  52  <?php
  53  }
  54  ?>