From 2053074e0bba0f0f0dd3c488cbfbab341be9fba4 Mon Sep 17 00:00:00 2001 From: Fred Tempez Date: Thu, 2 Apr 2020 22:32:46 +0200 Subject: [PATCH] Adaptation v10 --- core/class/template.class.php | 102 +++++++++++++++++----------------- 1 file changed, 52 insertions(+), 50 deletions(-) diff --git a/core/class/template.class.php b/core/class/template.class.php index 9072a2e9..b550386e 100644 --- a/core/class/template.class.php +++ b/core/class/template.class.php @@ -598,56 +598,58 @@ class template { } /** - * Crée un tableau - * @param array $cols Cols des colonnes (format: [col colonne1, col colonne2, etc]) - * @param array $body Contenu (format: [[contenu1, contenu2, etc], [contenu1, contenu2, etc]]) - * @param array $head Entêtes (format : [[titre colonne1, titre colonne2, etc]) - * @param array $attributes Attributs ($key => $value) - * @return string - */ - public static function table(array $cols = [], array $body = [], array $head = [], array $attributes = []) { - // Attributs par défaut - $attributes = array_merge([ - 'class' => '', - 'classWrapper' => '', - 'id' => '' - ], $attributes); - // Début du wrapper - $html = '
'; - // Début tableau - $html .= ''; - // Entêtes - if($head) { - // Début des entêtes - $html .= ''; - $html .= ''; - $i = 0; - foreach($head as $th) { - $html .= ''; - } - // Fin des entêtes - $html .= ''; - $html .= ''; - } - // Début contenu - $html .= ''; - foreach($body as $tr) { - $html .= ''; - $i = 0; - foreach($tr as $td) { - $html .= ''; - } - $html .= ''; - } - // Fin contenu - $html .= ''; - // Fin tableau - $html .= '
' . $th . '
' . $td . '
'; - // Fin container - $html .= '
'; - // Retourne le html - return $html; - } + * Crée un tableau + * @param array $cols Cols des colonnes (format: [col colonne1, col colonne2, etc]) + * @param array $body Contenu (format: [[contenu1, contenu2, etc], [contenu1, contenu2, etc]]) + * @param array $head Entêtes (format : [[titre colonne1, titre colonne2, etc]) + * @param array $attributes Attributs ($key => $value) + * @return string + */ + public static function table(array $cols = [], array $body = [], array $head = [], array $attributes = [], array $rowsId = []) { + // Attributs par défaut + $attributes = array_merge([ + 'class' => '', + 'classWrapper' => '', + 'id' => '' + ], $attributes); + // Début du wrapper + $html = '
'; + // Début tableau + $html .= ''; + // Entêtes + if($head) { + // Début des entêtes + $html .= ''; + $html .= ''; + $i = 0; + foreach($head as $th) { + $html .= ''; + } + // Fin des entêtes + $html .= ''; + $html .= ''; + } + // Début contenu + $j = 0; + foreach($body as $tr) { + // Id de ligne pour les tableaux drag and drop + $html .= ''; + $j++; + $i = 0; + foreach($tr as $td) { + $html .= ''; + } + $html .= ''; + } + // Fin contenu + $html .= ''; + // Fin tableau + $html .= '
' . $th . '
' . $td . '
'; + // Fin container + $html .= '
'; + // Retourne le html + return $html; + } /** * Crée un champ texte court