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

123 lines
5.6 KiB
PHP

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