openrat-cms

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

BlockMenu.class.php (3976B)


      1 <?php
      2 // ---------------------------------------------------------------------------
      3 // $Id$
      4 // ---------------------------------------------------------------------------
      5 // OpenRat Content Management System
      6 // Copyright (C) 2002 Jan Dankert, jandankert@jandankert.de
      7 //
      8 // This program is free software; you can redistribute it and/or
      9 // modify it under the terms of the GNU General Public License
     10 // as published by the Free Software Foundation; either version 2
     11 // of the License, or (at your option) any later version.
     12 //
     13 // This program is distributed in the hope that it will be useful,
     14 // but WITHOUT ANY WARRANTY; without even the implied warranty of
     15 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     16 // GNU General Public License for more details.
     17 //
     18 // You should have received a copy of the GNU General Public License
     19 // along with this program; if not, write to the Free Software
     20 // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
     21 // ---------------------------------------------------------------------------
     22 // $Log$
     23 // Revision 1.2  2004-12-25 21:05:14  dankert
     24 // erbt von Klasse Dynamic
     25 //
     26 // Revision 1.1  2004/10/14 21:16:12  dankert
     27 // Erzeugen eines Menues in Bloecken
     28 //
     29 // ---------------------------------------------------------------------------
     30 use cms\model\Folder;
     31 use cms\model\BaseObject;
     32 
     33 
     34 /**
     35  * Erstellen eines Hauptmenues
     36  * @author Jan Dankert
     37  */
     38 class BlockMenu extends Macro
     39 {
     40 	/**
     41 	 * Bitte immer alle Parameter in dieses Array schreiben, dies ist fuer den Web-Developer hilfreich.
     42 	 * @type String
     43 	 */
     44 	var $parameters  = Array(
     45 		'arrowChar'=>'String between menu entries, default: "&middot;"'
     46 		);
     47 
     48 
     49 	var $arrowChar = ' &middot; ';
     50 
     51 	/**
     52 	 * Bitte immer eine Beschreibung benutzen, dies ist fuer den Web-Developer hilfreich.
     53 	 * @type String
     54 	 */
     55 	var $description = 'Creates a main menu.';
     56 	var $version     = '$Id$';
     57 	var $api;
     58 
     59 	// Erstellen des Hauptmenues
     60 	function execute()
     61 	{
     62 		// Erstellen des Hauptmenues
     63 		
     64 		// Lesen des Root-Ordners
     65 		$folder = new Folder( $this->getRootObjectId() );
     66 		
     67 		// Schleife ueber alle Inhalte des Root-Ordners
     68 		foreach( $folder->getObjectIds() as $id )
     69 		{
     70 			$o = new BaseObject( $id );
     71 			$o->languageid = $this->page->languageid;
     72 			$o->load();
     73 			if ( $o->isFolder ) // Nur wenn Ordner
     74 			{
     75 				$f = new Folder( $id );
     76 				
     77 				// Ermitteln eines Objektes mit dem Dateinamen index
     78 				$oid = $f->getObjectIdByFileName('index');
     79 				
     80 				if	( count($f->getLinks())+count($f->getPages()) > 0 )
     81 				{
     82 					$this->output( '
     83 			<!-- sidebox -->
     84 		     <table bgcolor="#000000" border="0" cellpadding="0" cellspacing="0" width="100%">
     85 		      <tr>
     86 		       <td>
     87 		        <table border="0" cellpadding="3" cellspacing="1" width="100%">
     88 		         <tr>
     89 		          <td bgcolor="#cccccc"><span class="title"> '.$o->name.'</span></a>
     90 		          </td>
     91 		         </tr>
     92 		         <tr>
     93 		          <td bgcolor="#ffffff">
     94 	');
     95 					// Untermenue
     96 					// Schleife ber alle Objekte im aktuellen Ordner
     97 					foreach( $f->getObjectIds() as $xid )
     98 				    {
     99 						$o = new BaseObject( $xid );
    100 						$o->languageid = $this->page->languageid;
    101 						$o->load();
    102 				
    103 						// Nur Seiten anzeigen
    104 						if (!$o->isPage && !$o->isLink ) continue;
    105 						
    106 						// Wenn aktuelle Seite, dann markieren, sonst Link
    107 						if ( $this->getObjectId() == $xid )
    108 						{
    109 							// aktuelle Seite
    110 							$this->output( '            <span class="small">o</span>
    111 							<strong class="nav">'.$o->name.'</strong>
    112 							<br />' );
    113 						}
    114 						else
    115 						{
    116 							$this->output( '            <span class="small">o</span>
    117 						       <a class="nav" href="'.$this->pathToObject($xid).'">'.$o->name.'</a>
    118 						       <br />' );
    119 						}
    120 					//Api::output( '<br/>' );
    121 					}
    122 			
    123 					$this->output( '
    124 			          </td>
    125 			         </tr>
    126 			        </table>
    127 			       </td>
    128 			      </tr>
    129 			     </table>
    130 			     <!-- end sidebox -->
    131 		     <br />
    132 					' );
    133 				}
    134 			}
    135 		}
    136 	}
    137 }