104 lines
3.4 KiB
PHP
104 lines
3.4 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 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;
|
|
}
|
|
}
|