Skip to content
Snippets Groups Projects
Commit 83f7b36c authored by Jan-Hendrik Willms's avatar Jan-Hendrik Willms
Browse files

prevent php8 warnings (seventh batch of changes), re #2193

Merge request studip/studip!1431
parent 057418dd
No related branches found
No related tags found
1 merge request!4Draft: Icon creation
......@@ -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>
......
......@@ -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;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment