aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan-Hendrik Willms <tleilax+studip@gmail.com>2024-05-07 13:51:48 +0000
committerJan-Hendrik Willms <tleilax+studip@gmail.com>2024-05-07 13:51:48 +0000
commit08d02aa1fe9bd0d1e7862137b7f1ff98dcbf66d2 (patch)
tree33aa5b78494d91d9ea2839b47cf65da3148984f3
parent95d79f130e55a68649f603df38a2b895c59d23ab (diff)
fixes #4128
Closes #4128 Merge request studip/studip!2971
-rw-r--r--app/controllers/lvgruppen/lvgruppen.php21
-rw-r--r--app/controllers/module/module.php2
-rw-r--r--app/controllers/resources/ajax.php2
-rw-r--r--app/controllers/room_management/planning.php8
-rw-r--r--app/controllers/search/studiengaenge.php2
-rw-r--r--app/controllers/shared/contacts.php4
-rw-r--r--app/views/course/wizard/steps/lvgroups/_node.php2
-rw-r--r--app/views/fachabschluss/abschluesse/index.php2
-rw-r--r--app/views/fachabschluss/faecher/fachbereiche.php4
-rw-r--r--app/views/lvgruppen/lvgruppen/details.php2
-rw-r--r--app/views/materialien/files/add_dokument.php6
-rw-r--r--app/views/questionnaire/assign.php16
-rw-r--r--app/views/resources/_common/_grouped_room_list.php2
-rw-r--r--app/views/shared/contacts/add_ranges_to_contact.php4
-rw-r--r--app/views/shared/contacts/details.php2
-rw-r--r--app/views/shared/contacts/range.php2
-rw-r--r--lib/classes/MVV.class.php2
-rw-r--r--lib/classes/coursewizardsteps/BasicDataWizardStep.php5
18 files changed, 47 insertions, 41 deletions
diff --git a/app/controllers/lvgruppen/lvgruppen.php b/app/controllers/lvgruppen/lvgruppen.php
index 5bac0fd..8562836 100644
--- a/app/controllers/lvgruppen/lvgruppen.php
+++ b/app/controllers/lvgruppen/lvgruppen.php
@@ -149,10 +149,12 @@ class Lvgruppen_LvgruppenController extends MVVController
$semester = Semester::find($this->semester_filter);
if ($semester && $semester->isCurrent()) {
$this->next_sem = Semester::findNext();
- $this->display_semesters[] = $this->next_sem;
- $this->courses = array_merge($this->courses,
- $this->lvgruppe->getAllAssignedCourses(false, $this->next_sem->id)
- );
+ if ($this->next_sem) {
+ $this->display_semesters[] = $this->next_sem;
+ $this->courses = array_merge($this->courses,
+ $this->lvgruppe->getAllAssignedCourses(false, $this->next_sem->id)
+ );
+ }
}
$this->current_sem = $semester;
$this->display_semesters[] = $semester;
@@ -451,7 +453,7 @@ class Lvgruppen_LvgruppenController extends MVVController
);
$widget->class = 'nested-select';
$widget->addElement(
- new SelectElement('select-none', _('Alle'), $selected_abschlussh === '')
+ new SelectElement('select-none', _('Alle'), $selected_abschluss === '')
);
$abschluesse = Abschluss::findBySQL(' 1 ORDER BY `name`');
foreach ($abschluesse as $abschluss) {
@@ -533,11 +535,12 @@ class Lvgruppen_LvgruppenController extends MVVController
private function set_trails_filter($start, $end)
{
// show only pathes with modules valid in the selected semester
- ModuleManagementModelTreeItem::setObjectFilter('Modulteil',
+ ModuleManagementModelTreeItem::setObjectFilter(
+ Modulteil::class,
function ($mt) use ($start, $end) {
- $modul_start = Semester::find($mt->modul->start)->beginn ?: 0;
- $modul_end = Semester::find($mt->modul->end)->ende ?: PHP_INT_MAX;
- return ($modul_start <= $end && $modul_end >= $start);
+ $modul_start = Semester::find($mt->modul->start)->beginn ?? 0;
+ $modul_end = Semester::find($mt->modul->end)->ende ?? PHP_INT_MAX;
+ return $modul_start <= $end && $modul_end >= $start;
}
);
}
diff --git a/app/controllers/module/module.php b/app/controllers/module/module.php
index 2f6ba4c..e57156f 100644
--- a/app/controllers/module/module.php
+++ b/app/controllers/module/module.php
@@ -53,7 +53,7 @@ class Module_ModuleController extends MVVController
if (count($search_result) > 0) {
$module_ids = $search_result;
} else {
- if ($_SESSION['mvv_filter_module_fach_id']) {
+ if (!empty($_SESSION['mvv_filter_module_fach_id'])) {
$module_ids = $this->findModuleIdsByFach($_SESSION['mvv_filter_module_fach_id']);
}
if (!empty($_SESSION['mvv_filter_module_abschluss_id'])) {
diff --git a/app/controllers/resources/ajax.php b/app/controllers/resources/ajax.php
index 6ff3942..998acaf 100644
--- a/app/controllers/resources/ajax.php
+++ b/app/controllers/resources/ajax.php
@@ -190,7 +190,7 @@ class Resources_AjaxController extends AuthenticatedController
'resource_id' => $resource->id
];
if (!$display_all_requests) {
- $requests_sql .= "AND user_id = :user_id ";
+ $requests_sql .= " AND user_id = :user_id ";
$requests_sql_params['user_id'] = $current_user->id;
}
diff --git a/app/controllers/room_management/planning.php b/app/controllers/room_management/planning.php
index c450c64..1484bbb 100644
--- a/app/controllers/room_management/planning.php
+++ b/app/controllers/room_management/planning.php
@@ -38,7 +38,7 @@ class RoomManagement_PlanningController extends AuthenticatedController
if ($selected_clipboard_id) {
$_SESSION['selected_clipboard_id'] = $selected_clipboard_id;
} else {
- $selected_clipboard_id = $_SESSION['selected_clipboard_id'];
+ $selected_clipboard_id = $_SESSION['selected_clipboard_id'] ?? null;
}
$this->display_all_requests = Request::get('display_all_requests');
@@ -282,7 +282,7 @@ class RoomManagement_PlanningController extends AuthenticatedController
if ($selected_clipboard_id) {
$_SESSION['selected_clipboard_id'] = $selected_clipboard_id;
} else {
- $selected_clipboard_id = $_SESSION['selected_clipboard_id'];
+ $selected_clipboard_id = $_SESSION['selected_clipboard_id'] ?? null;
}
$this->display_all_requests = Request::get('display_all_requests');
@@ -411,7 +411,7 @@ class RoomManagement_PlanningController extends AuthenticatedController
}
//Check if a clipboard is selected:
- $selected_clipboard_id = $_SESSION['selected_clipboard_id'];
+ $selected_clipboard_id = $_SESSION['selected_clipboard_id'] ?? null;
$rooms = [];
if ($selected_clipboard_id) {
$clipboard = Clipboard::find($selected_clipboard_id);
@@ -1075,7 +1075,7 @@ class RoomManagement_PlanningController extends AuthenticatedController
if ($selected_clipboard_id) {
$_SESSION['selected_clipboard_id'] = $selected_clipboard_id;
} else {
- $selected_clipboard_id = $_SESSION['selected_clipboard_id'];
+ $selected_clipboard_id = $_SESSION['selected_clipboard_id'] ?? null;
}
//Get the selected date or use the current date, if none specified:
diff --git a/app/controllers/search/studiengaenge.php b/app/controllers/search/studiengaenge.php
index a075ce9..ae27106 100644
--- a/app/controllers/search/studiengaenge.php
+++ b/app/controllers/search/studiengaenge.php
@@ -228,7 +228,7 @@ class Search_StudiengaengeController extends MVVController
} else {
$this->active_sem = Semester::find($this->sessGet('selected_semester', Semester::findCurrent()->id));
}
- $this->active_sem = $this->semesters[$this->active_sem->id] ? $this->active_sem : null;
+ $this->active_sem = !empty($this->semesters[$this->active_sem->id]) ? $this->active_sem : null;
if (!$this->active_sem && count($this->semesters)) {
$active_sem = reset($this->semesters);
$this->active_sem = Semester::find($active_sem['semester_id']);
diff --git a/app/controllers/shared/contacts.php b/app/controllers/shared/contacts.php
index 98670f4..62dd7a8 100644
--- a/app/controllers/shared/contacts.php
+++ b/app/controllers/shared/contacts.php
@@ -725,7 +725,7 @@ class Shared_ContactsController extends MVVController
$this->mvvcontact_id = $user_id;
$this->selected_sem_end = $this->filter['end_sem.ende'];
- $this->selected_inst = $this->filter['mvv_studiengang.institut_id'];
+ $this->selected_inst = $this->filter['mvv_studiengang.institut_id'] ?? null;
if (Request::submitted('store')) {
$selected = Request::getArray('ranges');
@@ -871,7 +871,7 @@ class Shared_ContactsController extends MVVController
));
$filter = [
'mvv_modul.stat' => $stat,
- 'mvv_modul_inst.institut_id' => $this->filter['mvv_modul_inst.institut_id'],
+ 'mvv_modul_inst.institut_id' => $this->filter['mvv_modul_inst.institut_id'] ?? '',
'start_sem.beginn' => $this->filter['start_sem.beginn'],
'end_sem.ende' => $this->filter['end_sem.ende']
];
diff --git a/app/views/course/wizard/steps/lvgroups/_node.php b/app/views/course/wizard/steps/lvgroups/_node.php
index 8b159bd..78db2f1 100644
--- a/app/views/course/wizard/steps/lvgroups/_node.php
+++ b/app/views/course/wizard/steps/lvgroups/_node.php
@@ -1,4 +1,4 @@
-<? if (!$search_result || in_array($node->id, $search_result)) : ?>
+<? if (empty($search_result) || in_array($node->id, $search_result)) : ?>
<? $id = $node->id . '-' . $pos_id; ?>
<? if (!count($children)) : ?>
<li><?= _('Keine Module verfügbar') ?></li>
diff --git a/app/views/fachabschluss/abschluesse/index.php b/app/views/fachabschluss/abschluesse/index.php
index 6750a76..2b39000 100644
--- a/app/views/fachabschluss/abschluesse/index.php
+++ b/app/views/fachabschluss/abschluesse/index.php
@@ -14,7 +14,7 @@
</tr>
</thead>
<? foreach ($abschluesse as $abschluss) : ?>
- <tbody class="<?= $abschluss->count_faecher ? '' : 'empty' ?> <?= ($abschluss_id ? 'not-collapsed' : 'collapsed') ?>">
+ <tbody class="<?= $abschluss->count_faecher ? '' : 'empty' ?> <?= !empty($abschluss_id) ? 'not-collapsed' : 'collapsed' ?>">
<tr class="header-row">
<td class="toggle-indicator">
<? if ($abschluss->count_faecher) : ?>
diff --git a/app/views/fachabschluss/faecher/fachbereiche.php b/app/views/fachabschluss/faecher/fachbereiche.php
index 5a4f6f1..844440c 100644
--- a/app/views/fachabschluss/faecher/fachbereiche.php
+++ b/app/views/fachabschluss/faecher/fachbereiche.php
@@ -10,7 +10,7 @@
</thead>
<? foreach ($fachbereiche as $fachbereich): ?>
<? if ($fachbereich['faecher']) : ?>
- <tbody class="<?= ($fachbereich_id === $fachbereich['institut_id'] ? 'not-collapsed' : 'collapsed') ?>">
+ <tbody class="<?= isset($fachbereich_id) && $fachbereich_id === $fachbereich['institut_id'] ? 'not-collapsed' : 'collapsed' ?>">
<tr class="header-row">
<td class="toggle-indicator">
<a class="mvv-load-in-new-row"
@@ -18,7 +18,7 @@
</td>
<td style="text-align: center;" class="dont-hide"><?= htmlReady($fachbereich['faecher']) ?> </td>
</tr>
- <? if ($fachbereich_id === $fachbereich['institut_id']) : ?>
+ <? if (isset($fachbereich_id) && $fachbereich_id === $fachbereich['institut_id']): ?>
<tr class="loaded-details nohover">
<?= $this->render_partial('fachabschluss/faecher/details_fachbereich', compact('fach')) ?>
</tr>
diff --git a/app/views/lvgruppen/lvgruppen/details.php b/app/views/lvgruppen/lvgruppen/details.php
index 073d552..6a9c3af 100644
--- a/app/views/lvgruppen/lvgruppen/details.php
+++ b/app/views/lvgruppen/lvgruppen/details.php
@@ -92,7 +92,7 @@
<? else : ?>
<ul style="list-style-type:none;" id="mvv-lvgruppen-semester">
<? foreach ($display_semesters as $semester) : ?>
- <? if ($courses[$semester->id]) : ?>
+ <? if (!empty($courses[$semester->id])) : ?>
<li>
<strong><?= htmlReady($semester->name) ?></strong>
<ul style="list-style-type:none;">
diff --git a/app/views/materialien/files/add_dokument.php b/app/views/materialien/files/add_dokument.php
index e53d917..3b706e9 100644
--- a/app/views/materialien/files/add_dokument.php
+++ b/app/views/materialien/files/add_dokument.php
@@ -35,7 +35,7 @@
</tr>
<tr>
<td>
- <div class="attachments" style="<?= (!$documents || !key_exists($key, $documents)) ? '' : 'display: none;'?>">
+ <div class="attachments" style="<?= (empty($documents) || !array_key_exists($key, $documents)) ? '' : 'display: none;'?>">
<span style="cursor:pointer;" onClick="$('#fileselector_<?= $key; ?>').toggle();$(this).toggle();">
<?= Icon::create('add', Icon::ROLE_CLICKABLE, ['title' => _("Datei hinzufügen"), 'class' => 'text-bottom']); ?>
<?= _("Datei hinzufügen") ?>
@@ -43,11 +43,11 @@
<div id="fileselector_<?= $key; ?>" style="display:none;">
<ul class="stgfiles list-unstyled">
<li style="display: none;" class="stgfile">
- <input type="hidden" name="document_id" id="document_id" value="<?= htmlReady($document_id) ?>">
+ <input type="hidden" name="document_id" id="document_id" value="<?= htmlReady($document_id ?? '') ?>">
<span class="icon"></span>
<span class="name"></span>
<span class="size"></span>
- <a class="remove_attachment"><?= Icon::create('trash', 'clickable')->asImg(['class' => "text-bottom"]) ?></a>
+ <a class="remove_attachment"><?= Icon::create('trash')->asImg(['class' => 'text-bottom']) ?></a>
</li>
</ul>
<div id="statusbar_container">
diff --git a/app/views/questionnaire/assign.php b/app/views/questionnaire/assign.php
index 4bf7fc5..5299a83 100644
--- a/app/views/questionnaire/assign.php
+++ b/app/views/questionnaire/assign.php
@@ -10,8 +10,8 @@
<select name="semester_id">
<? foreach ($available_semesters as $available_semester): ?>
<option value="<?= htmlReady($available_semester->id) ?>"
- <?= ($available_semester->id == $semester_id)
- ? 'selected="selected"'
+ <?= isset($semester_id) && $available_semester->id == $semester_id
+ ? 'selected'
: ''
?>>
<?= htmlReady($available_semester->name) ?>
@@ -24,13 +24,13 @@
(<?= _('optional') ?>)
<select name="institute_id">
<option value=""
- <?= ($institute_id == '' ? 'selected="selected"' : '') ?>>
+ <?= empty($institute_id) ? 'selected' : '' ?>>
<?= _('(bitte wählen)') ?>
</option>
<? foreach ($available_institutes as $available_institute): ?>
<option value="<?= htmlReady($available_institute['Institut_id']) ?>"
- <?= ($available_institute['Institut_id'] == $institute_id)
- ? 'selected="selected"'
+ <?= isset($institute_id) && $available_institute['Institut_id'] == $institute_id
+ ? 'selected'
: ''
?>>
<?= htmlReady($available_institute['Name']) ?>
@@ -43,13 +43,13 @@
(<?= _('optional') ?>)
<select name="course_type_id">
<option value=""
- <?= ($course_type_id == '' ? 'selected="selected"' : '') ?>>
+ <?= empty($course_type_id) ? 'selected' : '' ?>>
<?= dgettext('AskALotPlugin', '(bitte wählen)') ?>
</option>
<? foreach ($available_course_types as $available_course_type): ?>
<option value="<?= htmlReady($available_course_type['id']) ?>"
- <?= ($available_course_type['id'] == $course_type_id)
- ? 'selected="selected"'
+ <?= isset($course_type_id) && $available_course_type['id'] == $course_type_id
+ ? 'selected'
: ''
?>>
<?= htmlReady($available_course_type['name']) ?>
diff --git a/app/views/resources/_common/_grouped_room_list.php b/app/views/resources/_common/_grouped_room_list.php
index f3d6b62..a27af17 100644
--- a/app/views/resources/_common/_grouped_room_list.php
+++ b/app/views/resources/_common/_grouped_room_list.php
@@ -64,7 +64,7 @@
<? if ($user) :?>
<?
$perms = [
- 'show_global_admin_actions' => $show_global_admin_actions,
+ 'show_global_admin_actions' => $show_global_admin_actions ?? false,
'show_admin_actions' => $resource->userHasPermission($user, 'admin'),
'show_tutor_actions' => $resource->userHasPermission($user, 'tutor'),
'show_autor_actions' => $resource->userHasPermission($user, 'autor'),
diff --git a/app/views/shared/contacts/add_ranges_to_contact.php b/app/views/shared/contacts/add_ranges_to_contact.php
index 389e72c..0f4ae3f 100644
--- a/app/views/shared/contacts/add_ranges_to_contact.php
+++ b/app/views/shared/contacts/add_ranges_to_contact.php
@@ -16,7 +16,7 @@
<select style="display: inline-block;" name="ansp_typ">
<option value=""<?= empty($ansp_typ) ? ' selected' : '' ?>></option>
<? foreach ($GLOBALS['MVV_CONTACTS']['TYPE']['values'] as $key => $entry) : ?>
- <option value="<?= $key ?>"<?= $key == $ansp_typ ? ' selected' : '' ?>><?= htmlReady($entry['name']) ?></option>
+ <option value="<?= $key ?>"<?= isset($ansp_typ) && $key == $ansp_typ ? ' selected' : '' ?>><?= htmlReady($entry['name']) ?></option>
<? endforeach; ?>
</select>
</label>
@@ -26,7 +26,7 @@
<?= _('Kategorie') ?>
<select style="display: inline-block;" name="ansp_kat">
<? foreach (MvvContactRange::getCategoriesByRangetype($range_type) as $key => $entry) : ?>
- <option value="<?= $key ?>"<?= $key == $ansp_kat ? ' selected' : '' ?>><?= htmlReady($entry['name']) ?></option>
+ <option value="<?= $key ?>"<?= isset($ansp_kat) && $key == $ansp_kat ? ' selected' : '' ?>><?= htmlReady($entry['name']) ?></option>
<? endforeach; ?>
</select>
</label>
diff --git a/app/views/shared/contacts/details.php b/app/views/shared/contacts/details.php
index f39d200..a4605ce 100644
--- a/app/views/shared/contacts/details.php
+++ b/app/views/shared/contacts/details.php
@@ -45,7 +45,7 @@
</td>
<? if ($object_type === 'Studiengang') : ?>
<td>
- <?= htmlReady($GLOBALS['MVV_CONTACTS']['TYPE']['values'][$rel['type']]['name']); ?>
+ <?= htmlReady($GLOBALS['MVV_CONTACTS']['TYPE']['values'][$rel['type']]['name'] ?? ''); ?>
</td>
<? endif; ?>
<td>
diff --git a/app/views/shared/contacts/range.php b/app/views/shared/contacts/range.php
index d66c494..f58b286 100644
--- a/app/views/shared/contacts/range.php
+++ b/app/views/shared/contacts/range.php
@@ -40,7 +40,7 @@
<td><?= htmlReady($mvv_contact->position); ?></td>
<td><?= htmlReady($mvv_contact->name) ?></td>
<? if($range_type !== 'Modul'): ?>
- <td><?= htmlReady($GLOBALS['MVV_CONTACTS']['TYPE']['values'][$mvv_contact->type]['name']) ?></td>
+ <td><?= htmlReady($GLOBALS['MVV_CONTACTS']['TYPE']['values'][$mvv_contact->type]['name'] ?? '') ?></td>
<? endif; ?>
<td><?= htmlReady($mvv_contact->getCategoryDisplayname()); ?></td>
<td ><?= htmlReady($mvv_contact->count_relations); ?></td>
diff --git a/lib/classes/MVV.class.php b/lib/classes/MVV.class.php
index 67bbbeb..517514c 100644
--- a/lib/classes/MVV.class.php
+++ b/lib/classes/MVV.class.php
@@ -843,7 +843,7 @@ class MVV implements Loggable {
public static function getContentLanguageImagePath($language): string
{
$content_language = $GLOBALS['MVV_MODUL_DESKRIPTOR']['SPRACHE']['values'][$language]['content_language'];
- return 'languages/' . ($GLOBALS['CONTENT_LANGUAGES'][$content_language]?$GLOBALS['CONTENT_LANGUAGES'][$content_language]['picture']:'lang_' . mb_strtolower($language) . '.gif');
+ return 'languages/' . ($GLOBALS['CONTENT_LANGUAGES'][$content_language]['picture'] ?? 'lang_' . mb_strtolower($language) . '.gif');
}
}
diff --git a/lib/classes/coursewizardsteps/BasicDataWizardStep.php b/lib/classes/coursewizardsteps/BasicDataWizardStep.php
index 58fb09f..6a1438f 100644
--- a/lib/classes/coursewizardsteps/BasicDataWizardStep.php
+++ b/lib/classes/coursewizardsteps/BasicDataWizardStep.php
@@ -620,7 +620,10 @@ class BasicDataWizardStep implements CourseWizardStep
}
}
-
+ } else {
+ foreach ($indices as $index) {
+ $values[$index] = $values[$index] ?? '';
+ }
}
return $values;