openrat-cms

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README

TagList.class.php (1593B)


      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 cms\model\Link;
     21 use util\Macro;
     22 
     23 
     24 /**
     25  * Erstellt eine Tagcloud.
     26  * @author Jan Dankert
     27  */
     28 class TagList extends Macro
     29 {
     30 	/**
     31 	 * Beschreibung dieser Klasse
     32 	 * @type String
     33 	 */
     34 	var $description = '';
     35 
     36 	function execute()
     37 	{
     38 		$page = $this->getPage();
     39 		$linkIds = $page->getLinksToMe();
     40 		
     41 		foreach( $linkIds as $linkid )
     42 		{
     43 			$l = new Link( $linkid );
     44 			$l->load();
     45 			$f = new Folder( $l->parentid );
     46 			$f->load();
     47 			
     48 			$target = $f->getFirstPage();
     49 			if	( $target==null) continue;
     50 			$target->load();
     51 			
     52 			// Link erzeugen
     53 			$this->output( '<div class="tag"><a href="'.$this->pathToObject($target->objectid).'">'.$f->getNameForLanguage( $this->pageContext->languageId )->name.'</a></div>' );
     54 		}
     55 	}
     56 
     57 }