noalyss Version-9
NOALYSS : serveur de comptabilité et ERP (2002)
Loading...
Searching...
No Matches
Output_Html_Tab Class Reference

Display the tabs. More...

+ Collaboration diagram for Output_Html_Tab:

Public Member Functions

 __construct ()
 
 add (Html_Tab $p_html_tab)
 Add Html_Tab.
 
 build_js ($p_not_hidden)
 Build the javascript to change the class name of the selected tab, hide other div and show the selected one.
 
 get_class_anchor ()
 CSS class for the A tag (anchor)
 
 get_class_comment ()
 CSS class for the comment default "tabs".
 
 get_class_content_div ()
 CSS class for the DIV with content (default empty)
 
 get_class_div ()
 CSS class for the DIV containing the UL.
 
 get_class_tab ()
 get the CSS class of tabs
 
 get_class_tab_main ()
 get the CSS class for the UL element
 
 get_class_tab_selected ()
 get the CSS class of tabs_selected
 
 get_mode ()
 get the mode , possible value are row or tabs , with mode = row , the class_content_div is set to row
 
 output ()
 print the html + javascript code of the tabs and the div
 
 set_class_anchor ($anchor_class)
 CSS class for the A tag (anchor)
 
 set_class_comment ($class_comment)
 CSS class for the comment default "tabs".
 
 set_class_content_div ($class_content_div)
 CSS class for the DIV with content (default empty)
 
 set_class_div ($class_div)
 CSS class for the DIV containing the UL.
 
 set_class_tab ($class_tab)
 set the CSS class of tabs, default is tabs
 
 set_class_tab_main ($class_tab_main)
 set the CSS class for the UL element
 
 set_class_tab_selected ($class_tab_selected)
 set the CSS class of tabs, default is tabs_selected
 
 set_mode ($mode)
 set the mode , possible values : row , tabs or accordeon
 

Protected Member Functions

 print_comment ($p_index)
 When printing row , a comment is written if not empty,.
 

Private Member Functions

 print_div ($p_index)
 

Private Attributes

 $a_tabs
 array of html tabs
 
 $class_anchor
 CSS class for the UL tag.
 
 $class_comment
 CSS class for the DIV with content, default empty.
 
 $class_content_div
 CSS class for the DIV containing the UL default empty.
 
 $class_div
 CSS class for the A tag (anchor) default empty.
 
 $class_tab
 for normal tab
 
 $class_tab_main
 
 $class_tab_selected
 for class_tab_selected
 
 $mode
 mode default tabs
 

Detailed Description

Display the tabs.

See also
Html_Tab
Examples
html_tab.test.php.

Definition at line 89 of file output_html_tab.class.php.

Constructor & Destructor Documentation

◆ __construct()

Output_Html_Tab::__construct ( )

Definition at line 105 of file output_html_tab.class.php.

106 {
107 $this->a_tabs=[];
108 $this->class_tab="tabs";
109 $this->class_tab_main="tabs";
110 $this->class_tab_selected="tabs_selected";
111 $this->set_mode("tab");
112 $this->class_anchor="";
113 $this->class_div="";
114 $this->class_content_div="";
115 $this->class_comment="tabs";
116 }
set_mode($mode)
set the mode , possible values : row , tabs or accordeon

References set_mode().

+ Here is the call graph for this function:

Member Function Documentation

◆ add()

Output_Html_Tab::add ( Html_Tab $p_html_tab)

Add Html_Tab.

Parameters
Html_Tab$p_html_tab

Definition at line 253 of file output_html_tab.class.php.

254 {
255 $this->a_tabs[]=clone $p_html_tab;
256
257 }

◆ build_js()

Output_Html_Tab::build_js ( $p_not_hidden)

Build the javascript to change the class name of the selected tab, hide other div and show the selected one.

Parameters
string$p_not_hiddenid of the showed tab
Returns
javascript string

Definition at line 302 of file output_html_tab.class.php.

