private static function transformUpdate($out = NULL) { $returnOut = []; $linkeSpalte = []; $rechteSpalte = []; for ($i = 0; $i < count(Ausleihe::getNames()); $i++) { array_push($linkeSpalte, Ausleihe::getNames()[$i]); } if ($out !== NULL) { array_push($linkeSpalte, HTML::buildInput('hidden', 'id', $out->getId())); } else { array_push($linkeSpalte, ''); } if ($out !== NULL) { $dbWerte = json_decode(json_encode($out), true); } // überführe $dbWerte in rechte Spalte $selected = NULL; if ($out !== NULL) { if ($out->getAuto() !== NULL) { $selected = $out->getAuto()->getId(); // Foreign Key } } $options = Option::buildOptions('Auto', $selected); $selected = NULL; if ($out !== NULL) { if ($out->getMitarbeiter() !== NULL) { $selected = $out->getMitarbeiter()->getId(); // Foreign Key } } $options2 = Option::buildOptions('Mitarbeiter', $selected); if ($out !== NULL) { array_push($rechteSpalte, HTML::buildDropDown('fahrzeug', '1', $options, NULL, 'fahrzeug')); array_push($rechteSpalte, HTML::buildDropDown('mitarbeiter', '1', $options2, NULL, 'mitarbeiter')); array_push($rechteSpalte, HTML::buildInput('text', 'vonTag', HTML::extractDateFromDateTime($dbWerte['von']), NULL, 'vonTag', NULL, 'TT.MM.JJJJ')); array_push($rechteSpalte, HTML::buildInput('text', 'vonZeit', HTML::extractTimeFromDateTime($dbWerte['von']))); array_push($rechteSpalte, HTML::buildInput('text', 'bisTag', HTML::extractDateFromDateTime($dbWerte['bis']), NULL, 'bisTag', NULL, 'TT.MM.JJJJ')); array_push($rechteSpalte, HTML::buildInput('text', 'bisZeit', HTML::extractTimeFromDateTime($dbWerte['bis']))); array_push($rechteSpalte, HTML::buildButton('OK', 'ok', 'updateAusleihe', 'OK')); } else { array_push($rechteSpalte, HTML::buildDropDown('fahrzeug', '1', $options, NULL, 'fahrzeug')); array_push($rechteSpalte, HTML::buildDropDown('mitarbeiter', '1', $options2, NULL, 'mitarbeiter')); array_push($rechteSpalte, HTML::buildInput('text', 'vonTag', '', NULL, 'vonTag', NULL, 'TT.MM.JJJJ')); array_push($rechteSpalte, HTML::buildInput('text', 'vonZeit', '', NULL, 'vonZeit', NULL, 'HH:MM')); array_push($rechteSpalte, HTML::buildInput('text', 'bisTag', '', NULL, 'bisTag', NULL, 'TT.MM.JJJJ')); array_push($rechteSpalte, HTML::buildInput('text', 'bisZeit', '', NULL, 'bisZeit', NULL, 'HH:MM')); array_push($rechteSpalte, HTML::buildButton('OK', 'ok', 'insertAusleihe', 'OK')); } $returnOut = HTML::buildFormularTable($linkeSpalte, $rechteSpalte); return $returnOut; }
private static function transformUpdate($out = NULL) { $returnOut = []; $linkeSpalte = []; $rechteSpalte = []; for ($i = 0; $i < count(Mitarbeiter::getNames()); $i++) { array_push($linkeSpalte, Mitarbeiter::getNames()[$i]); } if ($out !== NULL) { array_push($linkeSpalte, HTML::buildInput('hidden', 'id', $out->getId())); } else { array_push($linkeSpalte, ''); } if ($out !== NULL) { $dbWerte = json_decode(json_encode($out), true); } // überführe $dbWerte in rechte Spalte //options für die abteilungen // $abt = Abteilung::getAll(); // $options = []; // // // zum abwählen // $options[0] = ['value' => 0, 'label' => '']; // $hatAbteilung = FALSE; // foreach ($abt as $o) { // $options[$o->getId()] = ['value' => $o->getId(), 'label' => $o->getName()]; // if ($out !== NULL) { // if ($o->getId() === $out->getAbteilung()->getId()) { // $options[$o->getId()]['selected'] = TRUE; // $hatAbteilung = TRUE; // } // } // } // if ($hatAbteilung == FALSE) { // $options[0]['selected'] = TRUE; // } $selected = NULL; if ($out !== NULL) { if ($out->getAbteilung() !== NULL) { $selected = $out->getAbteilung()->getId(); // Foreign Key } } $options = Option::buildOptions('Abteilung', $selected); $selected = NULL; if ($out !== NULL) { if ($out->getVorgesetzter() !== NULL) { $selected = $out->getVorgesetzter()->getId(); } } $options2 = Option::buildOptions('Mitarbeiter', $selected, TRUE); // zum abwählen // $options2[0] = ['value' => 0, 'label' => '']; // $hatVorgesetzte = FALSE; // foreach ($vorgesetzte as $o) { // $options2[$o->getId()] = ['value' => $o->getId(), 'label' => $o->getVorname() . ' ' . $o->getNachname()]; // if ($out !== NULL) { // if ($out->getVorgesetzter() !== NULL) { // if ($o->getId() === $out->getVorgesetzter()->getId()) { // $options2[$out->getVorgesetzter()->getId()]['selected'] = TRUE; // $hatVorgesetzte = TRUE; // } // } else { // $options2[0]['selected'] = TRUE; // } // } // } // if ($hatVorgesetzte == FALSE) { // $options2[0]['selected'] = TRUE; // } // // radio $options erstellen $radioOptions = []; $radioOption = []; if ($out !== Null) { $radioOption['label'] = 'weibl.'; if ($out->getGeschlecht() === 'w') { $radioOption['checked'] = TRUE; } $radioOption['value'] = 'w'; array_push($radioOptions, $radioOption); $radioOption = []; $radioOption['label'] = 'männl.'; if ($out->getGeschlecht() === 'm') { $radioOption['checked'] = TRUE; } $radioOption['value'] = 'm'; array_push($radioOptions, $radioOption); } else { $radioOption['label'] = 'weibl.'; $radioOption['checked'] = TRUE; $radioOption['value'] = 'w'; array_push($radioOptions, $radioOption); $radioOption['label'] = 'männl.'; $radioOption['checked'] = NULL; $radioOption['value'] = 'm'; array_push($radioOptions, $radioOption); } if ($out !== NULL) { array_push($rechteSpalte, HTML::buildInput('text', 'vorname', $dbWerte['vorname'], NULL, 'vorname')); array_push($rechteSpalte, HTML::buildInput('text', 'nachname', $dbWerte['nachname'], NULL, 'nachname')); array_push($rechteSpalte, HTML::buildRadio('geschlecht', $radioOptions, FALSE)); array_push($rechteSpalte, HTML::buildInput('text', 'geburtsdatum', HTML::mysqlToGerman($dbWerte['geburtsdatum']), NULL, 'geburtsdatum', NULL, 'TT.MM.JJJJ')); array_push($rechteSpalte, HTML::buildDropDown('abteilung', '1', $options, NULL, 'abteilung')); array_push($rechteSpalte, HTML::buildInput('text', 'stundenlohn', $dbWerte['stundenlohn'], NULL, 'stundenlohn')); array_push($rechteSpalte, HTML::buildDropDown('vorgesetzter', '1', $options2, NULL, 'vorgesetzter')); array_push($rechteSpalte, HTML::buildButton('OK', 'ok', 'updateMitarbeiter', 'OK')); } else { array_push($rechteSpalte, HTML::buildInput('text', 'vorname', '', NULL, 'vorname')); array_push($rechteSpalte, HTML::buildInput('text', 'nachname', '', NULL, 'nachname')); array_push($rechteSpalte, HTML::buildRadio('geschlecht', $radioOptions, FALSE)); array_push($rechteSpalte, HTML::buildInput('text', 'geburtsdatum', '', NULL, 'geburtsdatum', NULL, 'TT.MM.JJJJ')); array_push($rechteSpalte, HTML::buildDropDown('abteilung', '1', $options, NULL, 'abteilung')); array_push($rechteSpalte, HTML::buildInput('text', 'stundenlohn', '', NULL, 'stundenlohn')); array_push($rechteSpalte, HTML::buildDropDown('vorgesetzter', '1', $options2, NULL, 'vorgesetzter')); array_push($rechteSpalte, HTML::buildButton('OK', 'ok', 'insertMitarbeiter', 'OK')); } $returnOut = HTML::buildFormularTable($linkeSpalte, $rechteSpalte); return $returnOut; }
private static function transformUpdate($out = NULL) { $returnOut = []; $linkeSpalte = []; $rechteSpalte = []; for ($i = 0; $i < count(Ausleihe::getNames()); $i++) { array_push($linkeSpalte, Ausleihe::getNames()[$i]); } if ($out !== NULL) { array_push($linkeSpalte, HTML::buildInput('hidden', 'id', $out->getId())); } else { array_push($linkeSpalte, ''); } if ($out !== NULL) { $dbWerte = json_decode(json_encode($out), true); } // überführe $dbWerte in rechte Spalte // auto $options erstellen // $auto = Auto::getAll(); // $options = []; // $options[0] = ['value' => 0, 'label' => '']; // $hatirgendwas = FALSE; // foreach ($auto as $o) { // $options[$o->getId()] = ['value' => $o->getId(), 'label' => $o->getHersteller()->getName() . ' ' . $o->getName() . ' ' . $o->getKennzeichen()]; // if ($out !== NULL) { // if ($o->getId() == $out->getAuto()->getId()) { // $options[$o->getId()]['selected'] = TRUE; // $hatirgendwas = TRUE; // } // } // } // if ($hatirgendwas == FALSE) { // $options[0]['selected'] = TRUE; // } $selected = NULL; if ($out !== NULL) { if ($out->getAuto() !== NULL) { $selected = $out->getAuto()->getId(); } } $options = Option::buildOptions('Auto', $selected); // mitarbeiter $options erstellen // $mitarbeiter = Mitarbeiter::getAll(); // $options2 = []; // // zum abwählen // $options2[0] = ['value' => 0, 'label' => '']; // $hatMitarbeiter = FALSE; // foreach ($mitarbeiter as $o) { // $options2[$o->getId()] = ['value' => $o->getId(), 'label' => $o->getVorname() . ' ' . $o->getNachname()]; // if ($out !== NULL) { // if ($o->getId() === $out->getMitarbeiter()->getId()) { // $options2[$o->getId()]['selected'] = TRUE; // $hatMitarbeiter = TRUE; // } // } // } // if ($hatMitarbeiter == FALSE) { // $options2[0]['selected'] = TRUE; // } $selected = NULL; if ($out !== NULL) { if ($out->getMitarbeiter() !== NULL) { $selected = $out->getMitarbeiter()->getId(); } } $options2 = Option::buildOptions('Mitarbeiter', $selected); if ($out !== NULL) { array_push($rechteSpalte, HTML::buildDropDown('fahrzeug', '1', $options, NULL, 'fahrzeug')); array_push($rechteSpalte, HTML::buildDropDown('mitarbeiter', '1', $options2, NULL, 'mitarbeiter')); array_push($rechteSpalte, HTML::buildInput('text', 'vonTag', HTML::extractDateFromDateTime($dbWerte['von']))); array_push($rechteSpalte, HTML::buildInput('text', 'vonZeit', HTML::extractTimeFromDateTime($dbWerte['von']))); array_push($rechteSpalte, HTML::buildInput('text', 'bisTag', HTML::extractDateFromDateTime($dbWerte['bis']))); array_push($rechteSpalte, HTML::buildInput('text', 'bisZeit', HTML::extractTimeFromDateTime($dbWerte['bis']))); array_push($rechteSpalte, HTML::buildButton('OK', 'ok', 'updateAusleihe', 'OK')); } else { array_push($rechteSpalte, HTML::buildDropDown('fahrzeug', '1', $options, NULL, 'fahrzeug')); array_push($rechteSpalte, HTML::buildDropDown('mitarbeiter', '1', $options2, NULL, 'mitarbeiter')); array_push($rechteSpalte, HTML::buildInput('text', 'vonTag', '', NULL, 'vonTag')); array_push($rechteSpalte, HTML::buildInput('text', 'vonZeit', '', NULL, 'vonZeit')); array_push($rechteSpalte, HTML::buildInput('text', 'bisTag', '', NULL, 'bisTag')); array_push($rechteSpalte, HTML::buildInput('text', 'bisZeit', '', NULL, 'bisZeit')); array_push($rechteSpalte, HTML::buildButton('OK', 'ok', 'insertAusleihe', 'OK')); } $returnOut = HTML::buildFormularTable($linkeSpalte, $rechteSpalte); return $returnOut; }
private static function transformUpdate($out = NULL) { $returnOut = []; $linkeSpalte = []; $rechteSpalte = []; for ($i = 0; $i < count(Auto::getNames()); $i++) { array_push($linkeSpalte, Auto::getNames()[$i]); } if ($out !== NULL) { array_push($linkeSpalte, HTML::buildInput('hidden', 'id', $out->getId())); } else { array_push($linkeSpalte, ''); } if ($out !== NULL) { $dbWerte = json_decode(json_encode($out), true); } // überführe $dbWerte in rechte Spalte $selected = NULL; if ($out !== NULL) { if ($out->getHersteller() !== NULL) { $selected = $out->getHersteller()->getId(); // Foreign Key } } $options = Option::buildOptions('Hersteller', $selected); if ($out !== NULL) { array_push($rechteSpalte, HTML::buildDropDown('herstellerName', '1', $options, NULL, 'hersteller')); array_push($rechteSpalte, HTML::buildInput('text', 'autoName', $dbWerte['name'], NULL, 'autoName')); array_push($rechteSpalte, HTML::buildInput('text', 'kennzeichen', $dbWerte['kennzeichen'], NULL, 'kennzeichen')); array_push($rechteSpalte, HTML::buildButton('OK', 'ok', 'updateAuto', 'OK')); } else { array_push($rechteSpalte, HTML::buildDropDown('herstellerName', '1', $options, NULL, 'hersteller')); array_push($rechteSpalte, HTML::buildInput('text', 'autoName', '', NUll, 'autoName')); array_push($rechteSpalte, HTML::buildInput('text', 'kennzeichen', '', NULL, 'kennzeichen')); array_push($rechteSpalte, HTML::buildButton('OK', 'ok', 'insertAuto', 'OK')); } $returnOut = HTML::buildFormularTable($linkeSpalte, $rechteSpalte); return $returnOut; }