TreeAction.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
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067
00068
00069
00077 class TreeAction extends Action
00078 {
00079 var $defaultSubAction = 'load';
00080 var $tree;
00081
00082
00086 function openall()
00087 {
00088 }
00089
00090
00094 function open()
00095 {
00096 $this->tree = Session::getTree();
00097 $this->tree->open( $this->getRequestId() );
00098 Session::setTree( $this->tree );
00099
00100 $this->callSubAction('show');
00101 }
00102
00103
00107 function close()
00108 {
00109 $this->tree = Session::getTree();
00110 $this->tree->close( $this->getRequestId() );
00111 Session::setTree( $this->tree );
00112
00113 $this->callSubAction('show');
00114 }
00115
00116
00120 function load()
00121 {
00122 global $SESS;
00123 $project = Session::getProject();
00124 $projectid = $project->projectid;
00125
00126
00127
00128
00129 if ( $projectid == -1 )
00130 {
00131 $this->tree = new AdministrationTree();
00132
00133 }
00134 else
00135 {
00136 $this->tree = new ProjectTree();
00137 $this->tree->projectId = $projectid;
00138
00139 $SESS[REQ_PARAM_LANGUAGE_ID] = Language::getDefaultId();
00140 $SESS['modelid' ] = Model::getDefaultId();
00141 }
00142
00143 Session::setTree( $this->tree );
00144 }
00145
00146
00157 function outputElement( $elId,$tiefe,$isLast )
00158 {
00159 $treeElement = $this->tree->elements[$elId];
00160
00161 $zeilen = array();
00162 $zeile = array();
00163
00164 if ( !isset($tree_last) )
00165 $tree_last=array();
00166
00167 $zeile['cols'] = array();
00168
00169 for ( $i=1; $i<=$tiefe-1; $i++ )
00170 {
00171 if ( $isLast[$i] )
00172 $zeile['cols'][] = 'blank';
00173 else
00174 $zeile['cols'][] = 'line';
00175 }
00176
00177 if ( $tiefe == 0 )
00178 {
00179 }
00180 elseif ( $treeElement->type != "" )
00181 {
00182 if ( count($treeElement->subElementIds) == 0 )
00183 {
00184 if ( $isLast[$tiefe] )
00185 $zeile['image'] = 'plus_end';
00186 else $zeile['image'] = 'plus';
00187
00188 $zeile['image_url' ] = Html::url('tree','open',$elId);
00189 $zeile['image_url_desc'] = lang('TREE_OPEN_ELEMENT');
00190 }
00191 else
00192 {
00193 if ( $isLast[$tiefe] )
00194 $zeile['image'] = 'minus_end';
00195 else $zeile['image'] = 'minus';
00196
00197 $zeile['image_url' ] = Html::url('tree','close',$elId);
00198 $zeile['image_url_desc'] = lang('TREE_CLOSE_ELEMENT');
00199 }
00200 }
00201 else
00202 {
00203 if ( $isLast[$tiefe] )
00204 $zeile['image'] = 'none_end';
00205 else $zeile['image'] = 'none';
00206 }
00207
00208
00209
00210 $zeile['icon'] = $treeElement->icon;
00211 $zeile['text'] = $treeElement->text;
00212 $zeile['desc'] = $treeElement->description;
00213 $zeile['name'] = $elId;
00214
00215
00216 if ( $treeElement->url != "" )
00217 $zeile['url'] = $treeElement->url;
00218
00219
00220 if ( $treeElement->target != "" )
00221 $zeile['target'] = $treeElement->target;
00222 else
00223 $zeile['target'] = 'cms_main';
00224
00225 $zeile['colspan'] = 20 - count( $zeile['cols'] ) - intval(isset($zeile['image']));
00226
00227 $zeilen[] = $zeile;
00228
00229 $nr = 0;
00230 foreach( $this->tree->elements[$elId]->subElementIds as $subElementId )
00231 {
00232 $nr++;
00233 if ( $nr == count($this->tree->elements[$elId]->subElementIds) )
00234 $isLast[$tiefe+1] = true;
00235 else $isLast[$tiefe+1] = false;
00236
00237
00238 $zeilen = array_merge( $zeilen,$this->outputElement( $subElementId,$tiefe+1,$isLast ) );
00239 }
00240
00241 return $zeilen;
00242 }
00243
00244
00248 function show()
00249 {
00250 global
00251 $tree,
00252 $SESS,
00253 $tree_last,
00254 $var;
00255
00256 $var['zeilen'] = array();
00257 $var['zeilen'] = $this->outputElement( 0,0,array() );
00258
00259 $this->setTemplateVars( $var );
00260 }
00261 }
00262
00263 ?>