303 {
304 $r="";
305 $nb=count($this->a_tabs);
306 $mode=$this->get_mode();
307 if ($mode=="accordeon") {
308 $r .= \Icon_Action::toggle_hide(uniqid(), sprintf("div%s", $p_not_hidden));
309
310 return $r;
311 }
312 for ($i =0 ; $i < $nb;$i++)
313 {
314 if ($mode=="tab") {
315
316 if ( $this->a_tabs[$i]->get_id() != $p_not_hidden) {
317 $r .= sprintf("$('div%s').hide();",$this->a_tabs[$i]->get_id() );
318 $r .= sprintf("$('tab%s').className='%s';",$this->a_tabs[$i]->get_id(),$this->class_tab );
319 } else {
320 $r .= sprintf("$('div%s').show();",$p_not_hidden );
321 $r .= sprintf("$('tab%s').className='%s';",$p_not_hidden ,$this->class_tab_selected);
322
323 }
324 } elseif ($mode=="row") {
325 if ( $this->a_tabs[$i]->get_id() != $p_not_hidden) {
326 $r .= sprintf("Effect.BlindUp('div%s',{duration : 0.7});",$this->a_tabs[$i]->get_id() );
327 $r .= sprintf("$('tab%s').className='%s';",$this->a_tabs[$i]->get_id(),$this->class_tab );
328 } else {
329 $r .= sprintf("Effect.SlideDown('div%s',{duration : 0.7});",$p_not_hidden );
330 $r .= sprintf("$('tab%s').className='%s';",$p_not_hidden ,$this->class_tab_selected);
331
332 }
333 } else {
334 throw new \Exception("OH283.unknow mode [$mode]");
335 }
336 }
337 return $r;
338 }
catch(Exception $exc) if(! $g_user->can_write_action($ag_id)) $r
get_mode()
get the mode , possible value are row or tabs , with mode = row , the class_content_div is set to row
$mode
mode default tabs
if( $delta< 0) elseif( $delta==0)

References $i, $mode, $nb, $r, elseif, get_mode(), and Icon_Action\toggle_hide().

Referenced by output().

+ Here is the call graph for this function:

◆ get_class_anchor()

Output_Html_Tab::get_class_anchor ( )

CSS class for the A tag (anchor)

Returns
type

Definition at line 178 of file output_html_tab.class.php.

179 {
180 return $this->class_anchor;
181 }
$class_anchor
CSS class for the UL tag.

References $class_anchor.

◆ get_class_comment()

Output_Html_Tab::get_class_comment ( )

CSS class for the comment default "tabs".

Returns
type

Definition at line 121 of file output_html_tab.class.php.

122 {
124 }
$class_comment
CSS class for the DIV with content, default empty.

References $class_comment.

Referenced by print_comment().

◆ get_class_content_div()

Output_Html_Tab::get_class_content_div ( )

CSS class for the DIV with content (default empty)

Definition at line 139 of file output_html_tab.class.php.

140 {
142 }
$class_content_div
CSS class for the DIV containing the UL default empty.

References $class_content_div.

◆ get_class_div()

Output_Html_Tab::get_class_div ( )

CSS class for the DIV containing the UL.

Returns
string

Definition at line 158 of file output_html_tab.class.php.

159 {
160 return $this->class_div;
161 }
$class_div
CSS class for the A tag (anchor) default empty.

References $class_div.

◆ get_class_tab()

Output_Html_Tab::get_class_tab ( )

get the CSS class of tabs

Returns
mixed

Definition at line 263 of file output_html_tab.class.php.

264 {
265 return $this->class_tab;
266 }

References $class_tab.

Referenced by output().

◆ get_class_tab_main()

Output_Html_Tab::get_class_tab_main ( )

get the CSS class for the UL element

Returns
type

Definition at line 196 of file output_html_tab.class.php.

References $class_tab_main.

◆ get_class_tab_selected()

Output_Html_Tab::get_class_tab_selected ( )

get the CSS class of tabs_selected

Returns
mixed

Definition at line 282 of file output_html_tab.class.php.

283 {
285 }
$class_tab_selected
for class_tab_selected

References $class_tab_selected.

◆ get_mode()

Output_Html_Tab::get_mode ( )

get the mode , possible value are row or tabs , with mode = row , the class_content_div is set to row

Returns
mixed

Definition at line 217 of file output_html_tab.class.php.

218 {
219 return $this->mode;
220 }

References $mode.

Referenced by build_js(), output(), and print_div().

◆ output()

Output_Html_Tab::output ( )

print the html + javascript code of the tabs and the div

Definition at line 355 of file output_html_tab.class.php.

