This commit is contained in:
salam committed 2025-10-21 07:24:54 +02:00
1 parent 551ad2369e
commit 9881d8c37b
23 files changed
+662 -236

No files matched your search

@@ -29,11 +29,12 @@ class CreateProjektInhaltsverzeichnis
'sort' => $inhalt->sort,
'ordnungszahl' => $inhalt->ordnungszahl,
'name' => $inhalt->name,
'ueberschrift_nicht_anzeigen' => $inhalt->ueberschrift_nicht_anzeigen,
'ueberschrift_anzeigen' => $inhalt->ueberschrift_anzeigen,
'tabellen_id' => $inhalt->tabellen_id,
'textblock_id' => $inhalt->textblock_id,
'seite' => $inhalt->seite,
'ohne_seitenzahl_anzeige' => $inhalt->ohne_seitenzahl_anzeige,
'neue_seite' => $inhalt->neue_seite,
'seitenzahl_anzeige' => $inhalt->seitenzahl_anzeige,
'textblock' => $textblock,
]);
}
+12 -29
View File
@@ -2,42 +2,25 @@
namespace App\Actions\Generate\Gutachten;
use App\Utilities\Html;
use App\Actions\Generate\MakeGutachten;
use App\Actions\Generate\Utilities\Format;
use App\Actions\Generate\Utilities\Html;
class Inhalt
{
public static function load($standardtext)
public static function create()
{
$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>';
foreach (MakeGutachten::$inhaltesverzeichnis as $inhalt) {
if ($inhalt->ueberschrift_anzeigen) {
$html .= '<tr>';
$html .= Html::td(Format::index($inhalt->ordnungszahl));
$html .= Html::td($inhalt->name);
$html .= Html::td(Format::seite($inhalt->seite));
$html .= '</tr>';
}
}
$html .= '</table>';
return $html;
@@ -0,0 +1,19 @@
<?php
namespace App\Actions\Generate\Gutachten;
use App\Actions\Generate\Utilities\Format;
class Ueberschrift
{
public static function create($inhalt)
{
if ($inhalt->ueberschrift_anzeigen) {
if ($inhalt->ordnungszahl * 1 > 0) {
return '<div class="header">'.Format::index($inhalt->ordnungszahl).' '.$inhalt->name.'</div>';
} else {
return '<div class="header">'.$inhalt->name.'</div>';
}
}
}
}
+24 -28
View File
@@ -9,8 +9,7 @@ use App\Actions\Generate\Gutachten\Paragraph6Tabelle;
use App\Actions\Generate\Gutachten\Platzhalter;
use App\Actions\Generate\Gutachten\Standardtext;
use App\Actions\Generate\Gutachten\Tabelle;
use App\Actions\Generate\Utilities\Format;
use App\Actions\Generate\Utilities\Html;
use App\Actions\Generate\Gutachten\Ueberschrift;
use App\Models\Auftraggeber;
use App\Models\Gutachter;
use App\Models\Inhaltsverzeichnis;
@@ -22,6 +21,8 @@ use Mpdf\Mpdf;
class MakeGutachten
{
public static $inhaltesverzeichnis;
public static $projekt;
public static $gutachter;
@@ -33,6 +34,8 @@ class MakeGutachten
public static function generate($filepath, $projekte_id)
{
self::$inhaltesverzeichnis = ProjektInhaltsverzeichnis::where('projekte_id', $projekte_id)->orderBy('sort')->get();
self::$projekt = Projekte::where('id', $projekte_id)->first();
self::$gutachter = Gutachter::where('id', self::$projekt->gutachter_id)->first();
@@ -63,35 +66,28 @@ class MakeGutachten
$mpdf->SetCreator('nutzwerte.at');
$mpdf->SetAuthor(self::$gutachter->title.' '.self::$gutachter->gender.' '.self::$gutachter->name);
$inhalte = ProjektInhaltsverzeichnis::where('projekte_id', $projekte_id)->orderBy('sort')->get();
foreach (self::$inhaltesverzeichnis as $inhalt) {
foreach ($inhalte as $inhalt) {
/**
* DECKBLATT
*/
if ($inhalt->name == 'DECKBLATT') {
$textblock = Platzhalter::replace($inhalt->textblock);
$html = Deckblatt::create($textblock);
$mpdf->WriteHTML($html, HTMLParserMode::HTML_BODY);
}
/**
* INHALTSVERZEICHNIS
*/
if ($inhalt->name == 'INHALTSVERZEICHNIS') {
if ($inhalt->neue_seite) {
$mpdf->AddPage();
$html = '<div class="header">INHALTSVERZEICHNIS</div>';
$html .= '<table class="inhalt">';
foreach ($inhalte as $data) {
$html .= '<tr>';
$html .= Html::td(Format::numeric($data->ordnungszahl, 2));
$html .= Html::td($data->name);
$html .= Html::td(Format::numeric($data->seite, 0));
$html .= '</tr>';
}
$html .= '</table>';
$mpdf->SetHTMLFooter('<div class="size09 center">Seite {PAGENO}<br><br></div>');
$mpdf->WriteHTML($html, HTMLParserMode::HTML_BODY);
}
$textblock = $inhalt->textblock ? Platzhalter::replace($inhalt->textblock) : '';
if ($inhalt->name == 'DECKBLATT') {
$html = Deckblatt::create($textblock);
} elseif ($inhalt->name == 'INHALTSVERZEICHNIS') {
$html = Inhalt::create();
} else {
$html = Ueberschrift::create($inhalt);
$html .= $textblock;
}
if ($inhalt->seitenzahl_anzeige == 1) {
$mpdf->SetHTMLFooter('<div class="center">Seite {PAGENO}<br><br></div>');
}
$mpdf->WriteHTML($html, HTMLParserMode::HTML_BODY);
}
// $inhalte = Inhaltsverzeichnis::where('projekte_id', $projekte_id)->where('is_active', 1)->orderBy('pos')->get();
+20 -2
View File
@@ -4,10 +4,28 @@ namespace App\Actions\Generate\Utilities;
class Format
{
public static function numeric($value, $stellen)
public static function seite($value)
{
if ($value * 1 > 0) {
return $value;
} else {
return '';
}
}
public static function index($value)
{
if (is_numeric($value) && $value * 1 > 0) {
return number_format($value, $stellen, '.', '.');
return number_format($value, 2, '.', '.');
} else {
return '';
}
}
public static function dezimal($value, $stellen = 2)
{
if (is_numeric($value) && $value * 1 > 0) {
return number_format($value, $stellen, ',', '.');
} else {
return '';
}