LinkList.class.php (2449B)
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.1 2005-01-28 23:06:10 dankert 24 // Neues Menue in Listenform (HTML-Listen), aehnlich "BlockMenu" 25 // 26 // Revision 1.2 2004/12/25 21:05:14 dankert 27 // erbt von Klasse Dynamic 28 // 29 // Revision 1.1 2004/10/14 21:16:12 dankert 30 // Erzeugen eines Menues in Bloecken 31 // 32 // --------------------------------------------------------------------------- 33 use cms\model\Folder; 34 use cms\model\BaseObject; 35 36 37 /** 38 * Creates a list of links. 39 * 40 * @author Jan Dankert 41 */ 42 class LinkList extends Macro 43 { 44 /** 45 * Bitte immer eine Beschreibung benutzen, dies ist fuer den Web-Developer hilfreich. 46 * @type String 47 */ 48 public $description = 'Creates a list of links'; 49 50 public $folderid; 51 52 53 function execute() 54 { 55 echo '<ul>'; 56 57 // 58 if ( ! $this->folderid ) 59 $this->folderid = $this->getRootObjectId(); 60 61 $folder = new Folder( $this->folderid ); 62 63 // Schleife ueber alle Inhalte des Ordners 64 foreach( $folder->getObjectIds() as $id ) 65 { 66 $o = new BaseObject( $id ); 67 $o->languageid = $this->page->languageid; 68 $o->load(); 69 70 // Nur Seiten und Verknuepfungen anzeigen 71 if (!$o->isPage && !$o->isLink && !$o->isUrl ) 72 continue; 73 74 // Wenn aktuelle Seite, dann markieren, sonst Link 75 $class = ($this->getObjectId() == $id )?'actual':''; 76 77 echo '<li class="'.$class.'"><a href="'.$this->pathToObject($id).'">'.$o->name.'</a></li>'; 78 } 79 80 echo '</ul>'; 81 } 82 }