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

63 lines
2.0 KiB
PHP

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