File modules/cms/macros/macro/LinkList.class.php

Last commit: Sun Nov 15 19:16:06 2020 +0100	Jan Dankert	Fix: Reading the name of the object with the name object.
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.1 2005-01-28 23:06:10 dankert 25 // Neues Menue in Listenform (HTML-Listen), aehnlich "BlockMenu" 26 // 27 // Revision 1.2 2004/12/25 21:05:14 dankert 28 // erbt von Klasse Dynamic 29 // 30 // Revision 1.1 2004/10/14 21:16:12 dankert 31 // Erzeugen eines Menues in Bloecken 32 // 33 // --------------------------------------------------------------------------- 34 use cms\model\Folder; 35 use cms\model\BaseObject; 36 use util\Macro; 37 38 39 /** 40 * Creates a list of links. 41 * 42 * @author Jan Dankert 43 */ 44 class LinkList extends Macro 45 { 46 /** 47 * Bitte immer eine Beschreibung benutzen, dies ist fuer den Web-Developer hilfreich. 48 * @type String 49 */ 50 public $description = 'Creates a list of links'; 51 52 public $folderid; 53 public $listStyleClassName = 'actual'; 54 public $actualStyleClassName = 'actual'; 55 56 57 function execute() 58 { 59 echo '<ul class="'.$this->listStyleClassName.'">'; 60 61 // 62 if ( ! $this->folderid ) 63 $this->folderid = $this->getRootObjectId(); 64 65 $folder = new Folder( $this->folderid ); 66 67 // Schleife ueber alle Inhalte des Ordners 68 foreach( $folder->getObjectIds() as $id ) 69 { 70 $o = new BaseObject( $id ); 71 $o->load(); 72 $name = $o->getNameForLanguage( $this->pageContext->languageId ); 73 74 // Only show pages, urls, links. 75 if (!$o->isPage && !$o->isLink && !$o->isUrl ) 76 continue; 77 78 // Mark the current object with a css class. 79 $class = ($this->getObjectId() == $id )?$this->actualStyleClassName:''; 80 81 echo '<li class="'.$class.'"><a title="'.$name->description.'" href="'.$this->pathToObject($id).'">'.$name->name.'</a></li>'; 82 } 83 84 echo '</ul>'; 85 } 86 }
Download modules/cms/macros/macro/LinkList.class.php
History Sun, 15 Nov 2020 19:16:06 +0100 Jan Dankert Fix: Reading the name of the object with the name object. 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.