openrat-cms

# OpenRat Content Management System
git clone http://git.code.weiherhei.de/openrat-cms.git
Log | Files | Refs

MainMenu.class.php (2583B)


      1 <?php
      2 // ---------------------------------------------------------------------------
      3 // $Id$
      4 // ---------------------------------------------------------------------------
      5 // OpenRat Content Management System
      6 // Copyright (C) 2002 Jan Dankert, jandankert@jandankert.de
      7 //
      8 // This program is free software; you can redistribute it and/or
      9 // modify it under the terms of the GNU General Public License
     10 // as published by the Free Software Foundation; either version 2
     11 // of the License, or (at your option) any later version.
     12 //
     13 // This program is distributed in the hope that it will be useful,
     14 // but WITHOUT ANY WARRANTY; without even the implied warranty of
     15 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     16 // GNU General Public License for more details.
     17 //
     18 // You should have received a copy of the GNU General Public License
     19 // along with this program; if not, write to the Free Software
     20 // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
     21 // ---------------------------------------------------------------------------
     22 // $Log$
     23 // Revision 1.2  2004-12-19 15:19:16  dankert
     24 // Klasse erbt von "Dynamic"
     25 //
     26 // Revision 1.1  2004/10/14 21:15:57  dankert
     27 // Erzeugen eines Hauptmenues
     28 //
     29 // ---------------------------------------------------------------------------
     30 use cms\model\Folder;
     31 use cms\model\BaseObject;
     32 
     33 
     34 /**
     35  * Erstellen eines Hauptmenues
     36  * @author Jan Dankert
     37  */
     38 class MainMenu extends Macro
     39 {
     40 	/**
     41 	 * Bitte immer alle Parameter in dieses Array schreiben, dies ist fuer den Web-Developer hilfreich.
     42 	 * @type String
     43 	 */
     44 	var $parameters  = Array(
     45 		'arrowChar'=>'String between menu entries, default: "&middot;"'
     46 		);
     47 
     48 
     49 	var $arrowChar = ' &middot; ';
     50 
     51 	/**
     52 	 * Bitte immer eine Beschreibung benutzen, dies ist fuer den Web-Developer hilfreich.
     53 	 * @type String
     54 	 */
     55 	var $description = 'Creates a main menu.';
     56 	var $version     = '$Id$';
     57 
     58 	// Erstellen des Hauptmenues
     59 	function execute()
     60 	{
     61 		// Lesen des Root-Ordners
     62 		$folder = new Folder( $this->getRootObjectId() );
     63 		
     64 		// Schleife ueber alle Inhalte des Root-Ordners
     65 		foreach( $folder->getObjectIds() as $id )
     66 		{
     67 			$o = new BaseObject( $id );
     68 			$o->languageid = $this->page->languageid;
     69 			$o->load();
     70 			if ( $o->isFolder ) // Nur wenn Ordner
     71 			{
     72 				$f = new Folder( $id );
     73 				
     74 				// Ermitteln eines Objektes mit dem Dateinamen index
     75 				$oid = $f->getObjectIdByFileName('index');
     76 				if ( is_numeric($oid) && $oid!=0 )
     77 					$this->output( $this->arrowChar.'<a href="'.$this->pathToObject($oid).'" title="'.$o->desc.'">'.$o->name.'</a>' );
     78 			}
     79 		}
     80 	}
     81 }