[ Index ]

PHP Cross Reference of Mambo 4.6.5

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

title

Body

[close]

/modules/ -> mod_sections.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  global $mosConfig_offset, $Itemid;
  17  
  18  //** ensure this file is being included by a parent file */
  19  defined( '_VALID_MOS' ) or die( 'Direct Access to this location is not allowed.' );
  20  
  21  $count = intval( $params->get( 'count', 20 ) );
  22  $access = !$mainframe->getCfg( 'shownoauth' );
  23  $now = date( 'Y-m-d H:i:s', time() + $mosConfig_offset * 60 * 60 );
  24  
  25  $database->setQuery(
  26  "SELECT a.id AS id, a.title AS title, COUNT(b.id) as cnt"
  27  . "\n FROM #__sections as a"
  28  . "\n LEFT JOIN #__content as b"
  29  . "\n ON a.id=b.sectionid"
  30  . ($access ? "\n AND b.access<='$my->gid'" : "" )
  31  . "\n AND (b.publish_up = '0000-00-00 00:00:00' OR b.publish_up <= '". $now ."' )"
  32  . "\n AND (b.publish_down = '0000-00-00 00:00:00' OR b.publish_down >= '". $now ."' )"
  33  . "\n WHERE a.scope='content'"
  34  . "\n AND a.published='1'"
  35  . ($access ? "\n AND a.access<='$my->gid'" : "" )
  36  . "\n GROUP BY a.id"
  37  . "\n HAVING COUNT(b.id)>0"
  38  . "\n ORDER BY a.ordering"
  39  . "\n LIMIT $count"
  40  );
  41  
  42  $rows = $database->loadObjectList();
  43  $menuhandler =& mosMenuHandler::getInstance();
  44  
  45  echo "<ul>\n";
  46  if ($rows) {
  47      foreach ($rows as $row) {
  48          $sectionItemid = $menuhandler->getSectionItemId($row->id,1);
  49          $url = "index.php?option=com_content&task=blogsection&id=".$row->id."&Itemid=$sectionItemid";
  50          echo "  <li><a href=\"" . sefRelToAbs($url) . "\">" . $row->title . "</a></li>\n";
  51      }
  52      echo "</ul>\n";
  53  }
  54  ?>