00001 <?php 00002 // --------------------------------------------------------------------------- 00003 // $Id$ 00004 // --------------------------------------------------------------------------- 00005 // OpenRat Content Management System 00006 // Copyright (C) 2002 Jan Dankert, jandankert@jandankert.de 00007 // 00008 // This program is free software; you can redistribute it and/or 00009 // modify it under the terms of the GNU General Public License 00010 // as published by the Free Software Foundation; either version 2 00011 // of the License, or (at your option) any later version. 00012 // 00013 // This program is distributed in the hope that it will be useful, 00014 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00015 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00016 // GNU General Public License for more details. 00017 // 00018 // You should have received a copy of the GNU General Public License 00019 // along with this program; if not, write to the Free Software 00020 // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 00021 // --------------------------------------------------------------------------- 00022 // $Log$ 00023 // Revision 1.3 2004-12-19 22:35:23 dankert 00024 // Parameter -Angabe 00025 // 00026 // Revision 1.2 2004/12/19 15:19:29 dankert 00027 // Klasse erbt von "Dynamic" 00028 // 00029 // Revision 1.1 2004/11/10 22:43:35 dankert 00030 // Beispiele fuer dynamische Templateelemente 00031 // 00032 // --------------------------------------------------------------------------- 00033 00034 00035 00040 class CommonMenu extends Dynamic 00041 { 00046 var $parameters = Array( 00047 'beforeEntry'=>'Chars before an active menu entry', 00048 'afterEntry' =>'Chars after an active menu entry' 00049 ); 00050 00055 var $description = 'Creates a main menu.'; 00056 00057 00061 var $beforeEntry = '<li><strong>'; 00062 var $afterEntry = '</strong></li>'; 00063 00064 00065 // Erstellen des Hauptmenues 00066 function execute() 00067 { 00068 // Erstellen eines Untermenues 00069 00070 // Ermitteln der aktuellen Seite 00071 $thispage = new Page( $this->getObjectId() ); 00072 $thispage->load(); // Seite laden 00073 00074 // uebergeordneter Ordner dieser Seite 00075 $f = new Folder( $thispage->parentid ); 00076 00077 // Schleife ueber alle Objekte im aktuellen Ordner 00078 foreach( $f->getObjectIds() as $id ) 00079 { 00080 $o = new Object( $id ); 00081 $o->languageid = $this->page->languageid; 00082 $o->load(); 00083 00084 // Nur Seiten anzeigen 00085 if (!$o->isPage && !$o->isLink ) continue; 00086 00087 // Wenn aktuelle Seite, dann markieren, sonst Link 00088 if ( $this->getObjectId() == $id ) 00089 { 00090 // aktuelle Seite 00091 $this->output( '<li><strong>'.$o->name.'</strong></li>' ); 00092 } 00093 else 00094 { 00095 // Link erzeugen 00096 $this->output( '<li><a href="'.$this->page->path_to_object($id).'">'.$o->name.'</a></li>' ); 00097 } 00098 } 00099 } 00100 }
1.5.8