diff options
| -rw-r--r-- | app/controllers/course/details.php | 38 | ||||
| -rw-r--r-- | app/views/course/details/index.php | 12 | ||||
| -rw-r--r-- | app/views/shared/mvv_tree.php | 23 |
3 files changed, 55 insertions, 18 deletions
diff --git a/app/controllers/course/details.php b/app/controllers/course/details.php index 7efee90..b3cac16 100644 --- a/app/controllers/course/details.php +++ b/app/controllers/course/details.php @@ -126,20 +126,26 @@ class Course_DetailsController extends AuthenticatedController if (Config::get()->COURSE_SEM_TREE_DISPLAY) { $this->mvv_tree = []; foreach ($mvv_object_pathes as $mvv_object_path) { - // show only complete pathes - if (count($mvv_object_path) == 4) { - // flatten the pathes to a linked list - $stg = reset($mvv_object_path); + // show only complete paths + if (count($mvv_object_path) === 4) { + $mvv_object_path['StgteilabschnittModul']->modul->setReplaceDfAbschnitt($mvv_object_path['StgteilAbschnitt']); + $mvv_object_path['Modulteil']->setReplaceDfAbschnitt($mvv_object_path['StgteilAbschnitt']); + $abschnitt_id = $mvv_object_path['StgteilAbschnitt']->id; + // flatten the paths to a linked list $parent_id = 'root'; foreach ($mvv_object_path as $mvv_object) { $mvv_object_id = $mvv_object instanceof StgteilabschnittModul ? $mvv_object->modul_id : $mvv_object->id; - $this->mvv_tree[$parent_id][$mvv_object_id] = - ['id' => $mvv_object_id, - 'name' => $mvv_object->getDisplayName(), - 'class' => get_class($mvv_object)]; - $parent_id = $mvv_object_id; + $this->mvv_tree[$parent_id][$tree_id] = + [ + 'id' => $mvv_object_id, + 'name' => $mvv_object->getDisplayName(), + 'class' => get_class($mvv_object), + 'tree_id' => $tree_id, + 'abschnitt_id' => $abschnitt_id + ]; + $parent_id = $tree_id; } } } @@ -153,17 +159,25 @@ class Course_DetailsController extends AuthenticatedController } } else { foreach ($mvv_object_pathes as $mvv_object_path) { - // show only complete pathes - if (count($mvv_object_path) == 4) { + // show only complete paths + if (count($mvv_object_path) === 4) { + $modul_id = ''; + $abschnitt_id = ''; $mvv_object_names = []; $modul_id = ''; foreach ($mvv_object_path as $mvv_object) { if ($mvv_object instanceof StgteilabschnittModul) { $modul_id = $mvv_object->modul_id; + $abschnitt_id = $mvv_object->abschnitt_id; } $mvv_object_names[] = $mvv_object->getDisplayName(); } - $this->mvv_pathes[] = [$modul_id => $mvv_object_names]; + $this->mvv_pathes[] = + [ + 'modul_id' => $modul_id, + 'names' => $mvv_object_names, + 'abschnitt_id' => $abschnitt_id, + ]; } } } diff --git a/app/views/course/details/index.php b/app/views/course/details/index.php index 9e5c036..7d10294 100644 --- a/app/views/course/details/index.php +++ b/app/views/course/details/index.php @@ -429,11 +429,17 @@ if (!empty($mvv_tree)) : ?> <ul class="list-unstyled"> <? foreach ($mvv_pathes as $mvv_path) : ?> <li> - <a data-dialog href="<?= URLHelper::getScriptLink('dispatch.php/search/module/overview/' . reset(array_keys($mvv_path)) . '/' . $course->start_semester->id) ?>"> - <?= htmlReady(implode(' > ', reset(array_values($mvv_path)))) ?> + <a data-dialog href="<?= URLHelper::getLink( + 'dispatch.php/search/module/overview/' + . $mvv_path['modul_id'] . '/' . $course->start_semester->id, + [ + 'abschnitt_id' => $mvv_path['abschnitt_id'], + ] + ) ?>"> + <?= htmlReady(implode(' > ', $mvv_path['names'])) ?> </a> </li> - <? endforeach; ?> + <? endforeach ?> </ul> </section> </article> diff --git a/app/views/shared/mvv_tree.php b/app/views/shared/mvv_tree.php index 6a6c82d..b34c11b 100644 --- a/app/views/shared/mvv_tree.php +++ b/app/views/shared/mvv_tree.php @@ -5,11 +5,28 @@ <? endif; ?> <label for="<?= htmlReady($current['id'] . $id_sfx->c++) ?>"></label> <? if ($current['class'] == 'StgteilabschnittModul') : ?> - <a data-dialog title="<?= htmlReady($current['name']) ?>" href="<?= URLHelper::getLink('dispatch.php/shared/modul/overview/' . $current['id'] . '/' . $course->start_semester->id) ?>"> + <a + data-dialog + title="<?= htmlReady($current['name']) ?>" + href="<?= URLHelper::getScriptLink( + 'dispatch.php/shared/modul/overview/' + . $current['id'] . '/' . $course->start_semester->id, + [ + 'abschnitt_id' => $current['abschnitt_id'], + ] + ) ?>"> <?= htmlReady($current['name']) ?> </a> - <a data-dialog="size=auto" title="<?= htmlReady($current['name']) ?>" href="<?= URLHelper::getLink('dispatch.php/shared/modul/description/' . $current['id']) ?>"> - <?= Icon::create('log', 'clickable', ['title' => _('Modulbeschreibung')]); ?> + <a + data-dialog="size=auto" + title="<?= htmlReady($current['name']) ?>" + href="<?= URLHelper::getScriptLink( + 'dispatch.php/shared/modul/description/' + . $current['id'], + [ + 'abschnitt_id' => $current['abschnitt_id'], + ]) ?>"> + <?= Icon::create('log', 'clickable', ['title' => _('Modulbeschreibung')]); ?> </a> <? else : ?> <?= htmlReady($current['name']) ?> |
