Files
nutzwerte_fi4/app/Actions/Generate/StandardTexte/Inhalt.php
T
2025-10-13 07:35:09 +02:00

46 lines
1.1 KiB
PHP

<?php
namespace App\Actions\Generate\StandardTexte;
use App\Utilities\Html;
class Inhalt
{
public static function load($standardtext)
{
$html = '<div class="header">INHALTSVERZEICHNIS</div>';
$standardtext = strip_tags($standardtext, '<br>');
$standardtext = str_replace('<br>', '§§', $standardtext);
$standardtext = str_replace('<br/>', '§§', $standardtext);
$standardtext = str_replace('<br />', '§§', $standardtext);
$arr = explode('§§', $standardtext);
$html .= '<table class="inhalt">';
foreach ($arr as $value) {
$tmp = explode('|', $value);
$tmp[0] = $tmp[0] ?? '';
$tmp[1] = $tmp[1] ?? '';
$tmp[2] = $tmp[2] ?? '';
$tmp[3] = $tmp[3] ?? '';
$html .= '<tr>';
$html .= Html::td($tmp[0]);
$html .= Html::td($tmp[1]);
$html .= Html::td($tmp[2]);
$html .= Html::td($tmp[3]);
$html .= '</tr>';
}
$html .= '</table>';
return $html;
}
}