File modules/cms/macros/macro/MainMenu.class.php

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