Adaptation v10

This commit is contained in:
Fred Tempez 2020-04-02 22:32:46 +02:00
parent 779a864761
commit 2053074e0b
1 changed files with 52 additions and 50 deletions

View File

@ -605,7 +605,7 @@ class template {
* @param array $attributes Attributs ($key => $value)
* @return string
*/
public static function table(array $cols = [], array $body = [], array $head = [], array $attributes = []) {
public static function table(array $cols = [], array $body = [], array $head = [], array $attributes = [], array $rowsId = []) {
// Attributs par défaut
$attributes = array_merge([
'class' => '',
@ -620,7 +620,7 @@ class template {
if($head) {
// Début des entêtes
$html .= '<thead>';
$html .= '<tr>';
$html .= '<tr class="nodrag">';
$i = 0;
foreach($head as $th) {
$html .= '<th class="col' . $cols[$i++] . '">' . $th . '</th>';
@ -630,9 +630,11 @@ class template {
$html .= '</thead>';
}
// Début contenu
$html .= '<tbody>';
$j = 0;
foreach($body as $tr) {
$html .= '<tr>';
// Id de ligne pour les tableaux drag and drop
$html .= '<tr id="' . $rowsId[$j] . '">';
$j++;
$i = 0;
foreach($tr as $td) {
$html .= '<td class="col' . $cols[$i++] . '">' . $td . '</td>';