File modules/cms/macros/macro/Sitemap.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-28 22:57:56 dankert 25 // Korrektur Vererbung, "api" ausgebaut 26 // 27 // Revision 1.1 2004/10/14 21:15:29 dankert 28 // Erzeugen und Anzeigen einer Sitemap 29 // 30 // --------------------------------------------------------------------------- 31 use cms\model\Folder; 32 use cms\model\BaseObject; 33 use cms\model\Page; 34 use util\Macro; 35 36 37 /** 38 * Erstellen eines Menues 39 * @author Jan Dankert 40 */ 41 class Sitemap extends Macro 42 { 43 /** 44 * Bitte immer alle Parameter in dieses Array schreiben, dies ist fuer den Web-Developer hilfreich. 45 * @type String 46 */ 47 var $parameters = Array( 48 'beforeEntry'=>'Chars before an active menu entry' 49 ); 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 57 58 /** 59 * Zeichenkette, die vor einem aktiven Menuepunkt gezeigt wird 60 */ 61 var $beforeEntry = '<li><strong>'; 62 var $afterEntry = '</strong></li>'; 63 64 var $api; 65 66 /** 67 * Erstellen einer Sitemap 68 */ 69 function execute() 70 { 71 // Erstellen eines Untermenues 72 73 // Ermitteln der aktuellen Seite 74 $thispage = new Page( $this->getObjectId() ); 75 $thispage->load(); // Seite laden 76 77 // uebergeordneter Ordner dieser Seite 78 $this->showFolder( $this->getRootObjectId() ); 79 } 80 81 function showFolder( $oid ) 82 { 83 // uebergeordneter Ordner dieser Seite 84 $f = new Folder( $oid ); 85 86 // Schleife ueber alle Objekte im aktuellen Ordner 87 foreach( $f->getObjectIds() as $id ) 88 { 89 $o = new BaseObject( $id ); 90 $o->load(); 91 92 // Ordner 93 if ($o->isFolder ) 94 { 95 $this->output( '<li><strong>'.$o->getNameForLanguage( $this->pageContext->languageId )->name.'</strong><br/>' ); 96 $this->output( '<ul>' ); 97 $this->showFolder( $id ); // Rekursiver Aufruf dieser Methode 98 $this->output( '</ul></li>' ); 99 } 100 101 // Seiten und Verkn?fpungen 102 if ($o->isPage || $o->isLink ) 103 { 104 // Wenn aktuelle Seite, dann markieren, sonst Link 105 if ( $this->getObjectId() == $id ) 106 { 107 // aktuelle Seite 108 $this->output( '<li><strong>'.$o->getNameForLanguage( $this->pageContext->languageId )->name.'</strong></li>' ); 109 } 110 else 111 { 112 // Link erzeugen 113 $this->output( '<li><a href="'.$this->pathToObject($id).'">'.$o->getNameForLanguage( $this->pageContext->languageId )->name.'</a></li>' ); 114 } 115 } 116 } 117 } 118 } 119 120 ?>
Download modules/cms/macros/macro/Sitemap.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.