diff --git a/app/views/settings/studies/institute.php b/app/views/settings/studies/institute.php index 1d678ba9784d5ec178fe9a72b043b6c4da80e933..b9d31d66168d206c6cf03845b5e8aa1c3f79f4c8 100644 --- a/app/views/settings/studies/institute.php +++ b/app/views/settings/studies/institute.php @@ -2,23 +2,23 @@ <h2><?= _('Meine Einrichtungen:') ?></h2> -<form action="<?= $controller->url_for('settings/studies/store_in') ?>" method="post" class="default"> +<form action="<?= $controller->store_in() ?>" method="post" class="default"> <input type="hidden" name="studip_ticket" value="<?= get_ticket() ?>"> <?= CSRFProtection::tokenTag() ?> <table class="default" id="select_institute"> <colgroup> <col> - <col width="100px"> + <? if ($allow_change['in']): ?> + <col style="width: 100px"> + <? endif; ?> </colgroup> <thead> <tr> <th><?= _('Einrichtung') ?></th> - <th> - <? if ($allow_change['in']): ?> - <?= _('austragen') ?> - <? endif; ?> - </th> + <? if ($allow_change['in']): ?> + <th><?= _('austragen') ?></th> + <? endif; ?> </thead> <tbody> <? if (count($institutes) === 0 && $allow_change['in']): ?> @@ -36,32 +36,30 @@ <td> <label for="inst_delete_<?= $inst_member->institute->id ?>"><?= htmlReady($inst_member->institute->name) ?></label> </td> - <td style="text-align:center"> - <? if ($allow_change['in']): ?> - <input type="checkbox" name="inst_delete[]" id="inst_delete_<?= $inst_member->institute->id ?>" - value="<?= $inst_member->institute->id ?>"> - <? else: ?> - <?= Icon::create('accept', 'inactive')->asImg(['class' => 'text-top']) ?> - <? endif; ?> + <? if ($allow_change['in']): ?> + <td style="text-align: center"> + <input type="checkbox" name="inst_delete[]" id="inst_delete_<?= htmlReady($inst_member->institute->id) ?>" + value="<?= htmlReady($inst_member->institute->id) ?>"> </td> + <? endif; ?> </tr> <? endforeach; ?> <? if (count($institutes) !== 0 && $allow_change['in']): ?> - <tr> - <td colspan="2" style="padding: 0px; text-align: right;"> - <footer> - <?= Button::create(_('Übernehmen'), 'store_in', ['title' => _('Änderungen übernehmen')]) ?> - </footer> - </td> - </tr> + <tr> + <td colspan="2" style="padding: 0; text-align: right;"> + <footer> + <?= Button::create(_('Übernehmen'), 'store_in', ['title' => _('Änderungen übernehmen')]) ?> + </footer> + </td> + </tr> <? endif ?> </tbody> </table> </form> <? if ($allow_change['in']): ?> -<form action="<?= $controller->url_for('settings/studies/store_in') ?>" method="post" class="default"> +<form action="<?= $controller->store_in() ?>" method="post" class="default"> <input type="hidden" name="studip_ticket" value="<?= get_ticket() ?>"> <?= CSRFProtection::tokenTag() ?> <fieldset> @@ -83,11 +81,11 @@ ): ?> <option class="<?= $i['is_fak'] ? 'nested-item-header' : 'nested-item' ?>" value="<?= htmlReady($i['Institut_id']) ?>"> - <?= htmlReady(my_substr($i['Name'], 0, 70)) ?> + <?= htmlReady($i['Name']) ?> </option> <? else: ?> <option class="<?= $i['is_fak'] ? 'nested-item-header' : 'nested-item' ?>" disabled> - <?= htmlReady(my_substr($i['Name'], 0, 70)) ?> + <?= htmlReady($i['Name']) ?> </option> <? endif; ?> <? endforeach; ?> diff --git a/app/views/settings/studies/studiengang.php b/app/views/settings/studies/studiengang.php index e5ac36b70744942d2c83467b5cf136b13e026b22..ec58d1f727615a723f615edcf52e9db1bebf71a7 100644 --- a/app/views/settings/studies/studiengang.php +++ b/app/views/settings/studies/studiengang.php @@ -2,7 +2,7 @@ <h2><?= _('Ich studiere folgende Fächer und Abschlüsse:') ?></h2> -<form action="<?= $controller->url_for('settings/studies/store_sg') ?>" method="post" class="default"> +<form action="<?= $controller->store_sg() ?>" method="post" class="default"> <?= CSRFProtection::tokenTag() ?> <table class="default" id="select_fach_abschluss"> @@ -10,8 +10,10 @@ <col> <col> <col> - <col width="100px"> - <col width="100px"> + <col style="width: 100px"> + <? if ($allow_change['sg']): ?> + <col style="width: 100px"> + <? endif; ?> </colgroup> <thead class="hidden-tiny-down"> <tr> @@ -19,17 +21,15 @@ <th><?= _('Abschluss') ?></th> <th id="version_label"><?= _('Versionen') ?></th> <th id="fachsemester_label"><?= _('Fachsemester') ?></th> + <? if ($allow_change['sg']): ?> <th style="text-align:center;" id="austragen_label"> - <? if ($allow_change['sg']): ?> - <?= _('austragen') ?> - <? else: ?> - - <? endif; ?> + <?= _('austragen') ?> </th> + <? endif; ?> </tr> </thead> <tbody> - <? if (count($user->studycourses) === 0 && $allow_change['sg']): ?> + <? if (count($user->studycourses) === 0 && $allow_change['sg']): ?> <tr> <td colspan="5" style="background: inherit;"> <strong><?= _('Sie haben sich noch keinem Studiengang zugeordnet.') ?></strong><br> @@ -37,73 +37,70 @@ <?= _('Tragen Sie bitte hier die Angaben aus Ihrem Studierendenausweis ein!') ?> </td> </tr> - <? endif; ?> + <? endif; ?> - <? foreach ($user->studycourses as $usc): ?> + <? foreach ($user->studycourses as $usc): ?> <tr> <td data-label="<?= _('Fach') ?>"><?= htmlReady($usc->studycourse->name) ?></td> <td data-label="<?= _('Abschluss') ?>"><?= htmlReady($usc->degree->name) ?></td> - <? if ($allow_change['sg']): ?> - <td data-label="<?= _('Version') ?>"> - <? $versionen = StgteilVersion::findByFachAbschluss($usc->fach_id, $usc->abschluss_id); ?> - <? $versionen = array_filter($versionen, function ($ver) { - return $ver->hasPublicStatus('genehmigt'); - }); ?> - <? if (count($versionen)) : ?> - <select name="change_version[<?= $usc->fach_id ?>][<?= $usc->abschluss_id ?>]" - aria-labelledby="version_label"> - <option value=""><?= _('-- Bitte Version auswählen --') ?></option> - <? foreach ($versionen as $version) : ?> - <option<?= $version->getId() == $usc->version_id ? ' selected' : '' ?> - value="<?= htmlReady($version->getId()) ?>"> - <?= htmlReady($version->getDisplayName()) ?> - </option> - <? endforeach; ?> - </select> - <? else : ?> - <?= tooltipIcon(_('Keine Version in der gewählten Fach-Abschluss-Kombination verfügbar.'), true) ?> - <? endif; ?> - </td> - <? else : ?> - <? $version = StgteilVersion::find($usc->version_id); ?> - <td> - <? if ($version && $version->hasPublicStatus('genehmigt')) : ?> - <?= htmlReady($version->getDisplayName()); ?> - <? endif; ?> - </td> - <? endif; ?> - <? if ($allow_change['sg']): ?> - <td data-label="<?= _('Fachsemester') ?>"> - <select name="change_fachsem[<?= $usc->fach_id?>][<?= $usc->abschluss_id ?>]" - aria-labelledby="fachsemester_label"> - <? for ($i = 1; $i <= 50; $i += 1): ?> - <option <? if ($i == $usc->semester) echo 'selected'; ?>><?= $i ?></option> - <? endfor; ?> + <? if ($allow_change['sg']): ?> + <td data-label="<?= _('Versionen') ?>"> + <? $versionen = StgteilVersion::findByFachAbschluss($usc->fach_id, $usc->abschluss_id); ?> + <? $versionen = array_filter($versionen, function ($ver) { + return $ver->hasPublicStatus('genehmigt'); + }); ?> + <? if (count($versionen)) : ?> + <select name="change_version[<?= htmlReady($usc->fach_id) ?>][<?= htmlReady($usc->abschluss_id) ?>]" + aria-labelledby="version_label"> + <option value=""><?= _('-- Bitte Version auswählen --') ?></option> + <? foreach ($versionen as $version) : ?> + <option<?= $version->getId() == $usc->version_id ? ' selected' : '' ?> + value="<?= htmlReady($version->getId()) ?>"> + <?= htmlReady($version->getDisplayName()) ?> + </option> + <? endforeach; ?> </select> - </td> - <td data-label="<?= _('austragen:') ?>"> - <input type="checkbox" aria-labelledby="austragen_label" - name="fach_abschluss_delete[<?= $usc->fach_id ?>]" - value="<?= $usc->abschluss_id ?>"> - </td> - <? else: ?> - <td data-label="<?= _('Fachsemester:') ?>"><?= htmlReady($usc->semester) ?></td> - <td data-label="<?= _('austragen:') ?>" style="text-align: right;"> - <?= Icon::create('accept', 'inactive')->asImg(['class' => 'text-top']) ?> - </td> + <? else : ?> + <?= tooltipIcon(_('Keine Version in der gewählten Fach-Abschluss-Kombination verfügbar.'), true) ?> + <? endif; ?> + </td> + <? else : ?> + <? $version = StgteilVersion::find($usc->version_id); ?> + <td data-label="<?= _('Versionen') ?>"> + <? if ($version && $version->hasPublicStatus('genehmigt')) : ?> + <?= htmlReady($version->getDisplayName()); ?> <? endif; ?> + </td> + <? endif; ?> + <? if ($allow_change['sg']): ?> + <td data-label="<?= _('Fachsemester') ?>"> + <select name="change_fachsem[<?= htmlReady($usc->fach_id) ?>][<?= htmlReady($usc->abschluss_id) ?>]" + aria-labelledby="fachsemester_label"> + <? for ($i = 1; $i <= 50; $i += 1): ?> + <option <? if ($i == $usc->semester) echo 'selected'; ?>><?= $i ?></option> + <? endfor; ?> + </select> + </td> + <td data-label="<?= _('austragen') ?>"> + <input type="checkbox" aria-labelledby="austragen_label" + name="fach_abschluss_delete[<?= htmlReady($usc->fach_id) ?>]" + value="<?= htmlReady($usc->abschluss_id) ?>"> + </td> + <? else: ?> + <td data-label="<?= _('Fachsemester') ?>"><?= htmlReady($usc->semester) ?></td> + <? endif; ?> </tr> <? endforeach; ?> <? if (count($user->studycourses) !== 0 && $allow_change['sg']): ?> - <tr> - <td colspan="5" style="padding: 0px; text-align: right;"> - <footer> - <?= Button::create(_('Übernehmen'), 'store_in', ['title' => _('Änderungen übernehmen')]) ?> - </footer> - </td> - </tr> + <tr> + <td colspan="5" style="padding: 0; text-align: right;"> + <footer> + <?= Button::create(_('Übernehmen'), 'store_in', ['title' => _('Änderungen übernehmen')]) ?> + </footer> + </td> + </tr> <? endif ?> </tbody> </table> @@ -111,7 +108,7 @@ <? if ($allow_change['sg']): ?> -<form action="<?= $controller->url_for('settings/studies/store_sg') ?>" method="post" class="default"> +<form action="<?= $controller->store_sg() ?>" method="post" class="default"> <?= CSRFProtection::tokenTag() ?> <fieldset> @@ -128,9 +125,11 @@ <select name="new_studiengang" id="new_studiengang" aria-label="<?= _('-- Bitte Fach auswählen --') ?>"> <option selected value="none"><?= _('-- Bitte Fach auswählen --') ?></option> - <? foreach ($faecher as $fach) : ?> - <?= sprintf('<option value="%s">%s</option>', $fach->id, htmlReady(my_substr($fach->name, 0, 50))); ?> - <? endforeach ?> + <? foreach ($faecher as $fach) : ?> + <option value="<?= htmlReady($fach->id) ?>"> + <?= htmlReady($fach->name) ?> + </option> + <? endforeach ?> </select> </label> @@ -138,17 +137,19 @@ <select name="new_abschluss" id="new_abschluss" aria-label="<?= _('-- Bitte Abschluss auswählen --') ?>"> <option selected value="none"><?= _('-- Bitte Abschluss auswählen --') ?></option> - <? foreach ($abschluesse as $abschluss) : ?> - <?= sprintf('<option value="%s">%s</option>' . "\n", $abschluss->id, htmlReady(my_substr($abschluss->name, 0, 50))); ?> - <? endforeach ?> + <? foreach ($abschluesse as $abschluss) : ?> + <option value="<?= htmlReady($abschluss->id) ?>"> + <?= htmlReady($abschluss->name) ?> + </option> + <? endforeach ?> </select> </label> <label> <select name="fachsem" aria-label="<?= _("Bitte Fachsemester wählen") ?>" class="size-s"> - <? for ($i = 1; $i <= 50; $i += 1): ?> - <option><?= $i ?></option> - <? endfor; ?> + <? for ($i = 1; $i <= 50; $i += 1): ?> + <option><?= $i ?></option> + <? endfor; ?> </select> </label> </div>