70 lines
2.3 KiB
PHP
70 lines
2.3 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
|
|
*
|
|
***/
|
|
|
|
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;
|
|
}
|
|
}
|