Skip to content
Snippets Groups Projects
Commit d674bcfb authored by Jan-Hendrik Willms's avatar Jan-Hendrik Willms Committed by David Siegfried
Browse files

prevent php8 warnings, fixes #2235

Closes #2235

Merge request studip/studip!1469
parent 573b6658
No related branches found
No related tags found
1 merge request!4Draft: Icon creation
......@@ -197,7 +197,7 @@ class Search_StudiengaengeController extends MVVController
$this->sessSet('selected_semester', $sem);
}
$this->with_courses = Request::option('with_courses', ($_SESSION['MVV_SEARCH_SEQUENCE_WITH_COURSES'] ?: null));
$this->with_courses = Request::option('with_courses', $_SESSION['MVV_SEARCH_SEQUENCE_WITH_COURSES'] ?? null);
$_SESSION['MVV_SEARCH_SEQUENCE_WITH_COURSES'] = $this->with_courses;
$studiengangTeil = StudiengangTeil::find($stgteil_id);
......
......@@ -85,10 +85,10 @@
_('Semesterplan'),
[
'editable' => true,
'selectable' => ($fullcalendar_studip_urls['add'] != null),
'selectable' => isset($fullcalendar_studip_urls['add']),
'studip_urls' => $fullcalendar_studip_urls,
'minTime' => ($min_time),
'maxTime' => ($max_time),
'minTime' => $min_time,
'maxTime' => $max_time,
'allDaySlot' => false,
'columnHeaderFormat' => ['weekday'=> 'short'],
'header' => [
......
......@@ -3,9 +3,9 @@
<? $sum_points = count($bc_points) - 1; ?>
<? $index = 0; ?>
<? foreach($bc_points as $type => $point):?>
<? $id2 = reset(array_values((array) $point['add'])); ?>
<? $link = $controller->action_link('' . $point['actn'], $point['id'], $id2); ?>
<? if (is_array($point['add'])) : ?>
<? $id2 = array_values((array) ($point['add'] ?? []))[0] ?? null; ?>
<? $link = $controller->action_link('' . $point['actn'], $point['id'] ?? null, $id2); ?>
<? if (isset($point['add']) && is_array($point['add'])) : ?>
<? $mvv_object = $type::find($point['id']); ?>
<? if ($mvv_object && $type == 'Fach' && $additional_object = Abschluss::find($point['add']['Abschluss'])) : ?>
<a href="<?= $link ?>"><?= htmlReady($mvv_object->getDisplayName() . ' (' . $additional_object->name . ')') ?></a>
......@@ -16,7 +16,7 @@
<? else : ?>
<? if ($type == 'StudiengangTeil' && $mvv_object = $type::find($point['id'])) : ?>
<a href="<?= $link ?>"><?= htmlReady($mvv_object->getDisplayName(ModuleManagementModel::DISPLAY_FACH)) ?></a>
<? elseif ($point['id'] && $mvv_object = $type::find($point['id'])) : ?>
<? elseif (!empty($point['id']) && $mvv_object = $type::find($point['id'])) : ?>
<a href="<?= $link ?>"><?= htmlReady($mvv_object->getDisplayName(0)) ?></a>
<? else : ?>
<a href="<?= $link ?>"><?= htmlReady($point['name']) ?></a>
......
......@@ -9,7 +9,7 @@
<th class="mvv-modul-details-head" data-mvv-field="mvv_modul.code"><?= htmlReady($modul->code) ?></th>
<th class="mvv-modul-details-head" data-mvv-field="mvv_modul.kp" style="text-align: right;"><?= sprintf("%d CP", $modul->kp) ?></th>
</tr>
<? if ($show_synopse || $modul->fassung_nr): ?>
<? if (!empty($show_synopse) || $modul->fassung_nr): ?>
<tr>
<th colspan="2" style="font-weight: normal;">
<? if ($show_synopse) : ?>
......@@ -44,7 +44,7 @@
</tr>
<tr>
<td><strong><?= _('Semester der erstmaligen Durchführung') ?></strong></td>
<td data-mvv-field="mvv_modul.start"><?= htmlReady($startSemester['name']) ?></td>
<td data-mvv-field="mvv_modul.start"><?= htmlReady($startSemester['name'] ?? '') ?></td>
</tr>
<? if ($instituteName) : ?>
<tr>
......@@ -77,7 +77,7 @@
?>
<li data-mvv-field="mvv_stgteilabschnitt_modul" data-mvv-id="<?= $affect_id; ?>" data-mvv-cooid="<?= $modul->getId(); ?>">
<?= htmlReady($path)?>
<? if (!$download && (count($pathes) > 9 && $i == 4)) : ?>
<? if (empty($download) && count($pathes) > 9 && $i == 4) : ?>
<label class="cb-more-label" for="cb_more_studycourses"><?= _('mehr...') ?></label>
<? endif; ?>
</li>
......
......@@ -175,11 +175,8 @@ class StudipSemTreeViewSimple
public function getInfoIcon($item_id)
{
if ($item_id === 'root') {
$info = $this->root_content;
}
$ret = $info ? tooltipicon(kill_format($info)) : '';
return $ret;
$info = $item_id === 'root' ? $this->root_content : '';
return $info ? tooltipicon(kill_format($info)) : '';
}
public function showContent($item_id, $num_all_entries = 0)
......
......@@ -339,8 +339,12 @@ class RoomSearchWidget extends SidebarWidget
$properties[$name] = $criteria['value'];
}
if ($properties[$name][0] && $properties[$name][1] &&
($properties[$name][0] > $properties[$name][1]) && $name != 'room_category_id') {
if (
isset($properties[$name][0], $properties[$name][1])
&& $properties[$name][0] && $properties[$name][1]
&& $properties[$name][0] > $properties[$name][1]
&& $name !== 'room_category_id'
) {
//A range is selected, but the range start is bigger
//then the range end. That's an error!
......
......@@ -13,7 +13,6 @@
* @category Stud.IP
* @since 3.5
*/
class Abschluss extends ModuleManagementModelTreeItem implements PrivacyObject
{
protected static function configure($config = [])
......@@ -47,16 +46,21 @@ class Abschluss extends ModuleManagementModelTreeItem implements PrivacyObject
'order_by' => 'GROUP BY fach_id ORDER BY name'
];
$config['additional_fields']['count_faecher']['get'] =
function($abschluss) { return $abschluss->count_faecher; };
$config['additional_fields']['kategorie_name']['get'] =
function($abschluss) { return $abschluss->kategorie_name; };
$config['additional_fields']['kategorie_id']['get'] =
function($abschluss) { return $abschluss->category_assignment->kategorie_id; };
$config['additional_fields']['count_studiengaenge']['get'] =
function($abschluss) { return $abschluss->count_studiengaenge; };
$config['additional_fields']['count_objects']['get'] =
function($abschluss) { return $abschluss->count_objects; };
$config['additional_fields']['count_faecher']['get'] = function (Abschluss $abschluss) {
return $abschluss->count_faecher;
};
$config['additional_fields']['kategorie_name']['get'] = function (Abschluss $abschluss) {
return $abschluss->kategorie_name;
};
$config['additional_fields']['kategorie_id']['get'] = function (Abschluss $abschluss) {
return $abschluss->category_assignment ? $abschluss->category_assignment->kategorie_id : null;
};
$config['additional_fields']['count_studiengaenge']['get'] = function (Abschluss $abschluss) {
return $abschluss->count_studiengaenge;
};
$config['additional_fields']['count_objects']['get'] = function (Abschluss $abschluss) {
return $abschluss->count_objects;
};
$config['additional_fields']['count_user']['get'] = 'countUser';
$config['i18n_fields']['name'] = true;
......
......@@ -268,6 +268,10 @@ class Semester extends SimpleORMap
$use_semester_id = true
)
{
$select_attributes = array_merge([
'name' => 'sem_select',
], $select_attributes ?? []);
$semester = Semester::findAllVisible();
unset($semester[0]);
......@@ -280,10 +284,6 @@ class Semester extends SimpleORMap
}
$semester = array_reverse($semester, true);
if (!$select_attributes['name']) {
$select_attributes['name'] = 'sem_select';
}
$template = $GLOBALS['template_factory']->open('shared/semester-selector');
$template->semesters = $semester;
$template->select_attributes = $select_attributes;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment