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

Last commit: Sun Dec 5 20:33:24 2021 +0100	dankert	Cleanup: Removed unusable properties from class 'Value' and 'BaseObject'.
1 <?php 2 namespace cms\macros\macro; 3 // OpenRat Content Management System 4 // Copyright (C) 2002-2012 Jan Dankert, cms@jandankert.de 5 // 6 // This program is free software; you can redistribute it and/or 7 // modify it under the terms of the GNU General Public License 8 // as published by the Free Software Foundation; either version 2 9 // of the License, or (at your option) any later version. 10 // 11 // This program is distributed in the hope that it will be useful, 12 // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 // GNU General Public License for more details. 15 // 16 // You should have received a copy of the GNU General Public License 17 // along with this program; if not, write to the Free Software 18 // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 19 use cms\model\Folder; 20 use util\Macro; 21 22 23 /** 24 * Erstellt eine Tagcloud. 25 * @author Jan Dankert 26 */ 27 class TagCloud extends Macro 28 { 29 /** 30 * Beschreibung dieser Klasse 31 * @type String 32 */ 33 var $description = ''; 34 35 36 public $keywordFolderId = 0; 37 38 39 // Erstellen des Hauptmenues 40 function execute() 41 { 42 if ( intval($this->keywordFolderId) == 0 ) 43 { 44 $this->output('param keywordfolderid not set'); 45 return; 46 } 47 48 $f = new Folder( $this->keywordFolderId ); 49 50 foreach( $f->getChildObjectIdsByName( $this->pageContext->languageId ) as $fid ) 51 { 52 $tf = new Folder($fid); 53 if ( !$tf->isFolder) 54 continue; 55 $tf->load(); 56 57 $target = $tf->getFirstPage(); 58 59 if ( $target == null) 60 continue; 61 $target->load(); 62 63 // Link zum Tag erzeugen 64 $this->output( '<div class="tag" style="font-size:'.(0.5+(sizeof($tf->getObjectIds())*0.1)).'em"><a href="'.$this->pathToObject($target->objectid).'">'.$tf->getNameForLanguage( $this->pageContext->languageId )->name.'</a></div>' ); 65 } 66 } 67 68 }
Download modules/cms/macros/macro/TagCloud.class.php
History Sun, 5 Dec 2021 20:33:24 +0100 dankert Cleanup: Removed unusable properties from class 'Value' and 'BaseObject'. 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.