[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Noalyss-commit] [noalyss] 13/17: Improve Output_Html : row , tab and ac
From: |
Dany De Bontridder |
Subject: |
[Noalyss-commit] [noalyss] 13/17: Improve Output_Html : row , tab and accordean |
Date: |
Mon, 31 Oct 2022 12:53:39 -0400 (EDT) |
sparkyx pushed a commit to branch master
in repository noalyss.
commit 3ad1602b92abfa2bb34f4db76ca58a41a3bba3ed
Author: sparkyx <danydb@noalyss.eu>
AuthorDate: Sun Oct 30 18:37:41 2022 +0100
Improve Output_Html : row , tab and accordean
---
include/lib/output_html_tab.class.php | 51 +++++++++++++++++++++++++----------
1 file changed, 37 insertions(+), 14 deletions(-)
diff --git a/include/lib/output_html_tab.class.php
b/include/lib/output_html_tab.class.php
index 1eff7f605..89ff75cde 100644
--- a/include/lib/output_html_tab.class.php
+++ b/include/lib/output_html_tab.class.php
@@ -166,23 +166,28 @@ class Output_Html_Tab
}
/**
- * set the mode , possible values are row or tabs
- * @param mixed $mode
+ * @brief set the mode , possible values : row , tabs or accordeon
+ * @param string $mode possible values : row , tabs or accordeon
*/
public function set_mode($mode)
{
- if ($mode != "row" && $mode != "tab") {
+ if (! in_array($mode,['tab','row','accordeon'] )) {
throw new Exception(_("OUTPUTHTML070 Mode invalide"));
}
$this->mode = $mode;
if ($mode == "row") {
$this->set_class_tab_selected("tab_row_selected");
$this->set_class_tab("tab_row");
- }
- if ( $mode == "tab") {
+
+ }elseif ( $mode == "tab") {
$this->set_class_tab_selected("tabs_selected");
$this->set_class_tab("tabs");
+ }elseif ($mode == "accordeon") {
+ $this->set_class_tab_selected("");
+ $this->set_class_tab("tab_row");
+ } else {
+ throw new \Exception("OH186.unknow mode [$mode]");
}
return $this;
}
@@ -244,9 +249,15 @@ class Output_Html_Tab
{
$r="";
$nb=count($this->a_tabs);
+ $mode=$this->get_mode();
+ if ($mode=="accordeon") {
+ $r .= \Icon_Action::toggle_hide(uniqid(), sprintf("div%s",
$p_not_hidden));
+
+ return $r;
+ }
for ($i =0 ; $i < $nb;$i++)
{
- if ($this->get_mode()=="tab") {
+ if ($mode=="tab") {
if ( $this->a_tabs[$i]->get_id() != $p_not_hidden) {
$r .=
sprintf("$('div%s').hide();",$this->a_tabs[$i]->get_id() );
@@ -256,7 +267,7 @@ class Output_Html_Tab
$r .= sprintf("$('tab%s').className='%s';",$p_not_hidden
,$this->class_tab_selected);
}
- } elseif ($this->get_mode()=="row") {
+ } elseif ($mode=="row") {
if ( $this->a_tabs[$i]->get_id() != $p_not_hidden) {
$r .= sprintf("Effect.BlindUp('div%s',{duration :
0.7});",$this->a_tabs[$i]->get_id() );
$r .=
sprintf("$('tab%s').className='%s';",$this->a_tabs[$i]->get_id(),$this->class_tab
);
@@ -265,6 +276,8 @@ class Output_Html_Tab
$r .= sprintf("$('tab%s').className='%s';",$p_not_hidden
,$this->class_tab_selected);
}
+ } else {
+ throw new \Exception("OH283.unknow mode [$mode]");
}
}
return $r;
@@ -294,6 +307,7 @@ class Output_Html_Tab
}
printf('<div class="%s">',$this->class_div);
printf ( '<ul class="%s">',$this->class_tab_main);
+ $mode=$this->get_mode();
for ($i=0; $i<$nb; $i++)
{
printf ('<li id="tab%s" class="%s">',
@@ -326,33 +340,39 @@ class Output_Html_Tab
echo '</a>';
break;
case 'static':
- // show one , hide other
+ // show one , hide other except for accordeon
$script=$this->build_js($this->a_tabs[$i]->get_id());
- printf('<a class="%s" onclick="%s">',
$this->class_anchor,$script);
+ if ($mode != 'accordeon') {
+ printf('<a class="%s" onclick="%s">',
$this->class_anchor,$script);
+ } else {
+ print $script;
+ }
+
printf ('<span class="title_%s"> %s </span>',
$this->get_class_tab(),
$this->a_tabs[$i]->get_title()
);
echo '</a>';
-
+ $script=$this->build_js($this->a_tabs[$i]->get_id());
+
break;
default:
throw new Exception('OUTPUTHTMLTAB01');
break;
}
- if ( $this->get_mode()=="row") {
+ if ( $mode =="row" || $mode == "accordeon") {
$this->print_comment($i);
}
echo '</li>';
- if ( $this->get_mode()=="row") {
+ if ( $mode =="row" || $mode == "accordeon") {
$this->print_div($i);
}
}
echo '</ul>';
echo '</div>';
- if ( $this->get_mode()=="tab" ) {
+ if ( $mode=="tab" ) {
for ($i=0;$i<$nb;$i++)
{
$this->print_div($i);
@@ -363,10 +383,13 @@ class Output_Html_Tab
private function print_div($p_index)
{
$class="";
- if ( $this->get_mode() == "row") {
+ if ( $this->get_mode() == "row" ) {
$class="tab_row";
+ } elseif ( $this->get_mode() == 'accordeon') {
+ $class="";
}
+
printf('<div id="div%s" style="display:none;clear:both" class="%s">',
$this->a_tabs[$p_index]->get_id(),
$class);
- [Noalyss-commit] [noalyss] branch master updated (75d59f1b5 -> 7749f97eb), Dany De Bontridder, 2022/10/31
- [Noalyss-commit] [noalyss] 03/17: Bug : Impression achat TVAC mode ligne TVAC toujours null, Dany De Bontridder, 2022/10/31
- [Noalyss-commit] [noalyss] 06/17: Documentation & code cleaning Javascript, Dany De Bontridder, 2022/10/31
- [Noalyss-commit] [noalyss] 09/17: Improve doc, Dany De Bontridder, 2022/10/31
- [Noalyss-commit] [noalyss] 01/17: Improve debug mode, Dany De Bontridder, 2022/10/31
- [Noalyss-commit] [noalyss] 02/17: Cosmetic, Dany De Bontridder, 2022/10/31
- [Noalyss-commit] [noalyss] 10/17: Fix : bug when of rounding number TOTAL_VEN_TVAC when generating an invoice, Dany De Bontridder, 2022/10/31
- [Noalyss-commit] [noalyss] 13/17: Improve Output_Html : row , tab and accordean,
Dany De Bontridder <=
- [Noalyss-commit] [noalyss] 12/17: correct patch, Dany De Bontridder, 2022/10/31
- [Noalyss-commit] [noalyss] 04/17: Task 0002212: Réconciliation : numéro de pièce doit être vide, Dany De Bontridder, 2022/10/31
- [Noalyss-commit] [noalyss] 08/17: Bug : toggleHideShow doesn't work with search_form and rotating button, Dany De Bontridder, 2022/10/31
- [Noalyss-commit] [noalyss] 07/17: rename user.class.php and User by noalyss_user.class.php and Noalyss_User, Dany De Bontridder, 2022/10/31
- [Noalyss-commit] [noalyss] 17/17: Bug : 840cd82f3b7f has introduced a bug when searching an accounting, Dany De Bontridder, 2022/10/31
- [Noalyss-commit] [noalyss] 15/17: Fix : type in debug info, Dany De Bontridder, 2022/10/31
- [Noalyss-commit] [noalyss] 16/17: info debug, Dany De Bontridder, 2022/10/31
- [Noalyss-commit] [noalyss] 05/17: esthetic, Dany De Bontridder, 2022/10/31
- [Noalyss-commit] [noalyss] 11/17: Fix bug : if TVA code contain space, it was considered as another tva_code, Dany De Bontridder, 2022/10/31
- [Noalyss-commit] [noalyss] 14/17: WYSIWYG textarea, Dany De Bontridder, 2022/10/31