356 {
357 $nb=count($this->a_tabs);
358 if ($nb==0)
359 {
360 return;
361 }
362 printf('<div class="%s">',$this->class_div);
363 printf ( '<ul class="%s">',$this->class_tab_main);
364 $mode=$this->get_mode();
365 for ($i=0; $i<$nb; $i++)
366 {
367 printf ('<li id="tab%s" class="%s">',
368 $this->a_tabs[$i]->get_id(),$this->class_tab);
369 switch ($this->a_tabs[$i]->get_mode())
370 {
371 case 'link':
372 printf ('<a class="%s" id="%s" href="%s">',
373 $this->class_anchor,
374 $this->a_tabs[$i]->get_id(),
375 $this->a_tabs[$i]->get_link());
376 printf ('<span class="title_%s"> %s </span>',
377 $this->get_class_tab(),
378 $this->a_tabs[$i]->get_title()
379 );
380 echo '</a>';
381
382 break;
383 case 'ajax':
384 printf('<a class="%s" id="%s" onclick="%s">',
385 $this->class_anchor,
386 $this->a_tabs[$i]->get_id(),
387 $this->a_tabs[$i]->get_link());
388 printf ('<span class="title_%s"> %s </span>',
389 $this->get_class_tab(),
390 $this->a_tabs[$i]->get_title()
391 );
392
393 echo $this->a_tabs[$i]->get_title();
394 echo '</a>';
395 break;
396 case 'static':
397 // show one , hide other except for accordeon
398 $script=$this->build_js($this->a_tabs[$i]->get_id());
399 if ($mode != 'accordeon') {
400 printf('<a class="%s" onclick="%s">', $this->class_anchor,$script);
401 } else {
403 }
404
405 printf ('<span class="title_%s"> %s </span>',
406 $this->get_class_tab(),
407 $this->a_tabs[$i]->get_title()
408 );
409
410 echo '</a>';
411 $script=$this->build_js($this->a_tabs[$i]->get_id());
412
413 break;
414 default:
415 throw new Exception('OUTPUTHTMLTAB01');
416 break;
417 }
418 if ( $mode =="row" || $mode == "accordeon") {
419 $this->print_comment($i);
420 }
421 echo '</li>';
422 if ( $mode =="row" || $mode == "accordeon") {
423 $this->print_div($i);
424 }
425 }
426 echo '</ul>';
427 echo '</div>';
428
429 if ( $mode=="tab" ) {
430 for ($i=0;$i<$nb;$i++)
431 {
432 $this->print_div($i);
433 }
434
435 }
436 }
print_comment($p_index)
When printing row , a comment is written if not empty,.
build_js($p_not_hidden)
Build the javascript to change the class name of the selected tab, hide other div and show the select...
get_class_tab()
get the CSS class of tabs
print
Type of printing.
$script
Definition popup.php:125

References $i, $mode, $nb, $script, build_js(), get_class_tab(), get_mode(), print, print_comment(), and print_div().

+ Here is the call graph for this function:

◆ print_comment()

Output_Html_Tab::print_comment ( $p_index)
protected

When printing row , a comment is written if not empty,.

Parameters
$p_index

Definition at line 344 of file output_html_tab.class.php.

344 {
345 printf ('<span class="%s"> %s </span>',
346 $this->get_class_comment(),
347 $this->a_tabs[$p_index]->get_comment()
348 );
349
350 }
get_class_comment()
CSS class for the comment default "tabs".

References get_class_comment().

Referenced by output().

+ Here is the call graph for this function:

◆ print_div()

Output_Html_Tab::print_div ( $p_index)
private

Definition at line 437 of file output_html_tab.class.php.

438 {
439 $class="";
440 if ( $this->get_mode() == "row" ) {
441 $class="tab_row";
442 } elseif ( $this->get_mode() == 'accordeon') {
443 $class="";
444 }
445
446
447 printf('<div id="div%s" style="display:none;clear:both" class="%s">',
448 $this->a_tabs[$p_index]->get_id(),
449 $class);
450 echo $this->a_tabs[$p_index]->get_content();
451 echo '</div>';
452
453 }

References $class, elseif, and get_mode().

Referenced by output().

+ Here is the call graph for this function:

◆ set_class_anchor()

Output_Html_Tab::set_class_anchor ( $anchor_class)

CSS class for the A tag (anchor)

Parameters
type$anchor_class

Definition at line 186 of file output_html_tab.class.php.

187 {
188 $this->class_anchor=$anchor_class;
189 $this;
190 }

◆ set_class_comment()

Output_Html_Tab::set_class_comment ( $class_comment)

CSS class for the comment default "tabs".

Returns
type

Definition at line 130 of file output_html_tab.class.php.

131 {
132 $this->class_comment=$class_comment;
133 return $this;
134 }

References $class_comment.

◆ set_class_content_div()

Output_Html_Tab::set_class_content_div ( $class_content_div)

CSS class for the DIV with content (default empty)

Parameters
string$class_content_div

Definition at line 148 of file output_html_tab.class.php.

149 {
150 $this->class_content_div=$class_content_div;
151 return $this;
152 }

References $class_content_div.

◆ set_class_div()

