openrat-cms

# OpenRat Content Management System
git clone http://git.code.weiherhei.de/openrat-cms.git
Log | Files | Refs

commit f87d2408d0879098aecc5cfee028068d71df4663
parent d9aced2f49072336253c74212d76fa3e87f209f1
Author: Jan Dankert <develop@jandankert.de>
Date:   Sat, 16 Nov 2019 01:43:49 +0100

New: LinkList for creating simple lists with links.

Diffstat:
modules/cms-macros/macro/LinkList.class.php | 83+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 83 insertions(+), 0 deletions(-)

diff --git a/modules/cms-macros/macro/LinkList.class.php b/modules/cms-macros/macro/LinkList.class.php @@ -0,0 +1,82 @@ +<?php +// --------------------------------------------------------------------------- +// $Id$ +// --------------------------------------------------------------------------- +// OpenRat Content Management System +// Copyright (C) 2002 Jan Dankert, jandankert@jandankert.de +// +// This program is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License +// as published by the Free Software Foundation; either version 2 +// of the License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +// --------------------------------------------------------------------------- +// $Log$ +// Revision 1.1 2005-01-28 23:06:10 dankert +// Neues Menue in Listenform (HTML-Listen), aehnlich "BlockMenu" +// +// Revision 1.2 2004/12/25 21:05:14 dankert +// erbt von Klasse Dynamic +// +// Revision 1.1 2004/10/14 21:16:12 dankert +// Erzeugen eines Menues in Bloecken +// +// --------------------------------------------------------------------------- +use cms\model\Folder; +use cms\model\BaseObject; + + +/** + * Creates a list of links. + * + * @author Jan Dankert + */ +class LinkList extends Macro +{ + /** + * Bitte immer eine Beschreibung benutzen, dies ist fuer den Web-Developer hilfreich. + * @type String + */ + public $description = 'Creates a list of links'; + + public $folderid; + + + function execute() + { + echo '<ul>'; + + // + if ( ! $this->folderid ) + $this->folderid = $this->getRootObjectId(); + + $folder = new Folder( $this->folderid ); + + // Schleife ueber alle Inhalte des Ordners + foreach( $folder->getObjectIds() as $id ) + { + $o = new BaseObject( $id ); + $o->languageid = $this->page->languageid; + $o->load(); + + // Nur Seiten und Verknuepfungen anzeigen + if (!$o->isPage && !$o->isLink && !$o->isUrl ) + continue; + + // Wenn aktuelle Seite, dann markieren, sonst Link + $class = ($this->getObjectId() == $id )?'actual':''; + + echo '<li class="'.$class.'"><a href="'.$this->page->path_to_object($id).'">'.$o->name.'</a></li>'; + } + + echo '</ul>'; + } +}+ \ No newline at end of file