File modules/cms/macros/macro/BlockMenu.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-25 21:05:14 dankert 25 // erbt von Klasse Dynamic 26 // 27 // Revision 1.1 2004/10/14 21:16:12 dankert 28 // Erzeugen eines Menues in Bloecken 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 BlockMenu 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 var $api; 60 61 // Erstellen des Hauptmenues 62 function execute() 63 { 64 // Erstellen des Hauptmenues 65 66 // Lesen des Root-Ordners 67 $folder = new Folder( $this->getRootObjectId() ); 68 69 // Schleife ueber alle Inhalte des Root-Ordners 70 foreach( $folder->getObjectIds() as $id ) 71 { 72 $o = new BaseObject( $id ); 73 $o->load(); 74 if ( $o->isFolder ) // Nur wenn Ordner 75 { 76 $f = new Folder( $id ); 77 78 // Ermitteln eines Objektes mit dem Dateinamen index 79 $oid = $f->getObjectIdByFileName('index'); 80 81 if ( count($f->getLinks())+count($f->getPages()) > 0 ) 82 { 83 $this->output( ' 84 <!-- sidebox --> 85 <table bgcolor="#000000" border="0" cellpadding="0" cellspacing="0" width="100%"> 86 <tr> 87 <td> 88 <table border="0" cellpadding="3" cellspacing="1" width="100%"> 89 <tr> 90 <td bgcolor="#cccccc"><span class="title"> '.$o->getNameForLanguage( $this->pageContext->languageId )->name.'</span></a> 91 </td> 92 </tr> 93 <tr> 94 <td bgcolor="#ffffff"> 95 '); 96 // Untermenue 97 // Schleife ber alle Objekte im aktuellen Ordner 98 foreach( $f->getObjectIds() as $xid ) 99 { 100 $o = new BaseObject( $xid ); 101 $o->load(); 102 103 // Nur Seiten anzeigen 104 if (!$o->isPage && !$o->isLink ) continue; 105 106 // Wenn aktuelle Seite, dann markieren, sonst Link 107 if ( $this->getObjectId() == $xid ) 108 { 109 // aktuelle Seite 110 $this->output( ' <span class="small">o</span> 111 <strong class="nav">'.$o->getNameForLanguage( $this->pageContext->languageId )->name.'</strong> 112 <br />' ); 113 } 114 else 115 { 116 $this->output( ' <span class="small">o</span> 117 <a class="nav" href="'.$this->pathToObject($xid).'">'.$o->getNameForLanguage( $this->pageContext->languageId )->name.'</a> 118 <br />' ); 119 } 120 //Api::output( '<br/>' ); 121 } 122 123 $this->output( ' 124 </td> 125 </tr> 126 </table> 127 </td> 128 </tr> 129 </table> 130 <!-- end sidebox --> 131 <br /> 132 ' ); 133 } 134 } 135 } 136 } 137 }
Download modules/cms/macros/macro/BlockMenu.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.