Chore: Verschiebe Git-Repository in das Hauptverzeichnis und richte .gitignore ein

This commit is contained in:
salam committed 2026-10-19 10:11:04 +02:00
commit 96d0545193
502 files changed
+176027

No files matched your search

@@ -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();
}
}
+67
View File
@@ -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();
}
}