Files
gutachten_t3/packages/gutachten/Classes/DB/Select/Objekte.php
T

79 lines
2.7 KiB
PHP

<?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;
}
}