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