From 666e75a0b80c267c731364323f743e64f61ef58b Mon Sep 17 00:00:00 2001 From: isaack <drericlaufer@gmx.de> Date: Mon, 19 Apr 2021 08:25:28 +0200 Subject: [PATCH] Update layout.lib.php --- euve/template/layout.lib.php | 25 +++++++++++++++++-------- template/layout.lib.php | 26 +++++++++++++++++--------- 2 files changed, 34 insertions(+), 17 deletions(-) diff --git a/euve/template/layout.lib.php b/euve/template/layout.lib.php index da8cc40..21af0e7 100644 --- a/euve/template/layout.lib.php +++ b/euve/template/layout.lib.php @@ -48,14 +48,19 @@ function Menuefoot($return = false){ * table_head() * * @author vms1-scripte.de - * @example table_head("hier,jede,Spalte,eintragen","table table-striped"); + * @example table_head("hier,jede,Spalte,eintragen","table table-striped",false); * @return HTML Code für Tabellenkopf einer Tabelle */ -function table_head($array = NULL,$style = '',$other = ''){ - echo '<table class="'. $style .'" '. $other .'>'; - if($array != NULL){ - $tr = explode(",",$array); - foreach($tr as $t) echo '<th>'. $t .'</th>'; +function table_head($array = NULL,$style = '',$other = '',$return = false){ + $aus = '<table class="'. $style .'" '. $other .'><tr>'; + foreach($array as $key){ + $aus .= '<th>'. $key .'</th>'; + } + $aus .= '</tr>'; + if($return == false){ + echo $aus; + }elseif($return == true){ + return $aus; } } @@ -85,8 +90,12 @@ function table_body($array){ * @example table_head(); * @return HTML Code für Endbereich einer Tabelle */ -function table_foot(){ - echo '</table>'; +function table_foot($return = false){ + if($return == false){ + echo '</table>'; + }elseif($return == true){ + return '</table>'; + } } /** diff --git a/template/layout.lib.php b/template/layout.lib.php index 461f2b3..4166cd1 100644 --- a/template/layout.lib.php +++ b/template/layout.lib.php @@ -43,15 +43,15 @@ function foot($return = false){ * table_head() * * @author vms1-scripte.de - * @example table_head("hier,jede,Spalte,eintragen","table table-striped"); + * @example table_head("hier,jede,Spalte,eintragen","table table-striped",false); * @return HTML Code für Tabellenkopf einer Tabelle */ -function table_head($array = NULL,$style = '', $other = '',$return = false){ +function table_head($array = NULL,$style = '',$other = '',$return = false){ $aus = '<table class="'. $style .'" '. $other .'>'; - if($array != NULL){ - $tr = explode(",",$array); - foreach($tr as $t) $aus .= '<th>'. $t .'</th>'; + foreach($array as $key){ + $aus .= '<th>'. $key .'</th>'; } + if($return == false){ echo $aus; }elseif($return == true){ @@ -127,8 +127,8 @@ function suee_close_form(){ * @return HTML Code für Inputfeld */ -function suee_add_input($info,$name,$type,$value = NULL, $placeholder = NULL, $other = NULL,$id = NULL, $infoZ = false){ - $input = '<div class="mb-3">'; +function suee_add_input($info,$name,$type,$value = NULL, $placeholder = NULL, $other = NULL,$id = NULL, $infoZ = false, $help = NULL){ + $input = ''; if($infoZ != false){ $input .= '<label for="'.$name .'" class="form-label">'; $input .= $info; @@ -150,7 +150,11 @@ function suee_add_input($info,$name,$type,$value = NULL, $placeholder = NULL, $o $input .= " placeholder=\"$placeholder\" "; } - $input .= '></div>'; + $input .= '>'; + if($help != NULL){ + $input .= '<div id="'. $name .'help" class="form-text">'. $help .'</div>'; + } + $input .= ''; return $input; } @@ -161,7 +165,7 @@ function suee_add_input($info,$name,$type,$value = NULL, $placeholder = NULL, $o * @return HTML Code für Select */ -function suee_add_select($name,$option,$other = '',$info = NULL){ +function suee_add_select($name,$option,$other = '',$info = NULL,$help = NULL){ $select = ''; if($info != NULL){ $select = '<label for="'. $name .'" class="form-label">'. $info .'</label>'; @@ -176,6 +180,10 @@ function suee_add_select($name,$option,$other = '',$info = NULL){ } $select .= '</select>'; + if($help != NULL){ + $select .= '<div class="form-text">'. $help .'</div>'; + } + return $select; } -- GitLab