Output_Html_Tab::set_class_div ( $class_div)

CSS class for the DIV containing the UL.

Returns
string

Definition at line 168 of file output_html_tab.class.php.

169 {
170 $this->class_div=$class_div;
171 return $this;
172 }

References $class_div.

◆ set_class_tab()

Output_Html_Tab::set_class_tab ( $class_tab)

set the CSS class of tabs, default is tabs

Parameters
mixed$class_tab

Definition at line 272 of file output_html_tab.class.php.

273 {
274 $this->class_tab = $class_tab;
275 return $this;
276 }

References $class_tab.

Referenced by set_mode().

◆ set_class_tab_main()

Output_Html_Tab::set_class_tab_main ( $class_tab_main)

set the CSS class for the UL element

Returns
this

Definition at line 206 of file output_html_tab.class.php.

207 {
208 $this->class_tab_main=$class_tab_main;
209 return $this;
210 }

References $class_tab_main.

◆ set_class_tab_selected()

Output_Html_Tab::set_class_tab_selected ( $class_tab_selected)

set the CSS class of tabs, default is tabs_selected

Parameters
mixed$class_tab_selected

Definition at line 291 of file output_html_tab.class.php.

292 {
293 $this->class_tab_selected = $class_tab_selected;
294 return $this;
295 }

References $class_tab_selected.

Referenced by set_mode().

◆ set_mode()

Output_Html_Tab::set_mode ( $mode)

set the mode , possible values : row , tabs or accordeon

Parameters
string$modepossible values : row , tabs or accordeon

Definition at line 226 of file output_html_tab.class.php.

227 {
228 if (! in_array($mode,['tab','row','accordeon'] )) {
229 throw new Exception(_("OUTPUTHTML070 Mode invalide"));
230 }
231 $this->mode = $mode;
232 if ($mode == "row") {
233 $this->set_class_tab_selected("tab_row_selected");
234 $this->set_class_tab("tab_row");
235
236 }elseif ( $mode == "tab") {
237 $this->set_class_tab_selected("tabs_selected");
238 $this->set_class_tab("tabs");
239
240 }elseif ($mode == "accordeon") {
241 $this->set_class_tab_selected("");
242 $this->set_class_tab("tab_row");
243 } else {
244 throw new \Exception("OH186.unknow mode [$mode]");
245 }
246 return $this;
247 }
_("actif, passif,charge,...")
set_class_tab($class_tab)
set the CSS class of tabs, default is tabs
set_class_tab_selected($class_tab_selected)
set the CSS class of tabs, default is tabs_selected

References $mode, _, elseif, set_class_tab(), and set_class_tab_selected().

Referenced by __construct().

+ Here is the call graph for this function:

Field Documentation

◆ $a_tabs

Output_Html_Tab::$a_tabs
private

array of html tabs

Definition at line 92 of file output_html_tab.class.php.

◆ $class_anchor

Output_Html_Tab::$class_anchor
private

CSS class for the UL tag.

Definition at line 97 of file output_html_tab.class.php.

Referenced by get_class_anchor().

◆ $class_comment

Output_Html_Tab::$class_comment
private

CSS class for the DIV with content, default empty.

Definition at line 100 of file output_html_tab.class.php.

Referenced by get_class_comment(), and set_class_comment().

◆ $class_content_div

Output_Html_Tab::$class_content_div
private

CSS class for the DIV containing the UL default empty.

Definition at line 99 of file output_html_tab.class.php.

Referenced by get_class_content_div(), and set_class_content_div().

◆ $class_div

Output_Html_Tab::$class_div
private

CSS class for the A tag (anchor) default empty.

Definition at line 98 of file output_html_tab.class.php.

Referenced by get_class_div(), and set_class_div().

◆ $class_tab

Output_Html_Tab::$class_tab
private

for normal tab

Definition at line 93 of file output_html_tab.class.php.

Referenced by get_class_tab(), and set_class_tab().

◆ $class_tab_main

Output_Html_Tab::$class_tab_main
private

Definition at line 96 of file output_html_tab.class.php.

Referenced by get_class_tab_main(), and set_class_tab_main().

◆ $class_tab_selected

Output_Html_Tab::$class_tab_selected
private

for class_tab_selected

Definition at line 94 of file output_html_tab.class.php.

Referenced by get_class_tab_selected(), and set_class_tab_selected().

◆ $mode

Output_Html_Tab::$mode
private

mode default tabs

Definition at line 95 of file output_html_tab.class.php.

Referenced by build_js(), get_mode(), output(), and set_mode().


The documentation for this class was generated from the following file: