Chore: Verschiebe Git-Repository in das Hauptverzeichnis und richte .gitignore ein
This commit is contained in:
commit
96d0545193
502 files changed
+176027
No files matched your search
@@ -0,0 +1,48 @@
|
||||
<?php
|
||||
|
||||
namespace HermannTelser\Gutachten\Berechnungen;
|
||||
|
||||
use HermannTelser\Gutachten\DB\DbFunction;
|
||||
use HermannTelser\Gutachten\Utility\Message;
|
||||
use TYPO3\CMS\Core\Utility\GeneralUtility;
|
||||
|
||||
class Berechnung
|
||||
{
|
||||
/**
|
||||
* @return false
|
||||
*/
|
||||
public static function berechnen()
|
||||
{
|
||||
// DbFunction::$debug = 1;
|
||||
|
||||
if (0 == DbFunction::$projektid) {
|
||||
DbFunction::$projektid = GeneralUtility::_GP('id');
|
||||
if (!is_numeric(DbFunction::$projektid)) {
|
||||
DbFunction::$projektid = GeneralUtility::_GP('projekt_aktive');
|
||||
}
|
||||
if (!is_numeric(DbFunction::$projektid)) {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
// ZU NUTZWERT wenn raumart 2,8 => normale Nutzfläche, Methode 2b
|
||||
FaktorenBasis::berechnen();
|
||||
|
||||
FaktorenGenerell::berechnen();
|
||||
|
||||
// Main
|
||||
$_result = DbFunction::select('tx_gutachten_raume_basis', ['id', 'factor', 'noDispInOrientierung'], ['pid' => DbFunction::$projektid]);
|
||||
|
||||
foreach ($_result as $key => $value) {
|
||||
if (1 == $value['noDispInOrientierung']) {
|
||||
OhneOrientierung::berechne($value['id']);
|
||||
} else {
|
||||
MitOrientierung::berechne($value['id'], $value['factor']);
|
||||
}
|
||||
}
|
||||
|
||||
if (DbFunction::$debug) {
|
||||
Message::note('Nutzwerberechnung Ende');
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
<?php
|
||||
|
||||
namespace HermannTelser\Gutachten\Berechnungen;
|
||||
|
||||
use HermannTelser\Gutachten\DB\DbFunction;
|
||||
|
||||
class FaktorenBasis
|
||||
{
|
||||
/**
|
||||
* @return false
|
||||
*/
|
||||
public static function berechnen()
|
||||
{
|
||||
// DbFunction::$debug = 1;
|
||||
|
||||
// ZU NUTZWERT wenn raumart 2,8 => normale Nutzfläche, Methode 2b
|
||||
DbFunction::secureUpdate('tx_gutachten_raume_generell', ['zunutzwert' => 0], ['AND' => ['pid' => DbFunction::$projektid, 'tt_raumart_id[!]' => [2, 8]]]);
|
||||
DbFunction::secureUpdate('tx_gutachten_raume_generell', ['zunutzwert' => 1], ['AND' => ['pid' => DbFunction::$projektid, 'tt_raumart_id' => [2, 8]]]);
|
||||
|
||||
DbFunction::secureUpdate('tx_gutachten_raume_basis', ['noDispInOrientierung' => 0], ['pid' => DbFunction::$projektid]);
|
||||
$res = DbFunction::select('tx_gutachten_raume_all', 'tt_raume_basis_id', ['AND' => ['pid' => DbFunction::$projektid, 'tt_raumart_id' => [5, 6, 9]], 'GROUP' => 'tt_raume_basis_id']);
|
||||
if ($res) {
|
||||
DbFunction::secureUpdate('tx_gutachten_raume_basis', ['noDispInOrientierung' => 1], ['id' => $res]);
|
||||
}
|
||||
|
||||
$fields = range('a', 'u');
|
||||
$res = DbFunction::select('tx_gutachten_raume_basis', 'id', ['AND' => ['pid' => DbFunction::$projektid, 'noDispInOrientierung' => 0]]);
|
||||
foreach ($res as $key => $raume_basis_id) {
|
||||
$arr = DbFunction::select('tx_gutachten_raume_basis', $fields, ['id' => $raume_basis_id]);
|
||||
$summe = array_sum($arr[0]);
|
||||
$bewertung = 100 + $summe;
|
||||
$factor = $bewertung / 100;
|
||||
|
||||
$update_array = [];
|
||||
$update_array['summe_az'] = $summe;
|
||||
$update_array['bewertung'] = $bewertung;
|
||||
$update_array['factor'] = $factor;
|
||||
DbFunction::secureUpdate('tx_gutachten_raume_basis', $update_array, ['id' => $raume_basis_id]);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
|
||||
namespace HermannTelser\Gutachten\Berechnungen;
|
||||
|
||||
use HermannTelser\Gutachten\DB\DbFunction;
|
||||
use HermannTelser\Gutachten\Utility\Message;
|
||||
|
||||
class FaktorenGenerell
|
||||
{
|
||||
/**
|
||||
* @return false
|
||||
*/
|
||||
public static function berechnen()
|
||||
{
|
||||
// DbFunction::$debug = 1;
|
||||
// controll
|
||||
$_raume = DbFunction::select('tx_gutachten_raume_generell', 'raum', ['AND' => ['pid' => DbFunction::$projektid, 'tt_raumart_id[>]' => 1, 'factor' => 0]]);
|
||||
if (\count($_raume) > 0) {
|
||||
$message = "\nProjekt: ".DbFunction::$projektid;
|
||||
$message .= "\nFür folgende Methoden fehlen die Faktoren.\nRäume: ";
|
||||
$message .= implode(', ', $_raume);
|
||||
// Message::error(__FILE__, __LINE__, $message);
|
||||
}
|
||||
|
||||
$_raume = DbFunction::select('tx_gutachten_raume_generell', ['raum', 'factor', 'tt_raumart_id'], ['pid' => DbFunction::$projektid]);
|
||||
foreach ($_raume as $value) {
|
||||
$update_array = [];
|
||||
$update_array['tt_raumart_id'] = $value['tt_raumart_id'];
|
||||
$update_array['factor'] = $value['factor'];
|
||||
DbFunction::secureUpdate('tx_gutachten_raume_all', $update_array, [
|
||||
'AND' => [
|
||||
'raum' => $value['raum'],
|
||||
'pid' => DbFunction::$projektid
|
||||
]
|
||||
]);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,97 @@
|
||||
<?php
|
||||
|
||||
namespace HermannTelser\Gutachten\Berechnungen;
|
||||
|
||||
use HermannTelser\Gutachten\DB\DbFunction;
|
||||
use HermannTelser\Gutachten\Utility\Message;
|
||||
|
||||
/***
|
||||
*
|
||||
* This file is part of the "NuhOdds Comparatore" Extension for TYPO3 CMS.
|
||||
*
|
||||
* For the full copyright and license information, please read the
|
||||
* LICENSE.txt file that was distributed with this source code.
|
||||
*
|
||||
* (c) 2019 Hermann Telser <hermann.telser@gmail.com>
|
||||
*
|
||||
***/
|
||||
|
||||
class MitOrientierung
|
||||
{
|
||||
/**
|
||||
* @param mixed $tt_raume_basis_id
|
||||
* @param mixed $rfM1
|
||||
*
|
||||
* @return false
|
||||
*/
|
||||
public static function berechne($tt_raume_basis_id, $rfM1)
|
||||
{
|
||||
// DbFunction::$debug = 1;
|
||||
|
||||
// METHODEN 1, 2, 2b , 3, 3b, 4
|
||||
|
||||
if (DbFunction::$debug) {
|
||||
Message::note('MIT Orientierung');
|
||||
}
|
||||
|
||||
// METHODE 2 & 2b
|
||||
// Summe
|
||||
$qmM1bis = DbFunction::sum('tx_gutachten_raume_all', 'qm', ['AND' => ['tt_raume_basis_id' => $tt_raume_basis_id, 'tt_raumart_id' => [2, 8]]]);
|
||||
|
||||
//# METHODE 1 ###
|
||||
$qmM1 = DbFunction::sum('tx_gutachten_raume_all', 'qm', ['AND' => ['tt_raume_basis_id' => $tt_raume_basis_id, 'tt_raumart_id' => 1]]);
|
||||
$result = $qmM1 + $qmM1bis;
|
||||
if ($result) {
|
||||
DbFunction::secureUpdate('tx_gutachten_raume_basis', ['qmM1uM2bis' => $result, 'qmM1' => $qmM1], ['id' => $tt_raume_basis_id]);
|
||||
}
|
||||
|
||||
// METHODE 2
|
||||
$res = DbFunction::select('tx_gutachten_raume_all', ['qm', 'factor'], ['AND' => ['tt_raume_basis_id' => $tt_raume_basis_id, 'tt_raumart_id' => [2, 8]]]);
|
||||
foreach ($res as $key => $value) {
|
||||
$nw = round($value['qm'] * $value['factor']);
|
||||
DbFunction::secureUpdate('tx_gutachten_raume_all', ['NWm2' => $nw], ['AND' => ['tt_raume_basis_id' => $tt_raume_basis_id, 'tt_raumart_id' => [2, 8]]]);
|
||||
}
|
||||
|
||||
// FINAL METHODE 1 & METHODE 2
|
||||
$NWm2 = DbFunction::sum('tx_gutachten_raume_all', 'NWm2', ['AND' => ['tt_raume_basis_id' => $tt_raume_basis_id, 'tt_raumart_id' => 2]]);
|
||||
$NWm2b = DbFunction::sum('tx_gutachten_raume_all', 'NWm2', ['AND' => ['tt_raume_basis_id' => $tt_raume_basis_id, 'tt_raumart_id' => 8]]);
|
||||
$qmM1uM2 = $qmM1 + $NWm2;
|
||||
$NWM1uM2 = round(($qmM1uM2 * $rfM1) + $NWm2b);
|
||||
if ($NWM1uM2) {
|
||||
DbFunction::secureUpdate('tx_gutachten_raume_basis', ['NWM1uM2' => $NWM1uM2, 'qmM1uM2' => $qmM1uM2], ['id' => $tt_raume_basis_id]);
|
||||
}
|
||||
|
||||
// METHODE 3 & 3b
|
||||
$res = DbFunction::select('tx_gutachten_raume_all', ['qm', 'factor', 'tt_raumart_id'], ['AND' => ['tt_raume_basis_id' => $tt_raume_basis_id, 'tt_raumart_id' => [3, 7]]]);
|
||||
foreach ($res as $key => $value) {
|
||||
if (3 == $value['tt_raumart_id']) {
|
||||
$nw = round($value['qm'] * $value['factor'] * $rfM1);
|
||||
$this_tt_raumart_id = 3;
|
||||
} else { // M3b ohne Wohnungsfactor
|
||||
$nw = round($value['qm'] * $value['factor']);
|
||||
$this_tt_raumart_id = 7;
|
||||
}
|
||||
DbFunction::secureUpdate('tx_gutachten_raume_all', ['NW' => $nw], ['AND' => ['id' => $tt_raume_basis_id, 'tt_raumart_id' => $this_tt_raumart_id]]);
|
||||
DbFunction::secureUpdate('tx_gutachten_raume_all', ['NW' => 1], ['AND' => ['NW' => 1, 'id' => $tt_raume_basis_id, 'tt_raumart_id' => $this_tt_raumart_id]]);
|
||||
}
|
||||
|
||||
// METHODE 4
|
||||
$res = DbFunction::select('tx_gutachten_raume_all', ['qm', 'factor'], ['AND' => ['tt_raume_basis_id' => $tt_raume_basis_id, 'tt_raumart_id' => 4]]);
|
||||
foreach ($res as $key => $value) {
|
||||
$nw = round($value['qm'] * $value['factor']);
|
||||
DbFunction::secureUpdate('tx_gutachten_raume_all', ['NW' => $nw], ['AND' => ['tt_raume_basis_id' => $tt_raume_basis_id, 'tt_raumart_id' => 4]]);
|
||||
}
|
||||
DbFunction::secureUpdate('tx_gutachten_raume_all', ['NW' => 1], ['AND' => ['NW' => 0, 'tt_raume_basis_id' => $tt_raume_basis_id, 'tt_raumart_id' => 4]]);
|
||||
|
||||
//## GNO ###
|
||||
$NWM3uM4 = DbFunction::sum('tx_gutachten_raume_all', 'nw', ['AND' => ['tt_raume_basis_id' => $tt_raume_basis_id, 'tt_raumart_id' => [3, 4]]]);
|
||||
$GNO = round($NWM1uM2 + $NWM3uM4);
|
||||
if ($GNO) {
|
||||
DbFunction::secureUpdate('tx_gutachten_raume_basis', ['GNO' => $GNO], ['id' => $tt_raume_basis_id]);
|
||||
}
|
||||
|
||||
if (DbFunction::$debug) {
|
||||
Message::note('GNO: ' . $GNO);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,74 @@
|
||||
<?php
|
||||
|
||||
namespace HermannTelser\Gutachten\Berechnungen;
|
||||
|
||||
use HermannTelser\Gutachten\DB\DbFunction;
|
||||
use HermannTelser\Gutachten\Utility\Message;
|
||||
|
||||
/***
|
||||
*
|
||||
* This file is part of the "NuhOdds Comparatore" Extension for TYPO3 CMS.
|
||||
*
|
||||
* For the full copyright and license information, please read the
|
||||
* LICENSE.txt file that was distributed with this source code.
|
||||
*
|
||||
* (c) 2019 Hermann Telser <hermann.telser@gmail.com>
|
||||
*
|
||||
***/
|
||||
|
||||
class OhneOrientierung
|
||||
{
|
||||
/**
|
||||
* @param mixed $tt_raume_basis_id
|
||||
* @param mixed $factor
|
||||
*
|
||||
* @return false
|
||||
*/
|
||||
public static function berechne($tt_raume_basis_id)
|
||||
{
|
||||
// DbFunction::$debug = 1;
|
||||
|
||||
// METHODEN 5 (5), 5a (6), 5b (9)
|
||||
|
||||
if (DbFunction::$debug) {
|
||||
Message::note('OHNE Orientierung');
|
||||
}
|
||||
|
||||
if (0 == DbFunction::$projektid) {
|
||||
die('No Projekt Id');
|
||||
}
|
||||
|
||||
// METHODE 5
|
||||
$res = DbFunction::select('tx_gutachten_raume_all', ['id', 'qm', 'factor', 'tt_raumart_id'], ['AND' => ['tt_raume_basis_id' => $tt_raume_basis_id, 'tt_raumart_id' => 5]]);
|
||||
foreach ($res as $key => $value) {
|
||||
$nw = round($value['qm'] * $value['factor']);
|
||||
|
||||
DbFunction::secureUpdate('tx_gutachten_raume_all', ['NW' => $nw], ['id' => $value['id']]);
|
||||
}
|
||||
|
||||
|
||||
// METHODE 5a
|
||||
$res = DbFunction::select('tx_gutachten_raume_all', ['qm', 'factor', 'tt_raumart_id'], ['AND' => ['tt_raume_basis_id' => $tt_raume_basis_id, 'tt_raumart_id' => 6]]);
|
||||
foreach ($res as $key => $value) {
|
||||
$nw = round($value['qm'] * $value['factor']);
|
||||
DbFunction::secureUpdate('tx_gutachten_raume_all', ['NW' => $nw], ['AND' => ['tt_raume_basis_id' => $tt_raume_basis_id, 'tt_raumart_id' => 6]]);
|
||||
}
|
||||
|
||||
// METHODE 5b
|
||||
$res = DbFunction::select('tx_gutachten_raume_all', ['qm', 'factor', 'tt_raumart_id'], ['AND' => ['tt_raume_basis_id' => $tt_raume_basis_id, 'tt_raumart_id' => 9]]);
|
||||
foreach ($res as $key => $value) {
|
||||
$nw = $value['qm'] * $value['factor'];
|
||||
DbFunction::secureUpdate('tx_gutachten_raume_all', ['NWungerundet' => $nw], ['AND' => ['tt_raume_basis_id' => $tt_raume_basis_id, 'tt_raumart_id' => 9]]);
|
||||
}
|
||||
|
||||
DbFunction::secureUpdate('tx_gutachten_raume_basis', ['NW' => 1], ['AND' => ['NW' => 0, 'id' => $tt_raume_basis_id, 'tt_raumart_id' => [5, 6, 9]]]);
|
||||
//
|
||||
$t1 = DbFunction::sum('tx_gutachten_raume_all', 'NW', ['AND' => ['tt_raume_basis_id' => $tt_raume_basis_id, 'tt_raumart_id' => [5, 6]]]);
|
||||
$t2 = DbFunction::sum('tx_gutachten_raume_all', 'NWungerundet', ['AND' => ['tt_raume_basis_id' => $tt_raume_basis_id, 'tt_raumart_id' => 9]]);
|
||||
$NWM5 = round($t1 + $t2);
|
||||
DbFunction::secureUpdate('tx_gutachten_raume_basis', ['GNO' => $NWM5], ['id' => $tt_raume_basis_id]);
|
||||
|
||||
// $qmM5 = DbFunction::sum('tx_gutachten_raume_all', 'qm', ['AND' => ['tt_raume_basis_id' => $tt_raume_basis_id, 'tt_raumart_id' => [5, 6, 9]]]);
|
||||
// DbFunction::secureUpdate('tx_gutachten_raume_basis', ['qmM5' => $qmM5], ['tt_raume_basis_id' => $tt_raume_basis_id]);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,209 @@
|
||||
<?php
|
||||
namespace HermannTelser\Gutachten\DB;
|
||||
|
||||
// composer dump-autoload -o
|
||||
|
||||
use \HermannTelser\Gutachten\Utility\Message;
|
||||
use \HermannTelser\Gutachten\Eid\TxGutachten;
|
||||
use PDO;
|
||||
|
||||
class DbFunction
|
||||
{
|
||||
public static $debug = 0;
|
||||
public static $projektid = 0;
|
||||
|
||||
/***************************************************
|
||||
* print sql querries
|
||||
***************************************************/
|
||||
public static function debugSql($line)
|
||||
{
|
||||
if (self::$debug or TxGutachten::$debug) {
|
||||
Message::note($line . " - " . str_replace('"', "", MariaDB::$db_handle->last()));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/***************************************************
|
||||
* secure UPDATE
|
||||
***************************************************/
|
||||
|
||||
public static function secureUpdate($table, $value_array, $where)
|
||||
{
|
||||
$max_tries = 3;
|
||||
$tries = 0;
|
||||
do {
|
||||
$retry = false;
|
||||
try {
|
||||
$data = MariaDB::$db_handle->update($table, $value_array, $where);
|
||||
|
||||
self::debugSql(__line__);
|
||||
|
||||
return $data->rowCount();
|
||||
|
||||
} catch (PDOException $exc) {
|
||||
if ($tries < $max_tries && $exc->errorInfo[0] == 40001 && $exc->errorInfo[1] == 1213) {
|
||||
$retry = true;
|
||||
sleep(1);
|
||||
} else {
|
||||
throw $exc;
|
||||
}
|
||||
}
|
||||
} while ($retry);
|
||||
|
||||
}
|
||||
|
||||
/***************************************************
|
||||
* secure INSERT
|
||||
***************************************************/
|
||||
|
||||
public static function secureInsert($table, $insert_array)
|
||||
{
|
||||
$max_tries = 3;
|
||||
$tries = 0;
|
||||
do {
|
||||
$retry = false;
|
||||
try {
|
||||
MariaDB::$db_handle->insert($table, $insert_array);
|
||||
|
||||
self::debugSql(__line__);
|
||||
} catch (PDOException $exc) {
|
||||
if ($tries < $max_tries && $exc->errorInfo[0] == 40001 && $exc->errorInfo[1] == 1213) {
|
||||
$retry = true;
|
||||
sleep(1);
|
||||
} else {
|
||||
throw $exc;
|
||||
}
|
||||
}
|
||||
} while ($retry);
|
||||
|
||||
return MariaDB::$db_handle->id();
|
||||
}
|
||||
|
||||
/***************************************************
|
||||
* DELETE
|
||||
***************************************************/
|
||||
|
||||
public static function delete($table, $where)
|
||||
{
|
||||
$handle = MariaDB::$db_handle->delete($table, $where);
|
||||
|
||||
self::debugSql(__line__);
|
||||
|
||||
return $handle;
|
||||
}
|
||||
|
||||
/***************************************************
|
||||
* SELECT data
|
||||
***************************************************/
|
||||
|
||||
public static function select($table, $fields, $where=[])
|
||||
{
|
||||
$tmp = MariaDB::$db_handle->select($table, $fields, $where);
|
||||
|
||||
self::debugSql(__line__);
|
||||
|
||||
return $tmp;
|
||||
}
|
||||
|
||||
/***************************************************
|
||||
* SUM data
|
||||
***************************************************/
|
||||
|
||||
public static function sum($table, $fields, $where=[])
|
||||
{
|
||||
$tmp = MariaDB::$db_handle->sum($table, $fields, $where);
|
||||
|
||||
self::debugSql(__line__);
|
||||
|
||||
return $tmp;
|
||||
}
|
||||
|
||||
/***************************************************
|
||||
* SELECT data
|
||||
***************************************************/
|
||||
|
||||
public static function selectJoin($table, $join, $fields, $where=[])
|
||||
{
|
||||
$tmp = MariaDB::$db_handle->select($table, $join, $fields, $where);
|
||||
|
||||
self::debugSql(__line__);
|
||||
|
||||
return $tmp;
|
||||
}
|
||||
|
||||
/***************************************************
|
||||
* select SINGLE row
|
||||
***************************************************/
|
||||
|
||||
public static function get($table, $fields, $where)
|
||||
{
|
||||
$tmp = MariaDB::$db_handle->get($table, $fields, $where);
|
||||
|
||||
self::debugSql(__line__);
|
||||
|
||||
return $tmp;
|
||||
}
|
||||
|
||||
|
||||
/***************************************************
|
||||
* select SINGLE row
|
||||
***************************************************/
|
||||
|
||||
public static function getJoin($table, $join, $fields, $where)
|
||||
{
|
||||
$tmp = MariaDB::$db_handle->get($table, $join, $fields, $where);
|
||||
|
||||
self::debugSql(__line__);
|
||||
|
||||
return $tmp;
|
||||
}
|
||||
|
||||
/***************************************************
|
||||
* sql query
|
||||
***************************************************/
|
||||
|
||||
public static function query($sql)
|
||||
{
|
||||
$arr = MariaDB::$db_handle->query($sql)->fetchAll(PDO::FETCH_ASSOC);
|
||||
|
||||
self::debugSql(__line__);
|
||||
|
||||
return $arr;
|
||||
}
|
||||
|
||||
/***************************************************
|
||||
* SELECT COUNT
|
||||
***************************************************/
|
||||
|
||||
public static function count($table, $where=[])
|
||||
{
|
||||
$tmp = MariaDB::$db_handle->count($table, $where);
|
||||
|
||||
self::debugSql(__line__);
|
||||
|
||||
return $tmp;
|
||||
}
|
||||
|
||||
/***************************************************
|
||||
* has
|
||||
***************************************************/
|
||||
|
||||
public static function has($table, $where)
|
||||
{
|
||||
$tmp = MariaDB::$db_handle->has($table, $where);
|
||||
|
||||
self::debugSql(__line__);
|
||||
|
||||
return $tmp;
|
||||
}
|
||||
|
||||
/***************************************************
|
||||
* toggle
|
||||
***************************************************/
|
||||
|
||||
public static function toggle($table, $field, $where)
|
||||
{
|
||||
self::query("UPDATE $table SET $field = 1 - $field WHERE $where");
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace HermannTelser\Gutachten\DB\Delete;
|
||||
|
||||
use HermannTelser\Gutachten\DB\DbFunction;
|
||||
use TYPO3\CMS\Core\Utility\GeneralUtility;
|
||||
|
||||
class DeleteById
|
||||
{
|
||||
public static function delete()
|
||||
{
|
||||
// DbFunction::$debug = 1;
|
||||
|
||||
$table = GeneralUtility::_GP('table');
|
||||
$rowid = GeneralUtility::_GP('id');
|
||||
|
||||
DbFunction::delete($table, ['id' => $rowid]);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
|
||||
namespace HermannTelser\Gutachten\DB\Delete;
|
||||
|
||||
use HermannTelser\Gutachten\DB\DbFunction;
|
||||
use TYPO3\CMS\Core\Utility\GeneralUtility;
|
||||
|
||||
class DeleteMerkmal
|
||||
{
|
||||
public static function delete()
|
||||
{
|
||||
// DbFunction::$debug = 1;
|
||||
|
||||
$id = GeneralUtility::_GP('id');
|
||||
if(!$id){
|
||||
exit;
|
||||
}
|
||||
|
||||
$_merkmal = DbFunction::select('tx_gutachten_help',['pid','colid'], ['id' => $id]);
|
||||
|
||||
if($_merkmal){
|
||||
$field = $_merkmal[0]['colid'];
|
||||
$update_array[$field] = 0;
|
||||
DbFunction::secureUpdate('tx_gutachten_raume_basis', $update_array, ['pid' => $_merkmal[0]['pid']]);
|
||||
|
||||
DbFunction::delete('tx_gutachten_help', ['id' => $id]);
|
||||
DbFunction::query("Update tx_gutachten_raume_basis SET summe_az = a+b+c+d+e+f+g+h+i+j+k+l+m+n+o+p+q+r+s+t+u where pid=" . $_merkmal[0]['pid']);
|
||||
DbFunction::query("Update tx_gutachten_raume_basis SET bewertung = 100 - summe_az where pid=" . $_merkmal[0]['pid']);
|
||||
echo 1;
|
||||
exit;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
|
||||
namespace HermannTelser\Gutachten\DB\Delete;
|
||||
|
||||
use HermannTelser\Gutachten\Utility\Message;
|
||||
use TYPO3\CMS\Core\Utility\GeneralUtility;
|
||||
use HermannTelser\Gutachten\DB\DbFunction;
|
||||
|
||||
class DeleteProjekt
|
||||
{
|
||||
public static function delete()
|
||||
{
|
||||
if (null !== GeneralUtility::_GP('id')) {
|
||||
|
||||
$projekt_id = GeneralUtility::_GP('id');
|
||||
|
||||
DbFunction::delete('tx_gutachten_projekte', ['id' => $projekt_id]);
|
||||
|
||||
$_tables = ['tx_gutachten_freigabe','tx_gutachten_projekteplatzhalter','tx_gutachten_projektestandards','tx_gutachten_raume_all','tx_gutachten_raume_basis','tx_gutachten_raume_generell'];
|
||||
|
||||
foreach ($_tables as $key => $table) {
|
||||
DbFunction::delete($table, ['pid' => $projekt_id]);
|
||||
}
|
||||
}
|
||||
|
||||
echo 1;
|
||||
exit;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
<?php
|
||||
|
||||
namespace HermannTelser\Gutachten\DB\Delete;
|
||||
|
||||
use HermannTelser\Gutachten\DB\DbFunction;
|
||||
use TYPO3\CMS\Core\Utility\GeneralUtility;
|
||||
|
||||
class DeleteRaumartBasis
|
||||
{
|
||||
public static function delete()
|
||||
{
|
||||
$rowid = GeneralUtility::_GP('id');
|
||||
DbFunction::delete('tx_gutachten_raume_basis', ['id' => $rowid]);
|
||||
DbFunction::delete('tx_gutachten_raume_all', ['tt_raume_basis_id' => $rowid]);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,56 @@
|
||||
<?php
|
||||
|
||||
namespace HermannTelser\Gutachten\DB\Delete;
|
||||
|
||||
use HermannTelser\Gutachten\Berechnungen\Berechnung;
|
||||
use TYPO3\CMS\Core\Utility\GeneralUtility;
|
||||
|
||||
/***
|
||||
*
|
||||
* This file is part of the "NuhOdds Comparatore" Extension for TYPO3 CMS.
|
||||
*
|
||||
* For the full copyright and license information, please read the
|
||||
* LICENSE.txt file that was distributed with this source code.
|
||||
*
|
||||
* (c) 2019 Hermann Telser <hermann.telser@gmail.com>, NUH-Odds GmbH
|
||||
*
|
||||
***/
|
||||
|
||||
class _DeleteController
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
$arr = [];
|
||||
switch (GeneralUtility::_GP('action')) {
|
||||
// delete
|
||||
case 'delete_from_table':
|
||||
DeleteById::delete();
|
||||
Berechnung::berechnen();
|
||||
break;
|
||||
case 'delete_raumart_von_basis':
|
||||
DeleteRaumartBasis::delete();
|
||||
Berechnung::berechnen();
|
||||
break;
|
||||
case 'projekt_delete':
|
||||
DeleteProjekt::delete();
|
||||
break;
|
||||
case 'delete_merkmal':
|
||||
DeleteMerkmal::delete();
|
||||
break;
|
||||
case 'delete_by_id':
|
||||
DeleteById::delete();
|
||||
break;
|
||||
|
||||
default:
|
||||
Message::error(
|
||||
__FILE__,
|
||||
__LINE__,
|
||||
'no controller switch defined'
|
||||
);
|
||||
}
|
||||
|
||||
header('Content-Type: application/json');
|
||||
echo json_encode($arr);
|
||||
exit();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
|
||||
namespace HermannTelser\Gutachten\DB\Insert;
|
||||
|
||||
use TYPO3\CMS\Core\Utility\GeneralUtility;
|
||||
use HermannTelser\Gutachten\DB\DbFunction;
|
||||
|
||||
/***
|
||||
*
|
||||
* This file is part of the "NuhOdds Comparatore" Extension for TYPO3 CMS.
|
||||
*
|
||||
* For the full copyright and license information, please read the
|
||||
* LICENSE.txt file that was distributed with this source code.
|
||||
*
|
||||
* (c) 2019 Hermann Telser <hermann.telser@gmail.com>, NUH-Odds GmbH
|
||||
*
|
||||
***/
|
||||
|
||||
class AddAuftraggeber
|
||||
{
|
||||
public static function add()
|
||||
{
|
||||
$data = json_decode(GeneralUtility::_GP('data'));
|
||||
$insert_array = [];
|
||||
foreach ($data as $key => $value) {
|
||||
$key = str_replace('2', '', $key);
|
||||
$insert_array[$key] = $value;
|
||||
}
|
||||
DbFunction::secureInsert('tx_gutachten_auftraggeber', $insert_array);
|
||||
echo 1;
|
||||
exit;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
namespace HermannTelser\Gutachten\DB\Insert;
|
||||
|
||||
use TYPO3\CMS\Core\Utility\GeneralUtility;
|
||||
use HermannTelser\Gutachten\DB\DbFunction;
|
||||
|
||||
/***
|
||||
*
|
||||
* This file is part of the "NuhOdds Comparatore" Extension for TYPO3 CMS.
|
||||
*
|
||||
* For the full copyright and license information, please read the
|
||||
* LICENSE.txt file that was distributed with this source code.
|
||||
*
|
||||
* (c) 2019 Hermann Telser <hermann.telser@gmail.com>, NUH-Odds GmbH
|
||||
*
|
||||
***/
|
||||
|
||||
class AddGutachter
|
||||
{
|
||||
public static function add()
|
||||
{
|
||||
$data = json_decode(GeneralUtility::_GP('data'));
|
||||
$insert_array = [];
|
||||
foreach ($data as $key => $value) {
|
||||
$key = str_replace('1', '', $key);
|
||||
$insert_array[$key] = $value;
|
||||
}
|
||||
DbFunction::secureInsert('tx_gutachten_gutachter', $insert_array);
|
||||
|
||||
echo 1;
|
||||
exit;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
<?php
|
||||
|
||||
namespace HermannTelser\Gutachten\DB\Insert;
|
||||
|
||||
use HermannTelser\Gutachten\DB\DbFunction;
|
||||
use TYPO3\CMS\Core\Utility\GeneralUtility;
|
||||
|
||||
/***
|
||||
*
|
||||
* This file is part of the "NuhOdds Comparatore" Extension for TYPO3 CMS.
|
||||
*
|
||||
* For the full copyright and license information, please read the
|
||||
* LICENSE.txt file that was distributed with this source code.
|
||||
*
|
||||
* (c) 2019 Hermann Telser <hermann.telser@gmail.com>, NUH-Odds GmbH
|
||||
*
|
||||
***/
|
||||
|
||||
class AddMerkmal
|
||||
{
|
||||
public static function create()
|
||||
{
|
||||
// DbFunction::$debug = 1;
|
||||
|
||||
$projektid = GeneralUtility::_GP('projektid');
|
||||
if (!$projektid) {
|
||||
exit;
|
||||
}
|
||||
|
||||
$colid = DbFunction::get('tx_gutachten_help', 'colid', ['pid' => $projektid, 'ORDER' => ['colid' => 'DESC']]);
|
||||
if (!$colid) {
|
||||
$colid = 'a';
|
||||
} else {
|
||||
++$colid;
|
||||
}
|
||||
|
||||
$insert_array = [];
|
||||
$insert_array['pid'] = $projektid;
|
||||
$insert_array['colid'] = $colid;
|
||||
$insert_array['coltitel'] = 'Neues Merkmal';
|
||||
DbFunction::secureInsert('tx_gutachten_help', $insert_array);
|
||||
echo 1;
|
||||
exit;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
<?php
|
||||
|
||||
namespace HermannTelser\Gutachten\DB\Insert;
|
||||
|
||||
use HermannTelser\Gutachten\DB\DbFunction;
|
||||
use TYPO3\CMS\Core\Utility\GeneralUtility;
|
||||
|
||||
/***
|
||||
*
|
||||
* This file is part of the "NuhOdds Comparatore" Extension for TYPO3 CMS.
|
||||
*
|
||||
* For the full copyright and license information, please read the
|
||||
* LICENSE.txt file that was distributed with this source code.
|
||||
*
|
||||
* (c) 2019 Hermann Telser <hermann.telser@gmail.com>, NUH-Odds GmbH
|
||||
*
|
||||
***/
|
||||
|
||||
class AddToTable
|
||||
{
|
||||
public static function create()
|
||||
{
|
||||
// DbFunction::$debug = 1;
|
||||
|
||||
$table = GeneralUtility::_GP('table');
|
||||
if (!$table) {
|
||||
exit;
|
||||
}
|
||||
|
||||
$field = GeneralUtility::_GP('field');
|
||||
$value = GeneralUtility::_GP('value');
|
||||
|
||||
if($field and $value){
|
||||
$insert_array = [];
|
||||
$insert_array[$field] = $value;
|
||||
DbFunction::secureInsert($table, $insert_array);
|
||||
}
|
||||
else {
|
||||
DbFunction::secureInsert($table);
|
||||
}
|
||||
echo 1;
|
||||
exit;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
|
||||
namespace HermannTelser\Gutachten\DB\Insert;
|
||||
|
||||
use HermannTelser\Gutachten\DB\DbFunction;
|
||||
use TYPO3\CMS\Core\Utility\GeneralUtility;
|
||||
|
||||
/***
|
||||
*
|
||||
* This file is part of the "NuhOdds Comparatore" Extension for TYPO3 CMS.
|
||||
*
|
||||
* For the full copyright and license information, please read the
|
||||
* LICENSE.txt file that was distributed with this source code.
|
||||
*
|
||||
* (c) 2019 Hermann Telser <hermann.telser@gmail.com>, NUH-Odds GmbH
|
||||
*
|
||||
***/
|
||||
|
||||
class NewProjekt
|
||||
{
|
||||
public static function create()
|
||||
{
|
||||
$internername = GeneralUtility::_GP('internername');
|
||||
$projektname = GeneralUtility::_GP('projektname');
|
||||
|
||||
if($internername!="" and $projektname != "")
|
||||
{
|
||||
$value_array = [];
|
||||
$value_array['intname'] = $internername;
|
||||
$value_array['name'] = $projektname;
|
||||
$value_array['erstelldatum'] = time();
|
||||
DbFunction::secureInsert("tx_gutachten_projekte", $value_array);
|
||||
}
|
||||
|
||||
echo 1;
|
||||
exit;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
<?php
|
||||
|
||||
namespace HermannTelser\Gutachten\DB\Insert;
|
||||
|
||||
use TYPO3\CMS\Core\Utility\GeneralUtility;
|
||||
|
||||
/***
|
||||
*
|
||||
* This file is part of the "NuhOdds Comparatore" Extension for TYPO3 CMS.
|
||||
*
|
||||
* For the full copyright and license information, please read the
|
||||
* LICENSE.txt file that was distributed with this source code.
|
||||
*
|
||||
* (c) 2019 Hermann Telser <hermann.telser@gmail.com>, NUH-Odds GmbH
|
||||
*
|
||||
***/
|
||||
|
||||
class _InsertController
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
$arr = [];
|
||||
switch (GeneralUtility::_GP('action')) {
|
||||
// Auftraggeber
|
||||
case 'auftraggeber_neu':
|
||||
AddAuftraggeber::add();
|
||||
break;
|
||||
|
||||
// Gutachter
|
||||
case 'gutachter_neu':
|
||||
AddGutachter::add();
|
||||
break;
|
||||
// any table
|
||||
case 'neues_projekt':
|
||||
NewProjekt::create();
|
||||
break;
|
||||
case 'neues_merkmal':
|
||||
AddMerkmal::create();
|
||||
break;
|
||||
case 'neues_element':
|
||||
AddToTable::create();
|
||||
break;
|
||||
default:
|
||||
Message::error(
|
||||
__FILE__,
|
||||
__LINE__,
|
||||
'no controller switch defined'
|
||||
);
|
||||
}
|
||||
|
||||
if (null !== GeneralUtility::_GP('berechnen')) {
|
||||
Berechnung::berechnen();
|
||||
}
|
||||
echo 1;
|
||||
exit;
|
||||
|
||||
// header('Content-Type: application/json');
|
||||
// echo json_encode($arr);
|
||||
// exit();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,67 @@
|
||||
<?php
|
||||
|
||||
namespace HermannTelser\Gutachten\DB;
|
||||
|
||||
// composer dump-autoload -o
|
||||
|
||||
use Medoo\Medoo;
|
||||
use PDO;
|
||||
|
||||
class MariaDB
|
||||
{
|
||||
public static $db_handle = 0;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
if ($_SERVER['SERVER_NAME'] == 'gutachten.test') {
|
||||
$mariadb_host = 'host.docker.internal';
|
||||
$mariadb_user = 'root';
|
||||
$mariadb_pass = 'salam';
|
||||
$mariadb_db = 'gutachten_t3';
|
||||
}else {
|
||||
$mariadb_host = '172.18.0.1';
|
||||
$mariadb_user = 'root';
|
||||
$mariadb_pass = 'salam';
|
||||
$mariadb_db = 'gutachten_t3';
|
||||
}
|
||||
|
||||
self::$db_handle = new Medoo([
|
||||
// required
|
||||
'database_type' => 'mysql',
|
||||
'database_name' => $mariadb_db,
|
||||
'server' => $mariadb_host,
|
||||
'username' => $mariadb_user,
|
||||
'password' => $mariadb_pass,
|
||||
|
||||
// [optional]
|
||||
'charset' => 'utf8mb4',
|
||||
'collation' => 'utf8mb4_general_ci',
|
||||
'port' => 3306,
|
||||
|
||||
// [optional] Table prefix
|
||||
// 'prefix' => 'PREFIX_',
|
||||
|
||||
// [optional] Enable logging (Logging is disabled by default for better performance)
|
||||
'logging' => false,
|
||||
|
||||
// [optional] MySQL socket (shouldn't be used with server and port)
|
||||
// 'socket' => '/tmp/mysql.sock',
|
||||
|
||||
// [optional] driver_option for connection, read more from http://www.php.net/manual/en/pdo.setattribute.php
|
||||
'option' => [
|
||||
PDO::ATTR_ERRMODE,
|
||||
PDO::ERRMODE_EXCEPTION,
|
||||
PDO::ATTR_CASE => PDO::CASE_NATURAL,
|
||||
PDO::ATTR_EMULATE_PREPARES, false,
|
||||
PDO::ATTR_DEFAULT_FETCH_MODE,
|
||||
PDO::FETCH_ASSOC,
|
||||
PDO::ATTR_TIMEOUT => 3600,
|
||||
],
|
||||
|
||||
// [optional] Medoo will execute those commands after connected to the database for initialization
|
||||
'command' => [
|
||||
'SET SQL_MODE=ANSI_QUOTES',
|
||||
],
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
namespace HermannTelser\Gutachten\DB\Select;
|
||||
|
||||
use HermannTelser\Gutachten\DB\DbFunction;
|
||||
use HermannTelser\Gutachten\Utility\Helper;
|
||||
|
||||
/***
|
||||
*
|
||||
* This file is part of the "NuhOdds Comparatore" Extension for TYPO3 CMS.
|
||||
*
|
||||
* For the full copyright and license information, please read the
|
||||
* LICENSE.txt file that was distributed with this source code.
|
||||
*
|
||||
* (c) 2019 Hermann Telser <hermann.telser@gmail.com>, NUH-Odds GmbH
|
||||
*
|
||||
***/
|
||||
|
||||
class Auftraggeber
|
||||
{
|
||||
public static function select()
|
||||
{
|
||||
$_arr = DbFunction::select('tx_gutachten_auftraggeber', '*');
|
||||
|
||||
// foreach ($_arr as $key => $_auftraggeber) {
|
||||
// foreach ($_auftraggeber as $feld => $value) {
|
||||
// if ($feld == "txt") {
|
||||
// $value = str_replace('<br />', PHP_EOL, $value);
|
||||
// $value = str_replace('\t', '', $value);
|
||||
// $_arr[$key][$feld] = trim(html_entity_decode(strip_tags($value)));
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
return $_arr;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
<?php
|
||||
|
||||
namespace HermannTelser\Gutachten\DB\Select;
|
||||
|
||||
use HermannTelser\Gutachten\DB\DbFunction;
|
||||
/***
|
||||
*
|
||||
* This file is part of the "NuhOdds Comparatore" Extension for TYPO3 CMS.
|
||||
*
|
||||
* For the full copyright and license information, please read the
|
||||
* LICENSE.txt file that was distributed with this source code.
|
||||
*
|
||||
* (c) 2019 Hermann Telser <hermann.telser@gmail.com>, NUH-Odds GmbH
|
||||
*
|
||||
***/
|
||||
|
||||
class MethodenInfo
|
||||
{
|
||||
// active projekte für user
|
||||
public static function load()
|
||||
{
|
||||
// DbFunction::$debug = 1;
|
||||
|
||||
$arr = DbFunction::select(
|
||||
'tx_gutachten_raumart',
|
||||
[
|
||||
'id',
|
||||
'raumart',
|
||||
'erklaerung',
|
||||
],
|
||||
[
|
||||
// 'isactive' => 1,
|
||||
'ORDER' => ['order' => 'ASC']
|
||||
]
|
||||
);
|
||||
|
||||
foreach ($arr as $key => $value) {
|
||||
$arr[$key]['id'] = (int) $value['id'];
|
||||
}
|
||||
|
||||
return $arr;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
<?php
|
||||
|
||||
namespace HermannTelser\Gutachten\DB\Select;
|
||||
|
||||
use HermannTelser\Gutachten\DB\DbFunction;
|
||||
/***
|
||||
*
|
||||
* This file is part of the "NuhOdds Comparatore" Extension for TYPO3 CMS.
|
||||
*
|
||||
* For the full copyright and license information, please read the
|
||||
* LICENSE.txt file that was distributed with this source code.
|
||||
*
|
||||
* (c) 2019 Hermann Telser <hermann.telser@gmail.com>, NUH-Odds GmbH
|
||||
*
|
||||
***/
|
||||
|
||||
use TYPO3\CMS\Core\Utility\GeneralUtility;
|
||||
|
||||
class MethodenProjekt
|
||||
{
|
||||
// active projekte für user
|
||||
public static function select()
|
||||
{
|
||||
|
||||
$tmp = DbFunction::select('tx_gutachten_aufstellung', ['id', 'titel']);
|
||||
$_aufstellung = [];
|
||||
$_aufstellung[0] = '';
|
||||
foreach ($tmp as $value) {
|
||||
$_aufstellung[$value['id']] = $value['titel'];
|
||||
}
|
||||
$projektid = GeneralUtility::_GP('id');
|
||||
|
||||
$arr = DbFunction::selectJoin(
|
||||
'tx_gutachten_raume_generell',
|
||||
['[>]tx_gutachten_raumart' => ['tx_gutachten_raume_generell.tt_raumart_id' => 'id']],
|
||||
[
|
||||
'tx_gutachten_raume_generell.id',
|
||||
'tx_gutachten_raume_generell.pid',
|
||||
'tx_gutachten_raume_generell.raum',
|
||||
'tx_gutachten_raume_generell.factor',
|
||||
'tx_gutachten_raume_generell.zunutzwert',
|
||||
'tx_gutachten_raume_generell.aufstellung_id',
|
||||
'tx_gutachten_raumart.raumart',
|
||||
'tx_gutachten_raumart.id(raumart_id)',
|
||||
],
|
||||
[
|
||||
'tx_gutachten_raume_generell.pid' => $projektid,
|
||||
]
|
||||
);
|
||||
foreach ($arr as $key => $value) {
|
||||
$arr[$key]['id'] = (int) $value['id'];
|
||||
$arr[$key]['pid'] = (int) $value['pid'];
|
||||
$arr[$key]['factor'] = (double) $value['factor'];
|
||||
$arr[$key]['raumart_id'] = (int) $value['raumart_id'];
|
||||
$arr[$key]['zunutzwert'] = (int) $value['zunutzwert'];
|
||||
$id = (int) $value['aufstellung_id'] ?? 0;
|
||||
$arr[$key]['aufstellung'] = $_aufstellung[$id];
|
||||
}
|
||||
|
||||
return $arr;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
namespace HermannTelser\Gutachten\DB\Select;
|
||||
use HermannTelser\Gutachten\DB\DbFunction;
|
||||
use TYPO3\CMS\Core\Utility\GeneralUtility;
|
||||
/***
|
||||
*
|
||||
* This file is part of the "NuhOdds Comparatore" Extension for TYPO3 CMS.
|
||||
*
|
||||
* For the full copyright and license information, please read the
|
||||
* LICENSE.txt file that was distributed with this source code.
|
||||
*
|
||||
* (c) 2019 Hermann Telser <hermann.telser@gmail.com>, NUH-Odds GmbH
|
||||
*
|
||||
***/
|
||||
|
||||
class Notizen
|
||||
{
|
||||
public static function notizen_projekt_laden()
|
||||
{
|
||||
$id = GeneralUtility::_GP('id');
|
||||
|
||||
$note = DbFunction::get('tx_gutachten_projekte', 'beschreibung', ['id' => $id]);
|
||||
|
||||
echo $note;
|
||||
|
||||
exit;
|
||||
|
||||
// $_projekte = Select::projekte($id);
|
||||
// echo '<div style="border: 1px solid #cccccc;">
|
||||
// <div data-dojo-type="dijit/Editor" value="'.$_projekte[0]['beschreibung'].'" name="notizen" id="notizen" data-dojo-props="onChange:function(){update_projekt_notizen(arguments[0])}"></div>
|
||||
// </div>';
|
||||
// exit;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,69 @@
|
||||
<?php
|
||||
|
||||
namespace HermannTelser\Gutachten\DB\Select;
|
||||
|
||||
use HermannTelser\Gutachten\DB\DbFunction;
|
||||
|
||||
/***
|
||||
*
|
||||
* This file is part of the "NuhOdds Comparatore" Extension for TYPO3 CMS.
|
||||
*
|
||||
* For the full copyright and license information, please read the
|
||||
* LICENSE.txt file that was distributed with this source code.
|
||||
*
|
||||
* (c) 2019 Hermann Telser <hermann.telser@gmail.com>, NUH-Odds GmbH
|
||||
*
|
||||
***/
|
||||
|
||||
class ObjektProjektByMethode
|
||||
{
|
||||
public static function select($method)
|
||||
{
|
||||
if ($method == 1) {
|
||||
$arr = DbFunction::select(
|
||||
'tx_gutachten_raume_all',
|
||||
['tt_raume_basis_id', 'geschoss'],
|
||||
[
|
||||
'AND' => [
|
||||
'pid' => DbFunction::$projektid,
|
||||
'tt_raumart_id' => 1
|
||||
],
|
||||
'GROUP' => ['tt_raume_basis_id','geschoss']
|
||||
]
|
||||
);
|
||||
$geschoss = [];
|
||||
foreach ($arr as $key => $value) {
|
||||
$geschoss[$value['tt_raume_basis_id']][] = $value['geschoss'];
|
||||
}
|
||||
}
|
||||
|
||||
// DbFunction::$debug = 1;
|
||||
$arr = DbFunction::selectJoin(
|
||||
'tx_gutachten_raume_basis',
|
||||
['[>]tx_gutachten_orientierung' => ['tx_gutachten_raume_basis.tt_orientierung_id' => 'id'],
|
||||
'[>]tx_gutachten_raume_all' => ['tx_gutachten_raume_basis.id' => 'tt_raume_basis_id'], ],
|
||||
[
|
||||
'tx_gutachten_raume_basis.id',
|
||||
'tx_gutachten_raume_basis.topNr',
|
||||
'tx_gutachten_raume_basis.typ',
|
||||
'tx_gutachten_raume_basis.GNO',
|
||||
'tx_gutachten_orientierung.orientierung',
|
||||
'tx_gutachten_raume_all.geschoss',
|
||||
],
|
||||
[
|
||||
'tx_gutachten_raume_basis.pid' => DbFunction::$projektid,
|
||||
'tx_gutachten_raume_all.tt_raumart_id' => $method,
|
||||
'GROUP' => 'tx_gutachten_raume_basis.id',
|
||||
'ORDER' => ['tx_gutachten_raume_basis.topNr' => 'ASC'],
|
||||
]
|
||||
);
|
||||
if ($method == 1) {
|
||||
foreach ($arr as $key => $value) {
|
||||
if (isset($geschoss[$value['id']])) {
|
||||
$arr[$key]['geschoss'] = implode(",", $geschoss[$value['id']]);
|
||||
}
|
||||
}
|
||||
}
|
||||
return $arr;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,78 @@
|
||||
<?php
|
||||
|
||||
namespace HermannTelser\Gutachten\DB\Select;
|
||||
|
||||
use HermannTelser\Gutachten\DB\DbFunction;
|
||||
use HermannTelser\Gutachten\Utility\Helper;
|
||||
|
||||
/***
|
||||
*
|
||||
* This file is part of the "NuhOdds Comparatore" Extension for TYPO3 CMS.
|
||||
*
|
||||
* For the full copyright and license information, please read the
|
||||
* LICENSE.txt file that was distributed with this source code.
|
||||
*
|
||||
* (c) 2019 Hermann Telser <hermann.telser@gmail.com>, NUH-Odds GmbH
|
||||
*
|
||||
***/
|
||||
|
||||
class Objekte
|
||||
{
|
||||
public static function select($projektid)
|
||||
{
|
||||
// DbFunction::$debug = 1;
|
||||
|
||||
// if (!is_numeric($projektid)) {
|
||||
// return [];
|
||||
// }
|
||||
|
||||
$arr = DbFunction::selectJoin(
|
||||
'tx_gutachten_raume_all',
|
||||
['[>]tx_gutachten_raume_basis' => ['tx_gutachten_raume_all.tt_raume_basis_id' => 'id'],
|
||||
'[>]tx_gutachten_orientierung' => ['tx_gutachten_raume_basis.tt_orientierung_id' => 'id'],
|
||||
'[>]tx_gutachten_raumart' => ['tx_gutachten_raume_all.tt_raumart_id' => 'id'], ],
|
||||
[
|
||||
'tx_gutachten_raume_all.id',
|
||||
'tx_gutachten_raume_all.tt_raume_basis_id',
|
||||
'tx_gutachten_raume_all.tt_raumart_id',
|
||||
'tx_gutachten_raume_all.pid',
|
||||
'tx_gutachten_raume_all.geschoss',
|
||||
'tx_gutachten_raume_all.raum',
|
||||
'tx_gutachten_raume_all.factor',
|
||||
'tx_gutachten_raume_all.qm',
|
||||
'tx_gutachten_raume_all.NW',
|
||||
'tx_gutachten_raume_all.NWungerundet',
|
||||
'tx_gutachten_raume_all.NWm2',
|
||||
'tx_gutachten_raume_all.factor (factorBasic)',
|
||||
|
||||
'tx_gutachten_raume_basis.topNr',
|
||||
'tx_gutachten_raume_basis.GNO',
|
||||
'tx_gutachten_raume_basis.NWM1uM2',
|
||||
|
||||
'tx_gutachten_orientierung.orientierung',
|
||||
'tx_gutachten_raumart.raumart',
|
||||
],
|
||||
[
|
||||
'tx_gutachten_raume_all.pid' => $projektid,
|
||||
]
|
||||
);
|
||||
|
||||
$in_menu = [];
|
||||
foreach ($arr as $key => $value) {
|
||||
$arr[$key]['show'] = \in_array($value['tt_raume_basis_id'], $in_menu) ? 0 : 1;
|
||||
$in_menu[] = $value['tt_raume_basis_id'];
|
||||
}
|
||||
$arr = Helper::make_int($arr, ['id', 'pid', 'tt_raume_basis_id', 'tt_raumart_id', 'GNO', 'NW', 'NWM1uM2']);
|
||||
$arr = Helper::format_double($arr, ['factor', 'qm', 'NWungerundet', 'NWm2', 'factorBasic'], 2);
|
||||
|
||||
return $arr;
|
||||
|
||||
// $fields = 'a.id, a.tt_raume_basis_id, a.tt_raumart_id, a.pid, a.geschoss, a.raum, a.factor, a.qm, a.NW, a.NWungerundet, a.NWm2, a.factor AS factorBasic,b.topNr, b.GNO, b.NWM1uM2, c.orientierung, d.raumart';
|
||||
// $from = 'tx_gutachten_raume_all a, tx_gutachten_raume_basis b, tx_gutachten_orientierung c, tx_gutachten_raumart d';
|
||||
// $where = "a.pid=$projektid AND a.tt_raume_basis_id = b.id AND b.tt_orientierung_id = c.id AND a.tt_raumart_id = d.id";
|
||||
// $order = 'a.tt_raume_basis_id';
|
||||
// // echo $GLOBALS['TYPO3_DB']->SELECTquery($fields, $from, $where, "", $order);exit;
|
||||
// $arr = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows($fields, $from, $where, '', $order);
|
||||
// return $arr;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
<?php
|
||||
|
||||
namespace HermannTelser\Gutachten\DB\Select;
|
||||
|
||||
use HermannTelser\Gutachten\DB\DbFunction;
|
||||
|
||||
/***
|
||||
*
|
||||
* This file is part of the "NuhOdds Comparatore" Extension for TYPO3 CMS.
|
||||
*
|
||||
* For the full copyright and license information, please read the
|
||||
* LICENSE.txt file that was distributed with this source code.
|
||||
*
|
||||
* (c) 2019 Hermann Telser <hermann.telser@gmail.com>, NUH-Odds GmbH
|
||||
*
|
||||
***/
|
||||
|
||||
class ObjekteExcel
|
||||
{
|
||||
public static function select($projektid)
|
||||
{
|
||||
return DbFunction::selectJoin(
|
||||
'tx_gutachten_raume_basis',
|
||||
['[>]tx_gutachten_orientierung' => ['tx_gutachten_raume_basis.tt_orientierung_id' => 'id']],
|
||||
[
|
||||
'tx_gutachten_raume_basis.id',
|
||||
'tx_gutachten_raume_basis.topNr',
|
||||
'tx_gutachten_raume_basis.GNO',
|
||||
'tx_gutachten_raume_basis.qmM1',
|
||||
'tx_gutachten_raume_basis.factor',
|
||||
'tx_gutachten_raume_basis.noDispInOrientierung (nodspl)',
|
||||
'tx_gutachten_orientierung.orientierung',
|
||||
],
|
||||
[
|
||||
'tx_gutachten_raume_basis.pid' => $projektid,
|
||||
'ORDER' => 'tx_gutachten_raume_basis.topNr',
|
||||
]
|
||||
);
|
||||
// $fields = 'a.id, a.topNr, a.GNO, a.qmM1, a.factor, a.noDispInOrientierung nodspl, b.orientierung';
|
||||
// $from = 'tx_gutachten_raume_basis a,tx_gutachten_orientierung b';
|
||||
// $where = 'a.tt_orientierung_id=b.id and a.pid = '.$projektid;
|
||||
// $order = 'topNr';
|
||||
// // echo $GLOBALS['TYPO3_DB']->SELECTquery($fields, $from, $where); exit;
|
||||
// return $GLOBALS['TYPO3_DB']->exec_SELECTgetRows($fields, $from, $where, '', $order);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
namespace HermannTelser\Gutachten\DB\Select;
|
||||
|
||||
use HermannTelser\Gutachten\DB\DbFunction;
|
||||
|
||||
/***
|
||||
*
|
||||
* This file is part of the "NuhOdds Comparatore" Extension for TYPO3 CMS.
|
||||
*
|
||||
* For the full copyright and license information, please read the
|
||||
* LICENSE.txt file that was distributed with this source code.
|
||||
*
|
||||
* (c) 2019 Hermann Telser <hermann.telser@gmail.com>, NUH-Odds GmbH
|
||||
*
|
||||
***/
|
||||
|
||||
class OrientierungProjekt
|
||||
{
|
||||
// active projekte für user
|
||||
public static function select($projekt_id)
|
||||
{
|
||||
$fields = 'a.id,a.pid,a.topNr,a.typ,a.tt_orientierung_id,b.orientierung,a.noDispInOrientierung,a.a,a.b,a.c,a.d,a.e,a.f,a.g,a.h,a.i,a.j,a.k,a.l,a.m,a.n,a.o,a.p,a.q,a.r,a.s,a.t,a.u,a.summe_az,a.bewertung,a.notizen';
|
||||
$from = 'tx_gutachten_raume_basis a, tx_gutachten_orientierung b';
|
||||
$where = "a.pid=$projekt_id AND a.tt_orientierung_id=b.id";
|
||||
// echo $GLOBALS['TYPO3_DB']->SELECTquery($fields, $from, $where);exit;
|
||||
// return $GLOBALS['TYPO3_DB']->exec_SELECTgetRows($fields, $from, $where);
|
||||
|
||||
return DbFunction::query("SELECT $fields FROM $from WHERE $where");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
<?php
|
||||
|
||||
namespace HermannTelser\Gutachten\DB\Select;
|
||||
|
||||
use HermannTelser\Gutachten\DB\DbFunction;
|
||||
|
||||
/***
|
||||
*
|
||||
* This file is part of the "NuhOdds Comparatore" Extension for TYPO3 CMS.
|
||||
*
|
||||
* For the full copyright and license information, please read the
|
||||
* LICENSE.txt file that was distributed with this source code.
|
||||
*
|
||||
* (c) 2019 Hermann Telser <hermann.telser@gmail.com>, NUH-Odds GmbH
|
||||
*
|
||||
***/
|
||||
|
||||
class Paragraph62
|
||||
{
|
||||
// active projekte für user
|
||||
public static function select($projekt_id)
|
||||
{
|
||||
// kennung kopf txt kontaktperson email telefon editor timestamp
|
||||
// DbFunction::$debug = 1;
|
||||
|
||||
return DbFunction::selectJoin(
|
||||
'tx_gutachten_raume_basis',
|
||||
['[>]tx_gutachten_orientierung' => ['tx_gutachten_raume_basis.tt_orientierung_id' => 'id'],
|
||||
'[>]tx_gutachten_raume_all' => ['tx_gutachten_raume_basis.id' => 'tt_raume_basis_id']],
|
||||
[
|
||||
// 'tx_gutachten_raume_basis.id',
|
||||
'tx_gutachten_raume_basis.topNr',
|
||||
'tx_gutachten_raume_all.geschoss',
|
||||
'tx_gutachten_orientierung.orientierung',
|
||||
'tx_gutachten_raume_basis.typ',
|
||||
// 'tx_gutachten_raume_basis.qmM1uM2bis(nzfl)',
|
||||
// 'tx_gutachten_raume_basis.noDispInOrientierung',
|
||||
// 'tx_gutachten_raume_all.qm(nzfl_apg)',
|
||||
],
|
||||
[
|
||||
'AND' => [
|
||||
'tx_gutachten_raume_all.tt_raumart_id' => [1,5,6,9],
|
||||
'tx_gutachten_raume_basis.pid' => $projekt_id
|
||||
],
|
||||
'GROUP' => ['tx_gutachten_raume_all.tt_raume_basis_id'],
|
||||
'ORDER' => ['tx_gutachten_raume_all.tt_raumart_id' => 'ASC','tx_gutachten_raume_basis.topNr' => 'ASC']
|
||||
]
|
||||
);
|
||||
|
||||
// print_r($res);
|
||||
// exit;
|
||||
// $fields = 'a.id, a.topNr, a.typ, a.qmM1uM2bis AS nzfl, a.noDispInOrientierung, b.orientierung, c.geschoss, c.qm AS nzfl_apg';
|
||||
// $from = 'tx_gutachten_raume_basis a, tx_gutachten_orientierung b, tx_gutachten_raume_all c';
|
||||
// $where = 'a.tt_orientierung_id=b.id and a.id=c.tt_raume_basis_id and c.tt_raumart_id IN (1,5,6,9) and a.pid = '.$projekt_id;
|
||||
// $group = 'c.tt_raume_basis_id';
|
||||
// $order = 'c.tt_raumart_id, a.topNr';
|
||||
// echo $GLOBALS['TYPO3_DB']->SELECTquery($fields, $from, $where, $group, $order);exit;
|
||||
// return $GLOBALS['TYPO3_DB']->exec_SELECTgetRows($fields, $from, $where, $group, $order);
|
||||
// return DbFunction::query("SELECT $fields FROM $from WHERE $where GROUP BY $group ORDER BY $order");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
namespace HermannTelser\Gutachten\DB\Select;
|
||||
|
||||
use HermannTelser\Gutachten\DB\DbFunction;
|
||||
|
||||
/***
|
||||
*
|
||||
* This file is part of the "NuhOdds Comparatore" Extension for TYPO3 CMS.
|
||||
*
|
||||
* For the full copyright and license information, please read the
|
||||
* LICENSE.txt file that was distributed with this source code.
|
||||
*
|
||||
* (c) 2019 Hermann Telser <hermann.telser@gmail.com>, NUH-Odds GmbH
|
||||
*
|
||||
***/
|
||||
|
||||
class Platzhalter
|
||||
{
|
||||
public static function select($projektid)
|
||||
{
|
||||
return DbFunction::select(
|
||||
'tx_gutachten_projekteplatzhalter',
|
||||
['code', 'txt'],
|
||||
['pid' => $projektid]
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
namespace HermannTelser\Gutachten\DB\Select;
|
||||
|
||||
use HermannTelser\Gutachten\DB\DbFunction;
|
||||
use HermannTelser\Gutachten\Utility\Helper;
|
||||
use TYPO3\CMS\Core\Utility\GeneralUtility;
|
||||
|
||||
/***
|
||||
*
|
||||
* This file is part of the "NuhOdds Comparatore" Extension for TYPO3 CMS.
|
||||
*
|
||||
* For the full copyright and license information, please read the
|
||||
* LICENSE.txt file that was distributed with this source code.
|
||||
*
|
||||
* (c) 2019 Hermann Telser <hermann.telser@gmail.com>
|
||||
*
|
||||
***/
|
||||
|
||||
class ProjektAllgemeinAlle
|
||||
{
|
||||
public static function select()
|
||||
{
|
||||
// DbFunction::$debug = 1;
|
||||
|
||||
$projektid = GeneralUtility::_GP('id');
|
||||
$arr = DbFunction::select('tx_gutachten_allgemein', '*', ['pid' => $projektid]);
|
||||
$arr = Helper::make_int($arr, ['id','pid','uid']);
|
||||
$arr = Helper::format_double($arr, ['qm'], 2);
|
||||
return $arr;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,77 @@
|
||||
<?php
|
||||
|
||||
namespace HermannTelser\Gutachten\DB\Select;
|
||||
|
||||
use HermannTelser\Gutachten\DB\DbFunction;
|
||||
use TYPO3\CMS\Core\Utility\GeneralUtility;
|
||||
use HermannTelser\Gutachten\Eid\TxGutachten;
|
||||
|
||||
class ProjektClone
|
||||
{
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public static function clone()
|
||||
{
|
||||
TxGutachten::$debug = 0;
|
||||
|
||||
$userid = $GLOBALS['TSFE']->fe_user->user['uid'];
|
||||
$projekt_id = GeneralUtility::_GP('id');
|
||||
if (!is_numeric($projekt_id)) {
|
||||
return [];
|
||||
}
|
||||
|
||||
$_projekte = Select::projekte($projekt_id);
|
||||
|
||||
if (!isset($_projekte[0])) {
|
||||
exit;
|
||||
}
|
||||
|
||||
$_new_projekte = $_projekte[0];
|
||||
|
||||
unset($_new_projekte['id']);
|
||||
unset($_new_projekte['gutachter']);
|
||||
unset($_new_projekte['auftraggeber']);
|
||||
unset($_new_projekte['active']);
|
||||
$_new_projekte['uid'] = $userid;
|
||||
$_new_projekte['intname'] .= ' (Kopie)';
|
||||
$_new_projekte['beschreibung'] = 'KOPIE! '.$_new_projekte['beschreibung'];
|
||||
$_new_projekte['erstelldatum'] = time();
|
||||
$new_projekt_id = DbFunction::secureInsert('tx_gutachten_projekte', $_new_projekte);
|
||||
|
||||
$_table_to_copy = ['tx_gutachten_projekteplatzhalter', 'tx_gutachten_projektestandards', 'tx_gutachten_allgemein', 'tx_gutachten_help', 'tx_gutachten_raume_generell'];
|
||||
|
||||
foreach ($_table_to_copy as $key => $table) {
|
||||
$_data = DbFunction::select($table, '*', ['pid' => $projekt_id]);
|
||||
foreach ($_data as $key => $value) {
|
||||
unset($value['id']);
|
||||
$value['pid'] = $new_projekt_id;
|
||||
DbFunction::secureInsert($table, $value);
|
||||
}
|
||||
}
|
||||
|
||||
$_data = DbFunction::select('tx_gutachten_raume_basis', '*', ['pid' => $projekt_id]);
|
||||
$_basis_ids = [];
|
||||
foreach ($_data as $key => $value) {
|
||||
$id = $value['id'];
|
||||
unset($value['id']);
|
||||
|
||||
$value['pid'] = $new_projekt_id;
|
||||
$_basis_ids[$id] = DbFunction::secureInsert('tx_gutachten_raume_basis', $value);
|
||||
}
|
||||
|
||||
$_data = DbFunction::select('tx_gutachten_raume_all', '*', ['pid' => $projekt_id]);
|
||||
foreach ($_data as $key => $value) {
|
||||
unset($value['id']);
|
||||
$value['pid'] = $new_projekt_id;
|
||||
|
||||
$tt_raume_basis_id = $value['tt_raume_basis_id'];
|
||||
$value['tt_raume_basis_id'] = $_basis_ids[$tt_raume_basis_id];
|
||||
|
||||
DbFunction::secureInsert('tx_gutachten_raume_all', $value);
|
||||
}
|
||||
|
||||
echo 1;
|
||||
exit;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,101 @@
|
||||
<?php
|
||||
|
||||
namespace HermannTelser\Gutachten\DB\Select;
|
||||
|
||||
use HermannTelser\Gutachten\DB\DbFunction;
|
||||
|
||||
/***
|
||||
*
|
||||
* This file is part of the "NuhOdds Comparatore" Extension for TYPO3 CMS.
|
||||
*
|
||||
* For the full copyright and license information, please read the
|
||||
* LICENSE.txt file that was distributed with this source code.
|
||||
*
|
||||
* (c) 2019 Hermann Telser <hermann.telser@gmail.com>, NUH-Odds GmbH
|
||||
*
|
||||
***/
|
||||
|
||||
class Projekte
|
||||
{
|
||||
public static function projekt_standards($id)
|
||||
{
|
||||
// $fields = 'a.*, b.txt textart';
|
||||
// $from = 'tx_gutachten_projektestandards a, tx_gutachten_textart b';
|
||||
// $where = "a.textart_id=b.id and a.pid=$projekt_id";
|
||||
// return $GLOBALS['TYPO3_DB']->SELECTquery($fields, $from, $where, "", "pos");
|
||||
// return $GLOBALS['TYPO3_DB']->exec_SELECTgetRows($fields, $from, $where, '', 'pos');
|
||||
|
||||
$where = [];
|
||||
if ($id) {
|
||||
$where['tx_gutachten_projektestandards.pid'] = $id;
|
||||
}
|
||||
$join = [];
|
||||
$join['[>]tx_gutachten_textart']['tx_gutachten_projektestandards.textart_id'] = 'id';
|
||||
|
||||
$fields = [
|
||||
'tx_gutachten_projektestandards.id',
|
||||
'tx_gutachten_projektestandards.textart_id',
|
||||
'tx_gutachten_projektestandards.spalten',
|
||||
'tx_gutachten_projektestandards.fontsize',
|
||||
'tx_gutachten_projektestandards.neueseite',
|
||||
'tx_gutachten_projektestandards.kennung',
|
||||
'tx_gutachten_projektestandards.titel',
|
||||
'tx_gutachten_projektestandards.txt',
|
||||
'tx_gutachten_projektestandards.platzhalter',
|
||||
'tx_gutachten_textart.txt(textart)',
|
||||
];
|
||||
|
||||
return DbFunction::selectJoin(
|
||||
'tx_gutachten_projektestandards',
|
||||
$join,
|
||||
$fields,
|
||||
$where
|
||||
);
|
||||
}
|
||||
|
||||
public static function standards()
|
||||
{
|
||||
// $fields = 'a.*, b.txt textart';
|
||||
// $from = 'tx_gutachten_standards a, tx_gutachten_textart b';
|
||||
// $where = 'a.textart_id=b.id';
|
||||
// // return $GLOBALS['TYPO3_DB']->SELECTquery($fields, $from, $where, "", "pos");
|
||||
// return $GLOBALS['TYPO3_DB']->exec_SELECTgetRows($fields, $from, $where, '', 'pos');
|
||||
|
||||
$join = [];
|
||||
$join['[>]tx_gutachten_textart']['tx_gutachten_standards.textart_id'] = 'id';
|
||||
|
||||
$fields = [
|
||||
'tx_gutachten_standards.id',
|
||||
'tx_gutachten_standards.textart_id',
|
||||
'tx_gutachten_standards.spalten',
|
||||
'tx_gutachten_standards.fontsize',
|
||||
'tx_gutachten_standards.neueseite',
|
||||
'tx_gutachten_standards.kennung',
|
||||
'tx_gutachten_standards.titel',
|
||||
'tx_gutachten_standards.txt',
|
||||
'tx_gutachten_standards.platzhalter',
|
||||
'tx_gutachten_textart.txt(textart)',
|
||||
];
|
||||
|
||||
return DbFunction::selectJoin(
|
||||
'tx_gutachten_standards',
|
||||
$join,
|
||||
$fields
|
||||
);
|
||||
}
|
||||
|
||||
public static function standards_alle()
|
||||
{
|
||||
$arr = self::standards();
|
||||
|
||||
foreach ($arr as $key => $value) {
|
||||
$arr[$key]['id'] = (int) $value['id'];
|
||||
$arr[$key]['pos'] = (int) $value['pos'] / 10;
|
||||
$arr[$key]['textart'] = ucwords($value['textart']);
|
||||
$arr[$key]['neueseite'] = (int) $value['neueseite'];
|
||||
$arr[$key]['all'] = \count($arr);
|
||||
}
|
||||
|
||||
return $arr;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
<?php
|
||||
|
||||
namespace HermannTelser\Gutachten\DB\Select;
|
||||
|
||||
use HermannTelser\Gutachten\DB\DbFunction;
|
||||
use TYPO3\CMS\Core\Utility\GeneralUtility;
|
||||
|
||||
/***
|
||||
*
|
||||
* This file is part of the "NuhOdds Comparatore" Extension for TYPO3 CMS.
|
||||
*
|
||||
* For the full copyright and license information, please read the
|
||||
* LICENSE.txt file that was distributed with this source code.
|
||||
*
|
||||
* (c) 2019 Hermann Telser <hermann.telser@gmail.com>
|
||||
*
|
||||
***/
|
||||
|
||||
class ProjekteSetActive
|
||||
{
|
||||
public static function set()
|
||||
{
|
||||
$projectid = GeneralUtility::_GP('id');
|
||||
$userid = $GLOBALS['TSFE']->fe_user->user['uid'];
|
||||
|
||||
$has = DbFunction::has('tx_gutachten_freigabe', ['AND' => ['userid' => $userid, 'projektid' => $projectid]]);
|
||||
|
||||
if (!$has) {
|
||||
$value_array = [];
|
||||
$value_array['userid'] = $userid;
|
||||
$value_array['projektid'] = $projectid;
|
||||
|
||||
DbFunction::secureInsert('tx_gutachten_freigabe', $value_array);
|
||||
|
||||
echo 1;
|
||||
} else {
|
||||
$active = DbFunction::delete('tx_gutachten_freigabe', ['AND' => ['userid' => $userid, 'projektid' => $projectid]]);
|
||||
|
||||
echo 0;
|
||||
}
|
||||
|
||||
exit;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
|
||||
namespace HermannTelser\Gutachten\DB\Select;
|
||||
|
||||
use HermannTelser\Gutachten\DB\DbFunction;
|
||||
use TYPO3\CMS\Core\Utility\GeneralUtility;
|
||||
|
||||
/***
|
||||
*
|
||||
* This file is part of the "NuhOdds Comparatore" Extension for TYPO3 CMS.
|
||||
*
|
||||
* For the full copyright and license information, please read the
|
||||
* LICENSE.txt file that was distributed with this source code.
|
||||
*
|
||||
* (c) 2019 Hermann Telser <hermann.telser@gmail.com>
|
||||
*
|
||||
***/
|
||||
|
||||
class ProjekteSetStatus
|
||||
{
|
||||
public static function set()
|
||||
{
|
||||
$id = GeneralUtility::_GP('id');
|
||||
$value = GeneralUtility::_GP('value');
|
||||
DbFunction::secureUpdate('tx_gutachten_projekte', ['value' => $value], ['id' => $id]);
|
||||
echo $value;
|
||||
exit;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,122 @@
|
||||
<?php
|
||||
|
||||
namespace HermannTelser\Gutachten\DB\Select;
|
||||
|
||||
use TYPO3\CMS\Core\Utility\GeneralUtility;
|
||||
|
||||
/***
|
||||
*
|
||||
* This file is part of the "NuhOdds Comparatore" Extension for TYPO3 CMS.
|
||||
*
|
||||
* For the full copyright and license information, please read the
|
||||
* LICENSE.txt file that was distributed with this source code.
|
||||
*
|
||||
* (c) 2019 Hermann Telser <hermann.telser@gmail.com>
|
||||
*
|
||||
***/
|
||||
|
||||
class ProjekteStammdatenEinzeln
|
||||
{
|
||||
public static function load()
|
||||
{
|
||||
$id = GeneralUtility::_GP('id');
|
||||
if (!is_numeric($id)) {
|
||||
return [];
|
||||
}
|
||||
$tmp = Select::projekte($id);
|
||||
$_projekt = $tmp[0];
|
||||
|
||||
$_gutachter = Select::select_table('tx_gutachten_gutachter', 0, 1);
|
||||
$_auftraggeber = Select::select_table('tx_gutachten_auftraggeber', 0, 1);
|
||||
|
||||
array_unshift($_auftraggeber, ['id' => 0, 'kennung' => 'Auftraggeber auswählen']);
|
||||
$auftraggeber_options = '';
|
||||
foreach ($_auftraggeber as $auftraggeber_id => $value) {
|
||||
if ($auftraggeber_id == $_projekt['auftraggeber_id']) {
|
||||
$auftraggeber_options .= '<option value="'.$auftraggeber_id.'" selected="selected"><span>'.$value['kennung'].'</span></option>';
|
||||
} else {
|
||||
$auftraggeber_options .= '<option value="'.$auftraggeber_id.'"><span>'.$value['kennung'].'</span></option>';
|
||||
}
|
||||
}
|
||||
|
||||
array_unshift($_gutachter, ['id' => 0, 'kennung' => 'Gutachter auswählen!']);
|
||||
$gutachter_options = '';
|
||||
foreach ($_gutachter as $gutachter_id => $value) {
|
||||
if ($gutachter_id == $_projekt['gutachter_id']) {
|
||||
$gutachter_options .= '<option value="'.$gutachter_id.'" selected="selected">'.$value['kennung'].'</option>';
|
||||
} else {
|
||||
$gutachter_options .= '<option value="'.$gutachter_id.'">'.$value['kennung'].'</option>';
|
||||
}
|
||||
}
|
||||
|
||||
$error_auftraggeber = 0 == $_projekt['auftraggeber_id'] ? ' error ' : '';
|
||||
$error_gutachter = 0 == $_projekt['gutachter_id'] ? ' error ' : '';
|
||||
|
||||
$myform = '
|
||||
<table class="pure-table nutzwert-table">
|
||||
<tr>
|
||||
<td class="nutzwert-td" style="height:34px;">
|
||||
<label for="projekt">ID:</label>
|
||||
</td>
|
||||
<td class="nutzwert-td">
|
||||
'.$_projekt['id'].'
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="nutzwert-td" style="height:34px;">
|
||||
<label for="projekt">Name:</label>
|
||||
</td>
|
||||
<td class="nutzwert-td" style="height:34px;">
|
||||
<input type="text" class="stammdaten_cellsize" id="projekt" name="projekt" required="true" value="'.$_projekt['name'].'" data-dojo-type="dijit/form/TextBox" data-dojo-props="onChange:function(){update_projekt_item(\'name\',arguments[0])}"/>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="nutzwert-td" style="height:34px;">
|
||||
<label for="intprojekt">Interner Name:</label>
|
||||
</td>
|
||||
<td class="nutzwert-td">
|
||||
<input type="text" class="stammdaten_cellsize" id="intprojekt" name="intprojekt" required="true" value="'.$_projekt['intname'].'" data-dojo-type="dijit/form/TextBox" data-dojo-type="dijit/form/TextBox" data-dojo-props="onChange:function(){update_projekt_item(\'intname\',arguments[0])}"/>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="nutzwert-td" style="height:34px;">
|
||||
<label for="erstellung">Erstellt am:</label>
|
||||
</td>
|
||||
<td class="nutzwert-td">
|
||||
<input type="text" class="stammdaten_cellsize" id="erstellung" name="erstellung" required="true" value="'.$_projekt['erstellung'].'" data-dojo-type="dijit/form/TextBox" data-dojo-type="dijit/form/TextBox" data-dojo-props="onChange:function(){update_projekt_item(\'erstellung\',arguments[0])}"/>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="nutzwert-td" style="height:34px;">
|
||||
<label for="auftraggeber_id">Auftraggeber:</label>
|
||||
</td>
|
||||
<td class="nutzwert-td">
|
||||
<select class="stammdaten_cellsize_select '.$error_auftraggeber.'" id="auftraggeber_id" name="auftraggeber_id" data-dojo-type="dijit/form/Select" data-dojo-props="onChange:function(){update_projekt_item(\'auftraggeber_id\',arguments[0])}"/>
|
||||
'.$auftraggeber_options.'
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="nutzwert-td" style="height:34px;">
|
||||
<label for="gutachter_id">Gutachter:</label>
|
||||
</td>
|
||||
<td class="nutzwert-td">
|
||||
<select class="stammdaten_cellsize_select '.$error_gutachter.'" id="gutachter_id" name="gutachter_id" data-dojo-type="dijit/form/Select" data-dojo-props="onChange:function(){update_projekt_item(\'gutachter_id\',arguments[0])}"/>
|
||||
'.$gutachter_options.'
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="nutzwert-td" style="height:34px;">
|
||||
<label for="nwbStartSeite">Nutzwerte Startseite:</label>
|
||||
</td>
|
||||
<td class="nutzwert-td">
|
||||
<input type="text" class="stammdaten_cellsize" id="nwbStartSeite" name="nwbStartSeite" required="true" value="'.$_projekt['nwbStartSeite'].'" data-dojo-type="dijit/form/TextBox" data-dojo-type="dijit/form/TextBox" data-dojo-props="onChange:function(){update_projekt_item(\'nwbStartSeite\',arguments[0])}"/>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
';
|
||||
echo $myform;
|
||||
exit;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,321 @@
|
||||
<?php
|
||||
|
||||
namespace HermannTelser\Gutachten\DB\Select;
|
||||
|
||||
// composer dump-autoload -o
|
||||
use HermannTelser\Gutachten\DB\DbFunction;
|
||||
use TYPO3\CMS\Core\Utility\GeneralUtility;
|
||||
|
||||
class Select
|
||||
{
|
||||
public static function select_table($table, $select_id = 0, $_id_as_key = 0, $_casting = [])
|
||||
{
|
||||
if ($select_id) {
|
||||
$tmp = DbFunction::select($table, '*', ['id' => $select_id]);
|
||||
} else {
|
||||
$tmp = DbFunction::select($table, '*');
|
||||
}
|
||||
|
||||
$arr = [];
|
||||
|
||||
foreach ($tmp as $key => $value) {
|
||||
$value['id'] = (int) $value['id'];
|
||||
|
||||
foreach ($_casting as $field => $cast) {
|
||||
if ($key == $field) {
|
||||
switch ($cast) {
|
||||
case 'int':
|
||||
$value[$key] = (int) $value[$key];
|
||||
break;
|
||||
case 'double':
|
||||
$value[$key] = (float) $value[$key];
|
||||
break;
|
||||
case 'string':
|
||||
$value[$key] = (string) $value[$key];
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($_id_as_key) {
|
||||
$arr[$value['id']] = $value;
|
||||
} else {
|
||||
$arr[] = $value;
|
||||
}
|
||||
}
|
||||
|
||||
return $arr;
|
||||
}
|
||||
|
||||
// $sql = "SELECT a.*, b.zunutzwert FROM tt_raume_all a, tt_raume_generell b
|
||||
// WHERE a.tt_raumart_id IN (2,8)
|
||||
// AND a.tt_raume_basis_id = $tt_raume_basis_id
|
||||
// AND a.raum=b.raum
|
||||
// AND a.pid = $pid
|
||||
// AND b.pid = $pid
|
||||
// ORDER BY a.raum";
|
||||
|
||||
|
||||
public static function orientierung_select()
|
||||
{
|
||||
$_orientierung = DbFunction::select('tx_gutachten_orientierung', ['id', 'orientierung'], ['ORDER' => 'sortierung']);
|
||||
$arr = [];
|
||||
foreach ($_orientierung as $key => $value) {
|
||||
$tmp = [];
|
||||
$tmp['id'] = $value['orientierung'];
|
||||
$tmp['orientierung'] = $value['orientierung'];
|
||||
$tmp['label'] = '<span class="dijitReset dijitMenuItem select_orientierung">'.$value['orientierung'].'</span>';
|
||||
$arr[] = $tmp;
|
||||
}
|
||||
|
||||
return $arr;
|
||||
}
|
||||
|
||||
public static function projekte($projektid = 0)
|
||||
{
|
||||
$mode = GeneralUtility::_GP('mode');
|
||||
|
||||
$_gutachter = self::select_table('tx_gutachten_gutachter', 0, 1);
|
||||
$_auftraggeber = self::select_table('tx_gutachten_auftraggeber', 0, 1);
|
||||
$_active = self::projekte_active_user();
|
||||
|
||||
$_projekte = self::select_table('tx_gutachten_projekte', $projektid);
|
||||
|
||||
$arr = [];
|
||||
foreach ($_projekte as $key => $value) {
|
||||
$value['gutachter'] = $_gutachter[$value['gutachter_id']]['kennung'];
|
||||
$value['auftraggeber'] = $_auftraggeber[$value['auftraggeber_id']]['kennung'];
|
||||
$value['active'] = \in_array($value['id'], $_active) ? 1 : 0;
|
||||
$arr[] = $value;
|
||||
}
|
||||
|
||||
return $arr;
|
||||
}
|
||||
|
||||
public static function aufstellung()
|
||||
{
|
||||
return self::select_table('tx_gutachten_aufstellung');
|
||||
}
|
||||
|
||||
|
||||
public static function text_art()
|
||||
{
|
||||
$result = DbFunction::select('tx_gutachten_textart', ['id', 'txt'],[ 'ORDER' => 'id']);
|
||||
$arr = [];
|
||||
$arr[0]['id'] = (int) 0;
|
||||
$arr[0]['name'] = "0 - Bitte Wählen";
|
||||
foreach ($result as $key => $value) {
|
||||
$id = (int) $value['id'];
|
||||
$arr[$id]['id'] = $id;
|
||||
$arr[$id]['name'] = $id . " - " . ucwords($value['txt']);
|
||||
}
|
||||
return $arr;
|
||||
}
|
||||
|
||||
public static function projekte_active_user()
|
||||
{
|
||||
return DbFunction::select('tx_gutachten_freigabe', 'projektid', ['userid' => $GLOBALS['TSFE']->fe_user->user['uid']]);
|
||||
}
|
||||
|
||||
|
||||
public static function raume_all($projektid, $tt_raume_basis_id, $tt_raumart_id, $out=0, $in=0)
|
||||
{
|
||||
/**
|
||||
* Exepiton (in/out) info in mail from 08.01.2025 from Marie
|
||||
* Fragestellung ist folgende:
|
||||
* beim WE-Objekt KIGA (Kindergarten) gibt es einen Raum „Garten-Lager EG", der nur über den Garten EG erreicht wird.
|
||||
* Der Garten ist ein Zubehör-Objekt zum KIGA (Methode 4).
|
||||
* Der Raum „Garten-Lager EG“ soll nun dem Garten zugeordnet werden (quasi als Zuschlag zum Zubehör), und darunter angeführt werden.
|
||||
* Siehe Anhang pdf auf Seite 15. (attachment in email)
|
||||
* */
|
||||
|
||||
$where = [];
|
||||
$where['AND']['pid'] = $projektid;
|
||||
$where['AND']['tt_raume_basis_id'] = $tt_raume_basis_id;
|
||||
if ($in) {
|
||||
$where['AND']['OR']['id'] = [$in];
|
||||
$where['AND']['OR']['tt_raumart_id'] = $tt_raumart_id;
|
||||
}
|
||||
else if ($out) {
|
||||
$where['AND']['tt_raumart_id'] = $tt_raumart_id;
|
||||
$where['AND']['id[!]'] = [$out];
|
||||
}
|
||||
else {
|
||||
$where['AND']['tt_raumart_id'] = $tt_raumart_id;
|
||||
}
|
||||
$where['ORDER']['raum'] = 'ASC';
|
||||
// if($in){
|
||||
// $res = DbFunction::select(
|
||||
// 'tx_gutachten_raume_all',
|
||||
// '*',
|
||||
// $where
|
||||
// );
|
||||
// print_r($res);
|
||||
// exit;
|
||||
// }
|
||||
|
||||
return DbFunction::select(
|
||||
'tx_gutachten_raume_all',
|
||||
'*',
|
||||
$where
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
public static function methoden_by_raumart($raumart)
|
||||
{
|
||||
$tmp = DbFunction::select('tx_gutachten_raumart', 'id', ['raumart' => $raumart]);
|
||||
if (isset($tmp[0]['id'])) {
|
||||
return $tmp[0]['id'];
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
public static function raeume_alle_orientierung($projektid)
|
||||
{
|
||||
// DbFunction::$debug = 1;
|
||||
|
||||
$res = DbFunction::select('tx_gutachten_orientierung', ['id', 'orientierung'], ['ORDER' => 'sortierung']);
|
||||
$map = [];
|
||||
foreach ($res as $field => $value) {
|
||||
$map[$value['id']] = $value['orientierung'];
|
||||
}
|
||||
|
||||
// $basis_stellplaetze = DbFunction::select('tx_gutachten_raume_all', 'tt_raume_basis_id', ['pid' => $projektid, 'raum' => ['Stellplatz+', 'Stellplatz']]);
|
||||
$arr = DbFunction::select('tx_gutachten_raume_basis', '*', ['pid' => $projektid, 'noDispInOrientierung' => 0, 'ORDER' => 'topNr']);
|
||||
foreach ($arr as $key => $value) {
|
||||
$arr[$key]['orientierung'] = $map[$value['tt_orientierung_id']];
|
||||
}
|
||||
|
||||
// $_range = range("a","u");
|
||||
foreach ($arr as $key => $value) {
|
||||
// foreach ($_range as $k => $char) {
|
||||
// $arr[$key][$char] = (double) $value[$char];
|
||||
// }
|
||||
$arr[$key]['id'] = (int) $value['id'];
|
||||
$arr[$key]['pid'] = (int) $value['pid'];
|
||||
$arr[$key]['uid'] = (int) $value['uid'];
|
||||
$arr[$key]['GNO'] = (int) $value['GNO'];
|
||||
$arr[$key]['tt_orientierung_id'] = (int) $value['tt_orientierung_id'];
|
||||
$arr[$key]['noDispInOrientierung'] = (int) $value['noDispInOrientierung'];
|
||||
// $arr[$key]['bewertung'] = (double) $value['bewertung'];
|
||||
// $arr[$key]['factor'] = (double) $value['factor'];
|
||||
// $arr[$key]['qmM1'] = (double) $value['qmM1'];
|
||||
// $arr[$key]['qmM1uM2'] = (double) $value['qmM1uM2'];
|
||||
// $arr[$key]['qmM1uM2bis'] = (double) $value['qmM1uM2bis'];
|
||||
// $arr[$key]['NWM1uM2'] = (double) $value['NWM1uM2'];
|
||||
// $arr[$key]['qmM1uM2'] = (double) $value['qmM1uM2'];raume_all
|
||||
// $arr[$key]['summe_az'] = (double) $value['summe_az'];
|
||||
}
|
||||
|
||||
return $arr;
|
||||
}
|
||||
|
||||
public static function raume_basis()
|
||||
{
|
||||
// $fields = ' a.id,
|
||||
// a.topNr,
|
||||
// b.geschoss,
|
||||
// a.typ,
|
||||
// 0 as nutzflaeche,
|
||||
// 0 as logia,
|
||||
// 0 as gesammtnutzflaeche,
|
||||
// '.$title_list.',
|
||||
// a.summe_az,
|
||||
// a.bewertung';
|
||||
//
|
||||
// $from = 'tx_gutachten_raume_basis a, tx_gutachten_raume_all b';
|
||||
// $where = 'b.tt_raume_basis_id = a.id';
|
||||
// $where .= " and a.noDispInOrientierung=0 and b.tt_raumart_id = 1 and a.pid = $projektid";
|
||||
|
||||
$_fields = [
|
||||
'tx_gutachten_raume_basis.id',
|
||||
'tx_gutachten_raume_basis.topNr',
|
||||
'tx_gutachten_raume_basis.typ',
|
||||
'tx_gutachten_raume_basis.summe_az',
|
||||
'tx_gutachten_raume_basis.bewertung',
|
||||
'tx_gutachten_raume_all.geschoss',
|
||||
];
|
||||
|
||||
$_titles = DbFunction::select('tx_gutachten_help', 'colid', ['pid' => $projektid]);
|
||||
foreach ($_titles as $key => $colid) {
|
||||
$_fields[] = 'tx_gutachten_raume_basis.'.$colid;
|
||||
}
|
||||
|
||||
$arr = DbFunction::selectJoin(
|
||||
'tx_gutachten_raume_basis',
|
||||
['[>]tx_gutachten_raume_all' => ['tx_gutachten_raume_basis.id' => 'tt_raume_basis_id']],
|
||||
$_fields,
|
||||
[
|
||||
'tx_gutachten_raume_basis.pid' => 17,
|
||||
'GROUP' => 'tx_gutachten_raume_basis.id',
|
||||
'ORDER' => ['tx_gutachten_raume_basis.topNr' => 'DESC'],
|
||||
]
|
||||
);
|
||||
|
||||
foreach ($arr as $key => $value) {
|
||||
$arr[$key]['nutzflaeche'] = 0;
|
||||
$arr[$key]['logia'] = 0;
|
||||
$arr[$key]['gesammtnutzflaeche'] = 0;
|
||||
}
|
||||
|
||||
return $arr;
|
||||
}
|
||||
|
||||
public static function orientierung_typen_column_einzel()
|
||||
{
|
||||
$projektid = GeneralUtility::_GP('id');
|
||||
|
||||
if (!is_numeric($projektid)) {
|
||||
return [];
|
||||
}
|
||||
|
||||
$arr = DbFunction::select('tx_gutachten_help', ['id', 'colid', 'coltitel'], ['pid' => $projektid, 'ORDER' => 'colid']);
|
||||
|
||||
foreach ($arr as $key => $value) {
|
||||
$arr[$key]['id'] = (int) $value['id'];
|
||||
$arr[$key]['pos'] = (int) $key + 1;
|
||||
}
|
||||
|
||||
return $arr;
|
||||
}
|
||||
|
||||
public static function platzhalter($projektid)
|
||||
{
|
||||
$arr = Projekte::projekt_standards($projektid);
|
||||
|
||||
$_platzhalter = [];
|
||||
foreach ($arr as $key => $value) {
|
||||
preg_match_all('/###(.*)###/U', $value['txt'], $pat_array);
|
||||
$_platzhalter = array_merge($_platzhalter, $pat_array[0]);
|
||||
}
|
||||
$_platzhalter = array_unique($_platzhalter);
|
||||
|
||||
DbFunction::delete('tx_gutachten_projekteplatzhalter', ['AND' => ['pid' => $projektid, 'code[!]' => $_platzhalter]]);
|
||||
|
||||
foreach ($_platzhalter as $key => $code) {
|
||||
$arr = DbFunction::select('tx_gutachten_projekteplatzhalter', ['id', 'code', 'txt'], ['AND' => ['pid' => $projektid, 'code' => $code]]);
|
||||
if (0 == \count($arr)) {
|
||||
$_value_array = [];
|
||||
$_value_array['code'] = $code;
|
||||
$_value_array['pid'] = $projektid;
|
||||
DbFunction::secureInsert('tx_gutachten_projekteplatzhalter', $_value_array);
|
||||
} elseif (\count($arr) > 1) {
|
||||
foreach ($arr as $key => $value) {
|
||||
if ($key > 0) {
|
||||
DbFunction::delete('tx_gutachten_projekteplatzhalter', ['id' => $value['id']]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$arr = DbFunction::select('tx_gutachten_projekteplatzhalter', ['id', 'code', 'txt'], ['AND' => ['pid' => $projektid, 'code' => $_platzhalter]]);
|
||||
foreach ($arr as $key => $value) {
|
||||
$arr[$key]['code'] = html_entity_decode($value['code']);
|
||||
$arr[$key]['txt'] = html_entity_decode($value['txt']);
|
||||
}
|
||||
|
||||
return $arr;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,103 @@
|
||||
<?php
|
||||
|
||||
namespace HermannTelser\Gutachten\DB\Select;
|
||||
|
||||
use HermannTelser\Gutachten\DB\DbFunction;
|
||||
|
||||
/***
|
||||
*
|
||||
* This file is part of the "NuhOdds Comparatore" Extension for TYPO3 CMS.
|
||||
*
|
||||
* For the full copyright and license information, please read the
|
||||
* LICENSE.txt file that was distributed with this source code.
|
||||
*
|
||||
* (c) 2019 Hermann Telser <hermann.telser@gmail.com>, NUH-Odds GmbH
|
||||
*
|
||||
***/
|
||||
|
||||
class Standards
|
||||
{
|
||||
public static function projekt_standards($id)
|
||||
{
|
||||
// $fields = 'a.*, b.txt textart';
|
||||
// $from = 'tx_gutachten_projektestandards a, tx_gutachten_textart b';
|
||||
// $where = "a.textart_id=b.id and a.pid=$projekt_id";
|
||||
// return $GLOBALS['TYPO3_DB']->SELECTquery($fields, $from, $where, "", "pos");
|
||||
// return $GLOBALS['TYPO3_DB']->exec_SELECTgetRows($fields, $from, $where, '', 'pos');
|
||||
|
||||
$where = ['ORDER' => 'pos'];
|
||||
if ($id) {
|
||||
$where['tx_gutachten_projektestandards.pid'] = $id;
|
||||
}
|
||||
$join = [];
|
||||
$join['[>]tx_gutachten_textart']['tx_gutachten_projektestandards.textart_id'] = 'id';
|
||||
|
||||
$fields = [
|
||||
'tx_gutachten_projektestandards.id',
|
||||
'tx_gutachten_projektestandards.pos',
|
||||
'tx_gutachten_projektestandards.textart_id',
|
||||
'tx_gutachten_projektestandards.spalten',
|
||||
'tx_gutachten_projektestandards.fontsize',
|
||||
'tx_gutachten_projektestandards.neueseite',
|
||||
'tx_gutachten_projektestandards.kennung',
|
||||
'tx_gutachten_projektestandards.titel',
|
||||
'tx_gutachten_projektestandards.txt',
|
||||
'tx_gutachten_projektestandards.platzhalter',
|
||||
'tx_gutachten_textart.txt(textart)',
|
||||
];
|
||||
|
||||
return DbFunction::selectJoin(
|
||||
'tx_gutachten_projektestandards',
|
||||
$join,
|
||||
$fields,
|
||||
$where
|
||||
);
|
||||
}
|
||||
|
||||
public static function standards()
|
||||
{
|
||||
// $fields = 'a.*, b.txt textart';
|
||||
// $from = 'tx_gutachten_standards a, tx_gutachten_textart b';
|
||||
// $where = 'a.textart_id=b.id';
|
||||
// // return $GLOBALS['TYPO3_DB']->SELECTquery($fields, $from, $where, "", "pos");
|
||||
// return $GLOBALS['TYPO3_DB']->exec_SELECTgetRows($fields, $from, $where, '', 'pos');
|
||||
|
||||
$join = [];
|
||||
$join['[>]tx_gutachten_textart']['tx_gutachten_standards.textart_id'] = 'id';
|
||||
|
||||
$fields = [
|
||||
'tx_gutachten_standards.id',
|
||||
'tx_gutachten_standards.textart_id',
|
||||
'tx_gutachten_standards.spalten',
|
||||
'tx_gutachten_standards.fontsize',
|
||||
'tx_gutachten_standards.neueseite',
|
||||
'tx_gutachten_standards.kennung',
|
||||
'tx_gutachten_standards.titel',
|
||||
'tx_gutachten_standards.txt',
|
||||
'tx_gutachten_standards.platzhalter',
|
||||
'tx_gutachten_textart.txt(textart)',
|
||||
];
|
||||
|
||||
return DbFunction::selectJoin(
|
||||
'tx_gutachten_standards',
|
||||
$join,
|
||||
$fields,
|
||||
['ORDER' => 'pos']
|
||||
);
|
||||
}
|
||||
|
||||
public static function standards_alle()
|
||||
{
|
||||
$arr = self::standards();
|
||||
|
||||
foreach ($arr as $key => $value) {
|
||||
$arr[$key]['id'] = (int) $value['id'];
|
||||
$arr[$key]['pos'] = (int) $key;
|
||||
$arr[$key]['textart'] = ucwords($value['textart']);
|
||||
$arr[$key]['neueseite'] = (int) $value['neueseite'];
|
||||
$arr[$key]['all'] = \count($arr);
|
||||
}
|
||||
|
||||
return $arr;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
namespace HermannTelser\Gutachten\DB\Select;
|
||||
|
||||
use HermannTelser\Gutachten\DB\DbFunction;
|
||||
use TYPO3\CMS\Core\Utility\GeneralUtility;
|
||||
|
||||
class StandardsAdd
|
||||
{
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public static function add($projektid)
|
||||
{
|
||||
|
||||
// DbFunction::$debug = 1;
|
||||
|
||||
if (!is_numeric($projektid)) {
|
||||
exit;
|
||||
}
|
||||
|
||||
$_value_array = [];
|
||||
$_value_array['pid'] = $projektid;
|
||||
$_value_array['pos'] = 3000;
|
||||
$_value_array['kennung'] = "FEHLT!";
|
||||
$_value_array['titel'] = "FEHLT!";
|
||||
DbFunction::secureInsert('tx_gutachten_projektestandards', $_value_array);
|
||||
|
||||
echo 1;
|
||||
exit;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
<?php
|
||||
|
||||
namespace HermannTelser\Gutachten\DB\Select;
|
||||
|
||||
use HermannTelser\Gutachten\DB\DbFunction;
|
||||
|
||||
class StandardsEinzeln
|
||||
{
|
||||
/**
|
||||
* @param mixed $id
|
||||
* @param mixed $projektid
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public static function load($projektid)
|
||||
{
|
||||
DbFunction::$debug = 0;
|
||||
|
||||
$arr = DbFunction::select('tx_gutachten_projektestandards', '*', ['pid' => $projektid, 'ORDER' => 'pos']);
|
||||
|
||||
if (0 == \count($arr)) {
|
||||
$arr = Standards::standards();
|
||||
|
||||
foreach ($arr as $key => $value) {
|
||||
unset($value['id']);
|
||||
unset($value['textart']);
|
||||
$value['pid'] = $projektid;
|
||||
$value_array = [];
|
||||
$value_array = $value;
|
||||
|
||||
DbFunction::secureInsert('tx_gutachten_projektestandards', $value_array);
|
||||
}
|
||||
|
||||
$arr = DbFunction::select('tx_gutachten_projektestandards', '*', ['pid' => $projektid, 'ORDER' => 'pos']);
|
||||
}
|
||||
|
||||
$sum = \count($arr);
|
||||
$value_array = [];
|
||||
foreach ($arr as $key => $value) {
|
||||
$arr[$key]['all'] = $sum;
|
||||
$arr[$key]['id'] = (int) $value['id'];
|
||||
if ($value['pos'] == 0) {
|
||||
$value_array['pos'] = $key+1;
|
||||
DbFunction::secureUpdate('tx_gutachten_projektestandards', $value_array, ['id' => $value['id']]);
|
||||
$arr[$key]['pos'] = (int) $key+1;;
|
||||
} else {
|
||||
$arr[$key]['pos'] = (int) $value['pos'];
|
||||
}
|
||||
$arr[$key]['hat_platzhalter'] = false !== strpos($value['txt'], '###') ? 1 : 0;
|
||||
$arr[$key]['neueseite'] = (int) $value['neueseite'];
|
||||
$arr[$key]['textart'] = ucwords($value['textart']);
|
||||
}
|
||||
return $arr;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,66 @@
|
||||
<?php
|
||||
|
||||
namespace HermannTelser\Gutachten\DB\Select;
|
||||
|
||||
use HermannTelser\Gutachten\DB\DbFunction;
|
||||
use TYPO3\CMS\Core\Utility\GeneralUtility;
|
||||
|
||||
class StandardsMove
|
||||
{
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public static function move()
|
||||
{
|
||||
$id = GeneralUtility::_GP('id');
|
||||
if (!is_numeric($id)) {
|
||||
return [];
|
||||
}
|
||||
|
||||
$pid = GeneralUtility::_GP('pid');
|
||||
if (!is_numeric($pid)) {
|
||||
return [];
|
||||
}
|
||||
|
||||
$dir = GeneralUtility::_GP('move');
|
||||
if (!\in_array($dir, ['first', 'up', 'down', 'last'])) {
|
||||
return [];
|
||||
}
|
||||
|
||||
$arr = DbFunction::select('tx_gutachten_projektestandards', '*', ['pid' => $pid, 'ORDER' => 'pos']);
|
||||
|
||||
$order = [];
|
||||
foreach ($arr as $key => $value) {
|
||||
$k = $value['pos'] * 10;
|
||||
|
||||
if ($value['id'] == $id) {
|
||||
switch ($dir) {
|
||||
case 'first':
|
||||
$k = 0;
|
||||
break;
|
||||
case 'up':
|
||||
$k -= 15;
|
||||
break;
|
||||
case 'down':
|
||||
$k += 15;
|
||||
break;
|
||||
case 'last':
|
||||
$k = 3000;
|
||||
break;
|
||||
}
|
||||
}
|
||||
$order[$k] = $value;
|
||||
}
|
||||
ksort($order);
|
||||
|
||||
$i = 1;
|
||||
$update_array = [];
|
||||
foreach ($order as $key => $value) {
|
||||
$value_array['pos'] = $i;
|
||||
DbFunction::secureUpdate('tx_gutachten_projektestandards', $value_array, ['id' => $value['id']]);
|
||||
++$i;
|
||||
}
|
||||
echo 1;
|
||||
exit;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,112 @@
|
||||
<?php
|
||||
|
||||
namespace HermannTelser\Gutachten\DB\Select;
|
||||
|
||||
use TYPO3\CMS\Core\Utility\GeneralUtility;
|
||||
|
||||
/***
|
||||
*
|
||||
* This file is part of the "NuhOdds Comparatore" Extension for TYPO3 CMS.
|
||||
*
|
||||
* For the full copyright and license information, please read the
|
||||
* LICENSE.txt file that was distributed with this source code.
|
||||
*
|
||||
* (c) 2019 Hermann Telser <hermann.telser@gmail.com>, NUH-Odds GmbH
|
||||
*
|
||||
***/
|
||||
|
||||
class _SelectController
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
$arr = [];
|
||||
$projektid = GeneralUtility::_GP('id');
|
||||
switch (GeneralUtility::_GP('action')) {
|
||||
case 'orientierung_alle':
|
||||
$arr = Select::select_table('tx_gutachten_orientierung');
|
||||
break;
|
||||
case 'gutachter_alle':
|
||||
$arr = Select::select_table('tx_gutachten_gutachter');
|
||||
break;
|
||||
case 'load_methoden_projekt':
|
||||
$arr = MethodenProjekt::select();
|
||||
break;
|
||||
case 'load_methoden':
|
||||
$arr = MethodenInfo::load();
|
||||
break;
|
||||
case 'p_allgemeine_alle':
|
||||
$arr = ProjektAllgemeinAlle::select();
|
||||
break;
|
||||
case 'auftraggeber_alle':
|
||||
$arr = Auftraggeber::select();
|
||||
break;
|
||||
case 'textart_alle':
|
||||
$arr = Select::text_art();
|
||||
break;
|
||||
case 'standards_alle':
|
||||
$arr = Standards::standards_alle();
|
||||
break;
|
||||
case 'standards_einzeln':
|
||||
$arr = StandardsEinzeln::load($projektid);
|
||||
break;
|
||||
case 'standards_add':
|
||||
StandardsAdd::add($projektid);
|
||||
break;
|
||||
case 'move_position':
|
||||
StandardsMove::move();
|
||||
break;
|
||||
case 'load_orientation_for_select':
|
||||
$arr = Select::orientierung_select();
|
||||
break;
|
||||
case 'orientierung_typen_colums_einzel':
|
||||
$arr = Select::orientierung_typen_column_einzel();
|
||||
break;
|
||||
case 'orientierung_typen_einzel':
|
||||
$arr = Select::raeume_alle_orientierung($projektid);
|
||||
break;
|
||||
case 'projekte_alle':
|
||||
$arr = Select::projekte();
|
||||
break;
|
||||
case 'aufstellung_alle':
|
||||
$arr = Select::aufstellung();
|
||||
break;
|
||||
case 'p_objekte_alle':
|
||||
$arr = Objekte::select($projektid);
|
||||
break;
|
||||
case 'p_notizen_alle':
|
||||
Notizen::notizen_projekt_laden();
|
||||
break;
|
||||
case 'projekte_basis_stammdaten':
|
||||
ProjekteStammdatenEinzeln::load();
|
||||
break;
|
||||
case 'projekt_status':
|
||||
ProjekteSetStatus::set();
|
||||
break;
|
||||
case 'projekt_active':
|
||||
ProjekteSetActive::set();
|
||||
break;
|
||||
case 'projekt_clone':
|
||||
ProjektClone::clone();
|
||||
break;
|
||||
case 'load_methoden_for_select':
|
||||
$arr = Select::select_table('tx_gutachten_raumart');
|
||||
break;
|
||||
case 'platzhalter_einzeln':
|
||||
$arr = Select::platzhalter($projektid);
|
||||
break;
|
||||
case 'load_aufstellung':
|
||||
$arr = Select::aufstellung();
|
||||
break;
|
||||
default:
|
||||
Message::error(
|
||||
__FILE__,
|
||||
__LINE__,
|
||||
'no controller switch defined'
|
||||
);
|
||||
}
|
||||
|
||||
header('Content-Type: application/json');
|
||||
echo json_encode($arr);
|
||||
exit();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
namespace HermannTelser\Gutachten\DB\Update;
|
||||
|
||||
use TYPO3\CMS\Core\Utility\GeneralUtility;
|
||||
use HermannTelser\Gutachten\DB\DbFunction;
|
||||
|
||||
class AbgleichRaumeGenerell
|
||||
{
|
||||
public static function update()
|
||||
{
|
||||
// DbFunction::$debug = 1;
|
||||
|
||||
$projektid = GeneralUtility::_GP('id');
|
||||
|
||||
$arr = DbFunction::select('tx_gutachten_raume_all', ['tt_raumart_id', 'raum', 'factor'], ['pid' => $projektid]);
|
||||
|
||||
foreach ($arr as $value) {
|
||||
$arr2 = DbFunction::get('tx_gutachten_raume_generell', 'pid', ['AND' => ['raum' => $value['raum'], 'pid' => $projektid]]);
|
||||
if (!$arr2) {
|
||||
$insert_array = [];
|
||||
$insert_array['tt_raumart_id'] = $value['tt_raumart_id'];
|
||||
$insert_array['pid'] = $projektid;
|
||||
$insert_array['raum'] = $value['raum'];
|
||||
$insert_array['factor'] = $value['factor'];
|
||||
DbFunction::secureInsert('tx_gutachten_raume_generell', $insert_array);
|
||||
}
|
||||
}
|
||||
echo 1;
|
||||
exit;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
namespace HermannTelser\Gutachten\DB\Update;
|
||||
|
||||
use TYPO3\CMS\Core\Utility\GeneralUtility;
|
||||
use HermannTelser\Gutachten\DB\DbFunction;
|
||||
|
||||
class ToggleField
|
||||
{
|
||||
/**
|
||||
* @param mixed $id
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public static function update()
|
||||
{
|
||||
// DbFunction::$debug = 1;
|
||||
|
||||
$table = GeneralUtility::_GP('table');
|
||||
$field = GeneralUtility::_GP('field');
|
||||
$rowid = GeneralUtility::_GP('id');
|
||||
$value_array = [];
|
||||
$value_array[$field] = FALSE;
|
||||
// $value_array["$field[*]"] = -1;
|
||||
|
||||
DbFunction::query("UPDATE $table SET $field = !$field WHERE id=$rowid");
|
||||
|
||||
// DbFunction::secureUpdate($table, $update_array, ['id' => $rowid]);
|
||||
echo 1;
|
||||
exit;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
<?php
|
||||
|
||||
namespace HermannTelser\Gutachten\DB\Update;
|
||||
|
||||
use HermannTelser\Gutachten\DB\DbFunction;
|
||||
use HermannTelser\Gutachten\DB\Select;
|
||||
use TYPO3\CMS\Core\Utility\GeneralUtility;
|
||||
|
||||
class UpdateAllgemeine
|
||||
{
|
||||
/**
|
||||
* @param mixed $rowid
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public static function update()
|
||||
{
|
||||
// DbFunction::$debug = 1;
|
||||
|
||||
$field = GeneralUtility::_GP('field');
|
||||
$value = GeneralUtility::_GP('value');
|
||||
$rowid = GeneralUtility::_GP('rowid');
|
||||
|
||||
$update_array = [];
|
||||
switch($field){
|
||||
case "factor";
|
||||
$update_array['qm'] = str_replace(',', '.', $value);
|
||||
break;
|
||||
case "geschoss":
|
||||
$update_array['geschoss'] = (string) $value;
|
||||
break;
|
||||
case "typ":
|
||||
$update_array['typ'] = (string) $value;
|
||||
break;
|
||||
default:
|
||||
exit;
|
||||
}
|
||||
|
||||
DbFunction::secureUpdate("tx_gutachten_allgemein", $update_array, ['id' => $rowid]);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
<?php
|
||||
|
||||
namespace HermannTelser\Gutachten\DB\Update;
|
||||
|
||||
use HermannTelser\Gutachten\DB\DbFunction;
|
||||
use HermannTelser\Gutachten\DB\Select;
|
||||
use TYPO3\CMS\Core\Utility\GeneralUtility;
|
||||
|
||||
class UpdateAllgemeineAll
|
||||
{
|
||||
/**
|
||||
* @param mixed $rowid
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public static function update()
|
||||
{
|
||||
// DbFunction::$debug = 1;
|
||||
|
||||
$field = GeneralUtility::_GP('field');
|
||||
$value = GeneralUtility::_GP('value');
|
||||
$rowid = GeneralUtility::_GP('rowid');
|
||||
|
||||
$update_array = [];
|
||||
switch($field){
|
||||
case "factor";
|
||||
$update_array['factor'] = str_replace(',', '.', $value);
|
||||
break;
|
||||
case "geschoss":
|
||||
$update_array['geschoss'] = (string) $value;
|
||||
break;
|
||||
case "qm":
|
||||
$update_array['qm'] = str_replace(',', '.', $value);
|
||||
break;
|
||||
default:
|
||||
exit;
|
||||
}
|
||||
|
||||
DbFunction::secureUpdate("tx_gutachten_raume_all", $update_array, ['id' => $rowid]);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
namespace HermannTelser\Gutachten\DB\Update;
|
||||
|
||||
use HermannTelser\Gutachten\DB\DbFunction;
|
||||
use TYPO3\CMS\Core\Utility\GeneralUtility;
|
||||
|
||||
class UpdateAufstellung
|
||||
{
|
||||
/**
|
||||
* @param mixed $id
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public static function update()
|
||||
{
|
||||
$value = (string) GeneralUtility::_GP('value');
|
||||
$id = GeneralUtility::_GP('id');
|
||||
DbFunction::secureUpdate('tx_gutachten_aufstellung', ['titel' => $value], ['id' => $id]);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
|
||||
namespace HermannTelser\Gutachten\DB\Update;
|
||||
|
||||
use HermannTelser\Gutachten\DB\DbFunction;
|
||||
use TYPO3\CMS\Core\Utility\GeneralUtility;
|
||||
|
||||
class UpdateAufstellungMany
|
||||
{
|
||||
public static function update()
|
||||
{
|
||||
// DbFunction::$debug = 1;
|
||||
|
||||
$aufstellung_id = GeneralUtility::_GP('aufstellung_id');
|
||||
if (!is_numeric($aufstellung_id)) {
|
||||
return [];
|
||||
}
|
||||
|
||||
$rowdata = GeneralUtility::_GP('data');
|
||||
$data = json_decode($rowdata, true);
|
||||
|
||||
foreach ($data as $key => $rowid) {
|
||||
$update_array = [];
|
||||
$update_array['aufstellung_id'] = $aufstellung_id;
|
||||
DbFunction::secureUpdate('tx_gutachten_raume_generell', $update_array, ['id' => $rowid]);
|
||||
}
|
||||
DbFunction::$projektid = DbFunction::get("tx_gutachten_raume_generell", "pid", ['id' => $rowid]);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
namespace HermannTelser\Gutachten\DB\Update;
|
||||
|
||||
use HermannTelser\Gutachten\DB\DbFunction;
|
||||
use TYPO3\CMS\Core\Utility\GeneralUtility;
|
||||
|
||||
class UpdateField
|
||||
{
|
||||
/**
|
||||
* @param mixed $id
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public static function update()
|
||||
{
|
||||
$table = GeneralUtility::_GP('table');
|
||||
$field = GeneralUtility::_GP('field');
|
||||
$value = GeneralUtility::_GP('value');
|
||||
$rowid = GeneralUtility::_GP('id');
|
||||
$update_array = [];
|
||||
$update_array[$field] = $value;
|
||||
DbFunction::secureUpdate($table, $update_array, ['id' => $rowid]);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
<?php
|
||||
|
||||
namespace HermannTelser\Gutachten\DB\Update;
|
||||
|
||||
use HermannTelser\Gutachten\DB\DbFunction;
|
||||
use HermannTelser\Gutachten\DB\Select;
|
||||
use TYPO3\CMS\Core\Utility\GeneralUtility;
|
||||
|
||||
class UpdateMethod
|
||||
{
|
||||
/**
|
||||
* @param mixed $rowid
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public static function update()
|
||||
{
|
||||
// DbFunction::$debug = 1;
|
||||
|
||||
$field = GeneralUtility::_GP('field');
|
||||
$value = GeneralUtility::_GP('value');
|
||||
$rowid = GeneralUtility::_GP('rowid');
|
||||
|
||||
|
||||
$update_array = [];
|
||||
switch($field){
|
||||
case "factor";
|
||||
$update_array['factor'] = str_replace(',', '.', $value);
|
||||
break;
|
||||
case "raumart_id":
|
||||
$update_array['tt_raumart_id'] =(int) $value;
|
||||
break;
|
||||
default:
|
||||
exit;
|
||||
}
|
||||
|
||||
DbFunction::secureUpdate("tx_gutachten_raume_generell", $update_array, ['id' => $rowid]);
|
||||
|
||||
DbFunction::$projektid = DbFunction::get("tx_gutachten_raume_generell", "pid", ['id' => $rowid]);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
namespace HermannTelser\Gutachten\DB\Update;
|
||||
|
||||
use HermannTelser\Gutachten\DB\DbFunction;
|
||||
use TYPO3\CMS\Core\Utility\GeneralUtility;
|
||||
|
||||
class UpdateMethodMany
|
||||
{
|
||||
public static function update()
|
||||
{
|
||||
// DbFunction::$debug = 1;
|
||||
|
||||
$methodid = GeneralUtility::_GP('methodid');
|
||||
if (!is_numeric($methodid)) {
|
||||
return [];
|
||||
}
|
||||
|
||||
$rowdata = GeneralUtility::_GP('data');
|
||||
$data = json_decode($rowdata, true);
|
||||
|
||||
foreach ($data as $key => $rowid) {
|
||||
$update_array = [];
|
||||
$update_array['tt_raumart_id'] = $methodid;
|
||||
DbFunction::secureUpdate('tx_gutachten_raume_generell', $update_array, ['id' => $rowid]);
|
||||
}
|
||||
|
||||
DbFunction::$projektid = DbFunction::get("tx_gutachten_raume_generell", "pid", ['id' => $rowid]);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
namespace HermannTelser\Gutachten\DB\Update;
|
||||
|
||||
use HermannTelser\Gutachten\DB\DbFunction;
|
||||
use HermannTelser\Gutachten\Eid\TxGutachten;
|
||||
use TYPO3\CMS\Core\Utility\GeneralUtility;
|
||||
|
||||
class UpdateMethodenProjektFactoren
|
||||
{
|
||||
/**
|
||||
* @param mixed $rowid
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public static function update()
|
||||
{
|
||||
// TxGutachten::$debug = 1;
|
||||
|
||||
$_post = GeneralUtility::_GP('data');
|
||||
$_data = json_decode($_post, true);
|
||||
|
||||
|
||||
foreach ($_data as $key => $value) {
|
||||
$factor = str_replace(',', '.', $value['factor']);
|
||||
DbFunction::secureUpdate('tx_gutachten_raume_generell', ['factor' => $factor], ['id' => $value['id']]);
|
||||
}
|
||||
echo 1;
|
||||
exit;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
namespace HermannTelser\Gutachten\DB\Update;
|
||||
|
||||
use HermannTelser\Gutachten\DB\DbFunction;
|
||||
use TYPO3\CMS\Core\Utility\GeneralUtility;
|
||||
|
||||
class UpdateNotizen
|
||||
{
|
||||
/**
|
||||
* @param mixed $id
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public static function update()
|
||||
{
|
||||
// DbFunction::$debug = 1;
|
||||
$value = GeneralUtility::_GP('data');
|
||||
$value = str_replace('"','',$value);
|
||||
$rowid = GeneralUtility::_GP('id');
|
||||
$update_array = [];
|
||||
$update_array['beschreibung'] = $value;
|
||||
|
||||
DbFunction::secureUpdate('tx_gutachten_projekte', $update_array, ['id' => $rowid]);
|
||||
exit;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,56 @@
|
||||
<?php
|
||||
|
||||
namespace HermannTelser\Gutachten\DB\Update;
|
||||
|
||||
use HermannTelser\Gutachten\DB\DbFunction;
|
||||
use TYPO3\CMS\Core\Utility\GeneralUtility;
|
||||
|
||||
class UpdateOrientierungTypenColums
|
||||
{
|
||||
/**
|
||||
* @param mixed $id
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public static function update()
|
||||
{
|
||||
|
||||
// DbFunction::$debug = 1;
|
||||
|
||||
$id = GeneralUtility::_GP('id');
|
||||
if (!is_numeric($id)) {
|
||||
return [];
|
||||
}
|
||||
|
||||
$coltitel = GeneralUtility::_GP('value');
|
||||
|
||||
$update_array = [];
|
||||
$update_array['coltitel'] = $coltitel;
|
||||
DbFunction::secureUpdate('tx_gutachten_help', $update_array, ['id' => $id]);
|
||||
|
||||
echo 1;
|
||||
exit;
|
||||
|
||||
// $rowdata = GeneralUtility::_GP('rowdata');
|
||||
// $data = json_decode($rowdata, true);
|
||||
// $coltitel = GeneralUtility::_GP('value');
|
||||
//
|
||||
// $rowid = $data['id'];
|
||||
//
|
||||
// if ($rowid > 0) {
|
||||
// $update_array = [];
|
||||
// $update_array['coltitel'] = $coltitel;
|
||||
// DbFunction::secureUpdate('tx_gutachten_help', $update_array, ['id' => $id]);
|
||||
// } elseif ($rowid < 0) {
|
||||
// $arr = DbFunction::select('tx_gutachten_help', 'colid', ['id' => $rowid]);
|
||||
// $tmp = array_diff(range('a', 'u'), $arr);
|
||||
// $character = array_shift($tmp);
|
||||
//
|
||||
// $insert_array = [];
|
||||
// $insert_array['pid'] = $id;
|
||||
// $insert_array['colid'] = $character;
|
||||
// $insert_array['coltitel'] = $coltitel;
|
||||
// DbFunction::secureInsert('tx_gutachten_help', $insert_array);
|
||||
// }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
namespace HermannTelser\Gutachten\DB\Update;
|
||||
|
||||
use HermannTelser\Gutachten\DB\DbFunction;
|
||||
use TYPO3\CMS\Core\Utility\GeneralUtility;
|
||||
|
||||
class UpdateProjekt
|
||||
{
|
||||
/**
|
||||
* @param mixed $id
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public static function update()
|
||||
{
|
||||
$table = GeneralUtility::_GP('table');
|
||||
$field = GeneralUtility::_GP('field');
|
||||
$value = GeneralUtility::_GP('value');
|
||||
$rowid = GeneralUtility::_GP('id');
|
||||
$update_array = [];
|
||||
$update_array[$field] = $value;
|
||||
DbFunction::secureUpdate($table, $update_array, ['id' => $rowid]);
|
||||
|
||||
echo 1;
|
||||
exit;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
|
||||
namespace HermannTelser\Gutachten\DB\Update;
|
||||
|
||||
use HermannTelser\Gutachten\DB\Select;
|
||||
use HermannTelser\Gutachten\DB\DbFunction;
|
||||
use TYPO3\CMS\Core\Utility\GeneralUtility;
|
||||
|
||||
class UpdateProjektPlatzhalter
|
||||
{
|
||||
/**
|
||||
* @param mixed $rowid
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public static function update()
|
||||
{
|
||||
$value = GeneralUtility::_GP('value');
|
||||
$rowid = GeneralUtility::_GP('rowid');
|
||||
|
||||
$update_array = [];
|
||||
$update_array['txt'] = $value;
|
||||
|
||||
DbFunction::secureUpdate("tx_gutachten_projekteplatzhalter", $update_array, ['id' => $rowid]);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
namespace HermannTelser\Gutachten\DB\Update;
|
||||
|
||||
use HermannTelser\Gutachten\DB\DbFunction;
|
||||
use TYPO3\CMS\Core\Utility\GeneralUtility;
|
||||
|
||||
class UpdateProjektStandards
|
||||
{
|
||||
/**
|
||||
* @param mixed $rowid
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public static function update()
|
||||
{
|
||||
// DbFunction::$debug = 1;
|
||||
|
||||
$data = GeneralUtility::_GP('data');
|
||||
$data = json_decode($data, true);
|
||||
$rowid = GeneralUtility::_GP('rowid');
|
||||
|
||||
$update_array = [];
|
||||
foreach ($data as $key => $value) {
|
||||
$update_array = array_merge($update_array, $value);
|
||||
}
|
||||
// $update_array['kennung'] = $update_array['titel'];
|
||||
DbFunction::secureUpdate("tx_gutachten_projektestandards", $update_array, ['id' => $rowid]);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,67 @@
|
||||
<?php
|
||||
|
||||
namespace HermannTelser\Gutachten\DB\Update;
|
||||
|
||||
use HermannTelser\Gutachten\DB\DbFunction;
|
||||
use HermannTelser\Gutachten\Eid\TxGutachten;
|
||||
use TYPO3\CMS\Core\Utility\GeneralUtility;
|
||||
|
||||
class UpdateRaeumeAlleOrientierung
|
||||
{
|
||||
/**
|
||||
* @param mixed $rowid
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public static function update()
|
||||
{
|
||||
// TxGutachten::$debug = 1;
|
||||
|
||||
$projekt_id = 0;
|
||||
|
||||
$_post = GeneralUtility::_GP('data');
|
||||
$_data = json_decode($_post, true);
|
||||
|
||||
$res = DbFunction::select('tx_gutachten_orientierung', ['id', 'orientierung'], ['ORDER' => 'sortierung']);
|
||||
$map = [];
|
||||
foreach ($res as $field => $value) {
|
||||
$map[$value['orientierung']] = $value['id'];
|
||||
}
|
||||
|
||||
$_range = range('a', 'u');
|
||||
foreach ($_data as $key => $value) {
|
||||
$projekt_id = $value['pid'];
|
||||
$raume_basis_id = $value['id'];
|
||||
$update_array = [];
|
||||
foreach ($_range as $key => $col) {
|
||||
$value[$col] = str_replace(',', '.', $value[$col]);
|
||||
$update_array[$col] = (float) $value[$col];
|
||||
}
|
||||
$update_array['tt_orientierung_id'] = $map[$value['orientierung']];
|
||||
$update_array['typ'] = $value['typ'];
|
||||
DbFunction::secureUpdate('tx_gutachten_raume_basis', $update_array, ['id' => $raume_basis_id]);
|
||||
}
|
||||
|
||||
DbFunction::secureUpdate('tx_gutachten_raume_basis', ['noDispInOrientierung' => 0], ['pid' => $projektid]);
|
||||
$res = DbFunction::select('tx_gutachten_raume_all', 'tt_raume_basis_id', ['AND' => ['pid' => $projektid, 'tt_raumart_id' => [5, 6, 9]], 'GROUP' => 'tt_raume_basis_id']);
|
||||
DbFunction::secureUpdate('tx_gutachten_raume_basis', ['noDispInOrientierung' => 1], ['id' => $res]);
|
||||
|
||||
$fields = range('a', 'u');
|
||||
$res = DbFunction::select('tx_gutachten_raume_basis', 'id', ['AND' => ['pid' => $projekt_id, 'noDispInOrientierung' => 0]]);
|
||||
foreach ($res as $key => $raume_basis_id) {
|
||||
$arr = DbFunction::select('tx_gutachten_raume_basis', $fields, ['id' => $raume_basis_id]);
|
||||
$summe = array_sum($arr[0]);
|
||||
$bewertung = 100 + $summe;
|
||||
$factor = $bewertung / 100;
|
||||
|
||||
$update_array = [];
|
||||
$update_array['summe_az'] = $summe;
|
||||
$update_array['bewertung'] = $bewertung;
|
||||
$update_array['factor'] = $factor;
|
||||
DbFunction::secureUpdate('tx_gutachten_raume_basis', $update_array, ['id' => $raume_basis_id]);
|
||||
}
|
||||
|
||||
echo 1;
|
||||
exit;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
|
||||
namespace HermannTelser\Gutachten\DB\Update;
|
||||
|
||||
use TYPO3\CMS\Core\Utility\GeneralUtility;
|
||||
use HermannTelser\Gutachten\DB\DbFunction;
|
||||
|
||||
class UpdateRow
|
||||
{
|
||||
/**
|
||||
* @param mixed $id
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public static function update()
|
||||
{
|
||||
$table = GeneralUtility::_GP('table');
|
||||
$rowdata = GeneralUtility::_GP('rowdata');
|
||||
$data = json_decode($rowdata, true);
|
||||
$id = GeneralUtility::_GP('id');
|
||||
$update_array = [];
|
||||
foreach ($data as $key => $subdata) {
|
||||
foreach ($subdata as $field => $value) {
|
||||
$update_array[$field] = $value;
|
||||
}
|
||||
}
|
||||
DbFunction::secureUpdate($table, $update_array, "id = $id");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,107 @@
|
||||
<?php
|
||||
|
||||
namespace HermannTelser\Gutachten\DB\Update;
|
||||
|
||||
use HermannTelser\Gutachten\Utility\Message;
|
||||
use TYPO3\CMS\Core\Utility\GeneralUtility;
|
||||
use HermannTelser\Gutachten\Berechnungen\Berechnung;
|
||||
use HermannTelser\Gutachten\DB\DbFunction;
|
||||
|
||||
/***
|
||||
*
|
||||
* This file is part of the "NuhOdds Comparatore" Extension for TYPO3 CMS.
|
||||
*
|
||||
* For the full copyright and license information, please read the
|
||||
* LICENSE.txt file that was distributed with this source code.
|
||||
*
|
||||
* (c) 2019 Hermann Telser <hermann.telser@gmail.com>, NUH-Odds GmbH
|
||||
*
|
||||
***/
|
||||
|
||||
class _UpdateController
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
$id = GeneralUtility::_GP('id');
|
||||
if($id && is_numeric($id)){
|
||||
DbFunction::query("UPDATE tx_gutachten_projekte SET timestamp = current_timestamp WHERE id=". GeneralUtility::_GP('id'));
|
||||
}
|
||||
|
||||
$arr = [];
|
||||
switch (GeneralUtility::_GP('action')) {
|
||||
// update
|
||||
case 'abgleich_raume_generell':
|
||||
AbgleichRaumeGenerell::update();
|
||||
break;
|
||||
case 'update_projektestandards':
|
||||
UpdateProjektStandards::update();
|
||||
break;
|
||||
case 'update_project_platzhalter':
|
||||
UpdateProjektPlatzhalter::update();
|
||||
// Berechnung::berechnen();
|
||||
break;
|
||||
case 'update_project':
|
||||
UpdateProjekt::update();
|
||||
// Berechnung::berechnen();
|
||||
break;
|
||||
case 'update_notizen':
|
||||
UpdateNotizen::update();
|
||||
// Berechnung::berechnen();
|
||||
break;
|
||||
case 'update_aufstellung':
|
||||
UpdateAufstellung::update();
|
||||
break;
|
||||
case 'update_field':
|
||||
UpdateField::update();
|
||||
break;
|
||||
case 'toggle_field':
|
||||
ToggleField::update();
|
||||
break;
|
||||
case 'update_row':
|
||||
UpdateRow::update();
|
||||
break;
|
||||
case 'update_method_many':
|
||||
UpdateMethodMany::update();
|
||||
Berechnung::berechnen();
|
||||
break;
|
||||
case 'update_austellung_many':
|
||||
UpdateAufstellungMany::update();
|
||||
break;
|
||||
case 'update_method':
|
||||
UpdateMethod::update();
|
||||
Berechnung::berechnen();
|
||||
break;
|
||||
case 'update_allgemein':
|
||||
UpdateAllgemeine::update();
|
||||
break;
|
||||
case 'update_orientierung_typen_colums':
|
||||
UpdateOrientierungTypenColums::update();
|
||||
break;
|
||||
case 'update_raeume_alle_orientierung':
|
||||
UpdateRaeumeAlleOrientierung::update();
|
||||
break;
|
||||
case 'update_methoden_projekt_factoren':
|
||||
UpdateMethodenProjektFactoren::update();
|
||||
break;
|
||||
case 'update_raume_all':
|
||||
UpdateAllgemeineAll::update();
|
||||
break;
|
||||
default:
|
||||
Message::error(
|
||||
__FILE__,
|
||||
__LINE__,
|
||||
'no controller switch defined'
|
||||
);
|
||||
}
|
||||
|
||||
if (null !== GeneralUtility::_GP('berechnen')) {
|
||||
Berechnung::berechnen();
|
||||
}
|
||||
echo 1;
|
||||
exit;
|
||||
|
||||
// header('Content-Type: application/json');
|
||||
// echo json_encode($arr);
|
||||
// exit();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
<?php
|
||||
|
||||
namespace HermannTelser\Gutachten\Downloads;
|
||||
|
||||
use HermannTelser\Gutachten\Utility\Helper;
|
||||
use HermannTelser\Gutachten\DB\DbFunction;
|
||||
|
||||
class AllgemeinTabelle
|
||||
{
|
||||
public static function load()
|
||||
{
|
||||
|
||||
$_allgemeine = DbFunction::select('tx_gutachten_allgemein', ['geschoss', 'typ', 'qm'], ['pid' => DbFunction::$projektid]);
|
||||
|
||||
$_data = array_chunk($_allgemeine, 2);
|
||||
|
||||
$html = '<table class="pure-table pure-table-striped br size07" style="width: 100%;">';
|
||||
$html .= '<tr>';
|
||||
$html .= '<th class="allheader" style="border-top: 0.1mm solid #cbcbcb; border-bottom: 0.1mm solid #cbcbcb;">Geschoß</th>';
|
||||
$html .= '<th class="allheader" style="width:50mm; border-top: 0.1mm solid #cbcbcb; border-bottom: 0.1mm solid #cbcbcb;">Typ</th>';
|
||||
$html .= '<th class="allheader" style="border-top: 0.1mm solid #cbcbcb; border-bottom: 0.1mm solid #cbcbcb;">Fläche</th>';
|
||||
$html .= '<td style="background-color:#fff;"></td>';
|
||||
$html .= '<th class="allheader" style="border-top: 0.1mm solid #cbcbcb; border-bottom: 0.1mm solid #cbcbcb;">Geschoß</th>';
|
||||
$html .= '<th class="allheader" style="width:50mm; border-top: 0.1mm solid #cbcbcb; border-bottom: 0.1mm solid #cbcbcb;">Typ</th>';
|
||||
$html .= '<th class="allheader" style="border-top: 0.1mm solid #cbcbcb; border-bottom: 0.1mm solid #cbcbcb;">Fläche</th>';
|
||||
$html .= '</tr>';
|
||||
|
||||
foreach ($_data as $key => $value) {#
|
||||
$html .= '<tr>';
|
||||
if (isset($value[0])) {
|
||||
$html .= '<td style="border-bottom: 0.1mm solid #cbcbcb;">'.$value[0]['geschoss'].'</td>';
|
||||
$html .= '<td style="border-bottom: 0.1mm solid #cbcbcb;">'.$value[0]['typ'].'</td>';
|
||||
$html .= '<td style="border-bottom: 0.1mm solid #cbcbcb;">'.Helper::number_format_de($value[0]['qm'], 2).'</td>';
|
||||
$html .= '<td style="background-color:#fff;"></td>';
|
||||
}
|
||||
if (isset($value[1])) {
|
||||
$html .= '<td style="border-bottom: 0.1mm solid #cbcbcb;">'.$value[1]['geschoss'].'</td>';
|
||||
$html .= '<td style="border-bottom: 0.1mm solid #cbcbcb;">'.$value[1]['typ'].'</td>';
|
||||
$html .= '<td style="border-bottom: 0.1mm solid #cbcbcb;">'.Helper::number_format_de($value[1]['qm'], 2).'</td>';
|
||||
}
|
||||
$html .= '</tr>';
|
||||
|
||||
}
|
||||
$html .= '</table>';
|
||||
return $html;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,70 @@
|
||||
<?php
|
||||
|
||||
namespace HermannTelser\Gutachten\Downloads;
|
||||
|
||||
use HermannTelser\Gutachten\Utility\Helper;
|
||||
use TYPO3\CMS\Core\Core\Environment;
|
||||
|
||||
class Deckblatt
|
||||
{
|
||||
/**
|
||||
* @param mixed $value
|
||||
* @param mixed $_platzhalter
|
||||
* @param mixed $_gutachter
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function create($value, $_projekt, $_platzhalter, $_gutachter, $_auftraggeber)
|
||||
{
|
||||
|
||||
$gutachter = Helper::replacePlatzhalter($_platzhalter, $_gutachter[0]['txt']);
|
||||
// gutachter
|
||||
$html = '<div class="deckblatt">';
|
||||
if ($_gutachter[0]['id'] == 1) {
|
||||
$image = Environment::getProjectPath()."/public/typo3conf/ext/gutachten/Resources/Public/BenutzerLogos/" . $_gutachter[0]['logo'];
|
||||
$html .= '<div class="gutachter">';
|
||||
$html .= '<img src="'.$image.'" style="width:80mm; height:auto">';
|
||||
$html .= '</div>';
|
||||
} else {
|
||||
$kopf = Helper::replacePlatzhalter($_platzhalter, $_gutachter[0]['kopf']);
|
||||
$html .= '<div class="gutachter"><h3>'.strip_tags($kopf).'</h3>'.$gutachter.'</div>';
|
||||
}
|
||||
|
||||
// title
|
||||
$title = Helper::replacePlatzhalter($_platzhalter, $value['txt']);
|
||||
$title = explode('<br />', $title);
|
||||
if (isset($value['paragraph6'])) {
|
||||
$html .= '<div class="gutachten"><h1>GUTACHTEN gem. §6</h1>';
|
||||
} else {
|
||||
$txt = $value['titel']=='Deckblatt' ? 'GUTACHTEN' : $value['titel'];
|
||||
$html .= '<div class="gutachten"><h1>' . $txt . '</h1>';
|
||||
}
|
||||
$html .= '<div class="pl-1">'.strip_tags($title[0]).'</div></div>';
|
||||
|
||||
$projektname = $title[0];
|
||||
// zweck
|
||||
if (isset($value['paragraph6'])) {
|
||||
$html .= '<div class="zweckbox bold">'.$_projekt[0]['name'].'<br />'.$title[1].'</div>';
|
||||
}
|
||||
else {
|
||||
$html .= '<div class="zweckbox"><h3>ZUR FESTSETZUNG DER NUTZWERTE</h3>'.$_projekt[0]['name'].'<br />'.$title[1].'</div>';
|
||||
}
|
||||
|
||||
$auftraggeber = Helper::replacePlatzhalter($_platzhalter, $_auftraggeber[0]['txt']);
|
||||
// first line h3
|
||||
$auftraggeber = str_replace("<br />", "|||", $auftraggeber);
|
||||
$auftraggeber = str_replace("</div>", "|||", $auftraggeber);
|
||||
$auftraggeber = strip_tags($auftraggeber);
|
||||
$tmp = explode('|||', $auftraggeber);
|
||||
$html .= '<div class="auftraggeber">';
|
||||
foreach ($tmp as $key => $value) {
|
||||
if ($value[0] == '-') {
|
||||
$html .= '<h3>' . trim(substr($value, 1)) . '</h3>';
|
||||
} else {
|
||||
$html .= trim(strip_tags($value)).'<br />';
|
||||
}
|
||||
}
|
||||
$html .= '</div>';
|
||||
return $html;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,289 @@
|
||||
<?php
|
||||
|
||||
namespace HermannTelser\Gutachten\Downloads;
|
||||
|
||||
|
||||
use HermannTelser\Gutachten\DB\DbFunction;
|
||||
use PhpOffice\PhpSpreadsheet\IOFactory;
|
||||
// Mpdf installed by typo3 extension
|
||||
use PhpOffice\PhpSpreadsheet\Spreadsheet;
|
||||
use PhpOffice\PhpSpreadsheet\Writer\Xlsx;
|
||||
use PhpOffice\PhpSpreadsheet\Style\Border;
|
||||
use PhpOffice\PhpSpreadsheet\Style\Color;
|
||||
use PhpOffice\PhpSpreadsheet\Style\Fill;
|
||||
use PhpOffice\PhpSpreadsheet\Style\Alignment;
|
||||
use TYPO3\CMS\Core\Utility\GeneralUtility;
|
||||
use HermannTelser\Gutachten\Utility\Message;
|
||||
|
||||
class ExcelAufstellung
|
||||
{
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public static function download()
|
||||
{
|
||||
// Message::debug(__file__,__line__, "DOWNLOAD SPREAD SHEET AUFSTELLUNG");
|
||||
|
||||
// DbFunction::$debug = 1;
|
||||
|
||||
$local_debug = 0;
|
||||
|
||||
$projektid = GeneralUtility::_GP('projekt_aktive');
|
||||
if (0 == $projektid or !is_numeric($projektid)) {
|
||||
die('aktive projekt ID fehlt!');
|
||||
}
|
||||
|
||||
$_aufstellung = DbFunction::selectJoin(
|
||||
'tx_gutachten_raume_generell',
|
||||
['[>]tx_gutachten_aufstellung' => ['tx_gutachten_raume_generell.aufstellung_id' => 'id']],
|
||||
[
|
||||
'tx_gutachten_raume_generell.raum',
|
||||
'tx_gutachten_raume_generell.aufstellung_id',
|
||||
'tx_gutachten_aufstellung.titel'
|
||||
],
|
||||
[
|
||||
'AND' =>
|
||||
[
|
||||
'tx_gutachten_raume_generell.pid' => $projektid,
|
||||
'tx_gutachten_raume_generell.aufstellung_id[!]' => 0
|
||||
]
|
||||
]
|
||||
);
|
||||
|
||||
|
||||
$_aufstellung_map = [];
|
||||
$_aufstellung_header = [];
|
||||
foreach ($_aufstellung as $key => $value) {
|
||||
$_aufstellung_map[$value['raum']] = $value['titel'];
|
||||
if(!in_array($value['titel'], $_aufstellung_header)){
|
||||
$_aufstellung_header[] = $value['titel'];
|
||||
}
|
||||
}
|
||||
|
||||
if(!$_aufstellung_map){
|
||||
Message::note('Die "Aufstellung Titel" fehlen, bitte bei Methoden hinzufügen (Top Menu).');
|
||||
exit;
|
||||
}
|
||||
|
||||
if($local_debug){
|
||||
print_r($_aufstellung_header);
|
||||
}
|
||||
|
||||
|
||||
$_projekt = DbFunction::select(
|
||||
'tx_gutachten_projekte',
|
||||
['id', 'auftraggeber_id', 'gutachter_id', 'intname', 'name', 'beschreibung', 'erstellung', 'onoff', 'upload', 'allgemeinupload', 'recalculate', 'zuabTitel', 'nwbTitel', 'zustTitel', 'allgemTitel', 'loggia_title', 'nwbStartSeite', 'm1pP', 'm5pP', 'timestamp', 'status', 'erstelldatum'],
|
||||
['id' => $projektid]
|
||||
);
|
||||
$projektname = str_replace(',', '', $_projekt[0]['name']);
|
||||
$projektname = preg_replace("'\W, '", '', $projektname) . ' ' . date('d. m. y. H:i:s');
|
||||
|
||||
if($local_debug){
|
||||
print_r($_projekt);
|
||||
}
|
||||
|
||||
$join = [];
|
||||
$join['[>]tx_gutachten_raume_all']['tx_gutachten_raume_basis.id'] = 'tt_raume_basis_id';
|
||||
$join['[>]tx_gutachten_orientierung']['tx_gutachten_raume_basis.tt_orientierung_id'] = 'id';
|
||||
|
||||
$fields = [];
|
||||
$fields[] = 'tx_gutachten_raume_basis.id';
|
||||
$fields[] = 'tx_gutachten_raume_basis.topNr';
|
||||
$fields[] = 'tx_gutachten_raume_basis.typ';
|
||||
$fields[] = 'tx_gutachten_orientierung.orientierung';
|
||||
$fields[] = 'tx_gutachten_raume_all.geschoss';
|
||||
$fields[] = 'tx_gutachten_raume_all.raum';
|
||||
$fields[] = 'tx_gutachten_raume_all.qm';
|
||||
$fields[] = 'tx_gutachten_raume_all.tt_raumart_id';
|
||||
|
||||
$where = [];
|
||||
$where['AND']['tx_gutachten_raume_basis.pid'] = $projektid;
|
||||
// $where['AND']['tx_gutachten_raume_basis.id'] = 43538;
|
||||
$where['AND']['tx_gutachten_raume_all.tt_raumart_id'] = [1, 2, 3, 4, 7];
|
||||
$where['AND']['tx_gutachten_raume_basis.noDispInOrientierung'] = 0;
|
||||
$where['ORDER']['tx_gutachten_raume_basis.topNr'] = 'ASC';
|
||||
$where['ORDER']['tx_gutachten_raume_all.raum'] = 'ASC';
|
||||
// $where['LIMIT'] = 2;
|
||||
$_raeume_alle = DbFunction::selectJoin(
|
||||
'tx_gutachten_raume_basis',
|
||||
$join,
|
||||
$fields,
|
||||
$where
|
||||
);
|
||||
|
||||
// print_r($_raeume_alle);
|
||||
// exit;
|
||||
|
||||
// [id] => 79543
|
||||
// [topNr] => W01
|
||||
// [orientierung] => N/W
|
||||
// [geschoss] => EG
|
||||
// [raum] => AR
|
||||
// [qm] => 0.75
|
||||
// [tt_raumart_id] => 1
|
||||
|
||||
$_sorted = [];
|
||||
$_header = [];
|
||||
$_header4 = [];
|
||||
$_header7 = [];
|
||||
foreach ($_raeume_alle as $row) {
|
||||
$tt_raume_basis_id = $row['id'];
|
||||
$_sorted[$tt_raume_basis_id]['Top'] = $row['topNr'];
|
||||
$_sorted[$tt_raume_basis_id]['Geschoß'] = $row['geschoss'];
|
||||
$_sorted[$tt_raume_basis_id]['Orientierung'] = $row['orientierung'];
|
||||
$_sorted[$tt_raume_basis_id]['Type'] = $row['typ'];
|
||||
$raum = $row['raum'];
|
||||
$_sorted[$tt_raume_basis_id][$raum] = $row['qm'];
|
||||
if($row['tt_raumart_id'] == 1)
|
||||
$_sorted[$tt_raume_basis_id]['Summe Nutzflächen'] += $row['qm'];
|
||||
if ($row['tt_raumart_id'] == 1){
|
||||
$_header[] = $row['raum'];
|
||||
}
|
||||
else if ($row['tt_raumart_id'] == 4)
|
||||
$_header4[$tt_raume_basis_id][] = $row['raum'];
|
||||
else if ($row['tt_raumart_id'] == 7)
|
||||
$_header7[$tt_raume_basis_id][] = $row['raum'];
|
||||
|
||||
}
|
||||
|
||||
$_header = array_unique($_header);
|
||||
sort($_header);
|
||||
array_unshift($_header, 'Top', 'Geschoß', 'Orientierung', 'Type');
|
||||
array_push($_header, 'Summe Nutzflächen');
|
||||
$_header = array_merge($_header, $_aufstellung_header);
|
||||
// print_r($_header);
|
||||
|
||||
$_header_char = [];
|
||||
$char = 'A';
|
||||
$summe_position = '';
|
||||
foreach ($_header as $value) {
|
||||
if ($value == 'Summe Nutzflächen') {
|
||||
$summe_position = $char;
|
||||
}
|
||||
$_header_char[$char] = $value;
|
||||
++$char;
|
||||
}
|
||||
$tmp = array_flip($_header_char);
|
||||
|
||||
if($local_debug){
|
||||
print_r($_aufstellung_map);
|
||||
print_r($tmp);
|
||||
}
|
||||
|
||||
$_final = [];
|
||||
foreach ($_sorted as $key => $flat) {
|
||||
|
||||
// print_r($flat);
|
||||
|
||||
|
||||
foreach ($flat as $name => $value) {
|
||||
|
||||
if(isset($_aufstellung_map[$name])){
|
||||
$name = $_aufstellung_map[$name];
|
||||
}
|
||||
|
||||
// if(!isset($tmp[$name])){
|
||||
// echo "\n" . $name . "\n";
|
||||
// print_r($_header4);
|
||||
// }
|
||||
|
||||
$char = $tmp[$name];
|
||||
if(isset($_final[$key][$char])){
|
||||
$_final[$key][$char] += $value;
|
||||
}
|
||||
else {
|
||||
$_final[$key][$char] = $value;
|
||||
}
|
||||
|
||||
}
|
||||
ksort($_final[$key]);
|
||||
// print_r($_final);
|
||||
// exit;
|
||||
}
|
||||
// print_r($_final);
|
||||
// exit;
|
||||
|
||||
|
||||
$spreadsheet = new Spreadsheet();
|
||||
$spreadsheet->getProperties()->setCreator('Architekt Vogl-Fernheim')->setTitle('Nutzwerte Aufstellung')->setDescription($projektname . ", erstellt am " . date("d.M.Y"));
|
||||
$activeSheet = $spreadsheet->getActiveSheet();
|
||||
$activeWorksheet = $spreadsheet->getActiveSheet();
|
||||
|
||||
foreach ($_header_char as $coll => $value) {
|
||||
$cell = $coll . 1;
|
||||
$activeWorksheet->getStyle($cell)->getAlignment()->setTextRotation(90);
|
||||
$activeWorksheet->getRowDimension('1')->setRowHeight(180);
|
||||
$activeWorksheet->setCellValue($cell, $value);
|
||||
$cellStyle = $activeWorksheet->getStyle($cell);
|
||||
$cellStyle->getFont()->getColor()->setARGB(Color::COLOR_WHITE);
|
||||
$cellStyle->getFill()->setFillType(Fill::FILL_SOLID);
|
||||
if (in_array($coll, ['A', 'B', 'C', 'D', $summe_position])) {
|
||||
$cellStyle->getFill()->getStartColor()->setARGB('00000000');
|
||||
} else {
|
||||
$cellStyle->getFill()->getStartColor()->setARGB('00595959');
|
||||
}
|
||||
|
||||
$cellStyle->getAlignment()->setHorizontal(Alignment::HORIZONTAL_CENTER);
|
||||
$cellStyle->getAlignment()->setVertical(Alignment::VERTICAL_CENTER);
|
||||
// $activeWorksheet->getStyle($cell)->getBorders()->getOutline()->setBorderStyle(Border::BORDER_HAIR)->setColor(new Color('FFFFFFFF'));
|
||||
}
|
||||
|
||||
foreach ($_header_char as $coll => $value) {
|
||||
$cell = $coll . 2;
|
||||
$cellStyle = $activeWorksheet->getStyle($cell);
|
||||
$cellStyle->getFont()->getColor()->setARGB(Color::COLOR_WHITE);
|
||||
$cellStyle->getFill()->setFillType(Fill::FILL_SOLID);
|
||||
if (in_array($coll, ['A', 'B', 'C', 'D', $summe_position])) {
|
||||
$cellStyle->getFill()->getStartColor()->setARGB('00000000');
|
||||
} else {
|
||||
$cellStyle->getFill()->getStartColor()->setARGB('00595959');
|
||||
}
|
||||
if (!in_array($coll, ['A', 'B', 'C', 'D'])) {
|
||||
$activeWorksheet->setCellValue($cell, 'm²');
|
||||
}
|
||||
$cellStyle->getAlignment()->setHorizontal(Alignment::HORIZONTAL_CENTER);
|
||||
// $activeWorksheet->getStyle($cell)->getBorders()->getOutline()->setBorderStyle(Border::BORDER_HAIR)->setColor(new Color('FFFFFFFF'));
|
||||
}
|
||||
$row = '3';
|
||||
// print_r($_final);
|
||||
// exit;
|
||||
foreach ($_final as $id => $einheit) {
|
||||
foreach ($einheit as $colum => $value) {
|
||||
$cell = $colum . $row;
|
||||
$activeWorksheet->setCellValue($cell, $value);
|
||||
$cellStyle = $activeWorksheet->getStyle($cell);
|
||||
|
||||
if (in_array($colum, ['A', $summe_position])) {
|
||||
$cellStyle->getFont()->getColor()->setARGB(Color::COLOR_WHITE);
|
||||
$cellStyle->getFill()->setFillType(Fill::FILL_SOLID);
|
||||
$cellStyle->getFill()->getStartColor()->setARGB('00000000');
|
||||
// $activeWorksheet->getStyle($cell)->getBorders()->getOutline()->setBorderStyle(Border::BORDER_HAIR)->setColor(new Color('FFFFFFFF'));
|
||||
} else if (in_array($colum, ['B', 'C'])) {
|
||||
$cellStyle->getFont()->getColor()->setARGB(Color::COLOR_WHITE);
|
||||
$cellStyle->getFill()->setFillType(Fill::FILL_SOLID);
|
||||
$cellStyle->getFill()->getStartColor()->setARGB('00595959');
|
||||
// $activeWorksheet->getStyle($cell)->getBorders()->getOutline()->setBorderStyle(Border::BORDER_HAIR)->setColor(new Color('FFFFFFFF'));
|
||||
} else {
|
||||
// $activeWorksheet->getStyle($cell)->getBorders()->getOutline()->setBorderStyle(Border::BORDER_HAIR)->setColor(new Color('00000000'));
|
||||
}
|
||||
}
|
||||
++$row;
|
||||
}
|
||||
|
||||
header('Content-Type: application/vnd.ms-excel');
|
||||
header('Content-Disposition: attachment;filename="' . $projektname . '.xlsx"');
|
||||
header('Cache-Control: max-age=0');
|
||||
|
||||
// If you're serving to IE over SSL, then the following may be needed
|
||||
header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT'); // always modified
|
||||
header('Cache-Control: cache, must-revalidate'); // HTTP/1.1
|
||||
header('Pragma: public'); // HTTP/1.0
|
||||
|
||||
// Xls
|
||||
// $writer = new Xlsx($spreadsheet);
|
||||
// $writer->save('hello world.xlsx');
|
||||
$writer = IOFactory::createWriter($spreadsheet, 'Xlsx');
|
||||
$writer->save('php://output');
|
||||
exit;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,288 @@
|
||||
<?php
|
||||
|
||||
namespace HermannTelser\Gutachten\Downloads;
|
||||
|
||||
use HermannTelser\Gutachten\DB\DbFunction;
|
||||
use HermannTelser\Gutachten\DB\Select\ObjekteExcel;
|
||||
use HermannTelser\Gutachten\DB\Select\Select;
|
||||
use HermannTelser\Gutachten\Utility\Message;
|
||||
use Mpdf;
|
||||
use PhpOffice\PhpSpreadsheet\IOFactory;
|
||||
// Mpdf installed by typo3 extension
|
||||
use PhpOffice\PhpSpreadsheet\Spreadsheet;
|
||||
use TYPO3\CMS\Core\Utility\GeneralUtility;
|
||||
|
||||
class ExcelNutzflaeche
|
||||
{
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public static function download()
|
||||
{
|
||||
// Message::debug(__file__,__line__, "DOWNLOAD SPREAD SHEET");
|
||||
|
||||
DbFunction::$debug = 0;
|
||||
|
||||
$projektid = GeneralUtility::_GP('projekt_aktive');
|
||||
|
||||
if (0 == $projektid or !is_numeric($projektid)) {
|
||||
die('aktive projekt ID fehlt!');
|
||||
}
|
||||
|
||||
$_projekt = DbFunction::select(
|
||||
'tx_gutachten_projekte',
|
||||
['id', 'auftraggeber_id', 'gutachter_id', 'intname', 'name', 'beschreibung', 'erstellung', 'onoff', 'upload', 'allgemeinupload', 'recalculate', 'zuabTitel', 'nwbTitel', 'zustTitel', 'allgemTitel', 'loggia_title', 'nwbStartSeite', 'm1pP', 'm5pP', 'timestamp', 'status', 'erstelldatum'],
|
||||
['id' => $projektid]
|
||||
);
|
||||
|
||||
$projektname = str_replace(',', '', $_projekt[0]['name']);
|
||||
$projektname = preg_replace("'\W, '", '', $projektname);
|
||||
|
||||
$file = file_get_contents(__DIR__.'/excel_header.txt');
|
||||
$file = preg_replace("/[\n\r]/", '', $file);
|
||||
$_headers = explode(',', $file);
|
||||
|
||||
//
|
||||
// // Create new Spreadsheet object
|
||||
$spreadsheet = new Spreadsheet();
|
||||
|
||||
// Set document properties
|
||||
$spreadsheet->getProperties()->setCreator('Hermann Telser Nutzwertberechnung')
|
||||
->setLastModifiedBy('Hermann Telser Nutzwertberechnung')
|
||||
->setTitle('Nutzwertberechnung')
|
||||
->setDescription('Nutzwertberechnung v10.1.3, © Hermann Telser 2007 - 2023');
|
||||
|
||||
// $_rot = [2, 3, 4, 5, 6, 7, 9, 10, 11, 12, 13, 14, 20, 21, 22, 23, 24, 25, 26, 27, 28, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 50, 51, 52, 53, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 90, 91, 92, 93];
|
||||
// $_gelb = [8, 19, 29];
|
||||
$_rot = [2, 3, 4, 5, 6, 7, 9, 10, 11, 12, 13, 14, 20, 21, 22, 23, 24, 25, 26, 27, 28, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 51, 52, 53, 54, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 91, 92, 93, 94];
|
||||
$_gelb = [8, 19, 29];
|
||||
|
||||
$row = '1';
|
||||
$coll = 'A';
|
||||
foreach ($_headers as $key => $value) {
|
||||
$cell = $coll.$row;
|
||||
|
||||
$spreadsheet->setActiveSheetIndex(0)->setCellValue($cell, $value);
|
||||
|
||||
if (\in_array($key, $_rot)) {
|
||||
$spreadsheet->getActiveSheet()->getStyle($cell)->getFont()->getColor()->setARGB('ffffff');
|
||||
$spreadsheet->getActiveSheet()->getStyle($cell)->getFill()->setFillType(\PhpOffice\PhpSpreadsheet\Style\Fill::FILL_SOLID)->getStartColor()->setARGB('ff0000');
|
||||
} elseif (\in_array($key, $_gelb)) {
|
||||
$spreadsheet->getActiveSheet()->getStyle($cell)->getFill()->setFillType(\PhpOffice\PhpSpreadsheet\Style\Fill::FILL_SOLID)->getStartColor()->setARGB('ffff00');
|
||||
}
|
||||
|
||||
$spreadsheet->getActiveSheet()
|
||||
->getStyle($cell)
|
||||
->getBorders()
|
||||
->getBottom()
|
||||
->setBorderStyle(\PhpOffice\PhpSpreadsheet\Style\Border::BORDER_THICK);
|
||||
|
||||
++$coll;
|
||||
}
|
||||
|
||||
$_objekte_all = ObjekteExcel::select($projektid);
|
||||
|
||||
// print_r($_objekte_all);
|
||||
// exit;
|
||||
|
||||
$row = 2;
|
||||
foreach ($_objekte_all as $key => $value) {
|
||||
$tt_raume_basis_id = $value['id'];
|
||||
|
||||
$cell = 'B'.$row;
|
||||
$spreadsheet->setActiveSheetIndex(0)->setCellValue($cell, $value['topNr']);
|
||||
|
||||
if (0 == $value['nodspl']) {
|
||||
$cell = 'C'.$row;
|
||||
$spreadsheet->setActiveSheetIndex(0)->setCellValue($cell, $value['GNO']);
|
||||
|
||||
$cell = 'D'.$row;
|
||||
$spreadsheet->setActiveSheetIndex(0)->setCellValue($cell, $value['qmM1']);
|
||||
|
||||
// M2
|
||||
$_methode_2 = DbFunction::selectJoin(
|
||||
'tx_gutachten_raume_all',
|
||||
['[>]tx_gutachten_raume_generell' => 'tt_raumart_id'],
|
||||
[
|
||||
'tx_gutachten_raume_all.uid',
|
||||
'tx_gutachten_raume_all.geschoss',
|
||||
'tx_gutachten_raume_all.raum',
|
||||
'tx_gutachten_raume_all.factor',
|
||||
'tx_gutachten_raume_all.qm',
|
||||
'tx_gutachten_raume_all.NW',
|
||||
'tx_gutachten_raume_all.NWungerundet',
|
||||
'tx_gutachten_raume_all.NWm2',
|
||||
'tx_gutachten_raume_all.uid',
|
||||
'tx_gutachten_raume_all.timestamp',
|
||||
'tx_gutachten_raume_generell.zunutzwert',
|
||||
],
|
||||
[
|
||||
'AND' => [
|
||||
'tx_gutachten_raume_all.tt_raumart_id' => [2, 8],
|
||||
'tx_gutachten_raume_all.tt_raume_basis_id' => $tt_raume_basis_id,
|
||||
'tx_gutachten_raume_all.pid' => $projektid,
|
||||
'tx_gutachten_raume_generell.pid' => $projektid,
|
||||
],
|
||||
'ORDER' => 'tx_gutachten_raume_all.raum',
|
||||
]
|
||||
);
|
||||
|
||||
$zunutzwert = 0;
|
||||
foreach ($_methode_2 as $k => $v) {
|
||||
//if($b['tt_raumart_id']==2) //M2
|
||||
//{
|
||||
// $summeM2_factor += $b['NWm2'];
|
||||
//}
|
||||
//else //M2b
|
||||
//{
|
||||
// $summeM2_ohne_factor += $b['NWm2'];
|
||||
//}
|
||||
if (1 == $v['zunutzwert']) {
|
||||
$zunutzwert += $v['qm'];
|
||||
}
|
||||
}
|
||||
if ($zunutzwert > 0) {
|
||||
$cell = 'E'.$row;
|
||||
$spreadsheet->setActiveSheetIndex(0)->setCellValue($cell, $zunutzwert);
|
||||
}
|
||||
|
||||
$cell = 'F'.$row;
|
||||
$gesamt = $value['qmM1'] + $zunutzwert;
|
||||
$spreadsheet->setActiveSheetIndex(0)->setCellValue($cell, $gesamt);
|
||||
} else {
|
||||
$cell = 'I'.$row;
|
||||
$spreadsheet->setActiveSheetIndex(0)->setCellValue($cell, $value['GNO']);
|
||||
|
||||
// STELLPLATZ qm
|
||||
// Methode 5
|
||||
$_m5 = DbFunction::select('tx_gutachten_raume_all', ['qm','raum'], ['AND' => ['tt_raume_basis_id' => $tt_raume_basis_id, 'tt_raumart_id' => 5]]);
|
||||
|
||||
$_qm = 0;
|
||||
$raum = '';
|
||||
foreach ($_m5 as $k => $m5) {
|
||||
$_qm += (float) $m5['qm'];
|
||||
$raum = (string) $m5['raum'];
|
||||
}
|
||||
|
||||
// echo "\n" . $raum;
|
||||
|
||||
$cell = 'L'.$row;
|
||||
$spreadsheet->setActiveSheetIndex(0)->setCellValue($cell, number_format($_qm, 2, ',', ''));
|
||||
$cell = 'AT'.$row;
|
||||
$spreadsheet->setActiveSheetIndex(0)->setCellValue($cell, "SALAM " . $raum);
|
||||
}
|
||||
|
||||
// Parifizierer
|
||||
$cell = 'R'.$row;
|
||||
$spreadsheet->setActiveSheetIndex(0)->setCellValue($cell, $_projekt[0]['gutachter']);
|
||||
|
||||
// LAGE
|
||||
$_lage = Select::raume_all($projektid, $tt_raume_basis_id, 1);
|
||||
$cell = 'AQ'.$row;
|
||||
$lage = $_lage[0]['geschoss'] ?? '';
|
||||
$spreadsheet->setActiveSheetIndex(0)->setCellValue($cell, $lage);
|
||||
$cell = 'AR'.$row;
|
||||
$spreadsheet->setActiveSheetIndex(0)->setCellValue($cell, $value['orientierung']);
|
||||
|
||||
// WOHNUNG
|
||||
if (0 == $value['nodspl']) {
|
||||
// BESCHREIBUNG
|
||||
$_beschreibung = Select::raume_all($projektid, $tt_raume_basis_id, [1, 2, 8]);
|
||||
if (\count($_beschreibung) > 0) {
|
||||
$_tmp = [];
|
||||
|
||||
// print_r($_beschreibung);
|
||||
foreach ($_beschreibung as $key => $value) {
|
||||
if (!\in_array($value['raum'], ['Loggia', 'Loggia 1', 'Loggia 2'])) {
|
||||
$_tmp[] = $value['raum'];
|
||||
}
|
||||
}
|
||||
$beschreibung = implode(', ', $_tmp);
|
||||
$cell = 'AT'.$row;
|
||||
$spreadsheet->setActiveSheetIndex(0)->setCellValue($cell, $beschreibung);
|
||||
}
|
||||
|
||||
// M2
|
||||
if (\count($_methode_2) > 0) {
|
||||
$_tmp = [];
|
||||
foreach ($_methode_2 as $key => $value) {
|
||||
if (\in_array($value['raum'], ['Loggia', 'Loggia 1', 'Loggia 2'])) {
|
||||
$_tmp[] = $value['raum'].': '.number_format($value['qm'], 2, ',', '').' m²';
|
||||
}
|
||||
}
|
||||
$beschreibung = implode(', ', $_tmp);
|
||||
$cell = 'AU'.$row;
|
||||
$spreadsheet->setActiveSheetIndex(0)->setCellValue($cell, $beschreibung);
|
||||
}
|
||||
|
||||
// M3
|
||||
$_m3 = Select::raume_all($projektid, $tt_raume_basis_id, [3, 7]);
|
||||
if (\count($_m3) > 0) {
|
||||
$_tmp = [];
|
||||
foreach ($_m3 as $key => $value) {
|
||||
$_tmp[] = $value['raum'].' '.number_format($value['qm'], 2, ',', '').' m²';
|
||||
}
|
||||
$m3 = implode(', ', $_tmp);
|
||||
$cell = 'AV'.$row;
|
||||
$spreadsheet->setActiveSheetIndex(0)->setCellValue($cell, $m3);
|
||||
}
|
||||
|
||||
// M4
|
||||
$_m4 = Select::raume_all($projektid, $tt_raume_basis_id, 4);
|
||||
if (\count($_m4) > 0) {
|
||||
$_tmp = [];
|
||||
foreach ($_m4 as $key => $value) {
|
||||
$_tmp[] = $value['raum'].' '.number_format($value['qm'], 2, ',', '').' m²';
|
||||
}
|
||||
$m4 = implode(', ', $_tmp);
|
||||
$cell = 'AW'.$row;
|
||||
$spreadsheet->setActiveSheetIndex(0)->setCellValue($cell, $m4);
|
||||
}
|
||||
} else {
|
||||
// Methode 5a & Methode 5b
|
||||
// $_m56 = Select::raume_all($projektid, $tt_raume_basis_id, [5, 6, 9]);
|
||||
$_m56 = DbFunction::select('tx_gutachten_raume_all', ['qm','raum'], ['AND' => ['tt_raume_basis_id' => $tt_raume_basis_id, 'tt_raumart_id' => [5, 6, 9] ],'ORDER' => ['tt_raumart_id' => 'ASC']]);
|
||||
|
||||
if (\count($_m56) > 0) {
|
||||
|
||||
$tmp1 = $_m56[0]['raum'];
|
||||
$cell = 'AT'.$row;
|
||||
$spreadsheet->setActiveSheetIndex(0)->setCellValue($cell, $tmp1);
|
||||
if(isset($_m56[1])){
|
||||
$tmp2 = $_m56[1]['raum'] . ' ' . number_format($_m56[1]['qm'], 2, ',', '').' m²';
|
||||
$cell = 'AV'.$row;
|
||||
$spreadsheet->setActiveSheetIndex(0)->setCellValue($cell, $tmp2);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
++$row;
|
||||
}
|
||||
|
||||
|
||||
// exit;
|
||||
|
||||
// Set active sheet index to the first sheet, so Excel opens this as the first sheet
|
||||
$spreadsheet->setActiveSheetIndex(0);
|
||||
// Rename worksheet
|
||||
$spreadsheet->getActiveSheet()->setTitle('Daten für den Kaufvertrag');
|
||||
|
||||
// Redirect output to a client’s web browser (Xls)
|
||||
header('Content-Type: application/vnd.ms-excel');
|
||||
header('Content-Disposition: attachment;filename="'.$projektname.'.xlsx"');
|
||||
header('Cache-Control: max-age=0');
|
||||
// If you're serving to IE 9, then the following may be needed
|
||||
header('Cache-Control: max-age=1');
|
||||
|
||||
// If you're serving to IE over SSL, then the following may be needed
|
||||
header('Last-Modified: '.gmdate('D, d M Y H:i:s').' GMT'); // always modified
|
||||
header('Cache-Control: cache, must-revalidate'); // HTTP/1.1
|
||||
header('Pragma: public'); // HTTP/1.0
|
||||
|
||||
// Xls
|
||||
$writer = IOFactory::createWriter($spreadsheet, 'Xlsx');
|
||||
$writer->save('php://output');
|
||||
|
||||
exit;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
namespace HermannTelser\Gutachten\Downloads;
|
||||
|
||||
use HermannTelser\Gutachten\Utility\Helper;
|
||||
|
||||
class Inhaltsverzeichnis
|
||||
{
|
||||
/**
|
||||
* @param mixed $value
|
||||
* @param mixed $_platzhalter
|
||||
* @param mixed $_gutachter
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function create($value, $_platzhalter)
|
||||
{
|
||||
$html .= '<div class="header">INHALTSVERZEICHNIS</div>';
|
||||
|
||||
$tmp = Helper::replacePlatzhalter($_platzhalter, $value['txt']);
|
||||
$_inhalt = explode('<br />', $tmp);
|
||||
|
||||
$table = '<table class="inhalt">';
|
||||
foreach ($_inhalt as $key => $value) {
|
||||
|
||||
$_row = explode('|', $value);
|
||||
$table .= Helper::table_row($_row, 0, 0);
|
||||
}
|
||||
$table .= '</table>';
|
||||
$html .= $table;
|
||||
|
||||
return $html;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,119 @@
|
||||
<?php
|
||||
|
||||
namespace HermannTelser\Gutachten\Downloads\Nutzflaeche;
|
||||
|
||||
use HermannTelser\Gutachten\DB\DbFunction;
|
||||
use HermannTelser\Gutachten\DB\Select\ObjektProjektByMethode;
|
||||
use HermannTelser\Gutachten\Utility\Helper;
|
||||
use HermannTelser\Gutachten\Downloads\PdfNutzflaeche;
|
||||
|
||||
class NutzflaecheZusammenstellung
|
||||
{
|
||||
/**
|
||||
* @param mixed $_projekt
|
||||
* @param mixed DbFunction::$projektid
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function load($_projekt) :string
|
||||
{
|
||||
// ZUSAMMENSTELLUNG
|
||||
|
||||
// DbFunction::$debug = 1;
|
||||
|
||||
$_objekte_all = ObjektProjektByMethode::select(1);
|
||||
|
||||
$summeNW = DbFunction::sum('tx_gutachten_raume_basis', 'GNO', ['pid' => DbFunction::$projektid]);
|
||||
|
||||
// print_r($_objekte_all);
|
||||
// exit;
|
||||
|
||||
$countProzent = [];
|
||||
$countNW = [];
|
||||
|
||||
// $html = '<table class="pure-table nutzwert" style="page-break-inside:avoid;">';
|
||||
$html = '<table class="pure-table pure-table-striped nutzwert-neu">';
|
||||
$html .= '<thead><tr class="header-row">';
|
||||
$html .= '<th style="border-bottom: 0.1mm solid #cbcbcb;">Top</th>';
|
||||
$html .= '<th style="border-bottom: 0.1mm solid #cbcbcb;">Geschoß</th>';
|
||||
$html .= '<th style="border-bottom: 0.1mm solid #cbcbcb;">Orientierung</th>';
|
||||
$html .= '<th style="border-bottom: 0.1mm solid #cbcbcb;">Typ</th>';
|
||||
$html .= '<th style="border-bottom: 0.1mm solid #cbcbcb;">NW</th>';
|
||||
$html .= '<th style="border-bottom: 0.1mm solid #cbcbcb;">x2 *</th>';
|
||||
$html .= '<th style="border-bottom: 0.1mm solid #cbcbcb;">%</th>';
|
||||
$html .= '</tr></thead>';
|
||||
|
||||
// $html .= Helper::table_header_row(explode('|', 'Top|Geschoß|Orientierung|Typ|NW|x2*|%'));
|
||||
|
||||
foreach ($_objekte_all as $key => $row) {
|
||||
if ($summeNW > 0) {
|
||||
$row['GNO2'] = $row['GNO'] * 2 .' / '.$summeNW * 2 .' tel Anteil =';
|
||||
$tmp = ($row['GNO'] * 2) / ($summeNW * 2) * 100;
|
||||
$row['prozent'] = Helper::number_format_de($tmp, 3).'%';
|
||||
} else {
|
||||
$row['GNO2'] = '';
|
||||
$row['prozent'] = '';
|
||||
}
|
||||
$countProzent[] = $tmp;
|
||||
$countNW[] = $row['GNO'];
|
||||
|
||||
$row['geschoss'] = PdfNutzflaeche::$_objekte_geschosse[$row['id']];
|
||||
|
||||
$html .= '<tr>';
|
||||
$html .= '<td style="border-bottom: 0.1mm solid #cbcbcb;">'.$row['topNr'].'</td>';
|
||||
$html .= '<td style="border-bottom: 0.1mm solid #cbcbcb;">'.$row['geschoss'].'</td>';
|
||||
$html .= '<td style="border-bottom: 0.1mm solid #cbcbcb;">'.$row['orientierung'].'</td>';
|
||||
$html .= '<td style="border-bottom: 0.1mm solid #cbcbcb;">'.$row['typ'].'</td>';
|
||||
$html .= '<td style="border-bottom: 0.1mm solid #cbcbcb;" class="right">'.$row['GNO'].'</td>';
|
||||
$html .= '<td style="border-bottom: 0.1mm solid #cbcbcb; text-align:center;">'.$row['GNO2'].'</td>';
|
||||
$html .= '<td style="border-bottom: 0.1mm solid #cbcbcb;">'.$row['prozent'].'</td>';
|
||||
$html .= '</tr>';
|
||||
}
|
||||
|
||||
$_objekte_all = ObjektProjektByMethode::select([5, 9]);
|
||||
|
||||
foreach ($_objekte_all as $key => $row) {
|
||||
$row['GNO2'] = $row['GNO'] * 2 .' / '.$summeNW * 2 .' tel Anteil =';
|
||||
|
||||
$tmp = ($row['GNO'] * 2) / ($summeNW * 2) * 100;
|
||||
$row['prozent'] = Helper::number_format_de($tmp, 3).'%';
|
||||
$countProzent[] = $tmp;
|
||||
$countNW[] = $row['GNO'];
|
||||
|
||||
$html .= '<tr>';
|
||||
$html .= '<td style="border-bottom: 0.1mm solid #cbcbcb;">'.$row['topNr'].'</td>';
|
||||
$html .= '<td style="border-bottom: 0.1mm solid #cbcbcb;">'.$row['geschoss'].'</td>';
|
||||
$html .= '<td style="border-bottom: 0.1mm solid #cbcbcb;">'.$row['orientierung'].'</td>';
|
||||
$html .= '<td style="border-bottom: 0.1mm solid #cbcbcb;">'.$row['typ'].'</td>';
|
||||
$html .= '<td style="border-bottom: 0.1mm solid #cbcbcb;" class="right">'.$row['GNO'].'</td>';
|
||||
$html .= '<td style="border-bottom: 0.1mm solid #cbcbcb; text-align:center;">'.$row['GNO2'].'</td>';
|
||||
$html .= '<td style="border-bottom: 0.1mm solid #cbcbcb;">'.$row['prozent'].'</td>';
|
||||
$html .= '</tr>';
|
||||
}
|
||||
|
||||
$str = '||||'.array_sum($countNW).'|'.$summeNW * 2 .' / '.$summeNW * 2 .' tel Anteil =|'.round(array_sum($countProzent)).'%';
|
||||
$html .= Helper::table_row_abschluss(explode('|', $str));
|
||||
$html .= '</table>';
|
||||
|
||||
$html .= '<p class="size07">* Die Anteile wurden verdoppelt, sodaß die Mindestanteile jederzeit durch zwei geteilt werden können.</p>';
|
||||
|
||||
// $_gutachter = DbFunction::select(
|
||||
// 'tx_gutachten_gutachter',
|
||||
// '*',
|
||||
// ['id' => $_projekt[0]['gutachter_id']]
|
||||
// );
|
||||
|
||||
// $html .= '<br><br><br><br><br><br><br><table class="nutzwert-neu">';
|
||||
// $html .= '<tr>';
|
||||
// $html .= '<td>'.$_projekt[0]['erstellung'].'</td>';
|
||||
// if (!\count($_gutachter)) {
|
||||
// $html .= '<td class="right">Gutacher Fehlt</td>';
|
||||
// } else {
|
||||
// $html .= '<td class="right">'.$_gutachter[0]['kopf'].'</td>';
|
||||
// }
|
||||
// $html .= '</tr>';
|
||||
// $html .= '</table>';
|
||||
|
||||
return $html;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,333 @@
|
||||
<?php
|
||||
|
||||
namespace HermannTelser\Gutachten\Downloads\Nutzflaeche;
|
||||
|
||||
use HermannTelser\Gutachten\DB\DbFunction;
|
||||
use HermannTelser\Gutachten\DB\Select\Select;
|
||||
use HermannTelser\Gutachten\Downloads\PdfNutzflaeche;
|
||||
use HermannTelser\Gutachten\Utility\Helper;
|
||||
|
||||
class NutzwertberechnungM1M4
|
||||
{
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public static function berechnen()
|
||||
{
|
||||
// DbFunction::$debug = 1;
|
||||
|
||||
// OBSOLET
|
||||
// $_raum['NWm2'];
|
||||
|
||||
$exception = 364106;
|
||||
|
||||
|
||||
$join = [];
|
||||
$join['[>]tx_gutachten_orientierung']['tx_gutachten_raume_basis.tt_orientierung_id'] = 'id';
|
||||
|
||||
$fields = [];
|
||||
$fields[] = 'tx_gutachten_raume_basis.id';
|
||||
$fields[] = 'tx_gutachten_raume_basis.uid';
|
||||
$fields[] = 'tx_gutachten_raume_basis.topNr';
|
||||
$fields[] = 'tx_gutachten_raume_basis.typ';
|
||||
$fields[] = 'tx_gutachten_raume_basis.factor';
|
||||
$fields[] = 'tx_gutachten_raume_basis.GNO';
|
||||
$fields[] = 'tx_gutachten_raume_basis.qmM1';
|
||||
$fields[] = 'tx_gutachten_raume_basis.qmM1uM2bis';
|
||||
$fields[] = 'tx_gutachten_raume_basis.qmM1uM2';
|
||||
$fields[] = 'tx_gutachten_raume_basis.NWM1uM2';
|
||||
$fields[] = 'tx_gutachten_raume_basis.summe_az';
|
||||
$fields[] = 'tx_gutachten_raume_basis.bewertung';
|
||||
$fields[] = 'tx_gutachten_orientierung.orientierung';
|
||||
foreach (range('a', 'u') as $key => $feld) {
|
||||
$fields[] = 'tx_gutachten_raume_basis.'.$feld;
|
||||
}
|
||||
$where = [];
|
||||
$where['AND']['tx_gutachten_raume_basis.noDispInOrientierung'] = 0;
|
||||
$where['AND']['tx_gutachten_raume_basis.pid'] = DbFunction::$projektid;
|
||||
$where['ORDER']['tx_gutachten_raume_basis.topNr'] = 'ASC';
|
||||
// $where['LIMIT'] = 2;
|
||||
$_raeume_alle = DbFunction::selectJoin(
|
||||
'tx_gutachten_raume_basis',
|
||||
$join,
|
||||
$fields,
|
||||
$where
|
||||
);
|
||||
|
||||
// $part1 = [];
|
||||
// $part2 = [];
|
||||
// foreach ($_raeume_alle as $key => $_raum) {
|
||||
// if ('' != $_raum['typ']) {
|
||||
// $part1[] = $_raum;
|
||||
// } else {
|
||||
// $part2[] = $_raum;
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// $topNr = array_column($part1, 'topNr');
|
||||
// array_multisort($topNr, SORT_ASC, $part1);
|
||||
//
|
||||
// $topNr = array_column($part2, 'topNr');
|
||||
// array_multisort($topNr, SORT_ASC, $part2);
|
||||
//
|
||||
// $_raeume_alle = array_merge($part1, $part2);
|
||||
|
||||
$html = '';
|
||||
foreach ($_raeume_alle as $key => $_objekte) {
|
||||
$tt_raume_basis_id = $_objekte['id'];
|
||||
|
||||
$_raume_m1 = Select::raume_all(DbFunction::$projektid, $tt_raume_basis_id, [1]);
|
||||
$_raume_m2 = Select::raume_all(DbFunction::$projektid, $tt_raume_basis_id, [2, 8]);
|
||||
$_raume_m3 = Select::raume_all(DbFunction::$projektid, $tt_raume_basis_id, [3, 7], $exception);
|
||||
|
||||
$pagebrake = \count($_raume_m1) + \count($_raume_m2) + \count($_raume_m3);
|
||||
|
||||
// Header
|
||||
if ($pagebrake > 45) {
|
||||
$html .= '<table class="pure-table nutzwert-neu">';
|
||||
} else {
|
||||
$html .= '<table class="pure-table nutzwert-neu" style="page-break-inside:avoid;">';
|
||||
}
|
||||
$html .= '<tr class="header-row">';
|
||||
$html .= '<td>Top Nr.</td>';
|
||||
$html .= '<td>Geschoß</td>';
|
||||
$html .= '<td>Orientierung</td>';
|
||||
$html .= '<td>Typ</td>';
|
||||
$html .= '<td></td>';
|
||||
$html .= '<td class="right">qm</td>';
|
||||
$html .= '<td colspan="6"></td>';
|
||||
$html .= '<td>NW</td>';
|
||||
$html .= '</tr>';
|
||||
|
||||
// if($tt_raume_basis_id == 86321){
|
||||
// print_r($_objekte);
|
||||
// exit;
|
||||
// }
|
||||
|
||||
// METHODE 1
|
||||
foreach ($_raume_m1 as $key => $_raum) {
|
||||
if ($key > 0) {
|
||||
$_objekte['topNr'] = '';
|
||||
$_raum['geschoss'] = '';
|
||||
$_objekte['orientierung'] = '';
|
||||
$_objekte['typ'] = '';
|
||||
} else {
|
||||
$_raum['geschoss'] = PdfNutzflaeche::$_objekte_geschosse[$tt_raume_basis_id];
|
||||
}
|
||||
|
||||
$html .= '<tr>';
|
||||
$html .= '<td class="first">'.$_objekte['topNr'].'</td>';
|
||||
$html .= '<td>'.$_raum['geschoss'].'</td>';
|
||||
$html .= '<td>'.$_objekte['orientierung'].'</td>';
|
||||
$html .= '<td>'.$_objekte['typ'].'</td>';
|
||||
$html .= '<td>'.$_raum['raum'].'</td>';
|
||||
$html .= '<td class="right">'.Helper::number_format_de($_raum['qm'], 2).'</td>';
|
||||
$html .= '<td colspan="7"></td>';
|
||||
$html .= '</tr>';
|
||||
}
|
||||
$NutzwertSummeGerundet = 0;
|
||||
|
||||
// METHODE 2 + 2b
|
||||
if (\count($_raume_m2) > 0) {
|
||||
// Methode 2 summen
|
||||
|
||||
// if($_objekte['id'] == 84964){
|
||||
// print_r($_objekte);
|
||||
// print_r($_raume_m2);
|
||||
// exit;
|
||||
// }
|
||||
|
||||
|
||||
$nw = $_objekte['qmM1'] * $_objekte['factor'];
|
||||
$html .= '<tr>';
|
||||
$html .= '<td class="first"></td>';
|
||||
$html .= '<td></td>';
|
||||
$html .= '<td></td>';
|
||||
$html .= '<td></td>';
|
||||
$html .= '<td></td>';
|
||||
$html .= '<td class="right">'.Helper::number_format_de($_objekte['qmM1'], 2).'</td>';
|
||||
$html .= '<td></td>';
|
||||
$html .= '<td></td>';
|
||||
$html .= '<td class="center">x</td>';
|
||||
$html .= '<td class="right">'.Helper::number_format_de($_objekte['factor'], 3).'</td>';
|
||||
$html .= '<td>=</td>';
|
||||
$html .= '<td class="right">'.Helper::number_format_de($nw, 3).'</td>';
|
||||
$html .= '<td class="right">'.round($nw).'</td>';
|
||||
$html .= '</tr>';
|
||||
|
||||
$factorSumme = 0;
|
||||
// $zunutzwert = 0;
|
||||
foreach ($_raume_m2 as $key => $_raum) {
|
||||
$html .= '<tr>';
|
||||
$html .= '<td class="first"></td>';
|
||||
$html .= '<td></td>';
|
||||
$html .= '<td></td>';
|
||||
$html .= '<td></td>';
|
||||
$html .= '<td>'.$_raum['raum'].'</td>';
|
||||
$html .= '<td class="right">'.Helper::number_format_de($_raum['qm'], 2).'</td>';
|
||||
$html .= '<td class="center">x</td>';
|
||||
$html .= '<td class="right">'.Helper::number_format_de($_raum['factor'], 3).'</td>';
|
||||
|
||||
if (2 == $_raum['tt_raumart_id']) {
|
||||
// Methode 2 (2)
|
||||
$html .= '<td class="center">x</td>';
|
||||
$html .= '<td>'.Helper::number_format_de($_objekte['factor'], 3).'</td>';
|
||||
$html .= '<td>=</td>';
|
||||
$factorSumme = $_raum['qm'] * $_raum['factor'] * $_objekte['factor'];
|
||||
$nw += $factorSumme;
|
||||
$html .= '<td class="right">'.Helper::number_format_de($factorSumme, 3).'</td>';
|
||||
} else {
|
||||
// Methode 2b (8) )
|
||||
$html .= '<td></td>';
|
||||
$html .= '<td></td>';
|
||||
$html .= '<td>=</td>';
|
||||
$factorSumme = $_raum['qm'] * $_raum['factor'];
|
||||
$nw += $factorSumme;
|
||||
$html .= '<td class="right">'.Helper::number_format_de($factorSumme, 3).'</td>';
|
||||
}
|
||||
$html .= '<td></td>';
|
||||
$html .= '</tr>';
|
||||
}
|
||||
$ungerundet = $nw;
|
||||
|
||||
$NutzwertSummeGerundet = round($ungerundet);
|
||||
|
||||
// if ($zunutzwert) {
|
||||
// $zunutzwert = $zunutzwert + $_objekte['qmM1'];
|
||||
$html .= '<tr>';
|
||||
$html .= '<td class="first"></td>';
|
||||
$html .= '<td></td>';
|
||||
$html .= '<td></td>';
|
||||
$html .= '<td></td>';
|
||||
// $html .= '<td>Gesamtnutzfläche</td>';
|
||||
// $html .= '<td class="right">'.Helper::number_format_de($zunutzwert, 2).'</td>';
|
||||
$html .= '<td></td>';
|
||||
$html .= '<td></td>';
|
||||
$html .= '<td></td>';
|
||||
$html .= '<td></td>';
|
||||
$html .= '<td></td>';
|
||||
$html .= '<td></td>';
|
||||
$html .= '<td></td>';
|
||||
$html .= '<td class="right">'.Helper::number_format_de($ungerundet, 3).'</td>';
|
||||
$html .= '<td class="right">'.$NutzwertSummeGerundet.'</td>';
|
||||
$html .= '</tr>';
|
||||
} else {
|
||||
// UNGERUNDETE CALCULATION
|
||||
$ungerundet = $_objekte['qmM1'] * $_objekte['factor'];
|
||||
$NutzwertSummeGerundet = round($ungerundet);
|
||||
|
||||
$html .= '<tr>';
|
||||
$html .= '<td class="first"></td>';
|
||||
$html .= '<td></td>';
|
||||
$html .= '<td></td>';
|
||||
$html .= '<td></td>';
|
||||
$html .= '<td></td>';
|
||||
$html .= '<td class="right">'.Helper::number_format_de($_objekte['qmM1'], 2).'</td>';
|
||||
$html .= '<td class="center">x</td>';
|
||||
$html .= '<td class="right">'.Helper::number_format_de($_objekte['factor'], 3).'</td>';
|
||||
$html .= '<td></td>';
|
||||
$html .= '<td></td>';
|
||||
$html .= '<td class="center">=</td>';
|
||||
$html .= '<td class="right">'.Helper::number_format_de($ungerundet, 3).'</td>';
|
||||
$html .= '<td class="right">'.$NutzwertSummeGerundet.'</td>';
|
||||
$html .= '</tr>';
|
||||
}
|
||||
|
||||
/********************************************************
|
||||
METHODE 3 + 3b
|
||||
(wie Methode 3 aber ohne Wohnungsfactor)
|
||||
********************************************************/
|
||||
foreach ($_raume_m3 as $key => $_raum) {
|
||||
$html .= '<tr>';
|
||||
$html .= '<td class="first"></td>';
|
||||
$html .= '<td>'.$_raum['geschoss'].'</td>';
|
||||
$html .= '<td></td>';
|
||||
$html .= '<td></td>';
|
||||
$html .= '<td>'.$_raum['raum'].'</td>';
|
||||
$html .= '<td class="right">'.Helper::number_format_de($_raum['qm'], 2).'</td>';
|
||||
|
||||
|
||||
if (3 == $_raum['tt_raumart_id']) { //Methode 3
|
||||
|
||||
$html .= '<td class="center">x</td>';
|
||||
$html .= '<td>'.Helper::number_format_de($_objekte['factor'], 3).'</td>';
|
||||
$html .= '<td class="center">x</td>';
|
||||
$html .= '<td class="right">'.Helper::number_format_de($_raum['factor'], 3).'</td>';
|
||||
$html .= '<td class="center">=</td>';
|
||||
|
||||
// $nw = $_raum['qm'] * $_raum['factor'] * $_objekte['factor'];
|
||||
$nw = $_raum['qm'] * $_raum['factor'] * $_objekte['factor'];
|
||||
$html .= '<td class="right">'.Helper::number_format_de($nw, 3).'</td>';
|
||||
$nw_gerundet = round($nw) < 1 ? 1 : round($nw);
|
||||
} else { //Methode 3b
|
||||
|
||||
$html .= '<td></td>';
|
||||
$html .= '<td></td>';
|
||||
$html .= '<td class="center">x</td>';
|
||||
$html .= '<td class="right">'.Helper::number_format_de($_raum['factor'], 3).'</td>';
|
||||
$html .= '<td class="center">=</td>';
|
||||
|
||||
$nw = $_raum['qm'] * $_raum['factor'];
|
||||
// $nw = $_raum['qm'] * $_raum['factor'];
|
||||
$html .= '<td class="right">'.Helper::number_format_de($nw, 3).'</td>';
|
||||
$nw_gerundet = round($nw) < 1 ? 1 : round($nw);
|
||||
}
|
||||
$html .= '<td class="right">'.round($nw_gerundet).'</td>';
|
||||
$html .= '</tr>';
|
||||
|
||||
$NutzwertSummeGerundet += $nw_gerundet;
|
||||
|
||||
// $html .= Helper::table_row(explode('|', $str));
|
||||
}
|
||||
|
||||
// METHODE 4
|
||||
$_raume = Select::raume_all(DbFunction::$projektid, $tt_raume_basis_id, 4, 0, $exception);
|
||||
|
||||
// if($tt_raume_basis_id == 82909){
|
||||
// print_r($_raume);
|
||||
// exit;
|
||||
// }
|
||||
|
||||
foreach ($_raume as $key => $_raum) {
|
||||
$nw = $_raum['qm'] * $_raum['factor'];
|
||||
$nw_gerundet = round($nw) < 1 ? 1 : round($nw);
|
||||
$NutzwertSummeGerundet += $nw_gerundet;
|
||||
|
||||
$html .= '<tr>';
|
||||
$html .= '<td class="first"></td>';
|
||||
$html .= '<td>'.$_raum['geschoss'].'</td>';
|
||||
$html .= '<td></td>';
|
||||
if($_raum['tt_raumart_id'] == 4){
|
||||
$html .= '<td>Zubehör</td>';
|
||||
}
|
||||
else{
|
||||
// exception type methode 7 and 4 anhängen, ist kein Zubehör
|
||||
$html .= '<td>*</td>';
|
||||
}
|
||||
|
||||
$html .= '<td>'.$_raum['raum'].'</td>';
|
||||
$html .= '<td class="right">'.Helper::number_format_de($_raum['qm'], 2).'</td>';
|
||||
$html .= '<td></td>';
|
||||
$html .= '<td></td>';
|
||||
$html .= '<td class="center">x</td>';
|
||||
$html .= '<td class="right">'.Helper::number_format_de($_raum['factor'], 3).'</td>';
|
||||
$html .= '<td class="center">=</td>';
|
||||
$html .= '<td class="right">'.Helper::number_format_de($nw, 3).'</td>';
|
||||
$html .= '<td class="right">'.round($nw_gerundet).'</td>';
|
||||
$html .= '</tr>';
|
||||
}
|
||||
|
||||
// Nutzwert gerundet
|
||||
$html .= '<tr class="header-row">';
|
||||
$html .= '<td class="abschluss-first right" colspan="12">Nutzwert gerundet</td>';
|
||||
$html .= '<td class="abschluss right">'.$NutzwertSummeGerundet.'</td>';
|
||||
$html .= '</tr>';
|
||||
|
||||
$html .= '</table>';
|
||||
|
||||
DbFunction::secureUpdate('tx_gutachten_raume_basis', ['GNO' => $NutzwertSummeGerundet], ['id' => $_objekte['id']]);
|
||||
}
|
||||
|
||||
return $html;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,123 @@
|
||||
<?php
|
||||
|
||||
namespace HermannTelser\Gutachten\Downloads\Nutzflaeche;
|
||||
|
||||
use HermannTelser\Gutachten\DB\DbFunction;
|
||||
use HermannTelser\Gutachten\DB\Select\Select;
|
||||
use HermannTelser\Gutachten\Utility\Helper;
|
||||
|
||||
class NutzwertBerechnungM5
|
||||
{
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public static function berechnen()
|
||||
{
|
||||
// DbFunction::$debug = 1;
|
||||
|
||||
$res = DbFunction::select('tx_gutachten_orientierung', ['id', 'orientierung'], ['ORDER' => 'sortierung']);
|
||||
$map = [];
|
||||
foreach ($res as $field => $value) {
|
||||
$map[$value['id']] = $value['orientierung'];
|
||||
}
|
||||
|
||||
// $basis_stellplaetze = DbFunction::select('tx_gutachten_raume_all', 'tt_raume_basis_id', ['pid' => $projektid, 'raum' => ['Stellplatz+', 'Stellplatz']]);
|
||||
$_objekte_all = DbFunction::select('tx_gutachten_raume_basis', '*', ['pid' => DbFunction::$projektid, 'noDispInOrientierung' => 1, 'ORDER' => 'topNr']);
|
||||
foreach ($_objekte_all as $key => $value) {
|
||||
$_objekte_all[$key]['orientierung'] = $map[$value['tt_orientierung_id']];
|
||||
}
|
||||
|
||||
foreach ($_objekte_all as $key => $value) {
|
||||
$_objekte_all[$key]['id'] = (int) $value['id'];
|
||||
$_objekte_all[$key]['pid'] = (int) $value['pid'];
|
||||
$_objekte_all[$key]['uid'] = (int) $value['uid'];
|
||||
$_objekte_all[$key]['GNO'] = (int) $value['GNO'];
|
||||
$_objekte_all[$key]['tt_orientierung_id'] = (int) $value['tt_orientierung_id'];
|
||||
$_objekte_all[$key]['noDispInOrientierung'] = (int) $value['noDispInOrientierung'];
|
||||
}
|
||||
// print_r($_objekte_all);
|
||||
// exit;
|
||||
$html = '';
|
||||
foreach ($_objekte_all as $key => $_objekte) {
|
||||
$tt_raume_basis_id = $_objekte['id'];
|
||||
|
||||
// Notizen
|
||||
// if ($value['notizen']!="") {
|
||||
// $str = "|".$v['notizen'];
|
||||
// $pdf->nwbTabelle($str, "13|13|120", 7);
|
||||
// }
|
||||
|
||||
//if methode 5+ Zubehöhr in liste schreiben
|
||||
|
||||
$_raume = DbFunction::select('tx_gutachten_raume_all', '*',
|
||||
[
|
||||
'AND' => [
|
||||
'tt_raume_basis_id' => $tt_raume_basis_id,
|
||||
'tt_raumart_id' => [5, 6, 9]
|
||||
],
|
||||
'ORDER' => ['tt_raumart_id' => 'ASC']
|
||||
]);
|
||||
|
||||
// if(86917 == $tt_raume_basis_id){
|
||||
// print_r($_objekte);
|
||||
// print_r($_raume);
|
||||
// exit;
|
||||
// }
|
||||
|
||||
if (\count($_raume) > 0) {
|
||||
$html .= '<table class="pure-table nutzwert-neu" style="page-break-inside:avoid;">';
|
||||
$html .= '<tr class="header-row">';
|
||||
$html .= '<td style="border-left: 1px solid #cbcbcb;">Top Nr.</td>';
|
||||
$html .= '<td>Geschoß</td>';
|
||||
$html .= '<td>Orientierung</td>';
|
||||
$html .= '<td>Typ</td>';
|
||||
$html .= '<td></td>';
|
||||
$html .= '<td>qm</td>';
|
||||
$html .= '<td colspan="4"></td>';
|
||||
$html .= '<td class="center">NW</td>';
|
||||
$html .= '</tr>';
|
||||
|
||||
$zubehoer = 6 == $_raume[0]['tt_raumart_id'] ? 'Zubehör' : $_objekte['typ'];
|
||||
|
||||
// Methode 5
|
||||
foreach ($_raume as $key => $value) {
|
||||
if ($key > 0) {
|
||||
$_objekte['topNr'] = '';
|
||||
$value['geschoss'] = '';
|
||||
$_objekte['orientierung'] = '';
|
||||
$_objekte['typ'] = '';
|
||||
}
|
||||
|
||||
$html .= '<tr>';
|
||||
$html .= '<td class="first">'.$_objekte['topNr'].'</td>';
|
||||
$html .= '<td>'.$value['geschoss'].'</td>';
|
||||
$html .= '<td>'.$_objekte['orientierung'].'</td>';
|
||||
$html .= '<td>'.$zubehoer.'</td>';
|
||||
$html .= '<td>'.$value['raum'].'</td>';
|
||||
$html .= '<td class="center">'.Helper::number_format_de($value['qm'], 2).'</td>';
|
||||
$html .= '<td class="center">x</td>';
|
||||
$html .= '<td class="center">'.Helper::number_format_de($value['factor'], 3).'</td>';
|
||||
$html .= '<td class="center">=</td>';
|
||||
|
||||
$tmp = $value['qm'] * $value['factor'];
|
||||
|
||||
$html .= '<td class="center">'.Helper::number_format_de($tmp, 3).'</td>';
|
||||
|
||||
if (9 == $value['tt_raumart_id']) {
|
||||
$html .= '<td class="center">'.round($value['NWungerundet']).'</td>';
|
||||
} else {
|
||||
$html .= '<td class="center">'.$value['NW'].'</td>';
|
||||
}
|
||||
$html .= '</tr>';
|
||||
}
|
||||
|
||||
$html .= '<tr class="header-row">';
|
||||
$html .= '<td class="abschluss-first" colspan="10">Nutzwert gerundet</td>';
|
||||
$html .= '<td class="abschluss center">'.$_objekte['GNO'].'</td>';
|
||||
$html .= '</tr>';
|
||||
$html .= '</table>';
|
||||
}
|
||||
}
|
||||
return $html;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
namespace HermannTelser\Gutachten\Downloads\Nutzflaeche;
|
||||
|
||||
use HermannTelser\Gutachten\DB\DbFunction;
|
||||
|
||||
class ObjectAufGeschossen
|
||||
{
|
||||
public static function load()
|
||||
{
|
||||
// DbFunction::$debug = 1;
|
||||
|
||||
$_arr = DbFunction::select(
|
||||
'tx_gutachten_raume_all',
|
||||
['tt_raume_basis_id', 'geschoss'],
|
||||
[
|
||||
'AND' => ['pid' => DbFunction::$projektid, 'tt_raumart_id[!]' => 4],
|
||||
'GROUP' => ['tt_raume_basis_id', 'geschoss'],
|
||||
]
|
||||
);
|
||||
|
||||
$_objekte_geschosse = [];
|
||||
foreach ($_arr as $key => $value) {
|
||||
$basisid = $value['tt_raume_basis_id'];
|
||||
$geschoss = $value['geschoss'];
|
||||
$_objekte_geschosse[$basisid][] = $geschoss;
|
||||
}
|
||||
|
||||
foreach ($_objekte_geschosse as $key => $value) {
|
||||
$_objekte_geschosse[$key] = implode(',', $value);
|
||||
}
|
||||
|
||||
return $_objekte_geschosse;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,173 @@
|
||||
<?php
|
||||
|
||||
namespace HermannTelser\Gutachten\Downloads\Nutzflaeche;
|
||||
|
||||
use HermannTelser\Gutachten\DB\DbFunction;
|
||||
use HermannTelser\Gutachten\Downloads\PdfNutzflaeche;
|
||||
use HermannTelser\Gutachten\Utility\Helper;
|
||||
|
||||
class TabelleZuAbschlaege
|
||||
{
|
||||
/**
|
||||
* @param mixed $_projekt
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function load($_projekt)
|
||||
{
|
||||
// DbFunction::$debug = 1;
|
||||
|
||||
$projektid = $_projekt[0]['id'];
|
||||
|
||||
$header_row = ['Top', 'Geschoß', 'Typ', 'Nutzfläche'];
|
||||
$header_row[] = 0 != $_projekt[0]['loggia_title'] ? $_projekt[0]['loggia_title'] : 'Loggia / sonst. Zusatzflächen';
|
||||
$header_row[] = 'Gesamtnutzfläche';
|
||||
|
||||
$_column_titel = DbFunction::select(
|
||||
'tx_gutachten_help',
|
||||
['colid', 'coltitel'],
|
||||
['pid' => $projektid]
|
||||
);
|
||||
foreach ($_column_titel as $key => $value) {
|
||||
$header_row[] = $value['coltitel'];
|
||||
}
|
||||
$header_row[] = 'Summe A-Z';
|
||||
$header_row[] = 'Wohnungsbewertung';
|
||||
$html = Helper::table_header_row_r($header_row);
|
||||
|
||||
$_fields = [
|
||||
'tx_gutachten_raume_basis.id',
|
||||
'tx_gutachten_raume_basis.topNr',
|
||||
'tx_gutachten_raume_all.geschoss',
|
||||
'tx_gutachten_raume_basis.typ',
|
||||
'tx_gutachten_raume_basis.u(nutzflaeche)',
|
||||
'tx_gutachten_raume_basis.u(loggia)',
|
||||
'tx_gutachten_raume_basis.u(gesammtnutzflaeche)',
|
||||
];
|
||||
foreach ($_column_titel as $key => $value) {
|
||||
$_fields[] = 'tx_gutachten_raume_basis.'.$value['colid'];
|
||||
}
|
||||
$_fields[] = 'tx_gutachten_raume_basis.summe_az';
|
||||
$_fields[] = 'tx_gutachten_raume_basis.bewertung';
|
||||
|
||||
$_where = [];
|
||||
$_where['AND']['tx_gutachten_raume_basis.pid'] = $projektid;
|
||||
$_where['AND']['tx_gutachten_raume_basis.noDispInOrientierung'] = 0;
|
||||
$_where['AND']['tx_gutachten_raume_all.tt_raumart_id'] = 1;
|
||||
// $_where['AND']['tx_gutachten_raume_basis.typ[!]'] = '';
|
||||
$_where['GROUP'] = 'tx_gutachten_raume_basis.id';
|
||||
$_where['ORDER']['tx_gutachten_raume_basis.topNr'] = 'ASC';
|
||||
|
||||
$_raeume = DbFunction::selectJoin(
|
||||
'tx_gutachten_raume_basis',
|
||||
['[>]tx_gutachten_raume_all' => ['tx_gutachten_raume_basis.id' => 'tt_raume_basis_id']],
|
||||
$_fields,
|
||||
$_where
|
||||
);
|
||||
|
||||
|
||||
|
||||
// $part1 = [];
|
||||
// $part2 = [];
|
||||
// foreach ($_raeume as $key => $value) {
|
||||
// if($value['typ'] != '')
|
||||
// {
|
||||
// $part1[] = $value;
|
||||
//
|
||||
// }
|
||||
// else {
|
||||
// $part2[] = $value;
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// $topNr = array_column($part1, 'topNr');
|
||||
// array_multisort($topNr, SORT_ASC, $part1);
|
||||
//
|
||||
// $topNr = array_column($part2, 'topNr');
|
||||
// array_multisort($topNr, SORT_ASC, $part2);
|
||||
|
||||
// $_raeume = array_merge($part1, $part2);
|
||||
|
||||
$summe_nutzfache = 0;
|
||||
$summe_loggien = 0;
|
||||
|
||||
foreach ($_raeume as $key => $value) {
|
||||
unset($_raeume[$key]['id']);
|
||||
|
||||
$tt_raume_basis_id = $value['id'];
|
||||
|
||||
$nutzflaeche = DbFunction::sum('tx_gutachten_raume_all', 'qm', ['AND' => ['tt_raumart_id' => 1, 'tt_raume_basis_id' => $tt_raume_basis_id]]);
|
||||
|
||||
$summe_nutzfache += $nutzflaeche;
|
||||
|
||||
$_raeume[$key]['nutzflaeche'] = Helper::number_format_de($nutzflaeche, 2);
|
||||
|
||||
$res = DbFunction::selectJoin(
|
||||
'tx_gutachten_raume_all',
|
||||
['[>]tx_gutachten_raume_generell' => 'tt_raumart_id'],
|
||||
'tx_gutachten_raume_all.qm',
|
||||
[
|
||||
'AND' => [
|
||||
'tx_gutachten_raume_all.pid' => $projektid,
|
||||
'tx_gutachten_raume_all.tt_raume_basis_id' => $tt_raume_basis_id,
|
||||
'tx_gutachten_raume_all.tt_raumart_id' => [2, 8],
|
||||
'tx_gutachten_raume_generell.zunutzwert' => 1,
|
||||
],
|
||||
'GROUP' => 'tx_gutachten_raume_all.id',
|
||||
]
|
||||
);
|
||||
$loggia = array_sum($res);
|
||||
$summe_loggien += $loggia;
|
||||
$_raeume[$key]['tt_raume_basis_id'] = $tt_raume_basis_id;
|
||||
$_raeume[$key]['loggia'] = round($loggia, 2);
|
||||
$sum = round($nutzflaeche + $loggia, 2);
|
||||
$_raeume[$key]['gesammtnutzflaeche'] = Helper::number_format_de($sum, 2);
|
||||
}
|
||||
|
||||
$_columns = range('a', 'u');
|
||||
$_columns[] = 'loggia';
|
||||
$_raeume = Helper::zero_to_null($_raeume, $_columns);
|
||||
|
||||
// print_r(PdfNutzflaeche::$_objekte_geschosse);
|
||||
//
|
||||
foreach ($_raeume as $key => $_row) {
|
||||
$basisid = $_row['tt_raume_basis_id'];
|
||||
|
||||
if (isset(PdfNutzflaeche::$_objekte_geschosse[$basisid])) {
|
||||
$_row['geschoss'] = PdfNutzflaeche::$_objekte_geschosse[$basisid];
|
||||
}
|
||||
unset($_row['tt_raume_basis_id']);
|
||||
|
||||
$html .= '<tr>';
|
||||
$i = 1;
|
||||
foreach ($_row as $key => $value) {
|
||||
if (is_numeric($value)) {
|
||||
$value = Helper::number_format_de($value, 2);
|
||||
}
|
||||
if ($i > 3) {
|
||||
$html .= '<td style="border-bottom: 0.1mm solid #cbcbcb;" class="right">'.$value.'</td>';
|
||||
} else {
|
||||
$html .= '<td style="border-bottom: 0.1mm solid #cbcbcb;">'.$value.'</td>';
|
||||
}
|
||||
++$i;
|
||||
}
|
||||
$html .= '</tr>';
|
||||
}
|
||||
|
||||
// SUMMEN
|
||||
$html .= '<tr>';
|
||||
$html .= '<td style="border-bottom: 0.1mm solid #cbcbcb;" colspan="3">Summen</td>';
|
||||
$html .= '<td style="border-bottom: 0.1mm solid #cbcbcb;" class="right">'.Helper::number_format_de($summe_nutzfache, 2).'</td>';
|
||||
if($summe_loggien){
|
||||
$html .= '<td style="border-bottom: 0.1mm solid #cbcbcb;" class="right">'.Helper::number_format_de($summe_loggien, 2).'</td>';
|
||||
}else {
|
||||
$html .= '<td style="border-bottom: 0.1mm solid #cbcbcb;"> </td>';
|
||||
}
|
||||
$sum_total = $summe_nutzfache + $summe_loggien;
|
||||
$html .= '<td style="border-bottom: 0.1mm solid #cbcbcb; border-right: 0.1mm solid #cbcbcb;" class="right">'.Helper::number_format_de($sum_total, 2).'</td>';
|
||||
$html .= '</tr>';
|
||||
|
||||
|
||||
return $html;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,144 @@
|
||||
<?php
|
||||
|
||||
namespace HermannTelser\Gutachten\Downloads;
|
||||
|
||||
ini_set('display_errors', 1);
|
||||
ini_set('display_startup_errors', 1);
|
||||
error_reporting(E_ALL);
|
||||
|
||||
use HermannTelser\Gutachten\Berechnungen\Berechnung;
|
||||
use HermannTelser\Gutachten\DB\DbFunction;
|
||||
use HermannTelser\Gutachten\Downloads\Nutzflaeche\NutzflaecheZusammenstellung;
|
||||
use HermannTelser\Gutachten\Downloads\Nutzflaeche\NutzwertBerechnungM1M4;
|
||||
use HermannTelser\Gutachten\Downloads\Nutzflaeche\NutzwertBerechnungM5;
|
||||
use HermannTelser\Gutachten\Downloads\Nutzflaeche\TabelleZuAbschlaege;
|
||||
use HermannTelser\Gutachten\Downloads\Nutzflaeche\ObjectAufGeschossen;
|
||||
use HermannTelser\Gutachten\Utility\Helper;
|
||||
use TYPO3\CMS\Core\Core\Environment;
|
||||
// Mpdf installed by typo3 extension
|
||||
use Mpdf;
|
||||
|
||||
class PdfNutzflaeche
|
||||
{
|
||||
public static $projektname = '';
|
||||
public static $_platzhalter = [];
|
||||
public static $_projekt = [];
|
||||
public static $_objekte_geschosse = [];
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public static function download()
|
||||
{
|
||||
// DbFunction::$debug = 1;
|
||||
|
||||
Berechnung::berechnen();
|
||||
|
||||
self::$_objekte_geschosse = ObjectAufGeschossen::load();
|
||||
|
||||
ob_clean(); // set to remove wrong headers which crashed some files (e.g. xls, dot, ...)
|
||||
|
||||
if (!isset(DbFunction::$projektid) or 0 == DbFunction::$projektid) {
|
||||
die('aktive projekt ID fehlt!');
|
||||
}
|
||||
|
||||
$_projekt = DbFunction::select(
|
||||
'tx_gutachten_projekte',
|
||||
['id', 'auftraggeber_id', 'gutachter_id', 'intname', 'name', 'beschreibung', 'erstellung', 'onoff', 'upload', 'allgemeinupload', 'recalculate', 'zuabTitel', 'nwbTitel', 'zustTitel', 'allgemTitel', 'loggia_title', 'nwbStartSeite', 'm1pP', 'm5pP', 'timestamp', 'status', 'erstelldatum'],
|
||||
['id' => DbFunction::$projektid]
|
||||
);
|
||||
|
||||
|
||||
$zuabTitel = ('' == $_projekt[0]['zuabTitel'] or 'fehlt!' == $_projekt[0]['zuabTitel']) ? '3.21 ZU UND ABSCHLAEGE' : $_projekt[0]['zuabTitel'];
|
||||
$nwbTitel = ('' == $_projekt[0]['nwbTitel'] or 'fehlt!' == $_projekt[0]['nwbTitel']) ? '3.30 NUTZWERTBERECHNUNG' : $_projekt[0]['nwbTitel'];
|
||||
$zustTitel = ('' == $_projekt[0]['zustTitel'] or 'fehlt!' == $_projekt[0]['zustTitel']) ? '3.40 ZUSAMMENSTELLUNG' : $_projekt[0]['zustTitel'];
|
||||
$allgemTitel = ('' == $_projekt[0]['allgemTitel'] or 'fehlt!' == $_projekt[0]['allgemTitel']) ? '3.40 ZUSAMMENSTELLUNG' : $_projekt[0]['allgemTitel'];
|
||||
|
||||
$_platzhalter = DbFunction::select(
|
||||
'tx_gutachten_projekteplatzhalter',
|
||||
['code', 'txt'],
|
||||
['pid' => DbFunction::$projektid]
|
||||
);
|
||||
|
||||
$_projektestandards = DbFunction::select(
|
||||
'tx_gutachten_projektestandards',
|
||||
['pos', 'neueseite', 'kennung', 'titel', 'txt', 'platzhalter', 'textart_id'],
|
||||
['pid' => DbFunction::$projektid, 'ORDER' => 'pos']
|
||||
);
|
||||
|
||||
foreach ($_projektestandards as $key => $value) {
|
||||
if (4 == $value['textart_id']) {
|
||||
$title = Helper::replacePlatzhalter($_platzhalter, $value['txt']);
|
||||
$title = explode('<br />', $title);
|
||||
$projektname = $title[0];
|
||||
}
|
||||
}
|
||||
// $title = DbFunction::get('tx_gutachten_projektestandards', 'txt', ['AND' => ['textart_id' => 4, 'pid' => $projektid]]);
|
||||
// $title = Helper::replacePlatzhalter($_platzhalter, $title);
|
||||
|
||||
$mpdf = new \Mpdf\Mpdf([
|
||||
'mode' => 'utf-8',
|
||||
'format' => 'A4-P',
|
||||
'margin_left' => 10,
|
||||
'margin_right' => 10,
|
||||
'margin_top' => 22,
|
||||
'margin_bottom' => 20,
|
||||
'margin_header' => 0,
|
||||
'margin_footer' => 0,
|
||||
]);
|
||||
$mpdf->shrink_tables_to_fit = 1;
|
||||
|
||||
$stylesheet = file_get_contents(__DIR__.'/style.css');
|
||||
$mpdf->WriteHTML($stylesheet, \Mpdf\HTMLParserMode::HEADER_CSS);
|
||||
|
||||
// 1 Tabelle Zu und Abschläge
|
||||
$mpdf->AddPage('', '', $_projekt[0]['nwbStartSeite']);
|
||||
// $footer = Helper::footer($projektname);
|
||||
$mpdf->SetHTMLFooter('<div class="size07 center">Seite {PAGENO}<br><br></div>');
|
||||
$html = '<div class="header">'.$zuabTitel.'</div>';
|
||||
$html .= '<table class="pure-table pure-table-striped nutzwert-neu">';
|
||||
$html .= TabelleZuAbschlaege::load($_projekt);
|
||||
$html .= '</table>';
|
||||
$mpdf->WriteHTML($html, \Mpdf\HTMLParserMode::HTML_BODY);
|
||||
|
||||
// // 2 NUTZWERTBERECHNUNG M1 - M4
|
||||
$mpdf->AddPage();
|
||||
$mpdf->SetHTMLFooter('<div class="size07 center">Seite {PAGENO}<br><br></div>');
|
||||
$html = '<div class="header">'.$nwbTitel.'</div>';
|
||||
$html .= NutzwertBerechnungM1M4::berechnen();
|
||||
$mpdf->WriteHTML($html, \Mpdf\HTMLParserMode::HTML_BODY);
|
||||
|
||||
// 3 NUTZWERTBERECHNUNG M5
|
||||
$html = NutzwertBerechnungM5::berechnen();
|
||||
$mpdf->WriteHTML($html, \Mpdf\HTMLParserMode::HTML_BODY);
|
||||
|
||||
// 4 ZUSAMMENSTELLUNG
|
||||
$mpdf->AddPage();
|
||||
$mpdf->SetHTMLFooter('<div class="size07 center">Seite {PAGENO}<br><br></div>');
|
||||
$html = '<div class="header">'.$zustTitel.'</div>';
|
||||
$html .= NutzflaecheZusammenstellung::load($_projekt);
|
||||
|
||||
// 5 DIGITALE SIGNATUR
|
||||
$image = Environment::getProjectPath()."/public/typo3conf/ext/gutachten/Resources/Public/Images/avf_stempel.png";
|
||||
$html .= '<div style="height: 150mm; padding: 0; page-break-inside: avoid;">';
|
||||
$html .= '<div class="header">3.41 Digitale Signatur</div>';
|
||||
$html .= '<table style="width:194mm; margin-top:80mm;"><tr>';
|
||||
$html .= '<td style="vertical-align:middle; text-align:right;">'.$_projekt[0]['erstellung'].'</td>';
|
||||
$html .= '<td style="text-align:right;"><img src="'.$image.'" style="width:36mm; height:36mm"></td>';
|
||||
$html .= '</tr></table>';
|
||||
$html .= '</div>';
|
||||
$mpdf->WriteHTML($html, \Mpdf\HTMLParserMode::HTML_BODY);
|
||||
|
||||
// 6 ALLGEMEINTABELLE
|
||||
$mpdf->AddPage();
|
||||
$mpdf->SetHTMLFooter('<div class="size07 center">Seite {PAGENO}<br><br></div>');
|
||||
$html = '<div class="header">'.$allgemTitel.'</div>';
|
||||
$html .= AllgemeinTabelle::load();
|
||||
$mpdf->WriteHTML($html, \Mpdf\HTMLParserMode::HTML_BODY);
|
||||
|
||||
// finale
|
||||
$mpdf->Output('Nutzflächen.pdf', Mpdf\Output\Destination::INLINE);
|
||||
|
||||
exit;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,154 @@
|
||||
<?php
|
||||
|
||||
namespace HermannTelser\Gutachten\Downloads;
|
||||
|
||||
use HermannTelser\Gutachten\DB\DbFunction;
|
||||
use HermannTelser\Gutachten\DB\Select\Paragraph62;
|
||||
use HermannTelser\Gutachten\Utility\Helper;
|
||||
use TYPO3\CMS\Core\Core\Environment;
|
||||
|
||||
use Mpdf;
|
||||
// Mpdf installed by typo3 extension
|
||||
use TYPO3\CMS\Core\Utility\GeneralUtility;
|
||||
|
||||
class PdfParagraph6
|
||||
{
|
||||
public static $Mpdf;
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public static function download()
|
||||
{
|
||||
// ob_clean(); // set to remove wrong headers which crashed some files (e.g. xls, dot, ...)
|
||||
|
||||
// DbFunction::$debug = 1;
|
||||
|
||||
DbFunction::$projektid = GeneralUtility::_GP('projekt_aktive');
|
||||
|
||||
if (0 == DbFunction::$projektid or !is_numeric(DbFunction::$projektid)) {
|
||||
die('aktive projekt ID fehlt!');
|
||||
}
|
||||
|
||||
$_platzhalter = DbFunction::select(
|
||||
'tx_gutachten_projekteplatzhalter',
|
||||
['code', 'txt'],
|
||||
['pid' => DbFunction::$projektid]
|
||||
);
|
||||
|
||||
$_projekt = DbFunction::select(
|
||||
'tx_gutachten_projekte',
|
||||
['auftraggeber_id', 'gutachter_id', 'intname', 'name', 'beschreibung', 'erstellung', 'onoff', 'upload', 'allgemeinupload', 'recalculate', 'zuabTitel', 'nwbTitel', 'zustTitel', 'allgemTitel', 'loggia_title', 'nwbStartSeite', 'm1pP', 'm5pP', 'timestamp', 'status', 'erstelldatum'],
|
||||
['id' => DbFunction::$projektid]
|
||||
);
|
||||
|
||||
$_auftraggeber = DbFunction::select(
|
||||
'tx_gutachten_auftraggeber',
|
||||
'*',
|
||||
['id' => $_projekt[0]['auftraggeber_id']]
|
||||
);
|
||||
|
||||
$_gutachter = DbFunction::select(
|
||||
'tx_gutachten_gutachter',
|
||||
'*',
|
||||
['id' => $_projekt[0]['gutachter_id']]
|
||||
);
|
||||
|
||||
|
||||
// print_r($_projekt);
|
||||
// print_r($_auftraggeber);
|
||||
// print_r($_gutachter);
|
||||
// exit;
|
||||
|
||||
self::$Mpdf = new \Mpdf\Mpdf([
|
||||
'mode' => 'utf-8',
|
||||
'format' => 'A4-P',
|
||||
'margin_left' => 10,
|
||||
'margin_right' => 10,
|
||||
'margin_top' => 10,
|
||||
'margin_bottom' => 10,
|
||||
'margin_header' => 0,
|
||||
'margin_footer' => 0,
|
||||
]);
|
||||
|
||||
$stylesheet = file_get_contents(__DIR__.'/style.css');
|
||||
|
||||
self::$Mpdf->WriteHTML($stylesheet, \Mpdf\HTMLParserMode::HEADER_CSS);
|
||||
// 1 tabelle
|
||||
// 2 inhaltsverzeichnis
|
||||
// 3 textblock
|
||||
// 4 deckblatt
|
||||
// 5 nur Überschrift
|
||||
// 6 auftraggeber
|
||||
// 7 tabelle § 6/2
|
||||
// 8 allgemeinflächen
|
||||
$_standards = DbFunction::select('tx_gutachten_projektestandards', '*', ['AND' => ['pid' => DbFunction::$projektid, 'kennung' => ['Deckblatt', '2.30 § 6 Teil 1', 'Tabelle § 6', '2.30 § 6 Teil 2']], 'ORDER' => 'pos']);
|
||||
|
||||
foreach ($_standards as $key => $value) {
|
||||
$textartid = (int)$value['textart_id'];
|
||||
switch ($textartid) {
|
||||
case '4':
|
||||
// DECKBLATT
|
||||
$value['paragraph6'] = 1;
|
||||
$html = Deckblatt::create($value, $_projekt, $_platzhalter, $_gutachter, $_auftraggeber);
|
||||
self::$Mpdf->WriteHTML($html, \Mpdf\HTMLParserMode::HTML_BODY);
|
||||
break;
|
||||
case '3':
|
||||
if (1 == $value['neueseite']) {
|
||||
self::$Mpdf->AddPageByArray(['mgt' => 22, 'mgb' => 22, 'mgl' => 10, 'mgr' => 10]);
|
||||
self::$Mpdf->SetHTMLFooter('<div class="size09 center">Seite {PAGENO}<br><br></div>');
|
||||
}
|
||||
// if ('' != $value['titel']) {
|
||||
// $html = '<div class="header">'.$value['titel'].'</div>';
|
||||
// } elseif ('' != $value['kennung']) {
|
||||
// $html = '<div class="header">'.$value['kennung'].'</div>';
|
||||
// }
|
||||
$textblock = Helper::replacePlatzhalter($_platzhalter, $value['txt']);
|
||||
$html = '<div class="textblock">' . $textblock . '</div>';
|
||||
self::$Mpdf->WriteHTML($html, \Mpdf\HTMLParserMode::HTML_BODY);
|
||||
break;
|
||||
case '7':
|
||||
// 7 tabelle § 6/2
|
||||
if (1 == $value['neueseite']) {
|
||||
self::$Mpdf->AddPage();
|
||||
self::$Mpdf->SetHTMLFooter('<div class="size09 center">Seite {PAGENO}<br><br></div>');
|
||||
}
|
||||
|
||||
$_paragraph_62 = Paragraph62::select(DbFunction::$projektid);
|
||||
|
||||
$html = '<table class="pure-table pure-table-striped nutzwert-neu center">';
|
||||
$html .= '<thead><tr class="header-row">';
|
||||
$html .= '<th style="border-bottom: 0.1mm solid #cbcbcb;">Top</th>';
|
||||
$html .= '<th style="border-bottom: 0.1mm solid #cbcbcb;">Geschoß</th>';
|
||||
$html .= '<th style="border-bottom: 0.1mm solid #cbcbcb;">Orientierung</th>';
|
||||
$html .= '<th style="border-bottom: 0.1mm solid #cbcbcb;">Typ</th>';
|
||||
$html .= '</tr></thead>';
|
||||
|
||||
// $html = '<table class="pure-table pure-table-striped nutzwert-neu">';
|
||||
// $html .= Helper::table_header_row(['Top', 'Geschoß', 'Orientierung', 'Typ']);
|
||||
foreach ($_paragraph_62 as $key => $value) {
|
||||
$html .= Helper::table_row($value, 1);
|
||||
}
|
||||
$html .= '</table>';
|
||||
|
||||
self::$Mpdf->WriteHTML($html, \Mpdf\HTMLParserMode::HTML_BODY);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// 5 DIGITALE SIGNATUR
|
||||
$image = Environment::getProjectPath()."/public/typo3conf/ext/gutachten/Resources/Public/Images/avf_stempel.png";
|
||||
$html = '<div style="height: 150mm; padding: 0; page-break-inside: avoid;">';
|
||||
$html .= '<div class="header">Digitale Signatur</div>';
|
||||
$html .= '<table style="width:194mm; margin-top:80mm;"><tr>';
|
||||
$html .= '<td style="vertical-align:middle; text-align:right;">'.$_projekt[0]['erstellung'].'</td>';
|
||||
$html .= '<td style="text-align:right;"><img src="'.$image.'" style="width:36mm; height:36mm"></td>';
|
||||
$html .= '</tr></table>';
|
||||
$html .= '</div>';
|
||||
|
||||
self::$Mpdf->WriteHTML($html, \Mpdf\HTMLParserMode::HTML_BODY);
|
||||
|
||||
self::$Mpdf->Output('GutachtenParagraph6.pdf', Mpdf\Output\Destination::INLINE);
|
||||
|
||||
exit;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,215 @@
|
||||
<?php
|
||||
|
||||
namespace HermannTelser\Gutachten\Downloads;
|
||||
|
||||
use HermannTelser\Gutachten\DB\DbFunction;
|
||||
use HermannTelser\Gutachten\DB\Select\Paragraph62;
|
||||
use HermannTelser\Gutachten\DB\Select\Select;
|
||||
use HermannTelser\Gutachten\Utility\Helper;
|
||||
use HermannTelser\Gutachten\Downloads\AllgemeinTabelle;
|
||||
|
||||
use Mpdf;
|
||||
// Mpdf installed by typo3 extension
|
||||
use TYPO3\CMS\Core\Utility\GeneralUtility;
|
||||
|
||||
class PdfStandards
|
||||
{
|
||||
public static $Mpdf;
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public static function download()
|
||||
{
|
||||
// ob_clean(); // set to remove wrong headers which crashed some files (e.g. xls, dot, ...)
|
||||
|
||||
// DbFunction::$debug = 1;
|
||||
|
||||
DbFunction::$projektid = GeneralUtility::_GP('projekt_aktive');
|
||||
|
||||
if (0 == DbFunction::$projektid or !is_numeric(DbFunction::$projektid)) {
|
||||
die('aktive projekt ID fehlt!');
|
||||
}
|
||||
|
||||
$_platzhalter = DbFunction::select(
|
||||
'tx_gutachten_projekteplatzhalter',
|
||||
['code', 'txt'],
|
||||
['pid' => DbFunction::$projektid]
|
||||
);
|
||||
|
||||
$_projekt = DbFunction::select(
|
||||
'tx_gutachten_projekte',
|
||||
['auftraggeber_id', 'gutachter_id', 'intname', 'name', 'beschreibung', 'erstellung', 'onoff', 'upload', 'allgemeinupload', 'recalculate', 'zuabTitel', 'nwbTitel', 'zustTitel', 'allgemTitel', 'loggia_title', 'nwbStartSeite', 'm1pP', 'm5pP', 'timestamp', 'status', 'erstelldatum'],
|
||||
['id' => DbFunction::$projektid]
|
||||
);
|
||||
|
||||
$_auftraggeber = DbFunction::select(
|
||||
'tx_gutachten_auftraggeber',
|
||||
'*',
|
||||
['id' => $_projekt[0]['auftraggeber_id']]
|
||||
);
|
||||
|
||||
$_gutachter = DbFunction::select(
|
||||
'tx_gutachten_gutachter',
|
||||
'*',
|
||||
['id' => $_projekt[0]['gutachter_id']]
|
||||
);
|
||||
|
||||
|
||||
// print_r($_projekt);
|
||||
// print_r($_auftraggeber);
|
||||
// print_r($_gutachter);
|
||||
// exit;
|
||||
|
||||
self::$Mpdf = new \Mpdf\Mpdf([
|
||||
'mode' => 'utf-8',
|
||||
'format' => 'A4-P',
|
||||
'margin_left' => 0,
|
||||
'margin_right' => 0,
|
||||
'margin_top' => 0,
|
||||
'margin_bottom' => 0,
|
||||
'margin_header' => 0,
|
||||
'margin_footer' => 0,
|
||||
]);
|
||||
|
||||
$stylesheet = file_get_contents(__DIR__.'/style.css');
|
||||
|
||||
self::$Mpdf->WriteHTML($stylesheet, \Mpdf\HTMLParserMode::HEADER_CSS);
|
||||
// 1 tabelle
|
||||
// 2 inhaltsverzeichnis
|
||||
// 3 textblock
|
||||
// 4 deckblatt
|
||||
// 5 nur Überschrift
|
||||
// 6 auftraggeber
|
||||
// 7 tabelle § 6/2
|
||||
// 8 allgemeinflächen
|
||||
$_standards = DbFunction::select('tx_gutachten_projektestandards', '*', ['AND' => ['hidden' => 0, 'pid' => DbFunction::$projektid], 'ORDER' => 'pos']);
|
||||
|
||||
foreach ($_standards as $key => $value) {
|
||||
$textartid = (int)$value['textart_id'];
|
||||
switch ($textartid) {
|
||||
case '4':
|
||||
// DECKBLATT
|
||||
$html = Deckblatt::create($value, $_projekt, $_platzhalter, $_gutachter, $_auftraggeber);
|
||||
self::$Mpdf->WriteHTML($html, \Mpdf\HTMLParserMode::HTML_BODY);
|
||||
break;
|
||||
case '2':
|
||||
// INHALTSVERZEICHNIS
|
||||
self::$Mpdf->AddPageByArray(['mgt' => 22, 'mgb' => 22, 'mgl' => 10, 'mgr' => 10]);
|
||||
$html = Inhaltsverzeichnis::create($value, $_platzhalter);
|
||||
self::$Mpdf->SetHTMLFooter('<div class="size09 center">Seite {PAGENO}<br><br></div>');
|
||||
self::$Mpdf->WriteHTML($html, \Mpdf\HTMLParserMode::HTML_BODY);
|
||||
|
||||
break;
|
||||
case '1':
|
||||
if (1 == $value['neueseite']) {
|
||||
self::$Mpdf->AddPage();
|
||||
self::$Mpdf->SetHTMLFooter('<div class="size09 center">Seite {PAGENO}<br><br></div>');
|
||||
}
|
||||
$html = '';
|
||||
if ('' != $value['titel']) {
|
||||
$html = '<div class="header">'.$value['titel'].'</div>';
|
||||
} elseif ('' != $value['kennung']) {
|
||||
$html = '<div class="header">'.$value['kennung'].'</div>';
|
||||
}
|
||||
|
||||
$text = Helper::replacePlatzhalter($_platzhalter, $value['txt']);
|
||||
$_text = explode('<br />', $text);
|
||||
$html .= '<table class="pure-table pure-table-striped ganzebreite size09">';
|
||||
foreach ($_text as $key => $value) {
|
||||
$_row = explode('|', $value);
|
||||
$html .= Helper::table_row($_row);
|
||||
}
|
||||
$html .= '</table>';
|
||||
self::$Mpdf->WriteHTML($html, \Mpdf\HTMLParserMode::HTML_BODY);
|
||||
break;
|
||||
case '3':
|
||||
if (1 == $value['neueseite']) {
|
||||
self::$Mpdf->AddPage();
|
||||
self::$Mpdf->SetHTMLFooter('<div class="size09 center">Seite {PAGENO}<br><br></div>');
|
||||
}
|
||||
$html = '';
|
||||
if ('' != $value['titel']) {
|
||||
$html = '<div class="header">'.$value['titel'].'</div>';
|
||||
} elseif ('' != $value['kennung']) {
|
||||
$html = '<div class="header">'.$value['kennung'].'</div>';
|
||||
}
|
||||
$textblock = Helper::replacePlatzhalter($_platzhalter, $value['txt']);
|
||||
$html .= '<div class="textblock">'.$textblock.'</div>';
|
||||
self::$Mpdf->WriteHTML($html, \Mpdf\HTMLParserMode::HTML_BODY);
|
||||
break;
|
||||
case '5':
|
||||
if (1 == $value['neueseite']) {
|
||||
self::$Mpdf->AddPage();
|
||||
self::$Mpdf->SetHTMLFooter('<div class="size09 center">Seite {PAGENO}<br><br></div>');
|
||||
}
|
||||
if ('' != $value['titel']) {
|
||||
$html = '<div class="header">'.$value['titel'].'</div>';
|
||||
} elseif ('' != $value['kennung']) {
|
||||
$html = '<div class="header">'.$value['kennung'].'</div>';
|
||||
}
|
||||
self::$Mpdf->WriteHTML($html, \Mpdf\HTMLParserMode::HTML_BODY);
|
||||
break;
|
||||
case '6':
|
||||
if (1 == $value['neueseite']) {
|
||||
self::$Mpdf->AddPage();
|
||||
self::$Mpdf->SetHTMLFooter('<div class="size09 center">Seite {PAGENO}<br><br></div>');
|
||||
}
|
||||
$html = '<div class="header">'.$value['titel'].'</div>';
|
||||
|
||||
$auftraggeber = str_replace('<br />', '|||', $_auftraggeber[0]['txt']);
|
||||
$auftraggeber = str_replace('</div>', '|||', $auftraggeber);
|
||||
$tmp = explode('|||', $auftraggeber);
|
||||
$string = '';
|
||||
foreach ($tmp as $key => $value) {
|
||||
$value = strip_tags($value);
|
||||
if ('-' == $value[0]) {
|
||||
$value = substr($value, 1);
|
||||
}
|
||||
$string .= trim(strip_tags($value)).'<br>';
|
||||
}
|
||||
$html .= '<div class="textblock">'.$string.'</div>';
|
||||
self::$Mpdf->WriteHTML($html, \Mpdf\HTMLParserMode::HTML_BODY);
|
||||
break;
|
||||
case '7':
|
||||
// 7 tabelle § 6/2
|
||||
if (1 == $value['neueseite']) {
|
||||
self::$Mpdf->AddPage();
|
||||
self::$Mpdf->SetHTMLFooter('<div class="size09 center">Seite {PAGENO}<br><br></div>');
|
||||
}
|
||||
|
||||
$_paragraph_62 = Paragraph62::select(DbFunction::$projektid);
|
||||
$html = '<table class="pure-table pure-table-striped ganzebreite size08 center">';
|
||||
$html .= Helper::table_header_row(['Top', 'Geschoß', 'Orientierung', 'Typ']);
|
||||
foreach ($_paragraph_62 as $key => $value) {
|
||||
$html .= Helper::table_row($value, 1);
|
||||
}
|
||||
$html .= '</table>';
|
||||
|
||||
self::$Mpdf->WriteHTML($html, \Mpdf\HTMLParserMode::HTML_BODY);
|
||||
break;
|
||||
case '8':
|
||||
// ALLGEMEINFLÄCHEN
|
||||
if (1 == $value['neueseite']) {
|
||||
self::$Mpdf->AddPage();
|
||||
self::$Mpdf->SetHTMLFooter('<div class="center">Seite {PAGENO}<br><br></div>');
|
||||
}
|
||||
|
||||
if ('' != $value['titel']) {
|
||||
$html = '<div class="header">'.$value['titel'].'</div>';
|
||||
} elseif ('' != $value['kennung']) {
|
||||
$html = '<div class="header">'.$value['kennung'].'</div>';
|
||||
}
|
||||
$html .= AllgemeinTabelle::load(DbFunction::$projektid);
|
||||
$html .= '<br><br><br><br><br><table class="inhalt"><tr>';
|
||||
$html .= '<td>'.$_projekt[0]['erstellung'].'</td>';
|
||||
$html .= '<td class="right">'.$_gutachter[0]['kopf'].'</td>';
|
||||
$html .= '</tr></table>';
|
||||
self::$Mpdf->WriteHTML($html, \Mpdf\HTMLParserMode::HTML_BODY);
|
||||
break;
|
||||
}
|
||||
}
|
||||
self::$Mpdf->Output('Standard.pdf', Mpdf\Output\Destination::INLINE);
|
||||
|
||||
exit;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
<?php
|
||||
|
||||
namespace HermannTelser\Gutachten\Downloads;
|
||||
|
||||
use HermannTelser\Gutachten\Utility\Message;
|
||||
use TYPO3\CMS\Core\Utility\GeneralUtility;
|
||||
|
||||
/***
|
||||
*
|
||||
* This file is part of the "NuhOdds Comparatore" Extension for TYPO3 CMS.
|
||||
*
|
||||
* For the full copyright and license information, please read the
|
||||
* LICENSE.txt file that was distributed with this source code.
|
||||
*
|
||||
* (c) 2019 Hermann Telser <hermann.telser@gmail.com>
|
||||
*
|
||||
* https://developmentgutachten.nuhodds.com/index.php?eID=tx_gutachten&controller=download_controller&action=pdf_excel&projekt_aktive=814
|
||||
***/
|
||||
|
||||
class _DownloadController
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
// Message::debug(__file__,__line__, "_DownloadController");
|
||||
// exit;
|
||||
|
||||
switch (GeneralUtility::_GP('action')) {
|
||||
// DOWNLOADS
|
||||
case 'pdf_standards':
|
||||
PdfStandards::download();
|
||||
break;
|
||||
case 'pdf_para6':
|
||||
PdfParagraph6::download();
|
||||
break;
|
||||
case 'pdf_nutzflaechen':
|
||||
PdfNutzflaeche::download();
|
||||
break;
|
||||
case 'excel_nutzflaechen':
|
||||
ExcelNutzflaeche::download();
|
||||
break;
|
||||
case 'excel_aufstellung':
|
||||
ExcelAufstellung::download();
|
||||
break;
|
||||
default:
|
||||
Message::error(
|
||||
__FILE__,
|
||||
__LINE__,
|
||||
'no controller switch defined'
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,230 @@
|
||||
Bautengruppe,
|
||||
TopNr,
|
||||
NWWhg,
|
||||
Nutzfläche,
|
||||
Loggia,
|
||||
Ges.Nutzfläche,
|
||||
AbstellplatzTop,
|
||||
AbstellplatzTop2,
|
||||
NWAbstellplatz,
|
||||
NWAbstellplatz2,
|
||||
Anzahl Pkw,
|
||||
Stellplatzfläche_,
|
||||
Stellplatzfläche2,
|
||||
NW-Whg+Pkw1,
|
||||
NW-Whg+Pkw1+2,
|
||||
Gesamtnutzwert,
|
||||
Gesamtnutzwert2,
|
||||
Parifizierer,
|
||||
Datum_Parifi,
|
||||
Anzahl Whg,
|
||||
Anzahl AP,
|
||||
Durchgang,
|
||||
Anrede,
|
||||
Titel,
|
||||
Vorname,
|
||||
Nachname,
|
||||
Geburt,
|
||||
Beruf,
|
||||
PersonStraße,
|
||||
PLZ,
|
||||
Ort,
|
||||
Partner ja=1,
|
||||
Anrede_P,
|
||||
Titel_P,
|
||||
Vorname_P,
|
||||
Nachname_P,
|
||||
Geburt_P,
|
||||
Beruf_P,
|
||||
Straße_P,
|
||||
Plz_P,
|
||||
Ort_P,
|
||||
Haus,
|
||||
Lage,
|
||||
Orientierung,
|
||||
Orientierung PPL,
|
||||
Beschreibung,
|
||||
Loggien,
|
||||
Zuschlag,
|
||||
Zubehör,
|
||||
Grundkosten,
|
||||
Baukosten,
|
||||
15% Eigenmittel,
|
||||
zusätz. Eigenmittel,
|
||||
KP-Wohnung und AP,
|
||||
KP-Wohnung,
|
||||
KP-Stellplatz,
|
||||
KP-Stellplatz2,
|
||||
Kaufpreis,
|
||||
UST ja=1,
|
||||
KP WHG netto,
|
||||
Ust WHG,
|
||||
Brutto WHG,
|
||||
KP TG netto,
|
||||
Ust TG,
|
||||
Brutto TG,
|
||||
UST WHG+TG,
|
||||
Netto WHG+TG,
|
||||
Brutto WHG+TG,
|
||||
Fälligk_KP_1,
|
||||
Fälligk_KP_2,
|
||||
Fälligk_KP_3,
|
||||
KPTeil1,
|
||||
KPTeil1 UST,
|
||||
KPTeil2,
|
||||
KPTeil2 UST,
|
||||
KPTeil3,
|
||||
KPTeil3 UST,
|
||||
KPTeil4,
|
||||
KPTeil4 UST,
|
||||
Kontrolle_KP,
|
||||
Kontrolle_KP UST,
|
||||
pfand_ngs,
|
||||
pfand_ngs UST,
|
||||
VertrKo,
|
||||
Bankgarantie,
|
||||
Wohnung.WbfDarlehen,
|
||||
Globaldarlehen,
|
||||
Globaldarlehen abzügl.zusätzl.EM,
|
||||
Globalbank,
|
||||
GrundstückNummer,
|
||||
GstGröße,
|
||||
Einlagezahl,
|
||||
Grundbuch,
|
||||
Baubeginn,
|
||||
Baufertigstellung,
|
||||
Spät_Übergabe,
|
||||
Bau-Ausstatt,
|
||||
Architekt,
|
||||
Baubescheid,
|
||||
Zahl-Baubescheid,
|
||||
Baubescheid2,
|
||||
Zahl-Baubescheid2,
|
||||
UnterschriftKaufvertragAm,
|
||||
Beglaubigungsnummer,
|
||||
UB1_Datum,
|
||||
EFNR1,
|
||||
STNR1,
|
||||
UB2_Datum,
|
||||
EFNR2,
|
||||
STNR2,
|
||||
GVKB_Datum,
|
||||
GVKB_Zahl,
|
||||
Fremdfinanzierung,
|
||||
KPVertr,
|
||||
TZl
|
||||
Bautengruppe,
|
||||
TopNr,
|
||||
NWWhg,
|
||||
Nutzfläche,
|
||||
Loggia,
|
||||
Ges.Nutzfläche,
|
||||
AbstellplatzTop,
|
||||
AbstellplatzTop2,
|
||||
NWAbstellplatz,
|
||||
NWAbstellplatz2,
|
||||
Anzahl Pkw,
|
||||
Stellplatzfläche_,
|
||||
Stellplatzfläche2,
|
||||
NW-Whg+Pkw1,
|
||||
NW-Whg+Pkw1+2,
|
||||
Gesamtnutzwert,
|
||||
Gesamtnutzwert2,
|
||||
Parifizierer,
|
||||
Datum_Parifi,
|
||||
Anzahl Whg,
|
||||
Anzahl AP,
|
||||
Durchgang,
|
||||
Anrede,
|
||||
Titel,
|
||||
Vorname,
|
||||
Nachname,
|
||||
Geburt,
|
||||
Beruf,
|
||||
PersonStraße,
|
||||
PLZ,
|
||||
Ort,
|
||||
Partner ja=1,
|
||||
Anrede_P,
|
||||
Titel_P,
|
||||
Vorname_P,
|
||||
Nachname_P,
|
||||
Geburt_P,
|
||||
Beruf_P,
|
||||
Straße_P,
|
||||
Plz_P,
|
||||
Ort_P,
|
||||
Haus,
|
||||
Lage,
|
||||
Orientierung,
|
||||
Orientierung PPL,
|
||||
Beschreibung,
|
||||
Loggien,
|
||||
Balkone,
|
||||
Zubehör,
|
||||
Grundkosten,
|
||||
Baukosten,
|
||||
15% Eigenmittel,
|
||||
zusätz. Eigenmittel,
|
||||
KP-Wohnung und AP,
|
||||
KP-Wohnung,
|
||||
KP-Stellplatz,
|
||||
KP-Stellplatz2,
|
||||
Kaufpreis,
|
||||
UST ja=1,
|
||||
KP WHG netto,
|
||||
Ust WHG,
|
||||
Brutto WHG,
|
||||
KP TG netto,
|
||||
Ust TG,
|
||||
Brutto TG,
|
||||
UST WHG+TG,
|
||||
Netto WHG+TG,
|
||||
Brutto WHG+TG,
|
||||
Fälligk_KP_1,
|
||||
Fälligk_KP_2,
|
||||
Fälligk_KP_3,
|
||||
KPTeil1,
|
||||
KPTeil1 UST,
|
||||
KPTeil2,
|
||||
KPTeil2 UST,
|
||||
KPTeil3,
|
||||
KPTeil3 UST,
|
||||
KPTeil4,
|
||||
KPTeil4 UST,
|
||||
Kontrolle_KP,
|
||||
Kontrolle_KP UST,
|
||||
pfand_ngs,
|
||||
pfand_ngs UST,
|
||||
VertrKo,
|
||||
Bankgarantie,
|
||||
Wohnung.WbfDarlehen,
|
||||
Globaldarlehen,
|
||||
Globaldarlehen abzügl.zusätzl.EM,
|
||||
Globalbank,
|
||||
GrundstückNummer,
|
||||
GstGröße,
|
||||
Einlagezahl,
|
||||
Grundbuch,
|
||||
Baubeginn,
|
||||
Baufertigstellung,
|
||||
Spät_Übergabe,
|
||||
Bau-Ausstatt,
|
||||
Architekt,
|
||||
Baubescheid,
|
||||
Zahl-Baubescheid,
|
||||
Baubescheid2,
|
||||
Zahl-Baubescheid2,
|
||||
UnterschriftKaufvertragAm,
|
||||
Beglaubigungsnummer,
|
||||
UB1_Datum,
|
||||
EFNR1,
|
||||
STNR1,
|
||||
UB2_Datum,
|
||||
EFNR2,
|
||||
STNR2,
|
||||
GVKB_Datum,
|
||||
GVKB_Zahl,
|
||||
Fremdfinanzierung,
|
||||
KPVertr,
|
||||
TZl
|
||||
@@ -0,0 +1,422 @@
|
||||
body {
|
||||
font-family: sans-serif;
|
||||
font-size: 11pt;
|
||||
line-height: 18pt;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
h1 {
|
||||
font-size: 2.3em;
|
||||
margin: 2mm 0;
|
||||
}
|
||||
|
||||
h3 {
|
||||
font-size: 1.4em;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
h4 {
|
||||
font-size: 1.1em;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
p {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.pl-1{
|
||||
padding-left: 1mm;
|
||||
}
|
||||
|
||||
.grau {
|
||||
color: #999;
|
||||
}
|
||||
|
||||
.bg-gray {
|
||||
background-color: #efefef;
|
||||
}
|
||||
|
||||
.right {
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
.orange {
|
||||
color: orange;
|
||||
}
|
||||
|
||||
.normal {
|
||||
font-weight: normal;
|
||||
}
|
||||
|
||||
.halfpage {
|
||||
width: 40%;
|
||||
}
|
||||
|
||||
.size1 {
|
||||
font-size: 1em;
|
||||
}
|
||||
|
||||
.size09 {
|
||||
font-size: .9em;
|
||||
}
|
||||
|
||||
.size08 {
|
||||
font-size: .8em;
|
||||
}
|
||||
|
||||
.size07 {
|
||||
font-size: .75em;
|
||||
}
|
||||
|
||||
.right {
|
||||
text-align: right !important;
|
||||
}
|
||||
|
||||
.center {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.left {
|
||||
text-align: left !important;
|
||||
}
|
||||
|
||||
.bold {
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.border-bt {
|
||||
border-bottom: 0.1mm solid #cbcbcb;
|
||||
border-top: 0.1mm solid #cbcbcb;
|
||||
}
|
||||
.br {
|
||||
border-right: 0.1mm solid #cbcbcb;
|
||||
}
|
||||
.bt {
|
||||
border-top: 0.1mm solid #cbcbcb;
|
||||
}
|
||||
.bb {
|
||||
border-bottom: 0.1mm solid #cbcbcb;
|
||||
}
|
||||
|
||||
.allheader{
|
||||
font-weight: bold;
|
||||
background-color: #ecf2f9;
|
||||
}
|
||||
|
||||
.rotate {
|
||||
transform: rotate(-90.0deg);
|
||||
-moz-transform: rotate(-90.0deg);
|
||||
/* FF3.5+ */
|
||||
-o-transform: rotate(-90.0deg);
|
||||
/* Opera 10.5 */
|
||||
-webkit-transform: rotate(-90.0deg);
|
||||
/* Saf3.1+, Chrome */
|
||||
}
|
||||
|
||||
.deckblatt {
|
||||
padding: 1rem;
|
||||
background-color: #efefef;
|
||||
height: 290mm;
|
||||
}
|
||||
|
||||
.gutachter {
|
||||
height: 100mm;
|
||||
text-align: right;
|
||||
margin-top: 3mm;
|
||||
margin-right: 3mm;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.gutachten {
|
||||
height: 50mm;
|
||||
text-align: left;
|
||||
margin-left: 15mm;
|
||||
}
|
||||
|
||||
.zweckbox {
|
||||
height: 80mm;
|
||||
text-align: right;
|
||||
margin-right: 5mm;
|
||||
}
|
||||
|
||||
.auftraggeber {
|
||||
text-align: right;
|
||||
margin-right: 5mm;
|
||||
vertical-align: bottom;
|
||||
}
|
||||
|
||||
.header {
|
||||
padding: 1mm 3mm;
|
||||
font-size: 1.3em;
|
||||
background-color: #ecf2f9;
|
||||
border: 0.1mm solid #ccc;
|
||||
width: 196mm;
|
||||
margin-top: 7mm;
|
||||
margin-bottom: 4mm;
|
||||
}
|
||||
|
||||
.textblock {
|
||||
padding: 0;
|
||||
margin-top: 10mm;
|
||||
margin-bottom: 7mm;
|
||||
}
|
||||
|
||||
/* GUTACHTEN TABLES START */
|
||||
|
||||
table.footer {
|
||||
font-size: .7em;
|
||||
border-top: 0.1mm solid #ccc;
|
||||
width: 100%;
|
||||
margin: 5mm 7mm;
|
||||
}
|
||||
|
||||
table.inhalt {
|
||||
width: 196mm;
|
||||
margin-left: 7mm;
|
||||
margin-right: 7mm;
|
||||
}
|
||||
|
||||
.inhalt td {
|
||||
padding: 1.5mm;
|
||||
}
|
||||
|
||||
table.ganzebreite {
|
||||
width: 196mm;
|
||||
margin-bottom: 5mm;
|
||||
}
|
||||
|
||||
.ganzebreite td .cell1 {
|
||||
padding-left: 5mm;
|
||||
}
|
||||
|
||||
table.center td {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.ganzebreite th {
|
||||
background-color: #cbcbcb;
|
||||
}
|
||||
|
||||
table.nutzwert-neu {
|
||||
font-size: .75em;
|
||||
width: 100%;
|
||||
margin-bottom: 7mm;
|
||||
border-top: 0.1mm solid #cbcbcb;
|
||||
border-right: 0.1mm solid #cbcbcb;
|
||||
border-bottom: 0.1mm solid #cbcbcb;
|
||||
}
|
||||
|
||||
table.ganzebreite tr.header-row td,
|
||||
table.nutzwert-neu tr.header-row td,
|
||||
table.nutzwert-neu tr.header-row th {
|
||||
padding: 5px 10px;
|
||||
background-color: #ecf2f9;
|
||||
border-bottom: 0.1mm solid #cbcbcb;
|
||||
color: #000;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
table.nutzwert-neu td.first {
|
||||
background-color: #ecf2f9;
|
||||
}
|
||||
|
||||
table.nutzwert-neu td.right {
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
table.nutzwert-neu td.center {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
table.nutzwert {
|
||||
font-size: .75em;
|
||||
width: 100%;
|
||||
margin-left: 5mm;
|
||||
margin-right: 5mm;
|
||||
margin-bottom: 7mm;
|
||||
}
|
||||
|
||||
.nutzwert tr.header-row td {
|
||||
padding: 5px 10px;
|
||||
background-color: #efefef;
|
||||
border-left: 0.1mm solid #cbcbcb;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.nutzwert th {
|
||||
padding: 5px 4px;
|
||||
text-align: center;
|
||||
background-color: #efefef;
|
||||
border-left: 0.1mm solid #cbcbcb;
|
||||
}
|
||||
|
||||
.nutzwert td {
|
||||
padding: 3px 2px;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.nutzwert td.abschluss-first {
|
||||
padding: 5px 10px;
|
||||
background-color: #efefef;
|
||||
border-top: 0.1mm solid #cbcbcb;
|
||||
border-left: 0.1mm solid #cbcbcb;
|
||||
border-bottom: 0.1mm solid #cbcbcb;
|
||||
font-weight: bold;
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
.nutzwert td.abschluss {
|
||||
padding: 5px 4px;
|
||||
background-color: #efefef;
|
||||
border-top: 0.1mm solid #cbcbcb;
|
||||
border-left: 0.1mm solid #cbcbcb;
|
||||
border-bottom: 0.1mm solid #cbcbcb;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
th.abschluss {
|
||||
background-color: #cbcbcb;
|
||||
}
|
||||
|
||||
.nutzwert td.abschluss .cell0 {
|
||||
background-color: #efefef;
|
||||
border-left: 0.1mm solid #cbcbcb;
|
||||
}
|
||||
|
||||
.nutzwert td.cell0 {
|
||||
width: 10mm;
|
||||
font-weight: bold;
|
||||
border-left: 0.1mm solid #cbcbcb;
|
||||
}
|
||||
|
||||
.nutzwert td.cell4 {
|
||||
padding-left: 1mm;
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
.nutzwert td.cell0 {
|
||||
background-color: #efefef;
|
||||
}
|
||||
|
||||
.nutzwert th.cell0 {
|
||||
border-left: 0.1mm solid #cbcbcb;
|
||||
}
|
||||
|
||||
table.zusammenstellung {
|
||||
font-size: .8em;
|
||||
width: 100%;
|
||||
margin-left: 5mm;
|
||||
margin-right: 5mm;
|
||||
margin-bottom: 0;
|
||||
}
|
||||
|
||||
.zusammenstellung th {
|
||||
background-color: #efefef;
|
||||
}
|
||||
|
||||
.lt {
|
||||
border-top: 0.1mm solid #cbcbcb;
|
||||
border-left: 0.1mm solid #cbcbcb;
|
||||
}
|
||||
|
||||
.anmerkung {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
font-size: .75em;
|
||||
width: 100%;
|
||||
margin-left: 5mm;
|
||||
margin-right: 5mm;
|
||||
margin-bottom: 7mm;
|
||||
}
|
||||
|
||||
.top {
|
||||
vertical-align: top;
|
||||
}
|
||||
|
||||
/* PURE TABLES START */
|
||||
|
||||
.pure-table {
|
||||
/* Remove spacing between table cells (from Normalize.css) */
|
||||
border-collapse: collapse;
|
||||
border-spacing: 0;
|
||||
empty-cells: show;
|
||||
/* border: 0.1mm solid #cbcbcb; */
|
||||
}
|
||||
|
||||
.pure-table-noborder {
|
||||
/* Remove spacing between table cells (from Normalize.css) */
|
||||
border-collapse: collapse;
|
||||
border-spacing: 0;
|
||||
empty-cells: show;
|
||||
}
|
||||
|
||||
.pure-table caption {
|
||||
color: #000;
|
||||
font: italic 85%/1 arial, sans-serif;
|
||||
padding: 1em 0;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.pure-table td,
|
||||
.pure-table th,
|
||||
.pure-table-noborder td,
|
||||
.pure-table-noborder th {
|
||||
border-left: 0.1mm solid #cbcbcb;
|
||||
/* inner column border */
|
||||
border-width: 0 0 0 0.1mm;
|
||||
font-size: inherit;
|
||||
margin: 0;
|
||||
overflow: visible;
|
||||
/*to make ths where the title is really long work*/
|
||||
padding: .5em 1em;
|
||||
/* cell padding */
|
||||
}
|
||||
|
||||
.pure-table thead {
|
||||
background-color: #e0e0e0;
|
||||
color: #000;
|
||||
text-align: left;
|
||||
vertical-align: bottom;
|
||||
}
|
||||
|
||||
/*
|
||||
striping:
|
||||
even - #fff (white)
|
||||
odd - #f2f2f2 (light gray)
|
||||
*/
|
||||
.pure-table td {
|
||||
background-color: transparent;
|
||||
}
|
||||
|
||||
.pure-table-odd td {
|
||||
background-color: #f2f2f2;
|
||||
}
|
||||
|
||||
/* nth-child selector for modern browsers */
|
||||
.pure-table-striped tr:nth-child(2n-1) td {
|
||||
background-color: #f2f2f2;
|
||||
}
|
||||
|
||||
/* BORDERED TABLES */
|
||||
.pure-table-bordered td {
|
||||
border-bottom: 0.1mm solid #cbcbcb;
|
||||
}
|
||||
|
||||
.pure-table-bordered tbody>tr:last-child>td {
|
||||
border-bottom-width: 0;
|
||||
}
|
||||
|
||||
/* HORIZONTAL BORDERED TABLES */
|
||||
|
||||
/* .pure-table-horizontal td,
|
||||
.pure-table-horizontal th {
|
||||
border-width: 0 0 0.1mm 0;
|
||||
border-bottom: 0.1mm solid #cbcbcb;
|
||||
} */
|
||||
|
||||
.pure-table-horizontal tbody>tr:last-child>td {
|
||||
border-bottom-width: 0;
|
||||
}
|
||||
@@ -0,0 +1,140 @@
|
||||
<?php
|
||||
|
||||
namespace HermannTelser\Gutachten\Eid;
|
||||
|
||||
ini_set('display_errors', 1);
|
||||
ini_set('display_startup_errors', 1);
|
||||
ini_set('memory_limit', '-1');
|
||||
set_time_limit(0);
|
||||
//error_reporting(E_ALL);
|
||||
error_reporting(E_ALL & ~E_NOTICE);
|
||||
|
||||
use HermannTelser\Gutachten\DB\Delete\_DeleteController;
|
||||
use HermannTelser\Gutachten\DB\Insert\_InsertController;
|
||||
use HermannTelser\Gutachten\DB\MariaDB;
|
||||
use HermannTelser\Gutachten\DB\Select\_SelectController;
|
||||
use HermannTelser\Gutachten\DB\Update\_UpdateController;
|
||||
use HermannTelser\Gutachten\Downloads\_DownloadController;
|
||||
use HermannTelser\Gutachten\Settings\_SettingsController;
|
||||
use HermannTelser\Gutachten\Uploads\_UploadsController;
|
||||
|
||||
use HermannTelser\Gutachten\Utility\Message;
|
||||
use TYPO3\CMS\Core\Utility\GeneralUtility;
|
||||
use TYPO3\CMS\Frontend\Controller\TypoScriptFrontendController;
|
||||
use TYPO3\CMS\Frontend\Utility\EidUtility;
|
||||
|
||||
/* * *************************************************************
|
||||
*
|
||||
* Copyright notice
|
||||
*
|
||||
* (c) 2017 Hermann Telser <hermann.telser@gmail.com>
|
||||
*
|
||||
* All rights reserved
|
||||
*
|
||||
* This script is part of the TYPO3 project. The TYPO3 project is
|
||||
* free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* The GNU General Public License can be found at
|
||||
* http://www.gnu.org/copyleft/gpl.html.
|
||||
*
|
||||
* This script is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* This copyright notice MUST APPEAR in all copies of the script!
|
||||
*
|
||||
|
||||
/var/www/html/gutachten.nuhodds.com/public/typo3conf/ext/gutachten/Classes
|
||||
|
||||
* ************************************************************* */
|
||||
if (!\defined('PATH_typo3conf')) {
|
||||
die('Could not access this script directly!');
|
||||
}
|
||||
|
||||
class TxGutachten
|
||||
{
|
||||
public static $debug = 0;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
global $TYPO3_CONF_VARS;
|
||||
|
||||
$pid = 3;
|
||||
// @var $GLOBALS['TSFE'] \TYPO3\CMS\Frontend\Controller\TypoScriptFrontendController
|
||||
$GLOBALS['TSFE'] = GeneralUtility::makeInstance(TypoScriptFrontendController::class, $TYPO3_CONF_VARS, $pid, 0);
|
||||
EidUtility::initLanguage();
|
||||
$GLOBALS['TSFE']->initFEuser();
|
||||
EidUtility::initTCA();
|
||||
$GLOBALS['TSFE']->set_no_cache();
|
||||
|
||||
//###########################################
|
||||
// SESSION
|
||||
//###########################################
|
||||
$feUserObj = EidUtility::initFEuser();
|
||||
$username = $feUserObj->user['username'];
|
||||
if ('' == $username) {
|
||||
if ('download' == $_GET['mode']) {
|
||||
echo '<html><header><script>document.location.href="index.php";</script></header></html>';
|
||||
} else {
|
||||
header('Content-Type: application/json');
|
||||
$arr[] = [
|
||||
'logout' => 1,
|
||||
];
|
||||
echo json_encode($arr);
|
||||
}
|
||||
exit;
|
||||
}
|
||||
|
||||
new MariaDB();
|
||||
}
|
||||
|
||||
/*
|
||||
* @return array
|
||||
https://developmentgutachten.nuhodds.com/index.php?eID=tx_gutachten&controller=download_controller&&action=pdf_excel&projekt_aktive=814
|
||||
|
||||
find /var/www/OTHER/ext_gutachten_js -type f -exec sed -i 's/standards_controller/select_controller/g' {} \;
|
||||
*/
|
||||
public function switch()
|
||||
{
|
||||
switch (GeneralUtility::_GP('controller')) {
|
||||
case 'download_controller':
|
||||
new _DownloadController();
|
||||
break;
|
||||
case 'uploads_controller':
|
||||
new _UploadsController();
|
||||
break;
|
||||
case 'settings_controller':
|
||||
new _SettingsController();
|
||||
break;
|
||||
|
||||
case 'select_controller':
|
||||
new _SelectController();
|
||||
break;
|
||||
case 'update_controller':
|
||||
new _UpdateController();
|
||||
break;
|
||||
case 'insert_controller':
|
||||
new _InsertController();
|
||||
break;
|
||||
case 'delete_controller':
|
||||
new _DeleteController();
|
||||
break;
|
||||
|
||||
default:
|
||||
Message::error(
|
||||
__FILE__,
|
||||
__LINE__,
|
||||
'no controller switch defined'
|
||||
);
|
||||
break;
|
||||
}
|
||||
|
||||
header('Content-Type: application/json');
|
||||
echo json_encode($arr);
|
||||
exit();
|
||||
}
|
||||
}
|
||||
+46
@@ -0,0 +1,46 @@
|
||||
<?php
|
||||
namespace HermannTelser\Gutachten\Settings;
|
||||
|
||||
use HermannTelser\Gutachten\DB\DbFunction;
|
||||
use HermannTelser\Gutachten\DB\Select;
|
||||
use TYPO3\CMS\Core\Utility\GeneralUtility;
|
||||
|
||||
set_time_limit(0);
|
||||
|
||||
class Sonderzeichen
|
||||
{
|
||||
/***************************************************
|
||||
* print sql querries
|
||||
***************************************************/
|
||||
public static function run()
|
||||
{
|
||||
// DbFunction::$debug = 1;
|
||||
|
||||
$from = array("Ÿ", "Š", "š", "§");
|
||||
$to = array("ü", "ä", "ö", "ß");
|
||||
|
||||
$_arr = DbFunction::select('tx_gutachten_allgemein', ['id', 'typ']);
|
||||
foreach ($_arr as $key => $value) {
|
||||
$value_array['typ'] = str_replace($from, $to, $value['typ']);
|
||||
|
||||
DbFunction::secureUpdate('tx_gutachten_allgemein', $value_array, ['id' => $value['id']]);
|
||||
}
|
||||
|
||||
$_arr = DbFunction::select('tx_gutachten_raume_all', ['id', 'raum']);
|
||||
foreach ($_arr as $key => $value) {
|
||||
$value_array['raum'] = str_replace($from, $to, $value['raum']);
|
||||
|
||||
DbFunction::secureUpdate('tx_gutachten_raume_all', $value_array, ['id' => $value['id']]);
|
||||
}
|
||||
|
||||
$_arr = DbFunction::select('tx_gutachten_raume_generell', ['id', 'raum']);
|
||||
foreach ($_arr as $key => $value) {
|
||||
$value_array['raum'] = str_replace($from, $to, $value['raum']);
|
||||
|
||||
DbFunction::secureUpdate('tx_gutachten_raume_generell', $value_array, ['id' => $value['id']]);
|
||||
}
|
||||
|
||||
echo 1;
|
||||
exit;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
<?php
|
||||
|
||||
namespace HermannTelser\Gutachten\Settings;
|
||||
|
||||
use HermannTelser\Gutachten\DB\DbFunction;
|
||||
use HermannTelser\Gutachten\DB\Select;
|
||||
use TYPO3\CMS\Core\Utility\GeneralUtility;
|
||||
|
||||
class TextEdit
|
||||
{
|
||||
/**
|
||||
* @param mixed $id
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public static function update()
|
||||
{
|
||||
$table = GeneralUtility::_GP('table');
|
||||
$field = GeneralUtility::_GP('field');
|
||||
$value = GeneralUtility::_GP('value');
|
||||
$id = GeneralUtility::_GP('id');
|
||||
if (-1 == $id) {
|
||||
$insert_array = [];
|
||||
$insert_array[$field] = $value;
|
||||
DbFunction::secureInsert($table, $insert_array);
|
||||
} else {
|
||||
$update_array = [];
|
||||
if ('tx_gutachten_raume_generell' == $table) {
|
||||
if ('raumart' == $field) {
|
||||
$update_array['tt_raumart_id'] = Select::methoden_by_raumart($value);
|
||||
} elseif ('factor' == $field) {
|
||||
$update_array['factor'] = str_replace(',', '.', $value);
|
||||
}
|
||||
} else {
|
||||
$update_array[$field] = $value;
|
||||
}
|
||||
DbFunction::secureUpdate($table, $update_array, ['id' => $id]);
|
||||
}
|
||||
if ('tx_gutachten_raume_basis' == $table) {
|
||||
DbFunction::query("Update tx_gutachten_raume_basis SET summe_az = a+b+c+d+e+f+g+h+i+j+k+l+m+n+o+p+q+r+s+t+u where id=$id");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
namespace HermannTelser\Gutachten\Settings;
|
||||
|
||||
use HermannTelser\Gutachten\DB\DbFunction;
|
||||
|
||||
class ToggleHelp
|
||||
{
|
||||
/**
|
||||
* @param mixed $id
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public static function toggle()
|
||||
{
|
||||
$help = DbFunction::get('fe_users', 'tx_help', ['uid' => $GLOBALS['TSFE']->fe_user->user['uid']]);
|
||||
$help = 1 == $help ? 0 : 1;
|
||||
$update_array = [];
|
||||
$update_array['tx_help'] = $help;
|
||||
DbFunction::secureUpdate('fe_users', $update_array, ['uid' => $GLOBALS['TSFE']->fe_user->user['uid']]);
|
||||
echo $help;
|
||||
exit;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
namespace HermannTelser\Gutachten\Settings;
|
||||
|
||||
use HermannTelser\Gutachten\DB\DbFunction;
|
||||
|
||||
class ToggleTheme
|
||||
{
|
||||
/**
|
||||
* @param mixed $id
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public static function toggle()
|
||||
{
|
||||
$theme = $GLOBALS['TSFE']->fe_user->user['tx_nuh_layout'];
|
||||
$userid = $GLOBALS['TSFE']->fe_user->user['uid'];
|
||||
|
||||
$update_array = [];
|
||||
$update_array['tx_nuh_layout'] = 'light' == $theme ? 'dark' : 'light';
|
||||
|
||||
DbFunction::secureUpdate('fe_users', $update_array, ['uid' => $userid]);
|
||||
|
||||
echo 1;
|
||||
exit;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,68 @@
|
||||
<?php
|
||||
|
||||
namespace HermannTelser\Gutachten\Settings;
|
||||
|
||||
use HermannTelser\Gutachten\Berechnungen\Berechnung;
|
||||
use HermannTelser\Gutachten\DB\DbFunction;
|
||||
use HermannTelser\Gutachten\Utility\Message;
|
||||
use TYPO3\CMS\Core\Utility\GeneralUtility;
|
||||
use TYPO3\CMS\Frontend\Utility\EidUtility;
|
||||
|
||||
/***
|
||||
*
|
||||
* This file is part of the "NuhOdds Comparatore" Extension for TYPO3 CMS.
|
||||
*
|
||||
* For the full copyright and license information, please read the
|
||||
* LICENSE.txt file that was distributed with this source code.
|
||||
*
|
||||
* (c) 2019 Hermann Telser <hermann.telser@gmail.com>, NUH-Odds GmbH
|
||||
*
|
||||
***/
|
||||
|
||||
class _SettingsController
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
$arr = [];
|
||||
switch (GeneralUtility::_GP('action')) {
|
||||
// SETTINGS
|
||||
case 'load_localscope':
|
||||
$arr = [];
|
||||
$feUserObj = EidUtility::initFEuser();
|
||||
$arr['uid'] = $feUserObj->user['uid'];
|
||||
$arr['username'] = $feUserObj->user['first_name'];
|
||||
$arr['tx_help'] = $feUserObj->user['tx_help'];
|
||||
break;
|
||||
case 'toggle_theme':
|
||||
ToggleTheme::toggle();
|
||||
exit;
|
||||
case 'toggle_help_onoff':
|
||||
ToggleHelp::toggle();
|
||||
exit;
|
||||
case 'tooltip':
|
||||
$id = GeneralUtility::_GP('id');
|
||||
echo DbFunction::get('tx_gutachten_tooltip', 'tip', ['id' => GeneralUtility::_GP('id')]);
|
||||
exit;
|
||||
break;
|
||||
case 'textedit':
|
||||
TextEdit::update();
|
||||
Berechnung::berechnen();
|
||||
echo 1;
|
||||
exit;
|
||||
break;
|
||||
case 'sonderzeichen':
|
||||
Sonderzeichen::run();
|
||||
break;
|
||||
default:
|
||||
Message::error(
|
||||
__FILE__,
|
||||
__LINE__,
|
||||
'no controller switch defined'
|
||||
);
|
||||
}
|
||||
|
||||
header('Content-Type: application/json');
|
||||
echo json_encode($arr);
|
||||
exit();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,148 @@
|
||||
<?php
|
||||
|
||||
namespace HermannTelser\Gutachten\Uploads;
|
||||
|
||||
use ForceUTF8\Encoding;
|
||||
use HermannTelser\Gutachten\DB\DbFunction;
|
||||
use TYPO3\CMS\Core\Utility\GeneralUtility;
|
||||
|
||||
class UploadAllgemein
|
||||
{
|
||||
/**
|
||||
* @return false
|
||||
*/
|
||||
public static function upload()
|
||||
{
|
||||
// DbFunction::$debug = 1;
|
||||
|
||||
$phpFileUploadErrors = [
|
||||
0 => 'There is no error, the file uploaded with success',
|
||||
1 => 'The uploaded file exceeds the upload_max_filesize directive in php.ini',
|
||||
2 => 'The uploaded file exceeds the MAX_FILE_SIZE directive that was specified in the HTML form',
|
||||
3 => 'The uploaded file was only partially uploaded',
|
||||
4 => 'No file was uploaded',
|
||||
6 => 'Missing a temporary folder',
|
||||
7 => 'Failed to write file to disk.',
|
||||
8 => 'A PHP extension stopped the file upload.',
|
||||
];
|
||||
|
||||
$userid = $GLOBALS['TSFE']->fe_user->user['uid'];
|
||||
$projektid = GeneralUtility::_GP('pid');
|
||||
|
||||
\define('SITE_ROOT', realpath(__DIR__));
|
||||
|
||||
$files = glob(SITE_ROOT.'/uploaded_files/*'); // get all file names
|
||||
foreach ($files as $file) { // iterate files
|
||||
if (is_file($file)) {
|
||||
unlink($file);
|
||||
} // delete file
|
||||
}
|
||||
|
||||
$response = [];
|
||||
$response['message'] = '<h3>Allgemeinflächen</h3>';
|
||||
// $response['message'] = '<i class="fa fa-exclamation-triangle rot"></i> <b>Falscher Dokumenteninhalt für Allgemeinflächen.</b>';
|
||||
// return $response;
|
||||
|
||||
|
||||
if (isset($_FILES['uploadedfile']) && UPLOAD_ERR_OK == $_FILES['uploadedfile']['error']) {
|
||||
$fileTmpPath = $_FILES['uploadedfile']['tmp_name'];
|
||||
$fileName = $_FILES['uploadedfile']['name'];
|
||||
$fileSize = $_FILES['uploadedfile']['size'];
|
||||
$fileType = $_FILES['uploadedfile']['type'];
|
||||
$fileNameCmps = explode('.', $fileName);
|
||||
$fileExtension = strtolower(end($fileNameCmps));
|
||||
// sanitize file-name
|
||||
$newFileName = md5(time().$fileName).'.'.$fileExtension;
|
||||
// check if file has one of the following extensions
|
||||
//$allowedfileExtensions = array('jpg', 'gif', 'png', 'zip', 'txt', 'xls', 'doc','rtf','csv');
|
||||
$allowedfileExtensions = ['csv', 'txt'];
|
||||
if (\in_array($fileExtension, $allowedfileExtensions)) {
|
||||
// directory in which the uploaded file will be moved
|
||||
$uploadFileDir = SITE_ROOT.'/uploaded_files/';
|
||||
$dest_path = $uploadFileDir.$newFileName;
|
||||
if (move_uploaded_file($fileTmpPath, $dest_path)) {
|
||||
if (DbFunction::$debug) {
|
||||
echo "Die Datei wurde erfolgreich hochgeladen.\n";
|
||||
}
|
||||
|
||||
$sum_raume_all_vorher = DbFunction::count('tx_gutachten_allgemein', ['pid' => $projektid]);
|
||||
|
||||
DbFunction::delete('tx_gutachten_allgemein', ['pid' => $projektid]);
|
||||
|
||||
$file = file_get_contents($dest_path);
|
||||
$file = Encoding::toUTF8($file, Encoding::ICONV_TRANSLIT);
|
||||
$arr = preg_split('/\r\n|\r|\n/', $file);
|
||||
|
||||
$sum_raume_all_nachher=0;
|
||||
foreach ($arr as $key => $value) {
|
||||
$row = explode('|', $value);
|
||||
$result = array_map('trim', $row);
|
||||
if (\count($result) > 4) {
|
||||
$response['message'] .= 'Mehr als Vier Spalten im Dokument.';
|
||||
$response['class'] = 'error';
|
||||
|
||||
return $response;
|
||||
} elseif (\count($result) < 4) {
|
||||
$response['message'] .= 'Weniger als Vier Spalten im Dokument.';
|
||||
$response['class'] = 'error';
|
||||
|
||||
return $response;
|
||||
// } elseif (!\in_array($result[0], ['Allg.', 'Allgemein'])) {
|
||||
// $response['message'] = 'Falsches Dokument.';
|
||||
// $response['class'] = 'error';
|
||||
//
|
||||
// return $response;
|
||||
}
|
||||
$insert_array = [];
|
||||
$insert_array['pid'] = $projektid;
|
||||
$insert_array['uid'] = $userid;
|
||||
$insert_array['geschoss'] = $result[1];
|
||||
$insert_array['typ'] = $result[2];
|
||||
$insert_array['qm'] = str_replace(',', '.', $result[3]);
|
||||
DbFunction::secureInsert('tx_gutachten_allgemein', $insert_array);
|
||||
$sum_raume_all_nachher++;
|
||||
}
|
||||
|
||||
$response['message'] .= "<b>Die Datei wurde erfolgreich hochgeladen.</b>";
|
||||
$response['message'] .= "<br>Summe Objekte vorher: $sum_raume_all_vorher";
|
||||
$response['message'] .= "; nachher: $sum_raume_all_nachher";
|
||||
$diff = abs($sum_raume_all_vorher - $sum_raume_all_nachher);
|
||||
$response['message'] .= "; <b>Differenz: $diff </b>";
|
||||
$response['class'] = 'ok';
|
||||
} else {
|
||||
$response['message'] .= $phpFileUploadErrors[$_FILES['uploadedfile']['error']];
|
||||
$response['file'] = $uploadfile;
|
||||
$response['class'] = 'error';
|
||||
$response['dir'] = __DIR__;
|
||||
$response['tmp'] = sys_get_temp_dir();
|
||||
|
||||
return $response;
|
||||
}
|
||||
} else {
|
||||
$response['message'] .= 'Dokument muss txt oder csv sein';
|
||||
$response['class'] = 'error';
|
||||
|
||||
return $response;
|
||||
}
|
||||
} else {
|
||||
$response['message'] .= $phpFileUploadErrors[$_FILES['uploadedfile']['error']];
|
||||
$response['file'] = $_FILES['uploadedfile']['name'];
|
||||
$response['class'] = 'error';
|
||||
$response['dir'] = __DIR__;
|
||||
$response['tmp'] = sys_get_temp_dir();
|
||||
$response['time'] = time();
|
||||
|
||||
return $response;
|
||||
}
|
||||
|
||||
// UPLOAD_ERR_INI_SIZE = Value: 1; The uploaded file exceeds the upload_max_filesize directive in php.ini.
|
||||
// UPLOAD_ERR_FORM_SIZE = Value: 2; The uploaded file exceeds the MAX_FILE_SIZE directive that was specified in the HTML form.
|
||||
// UPLOAD_ERR_PARTIAL = Value: 3; The uploaded file was only partially uploaded.
|
||||
// UPLOAD_ERR_NO_FILE = Value: 4; No file was uploaded.
|
||||
// UPLOAD_ERR_NO_TMP_DIR = Value: 6; Missing a temporary folder. Introduced in PHP 5.0.3.
|
||||
// UPLOAD_ERR_CANT_WRITE = Value: 7; Failed to write file to disk. Introduced in PHP 5.1.0.
|
||||
// UPLOAD_ERR_EXTENSION = Value: 8; A PHP extension stopped the file upload. PHP does not provide a way to ascertain which extension caused the file upload to stop; examining the list of loaded extensions with phpinfo() may help.
|
||||
|
||||
return $response;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,200 @@
|
||||
<?php
|
||||
|
||||
namespace HermannTelser\Gutachten\Uploads;
|
||||
|
||||
use ForceUTF8\Encoding;
|
||||
use HermannTelser\Gutachten\DB\DbFunction;
|
||||
use TYPO3\CMS\Core\Utility\GeneralUtility;
|
||||
|
||||
class UploadNutzflaechen
|
||||
{
|
||||
/**
|
||||
* @return false
|
||||
*/
|
||||
public static function upload()
|
||||
{
|
||||
// DbFunction::$debug = 1;
|
||||
|
||||
$phpFileUploadErrors = [
|
||||
0 => 'There is no error, the file uploaded with success',
|
||||
1 => 'The uploaded file exceeds the upload_max_filesize directive in php.ini',
|
||||
2 => 'The uploaded file exceeds the MAX_FILE_SIZE directive that was specified in the HTML form',
|
||||
3 => 'The uploaded file was only partially uploaded',
|
||||
4 => 'No file was uploaded',
|
||||
6 => 'Missing a temporary folder',
|
||||
7 => 'Failed to write file to disk.',
|
||||
8 => 'A PHP extension stopped the file upload.',
|
||||
];
|
||||
|
||||
$userid = $GLOBALS['TSFE']->fe_user->user['uid'];
|
||||
$projektid = GeneralUtility::_GP('pid');
|
||||
|
||||
\define('SITE_ROOT', realpath(__DIR__));
|
||||
|
||||
$files = glob(SITE_ROOT.'/uploaded_files/*'); // get all file names
|
||||
foreach ($files as $file) { // iterate files
|
||||
if (is_file($file)) {
|
||||
unlink($file);
|
||||
} // delete file
|
||||
}
|
||||
$response = [];
|
||||
$response['message'] = '<h3>Nutzflächen</h3>';
|
||||
// $response['message'] = '<i class="fa fa-exclamation-triangle rot"></i> <b>Falscher Dokumenteninhalt für Nutzflächen .</b>';
|
||||
// return $response;
|
||||
|
||||
if (isset($_FILES['uploadedfile']) && UPLOAD_ERR_OK == $_FILES['uploadedfile']['error']) {
|
||||
$fileTmpPath = $_FILES['uploadedfile']['tmp_name'];
|
||||
$fileName = $_FILES['uploadedfile']['name'];
|
||||
$fileSize = $_FILES['uploadedfile']['size'];
|
||||
$fileType = $_FILES['uploadedfile']['type'];
|
||||
$fileNameCmps = explode('.', $fileName);
|
||||
$fileExtension = strtolower(end($fileNameCmps));
|
||||
// sanitize file-name
|
||||
$newFileName = md5(time().$fileName).'.'.$fileExtension;
|
||||
// check if file has one of the following extensions
|
||||
//$allowedfileExtensions = array('jpg', 'gif', 'png', 'zip', 'txt', 'xls', 'doc','rtf','csv');
|
||||
$allowedfileExtensions = ['csv', 'txt'];
|
||||
if (\in_array($fileExtension, $allowedfileExtensions)) {
|
||||
// directory in which the uploaded file will be moved
|
||||
$uploadFileDir = SITE_ROOT.'/uploaded_files/';
|
||||
$dest_path = $uploadFileDir.$newFileName;
|
||||
if (move_uploaded_file($fileTmpPath, $dest_path)) {
|
||||
if (DbFunction::$debug) {
|
||||
echo "Die Datei wurde erfolgreich hochgeladen.\n";
|
||||
}
|
||||
// DbFunction::delete('tx_gutachten_allgemein', ['pid' => $projektid]);
|
||||
|
||||
$file = file_get_contents($dest_path);
|
||||
// echo $file; exit;
|
||||
$file = Encoding::toUTF8($file, Encoding::ICONV_TRANSLIT);
|
||||
$arr = preg_split('/\r\n|\r|\n/', $file);
|
||||
|
||||
// Order by topNr
|
||||
$_ordered = [];
|
||||
foreach ($arr as $key => $value) {
|
||||
$row = explode('|', $value);
|
||||
$result = array_map('trim', $row);
|
||||
if (\count($result) > 4) {
|
||||
$response['message'] = 'Mehr als Vier Spalten im Dokument.';
|
||||
$response['class'] = 'error';
|
||||
|
||||
return $response;
|
||||
} elseif (\count($result) < 4) {
|
||||
$response['message'] = 'Weniger als Vier Spalten im Dokument.';
|
||||
$response['class'] = 'error';
|
||||
|
||||
return $response;
|
||||
}
|
||||
if ('' != $value) {
|
||||
$topNr = $result[0];
|
||||
if ('' != $topNr) {
|
||||
$_ordered[$topNr][] = $result;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$sum_raume_all_vorher = DbFunction::count('tx_gutachten_raume_all', ['pid' => $projektid]);
|
||||
|
||||
$_raeume = [];
|
||||
foreach ($_ordered as $topNr => $daten) {
|
||||
$tt_raume_basis_id = DbFunction::get('tx_gutachten_raume_basis', 'id', ['AND' => ['pid' => $projektid, 'topNr' => $topNr]]);
|
||||
|
||||
if (!$tt_raume_basis_id) {
|
||||
$insert_array = [];
|
||||
$insert_array['pid'] = $projektid;
|
||||
$insert_array['uid'] = $userid;
|
||||
$insert_array['topNr'] = $topNr;
|
||||
$tt_raume_basis_id = DbFunction::secureInsert('tx_gutachten_raume_basis', $insert_array);
|
||||
}
|
||||
|
||||
// tx_gutachten_raume_all
|
||||
foreach ($daten as $key => $value) {
|
||||
$geschoss = $value[1];
|
||||
$raum = $value[2];
|
||||
$flaeche = $value[3];
|
||||
$flaeche = str_replace(',', '.', $flaeche);
|
||||
$_raeume[] = $raum;
|
||||
|
||||
$tmp = DbFunction::select('tx_gutachten_raume_all', 'id', ['AND' => ['pid' => $projektid, 'raum' => $raum, 'tt_raume_basis_id' => $tt_raume_basis_id]]);
|
||||
if (!\count($tmp)) {
|
||||
$insert_array = [];
|
||||
$insert_array['tt_raume_basis_id'] = $tt_raume_basis_id;
|
||||
$insert_array['uid'] = $userid;
|
||||
$insert_array['pid'] = $projektid;
|
||||
$insert_array['geschoss'] = $geschoss;
|
||||
$insert_array['raum'] = $raum;
|
||||
$insert_array['qm'] = $flaeche;
|
||||
DbFunction::secureInsert('tx_gutachten_raume_all', $insert_array);
|
||||
} else {
|
||||
$update_array = [];
|
||||
$update_array['qm'] = $flaeche;
|
||||
$update_array['geschoss'] = $geschoss;
|
||||
DbFunction::secureUpdate('tx_gutachten_raume_all', $update_array, ['id' => $tmp[0]]);
|
||||
}
|
||||
}
|
||||
}
|
||||
$_raeume = array_unique($_raeume);
|
||||
|
||||
$_obsolet = [];
|
||||
$tmp = DbFunction::select('tx_gutachten_raume_generell', 'raum', ['pid' => $projektid]);
|
||||
|
||||
foreach ($tmp as $key => $raum) {
|
||||
if (!\in_array($raum, $_raeume)) {
|
||||
$_obsolet[] = $raum;
|
||||
}
|
||||
}
|
||||
foreach ($_obsolet as $key => $raum) {
|
||||
DbFunction::delete('tx_gutachten_raume_generell', ['AND' => ['pid' => $projektid, 'raum' => $raum]]);
|
||||
}
|
||||
|
||||
foreach ($_raeume as $key => $raum) {
|
||||
$tmp = DbFunction::select('tx_gutachten_raume_generell', ['id', 'raum'], ['AND' => ['pid' => $projektid, 'raum' => $raum], 'ORDER' => 'id']);
|
||||
if (0 == \count($tmp)) {
|
||||
$insert_array = [];
|
||||
$insert_array['pid'] = $projektid;
|
||||
$insert_array['uid'] = $userid;
|
||||
$insert_array['raum'] = $raum;
|
||||
DbFunction::secureInsert('tx_gutachten_raume_generell', $insert_array);
|
||||
} elseif (\count($tmp) > 1) {
|
||||
foreach ($tmp as $k => $v) {
|
||||
if ($k > 0) {
|
||||
DbFunction::delete('tx_gutachten_raume_generell', ['id' => $v['id']]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$sum_raume_all_nachher = DbFunction::count('tx_gutachten_raume_all', ['pid' => $projektid]);
|
||||
|
||||
$response['message'] .= "<b>Die Datei wurde erfolgreich hochgeladen.</b>";
|
||||
$response['message'] .= "<br>Summe Objekte vorher: $sum_raume_all_vorher";
|
||||
$response['message'] .= "; nachher: $sum_raume_all_nachher";
|
||||
$diff = abs($sum_raume_all_vorher - $sum_raume_all_nachher);
|
||||
$response['message'] .= "; <b>Differenz: $diff </b>";
|
||||
$response['class'] = 'ok';
|
||||
|
||||
return $response;
|
||||
}
|
||||
$response['message'] = $phpFileUploadErrors[$_FILES['uploadedfile']['error']];
|
||||
$response['file'] = $uploadfile;
|
||||
$response['class'] = 'error';
|
||||
$response['dir'] = __DIR__;
|
||||
$response['tmp'] = sys_get_temp_dir();
|
||||
|
||||
return $response;
|
||||
}
|
||||
$response['message'] = 'Dokument muss txt oder csv sein';
|
||||
$response['class'] = 'error';
|
||||
|
||||
return $response;
|
||||
}
|
||||
$response['message'] = $phpFileUploadErrors[$_FILES['uploadedfile']['error']];
|
||||
$response['file'] = $_FILES['uploadedfile']['name'];
|
||||
$response['class'] = 'error';
|
||||
$response['dir'] = __DIR__;
|
||||
$response['tmp'] = sys_get_temp_dir();
|
||||
$response['time'] = time();
|
||||
|
||||
return $response;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
<?php
|
||||
|
||||
namespace HermannTelser\Gutachten\Uploads;
|
||||
|
||||
use HermannTelser\Gutachten\Utility\Message;
|
||||
use TYPO3\CMS\Core\Utility\GeneralUtility;
|
||||
|
||||
/***
|
||||
*
|
||||
* This file is part of the "NuhOdds Comparatore" Extension for TYPO3 CMS.
|
||||
*
|
||||
* For the full copyright and license information, please read the
|
||||
* LICENSE.txt file that was distributed with this source code.
|
||||
*
|
||||
* (c) 2019 Hermann Telser <hermann.telser@gmail.com>
|
||||
*
|
||||
***/
|
||||
class _UploadsController
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
$arr = [];
|
||||
switch (GeneralUtility::_GP('action')) {
|
||||
// DOWNLOADS
|
||||
case 'allgemein':
|
||||
$arr = UploadAllgemein::upload();
|
||||
break;
|
||||
case 'nutzflaechen':
|
||||
$arr = UploadNutzflaechen::upload();
|
||||
break;
|
||||
|
||||
default:
|
||||
Message::error(
|
||||
__FILE__,
|
||||
__LINE__,
|
||||
'no controller switch defined'
|
||||
);
|
||||
}
|
||||
|
||||
header('Content-Type: application/json');
|
||||
echo json_encode($arr);
|
||||
exit();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
Allgemein | EG | Fahrräder | 7,20␍Allgemein | EG | Freifläche 1 | 45,42␍Allgemein | EG | Freifläche 2 | 19,85␍Allgemein | EG | Grünfläche | 118,22␍Allgemein | EG | Quartiersplatz | 267,15␍Allgemein | EG | Stiege EG | 15,66␍Allgemein | EG | Trafor. 1 | 2,81␍Allgemein | EG | Trafor. 2 | 2,81␍Allgemein | EG | Trafor. 3 | 11,98␍Allgemein | EG | Zugang | 286,74␍Allgemein | OG1 | Gang | 17,00␍Allgemein | OG1 | Stgh. OG1 | 14,74␍Allgemein | OG2 | Gang | 17,00␍Allgemein | OG2 | Stgh. OG2 | 16,07␍Allgemein | OG3 | Dachfläche bekiest | 317,29␍Allgemein | OG3 | Stgh. OG3 | 13,72␍Allgemein | UG | Abluft B | 1,90␍Allgemein | UG | einspurige EB01 | 2,81␍Allgemein | UG | einspurige EB02 | 2,50␍Allgemein | UG | einspurige EB03 | 2,50␍Allgemein | UG | Elektro B | 5,33␍Allgemein | UG | Fahrräder B | 41,71␍Allgemein | UG | Gang B | 18,45␍Allgemein | UG | Garage B | 495,63␍Allgemein | UG | KIWA/Sport B | 6,97␍Allgemein | UG | Müllraum B | 16,53␍Allgemein | UG | Schleuse B | 4,09␍Allgemein | UG | Stellplatz B01 | 13,27␍Allgemein | UG | Stellplatz B02 | 13,39␍Allgemein | UG | Stellplatz B03 | 13,39␍Allgemein | UG | Stellplatz B04 | 15,00␍Allgemein | UG | Stellplatz B05 | 15,30␍Allgemein | UG | Stgh. UG | 4,66␍Allgemein | UG | Technik B | 11,93
|
||||
@@ -0,0 +1,170 @@
|
||||
<?php
|
||||
|
||||
namespace HermannTelser\Gutachten\Utility;
|
||||
|
||||
class Helper
|
||||
{
|
||||
/**
|
||||
* cut string at char.
|
||||
*
|
||||
* @param mixed $string
|
||||
* @param mixed $char
|
||||
*/
|
||||
public static function after($string, $char)
|
||||
{
|
||||
if (!\is_bool(strpos($char, $string))) {
|
||||
return substr($char, strpos($char, $string) + \strlen($string));
|
||||
}
|
||||
}
|
||||
|
||||
public static function number_format_de($value, $char)
|
||||
{
|
||||
if (is_numeric($value)) {
|
||||
return number_format($value, $char, ',', '.');
|
||||
} else {
|
||||
return $value;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static function before($string, $char)
|
||||
{
|
||||
return substr($char, 0, strpos($char, $string));
|
||||
}
|
||||
|
||||
public static function between($string, $that, $char)
|
||||
{
|
||||
return self::before($that, self::after($string, $char));
|
||||
}
|
||||
|
||||
public static function replacePlatzhalter($_platzhalter, $string)
|
||||
{
|
||||
foreach ($_platzhalter as $key => $value) {
|
||||
$string = str_replace($value['code'], $value['txt'], $string);
|
||||
}
|
||||
$string = html_entity_decode($string);
|
||||
|
||||
return $string;
|
||||
}
|
||||
|
||||
|
||||
public static function table_row_abschluss($_row)
|
||||
{
|
||||
$html = '<tr>';
|
||||
foreach ($_row as $key => $value) {
|
||||
$html .= '<th class="abschluss cell'.$key.'">'.$value.'</th>';
|
||||
}
|
||||
$html .= '</tr>';
|
||||
|
||||
return $html;
|
||||
}
|
||||
|
||||
public static function table_row($_row, $border = 0)
|
||||
{
|
||||
$html = '<tr>';
|
||||
foreach ($_row as $key => $value) {
|
||||
if ($border) {
|
||||
$html .= '<td class="cell'.$key.'" style="border-bottom: 0.1mm solid #cbcbcb;">'.$value.'</td>';
|
||||
} else {
|
||||
$html .= '<td class="cell'.$key.'">'.$value.'</td>';
|
||||
}
|
||||
}
|
||||
$html .= '</tr>';
|
||||
|
||||
return $html;
|
||||
}
|
||||
|
||||
|
||||
public static function make_int($arr, $_fields)
|
||||
{
|
||||
foreach ($arr as $key => $value) {
|
||||
foreach ($_fields as $k => $field) {
|
||||
if (isset($value[$field])) {
|
||||
$arr[$key][$field] = (int) $value[$field];
|
||||
}
|
||||
}
|
||||
}
|
||||
return $arr;
|
||||
}
|
||||
|
||||
public static function make_double($arr, $_fields)
|
||||
{
|
||||
foreach ($arr as $key => $value) {
|
||||
foreach ($_fields as $k => $field) {
|
||||
if (isset($value[$field])) {
|
||||
$arr[$key][$field] = (float) $value[$field];
|
||||
}
|
||||
}
|
||||
}
|
||||
return $arr;
|
||||
}
|
||||
|
||||
|
||||
public static function zero_to_null($arr, $_fields)
|
||||
{
|
||||
foreach ($arr as $key => $value) {
|
||||
foreach ($_fields as $k => $field) {
|
||||
if (isset($value[$field])) {
|
||||
if ((float) $value[$field] == 0) {
|
||||
$arr[$key][$field] = '';
|
||||
} else {
|
||||
$arr[$key][$field] = self::number_format_de($value[$field], 2);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return $arr;
|
||||
}
|
||||
|
||||
public static function format_double($arr, $_fields, $stellen)
|
||||
{
|
||||
foreach ($arr as $key => $value) {
|
||||
foreach ($_fields as $k => $field) {
|
||||
if (isset($value[$field])) {
|
||||
$arr[$key][$field] = self::number_format_de($value[$field], $stellen);
|
||||
}
|
||||
}
|
||||
}
|
||||
return $arr;
|
||||
}
|
||||
|
||||
|
||||
public static function table_header_row($_row)
|
||||
{
|
||||
$html = '<thead><tr>';
|
||||
foreach ($_row as $key => $value) {
|
||||
if ($value == 'space') {
|
||||
$html .= '<td class="blank"> </td>';
|
||||
} else {
|
||||
$html .= '<th class="cell'.$key.'">'.$value.'</th>';
|
||||
}
|
||||
}
|
||||
$html .= '</tr></thead>';
|
||||
|
||||
return $html;
|
||||
}
|
||||
|
||||
public static function table_header_row_r($_row)
|
||||
{
|
||||
$html = '<thead><tr text-rotate="90deg">';
|
||||
foreach ($_row as $key => $value) {
|
||||
$html .= '<td style="background-color: #ecf2f9; border-bottom: 0.1mm solid #cbcbcb;">'.$value.'</td>';
|
||||
}
|
||||
$html .= '</tr></thead>';
|
||||
|
||||
return $html;
|
||||
}
|
||||
|
||||
public static function footer($projektname)
|
||||
{
|
||||
$html = '<table class="footer">
|
||||
<tr>
|
||||
<td width="40%">{DATE j-m-Y}</td>
|
||||
<td width="20%" align="center">Seite {PAGENO}/{nbpg}</td>
|
||||
<td width="40%" style="text-align: right;">' . $projektname . '</td>
|
||||
</tr>
|
||||
</table>';
|
||||
|
||||
return $html;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
<?php
|
||||
|
||||
namespace HermannTelser\Gutachten\Utility;
|
||||
|
||||
class Message
|
||||
{
|
||||
// error
|
||||
|
||||
public static function error($filename, $linenumber, $message)
|
||||
{
|
||||
die(PHP_EOL.PHP_EOL.
|
||||
'-----------------------------------------------------------'.PHP_EOL.
|
||||
'DOKUMENT: '.$filename.PHP_EOL.
|
||||
'ZEILE: '.$linenumber.PHP_EOL.
|
||||
'FEHLER: '.$message.PHP_EOL.
|
||||
"\nVerarbeitung gestoppt !".PHP_EOL.
|
||||
'-----------------------------------------------------------'.PHP_EOL.
|
||||
PHP_EOL);
|
||||
}
|
||||
|
||||
// warning
|
||||
|
||||
public static function warning($filename, $linenumber, $message)
|
||||
{
|
||||
echo PHP_EOL.
|
||||
'-----------------------------------------------------------'.PHP_EOL.
|
||||
'DOKUMENT: '.$filename.PHP_EOL.
|
||||
'ZEILE: '.$linenumber.PHP_EOL.
|
||||
'WARNUNG: '.$message.PHP_EOL.
|
||||
'-----------------------------------------------------------'.PHP_EOL.
|
||||
PHP_EOL;
|
||||
}
|
||||
|
||||
public static function debug($filename, $linenumber, $message)
|
||||
{
|
||||
echo PHP_EOL.
|
||||
'-----------------------------------------------------------'.PHP_EOL.
|
||||
'doc: '.$filename.PHP_EOL.
|
||||
'line: '.$linenumber.PHP_EOL.
|
||||
'note: '.$message.PHP_EOL.
|
||||
'-----------------------------------------------------------'.PHP_EOL.
|
||||
PHP_EOL;
|
||||
}
|
||||
|
||||
// note
|
||||
|
||||
public static function note($message)
|
||||
{
|
||||
echo PHP_EOL.
|
||||
'-----------------------------------------------------------'.PHP_EOL.
|
||||
$message.PHP_EOL.
|
||||
'-----------------------------------------------------------'.PHP_EOL;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user