File modules/cms/macros/macro/BreadCrumb.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.3 2007-11-30 23:25:25 dankert 25 // Das Men? in der Sprache der zu ver?ffentlichenden Seite erzeugen. 26 // 27 // Revision 1.2 2005/01/04 19:59:55 dankert 28 // Allgemeine Korrekturen, Erben von "Dynamic"-klasse 29 // 30 // Revision 1.1 2004/11/10 22:43:35 dankert 31 // Beispiele fuer dynamische Templateelemente 32 // 33 // --------------------------------------------------------------------------- 34 use cms\model\Folder; 35 use util\Macro; 36 37 38 /** 39 * Erstellen einer sog. Brotkruemel-Navigation 40 * @author Jan Dankert 41 */ 42 class BreadCrumb extends Macro 43 { 44 /** 45 * Bitte immer alle Parameter in dieses Array schreiben, dies ist fuer den Web-Developer hilfreich. 46 * @type String 47 */ 48 var $parameters = Array( 49 'beforeEntry'=>'Chars before an active menu entry' 50 ); 51 52 /** 53 * Bitte immer eine Beschreibung benutzen, dies ist fuer den Web-Developer hilfreich. 54 * @type String 55 */ 56 var $description = 'Creates a main menu.'; 57 58 59 /** 60 * Zeichenkette, die vor einem aktiven Menuepunkt gezeigt wird 61 */ 62 var $beforeEntry = '»'; 63 64 var $api; 65 66 /** 67 * Erstellen einer BreadCrumb-Navigation. 68 */ 69 function execute() 70 { 71 // Erstellen eines Untermenues 72 73 // Ermitteln der aktuellen Seite 74 $f = new Folder($this->page->parentid); 75 $parentIds = $f->parentObjectFileNames(false,true); 76 $lastoid = 0; 77 78 foreach( $parentIds as $oid=>$filename ) 79 { 80 $of = new Folder($oid); 81 $of->load(); 82 $pl = $of->getFirstPageOrLink(); 83 84 $this->output( $this->beforeEntry ); 85 86 if ( is_object($pl) && $pl->objectid != $this->page->objectid ) 87 $this->output('<a href="'.$this->pathToObject($pl->objectid).'" class="breadcrumb">'.$of->getNameForLanguage( $this->pageContext->languageId )->name.'</a>' ); 88 else 89 $this->output('<span class="breadcrumb">'.$of->getNameForLanguage( $this->pageContext->languageId )->name.'</span>' ); 90 91 if ( is_object($pl) ) 92 $lastoid = $pl->objectid; 93 } 94 95 if ( $lastoid != $this->page->objectid ) 96 { 97 $this->output( $this->beforeEntry ); 98 $this->output('<span class="breadcrumb">'.$this->page->getNameForLanguage( $this->pageContext->languageId )->name.'</span>' ); 99 } 100 101 } 102 } 103 104 ?>
Downloadmodules/cms/macros/macro/BreadCrumb.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.