Files
nutzwerte_fi4/app/Actions/Generate/Utilities/Html.php
T

70 lines
2.2 KiB
PHP

<?php
namespace App\Actions\Generate\Utilities;
class Html
{
public static function table_header($header_row, $style = '')
{
$style = " style=\" $style\"" ?? '';
$html = '<table autosize="1" class="table-striped" '.$style.'>';
$html .= '<thead><tr>';
foreach ($header_row as $value) {
$html .= '<th class="bl bt br bb center bg-user-set">'.$value.'</th>';
}
$html .= '</tr></thead>';
return $html;
}
public static function table_footer($nutzwert_summe, $colspan = 12)
{
$colspan--;
$html = '<tfooter><tr>';
$html .= '<th class="bl bb bg-user-set"></th>';
$html .= '<th colspan="'.$colspan.'" class="bt bb right bg-user-set">Nutzwert gerundet</th>';
$html .= '<th class="bt br bb center bg-user-set">'.$nutzwert_summe.'</th>';
$html .= '</tr></tfooter>';
return $html;
}
public static function table_header_90($header_row)
{
$html = '<table class="table-striped">';
$html .= '<thead><tr text-rotate="90">';
$mm = 190 / \count($header_row);
foreach ($header_row as $value) {
$html .= '<th class="bl bt br bb bg-user-set normal" style="vertical-align: bottom; width: '.$mm.'mm;">&nbsp;'.$value.'&nbsp;</th>';
}
$html .= '</tr></thead>';
return $html;
}
public static function table_2_columns($header_row)
{
$html = '<table class="table-striped"><thead><tr>';
foreach ($header_row as $value) {
$html .= '<th class="bl bt br bb bg-user-set">'.$value.'</th>';
}
$html .= '<th style="background:white"></th>';
foreach ($header_row as $value) {
$html .= '<th class="bl bt br bb bg-user-set">'.$value.'</th>';
}
$html .= '</thead></tr>';
return $html;
}
public static function td($value = '', $classname = '', $colspan = 0, $style = '')
{
$cls = $classname != '' ? ' class="'.$classname.'"' : '';
$spn = $colspan != '' ? ' colspan="'.$colspan.'"' : '';
$style = $style != '' ? ' style="'.$style.'"' : '';
return "<td $cls $spn $style>".$value.'</td>';
}
}