diff --git a/app/views/course/wizard/steps/basicdata/index.php b/app/views/course/wizard/steps/basicdata/index.php index cc97058dc202f8feb188c6870fec95204bea7e7e..e1f10a4fde1e32397147c16fe260cca895507f09 100644 --- a/app/views/course/wizard/steps/basicdata/index.php +++ b/app/views/course/wizard/steps/basicdata/index.php @@ -43,7 +43,7 @@ <?= $course_number_format_config['comment'] ? tooltipIcon($course_number_format_config['comment']) : '' ?> </label> <? $course_number_format = Config::get()->COURSE_NUMBER_FORMAT; ?> - <input type="text" name="number" id="wizard-number" size="20" maxlength="99" value="<?= htmlReady($values['number']) ?>" + <input type="text" name="number" id="wizard-number" size="20" maxlength="99" value="<?= htmlReady($values['number'] ?? '') ?>" <? if ($course_number_format) : ?>pattern="<?= htmlReady($course_number_format) ?>" <? endif ?>/> </section> <section> @@ -80,8 +80,8 @@ <div id="wizard-instsearch"> <?= $instsearch ?> </div> - <?php if ($values['part_inst_id_parameter']) : ?> - <?= Icon::create('arr_2down', 'sort')->asInput(["name" => 'add_part_inst', "value" => '1']) ?> + <?php if (!empty($values['part_inst_id_parameter'])) : ?> + <?= Icon::create('arr_2down', Icon::ROLE_SORT)->asInput(["name" => 'add_part_inst', "value" => '1']) ?> <?php endif ?> </section> <section> @@ -105,8 +105,8 @@ <div id="wizard-lecturersearch"> <?= $lsearch ?> </div> - <?php if ($values['lecturer_id_parameter']) : ?> - <?= Icon::create('arr_2down', 'sort')->asInput(["name" => 'add_lecturer', "value" => '1']) ?> + <?php if (!empty($values['lecturer_id_parameter'])) : ?> + <?= Icon::create('arr_2down', Icon::ROLE_SORT)->asInput(["name" => 'add_lecturer', "value" => '1']) ?> <?php endif ?> </section> <section> @@ -131,8 +131,8 @@ <div id="wizard-deputysearch"> <?= $dsearch ?> </div> - <?php if ($values['deputy_id_parameter']) : ?> - <?= Icon::create('arr_2down', 'sort')->asInput(["name" => 'add_deputy', "value" => '1']) ?> + <?php if (!empty($values['deputy_id_parameter'])) : ?> + <?= Icon::create('arr_2down', Icon::ROLE_SORT)->asInput(["name" => 'add_deputy', "value" => '1']) ?> <?php endif ?> </section> <section> @@ -159,8 +159,8 @@ <div id="wizard-tutorsearch"> <?= $tsearch ?> </div> - <?php if ($values['tutor_id_parameter']) : ?> - <?= Icon::create('arr_2down', 'sort')->asInput(["name" => 'add_tutor', "value" => '1']) ?> + <?php if (!empty($values['tutor_id_parameter'])) : ?> + <?= Icon::create('arr_2down', Icon::ROLE_SORT)->asInput(["name" => 'add_tutor', "value" => '1']) ?> <?php endif ?> </section> diff --git a/lib/classes/coursewizardsteps/BasicDataWizardStep.php b/lib/classes/coursewizardsteps/BasicDataWizardStep.php index ebb8ff552aa9125205ad863c173f62b3392ef8db..e3ddc47f9e2c60225738e3faf354a9cc3b022638 100644 --- a/lib/classes/coursewizardsteps/BasicDataWizardStep.php +++ b/lib/classes/coursewizardsteps/BasicDataWizardStep.php @@ -82,8 +82,11 @@ class BasicDataWizardStep implements CourseWizardStep foreach (Semester::getAll() as $s) { if ($s->ende >= $now) { if ($GLOBALS['perm']->have_perm("admin")) { - if ($s->id == $GLOBALS['user']->cfg->MY_COURSES_SELECTED_CYCLE && - !$values['start_time'] && Request::isXhr()) { + if ( + $s->id == $GLOBALS['user']->cfg->MY_COURSES_SELECTED_CYCLE + && empty($values['start_time']) + && Request::isXhr() + ) { $values['start_time'] = $s->beginn; } } @@ -93,7 +96,7 @@ class BasicDataWizardStep implements CourseWizardStep if (empty($values['start_time'])) { $values['start_time'] = Semester::findDefault()->beginn; } - if ($values['studygroup'] && (!count($typestruct) || !$values['institute']) ) { + if (!empty($values['studygroup']) && (!count($typestruct) || empty($values['institute'])) ) { $message = sprintf(_('Die Konfiguration der Studiengruppen ist unvollständig. ' . 'Bitte wenden Sie sich an [die Stud.IP-Administration]%s .'), URLHelper::getLink('dispatch.php/siteinfo/show') @@ -104,7 +107,7 @@ class BasicDataWizardStep implements CourseWizardStep if (count($semesters) > 0) { $tpl->set_attribute('semesters', array_reverse($semesters)); // If no semester is set, use current as selected default. - if (!$values['start_time']) { + if (empty($values['start_time'])) { $values['start_time'] = Semester::findCurrent()->beginn; } } else { @@ -125,7 +128,7 @@ class BasicDataWizardStep implements CourseWizardStep $institutes = Institute::getMyInstitutes(); if (!empty($values['studygroup']) || count($institutes) > 0) { $tpl->set_attribute('institutes', $institutes); - if (!$values['institute']) { + if (empty($values['institute'])) { if ($GLOBALS['user']->cfg->MY_INSTITUTES_DEFAULT && Request::isXhr()) { $values['institute'] = $GLOBALS['user']->cfg->MY_INSTITUTES_DEFAULT; } else { @@ -185,7 +188,11 @@ class BasicDataWizardStep implements CourseWizardStep * present. But this can only be done if your own permission level * is 'dozent'. */ - if (!$values['lecturers'] && $GLOBALS['perm']->have_perm('dozent') && !$GLOBALS['perm']->have_perm('admin')) { + if ( + empty($values['lecturers']) + && $GLOBALS['perm']->have_perm('dozent') + && !$GLOBALS['perm']->have_perm('admin') + ) { $values['lecturers'][$GLOBALS['user']->id] = true; // Remove from deputies if set. if ($deputies && $values['deputies'][$GLOBALS['user']->id]) { @@ -556,16 +563,22 @@ class BasicDataWizardStep implements CourseWizardStep public static function tsearchHelper($psearch, $context) { $ret['permission'] = ['tutor', 'dozent']; - $ret['exclude_user'] = array_keys((array)$context['tutors']); - $ret['institute'] = array_merge([$context['institute']], array_keys((array)$context['participating'])); + $ret['exclude_user'] = array_keys((array) ($context['tutors'] ?? [])); + $ret['institute'] = array_merge( + [$context['institute']], + array_keys((array) ($context['participating'] ?? [])) + ); return $ret; } public static function lsearchHelper($psearch, $context) { $ret['permission'] = 'dozent'; - $ret['exclude_user'] = array_keys((array)$context['lecturers']); - $ret['institute'] = array_merge([$context['institute']], array_keys((array)$context['participating'])); + $ret['exclude_user'] = array_keys((array) ($context['lecturers'] ?? [])); + $ret['institute'] = array_merge( + [$context['institute']], + array_keys((array) ($context['participating'] ?? [])) + ); return $ret; }