TYPO3 API  SVNRelease
makeMenu_datedirectory.inc
Go to the documentation of this file.
00001 <?php
00002 /***************************************************************
00003 *  Copyright notice
00004 *
00005 *  (c) 1999-2009 Kasper Skårhøj (kasperYYYY@typo3.com)
00006 *  All rights reserved
00007 *
00008 *  This script is part of the TYPO3 project. The TYPO3 project is
00009 *  free software; you can redistribute it and/or modify
00010 *  it under the terms of the GNU General Public License as published by
00011 *  the Free Software Foundation; either version 2 of the License, or
00012 *  (at your option) any later version.
00013 *
00014 *  The GNU General Public License can be found at
00015 *  http://www.gnu.org/copyleft/gpl.html.
00016 *  A copy is found in the textfile GPL.txt and important notices to the license
00017 *  from the author is found in LICENSE.txt distributed with these scripts.
00018 *
00019 *
00020 *  This script is distributed in the hope that it will be useful,
00021 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00022 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00023 *  GNU General Public License for more details.
00024 *
00025 *  This copyright notice MUST APPEAR in all copies of the script!
00026 ***************************************************************/
00027 /**
00028  * Date directory
00029  * Can be used with the HMENU cObject, special property set to "userdefined".
00030  *
00031  * $Id: makeMenu_datedirectory.inc 10317 2011-01-26 00:56:49Z baschny $
00032  * Revised for TYPO3 3.6 June/2003 by Kasper Skårhøj
00033  *
00034  * @author  Olaf.Schuemann@erz.be.ch
00035  * @see makeMenu_keywords_updated.inc
00036  */
00037 
00038 
00039 if (!is_object($this)) die ('Error: No parent object present.');
00040 
00041 
00042 
00043 
00044 
00045 $day = $conf['day'];
00046 $name = $conf['name'];
00047 $menuItemsArray = array();
00048 
00049 if ($day==-1) $day=date('w');
00050 if ($day==date('w')) {
00051     $son=mktime(0,0,0,date('m'),date('d'),date('Y'));
00052 } else {
00053     for ($i=1;;$i++) {
00054         $son=mktime(0,0,0,date('m'),date('d')-$i,date('Y'));
00055         if ($day==date('w',$son)) break;
00056         if ($i>100) break;  // Security that it's not an eternal loop.
00057     }
00058 }
00059 
00060 $date = date('Y-m-d', $son);
00061 $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('uid', 'pages', 'title LIKE '.$GLOBALS['TYPO3_DB']->fullQuoteStr($name.$date, 'pages'));  // get the uid of the page
00062 $row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res);
00063 
00064 $value=$row['uid'];
00065 
00066 if ($value=='') {
00067     $value=$GLOBALS['TSFE']->page['uid'];
00068 }
00069 $items=t3lib_div::intExplode(',',$value);
00070 foreach ($items as $id) {
00071     $res = $GLOBALS['TSFE']->cObj->exec_getQuery('pages',Array('pidInList'=>$id,'orderBy'=>$altSortField));
00072     while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res))        {
00073         $menuItemsArray[]=$row;
00074     }
00075 }
00076 
00077 ?>