openrat-cms

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

PagesNavigation.class.php (2590B)


      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.2  2005-01-04 19:59:55  dankert
     25 // Allgemeine Korrekturen, Erben von "Dynamic"-klasse
     26 //
     27 // Revision 1.1  2004/11/10 22:43:35  dankert
     28 // Beispiele fuer dynamische Templateelemente
     29 //
     30 // ---------------------------------------------------------------------------
     31 use cms\model\Folder;
     32 use util\Macro;
     33 
     34 
     35 /**
     36  * Erstellen eines Hauptmenues
     37  * @author Jan Dankert
     38  */
     39 class PagesNavigation extends Macro
     40 {
     41 	/**
     42 	 * Bitte immer alle Parameter in dieses Array schreiben, dies ist fuer den Web-Developer hilfreich.
     43 	 * @type String
     44 	 */
     45 	var $parameters  = Array(
     46 		'arrowChar'=>'String between entries'
     47 		);
     48 
     49 
     50 	var $arrowChar = ' &middot; ';
     51 
     52 	/**
     53 	 * Bitte immer eine Beschreibung benutzen, dies ist fuer den Web-Developer hilfreich.
     54 	 * @type String
     55 	 */
     56 	var $description = 'Creates a page navigation.';
     57 	var $version     = '$Id$';
     58 	var $api;
     59 
     60 	// Erstellen des Hauptmenues
     61 	function execute()
     62 	{
     63 		// Lesen des Root-Ordners
     64 		$folder = new Folder( $this->page->parentid );
     65 		
     66 		$nr = 0;
     67 		// Schleife ueber alle Inhalte des Root-Ordners
     68 		/** @var \cms\model\BaseObject $o */
     69 		foreach($folder->getObjects() as $o )
     70 		{
     71 			$nr++;
     72 			if ( $o->isPage || $o->isLink )
     73 			{
     74 				if ( $o->objectid != $this->page->objectid )
     75 					$this->output( '<a href="'.$this->pathToObject($o->objectid).'" title="'.$o->getNameForLanguage( $this->pageContext->languageId )->description.'" class="pagenav">'.$nr.'</a>' );
     76 				else
     77 					$this->output( '<strong>'.$nr.'</strong>' );
     78 			}
     79 		}
     80 	}
     81 }