DoiMenu.class.php
gehe zur Dokumentation dieser Datei00001 <?php
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00047 class DoiMenu extends Dynamic
00048 {
00053 var $description = 'You *have to* include doiMenuDOM.js in the page!<br/>Put the code below in head section:<br/><tt><script type="text/javascript" src="{{your-elementname}}.js"></script></tt><br/>The file is distributed with OpenRat';
00054
00055
00060 var $parameterFileId = 0;
00061
00066 var $direction = 'horizontal';
00067
00068
00072 function execute()
00073 {
00074
00075
00076
00077 $thispage = new Page( $this->getObjectId() );
00078 $thispage->load();
00079
00080 $this->outputLn('<script name="javascript" type="text/javascript">');
00081
00082 $this->outputLn(" var menu = new TMainMenu('menu','".$this->direction."');");
00083
00084 $ro = new Folder($this->getRootObjectId());
00085 $this->showFolder( $ro );
00086
00087 if ( intval( $this->parameterFileId ) != 0 )
00088 {
00089 $f = new File( intval($this->parameterFileId) );
00090 $this->outputLn( $f->loadValue() );
00091 }
00092
00093 $this->outputLn( ' menu.Build()' );
00094 $this->outputLn( '</script');
00095 }
00096
00097
00098 function showFolder( $fo )
00099 {
00100 if ( $fo->objectid == intval($this->getRootObjectId()) )
00101 $parentMenu = 'menu';
00102 else
00103 $parentMenu = 'menu'.$fo->objectid;
00104
00105 foreach( $fo->getObjects() as $o )
00106 {
00107 $menu = 'menu'.$o->objectid;
00108
00109 if ( $o->isFolder )
00110 { $nf = new Folder($o->objectid);
00111 $pl = $nf->getFirstPageOrLink();
00112 if ( is_object($pl) )
00113 {
00114 $this->outputLn(" var $menu = new TPopMenu('".$o->name."','','a','".$this->pathToObject($pl->objectid)."','".$o->desc."');");
00115 $this->outputLn(" $parentMenu.Add(menu".$o->objectid.");");
00116 $this->showFolder( $nf );
00117 }
00118 }
00119
00120 if ( $o->isPage || $o->isPage )
00121 {
00122 $this->outputLn(" var $menu = new TPopMenu('".$o->name."','','a','".$this->pathToObject($o->objectid)."','".$o->desc."');");
00123 $this->outputLn(" $parentMenu.Add(menu".$o->objectid.");");
00124 }
00125 }
00126 }
00127
00128 }
00129
00130 ?>