aboutsummaryrefslogtreecommitdiff
path: root/app/controllers/course/go.php
diff options
context:
space:
mode:
authorAndré Noack <noack@data-quest.de>2024-12-12 14:52:00 +0000
committerDavid Siegfried <david.siegfried@uni-vechta.de>2024-12-12 14:52:00 +0000
commit940d2aaa8638b4e0c764579cb3977e7be527c81f (patch)
tree79bd2d7f02359e1bb24931b33513e082f8404a91 /app/controllers/course/go.php
parent3a2a88172ccbe97aaecf4ea32b97cd07b92dcb11 (diff)
StEP 1552 closes #1552
Closes #1552 Merge request studip/studip!1137
Diffstat (limited to 'app/controllers/course/go.php')
-rw-r--r--app/controllers/course/go.php69
1 files changed, 69 insertions, 0 deletions
diff --git a/app/controllers/course/go.php b/app/controllers/course/go.php
new file mode 100644
index 0000000..03ae1df
--- /dev/null
+++ b/app/controllers/course/go.php
@@ -0,0 +1,69 @@
+<?php
+/**
+ * dispatch.php/course/go - startpage for course controller, formerly known as seminar_main.php
+ *
+ * @author André Noack <noack@data-quest.de>
+ * @license GPL2 or any later version
+ * @since 6.0
+ */
+
+class Course_GoController extends AuthenticatedController
+{
+ protected $allow_nobody = true;
+
+ public function __construct(\Trails\Dispatcher $dispatcher)
+ {
+ if (Request::option('to')) {
+ Request::set('cid', Request::option('to'));
+ }
+ parent::__construct($dispatcher);
+ }
+
+ public function index_action()
+ {
+ $course_id = Context::getId();
+
+ if (!$course_id && Request::get('cid')) {
+ $archive_id = Request::get('cid');
+ $archived = ArchivedCourse::find($archive_id);
+ if ($archived) {
+ $this->redirect(URLHelper::getURL('dispatch.php/search/archive', [
+ 'criteria' => $archived->name,
+ ]));
+ return;
+ }
+ }
+
+ if (!$course_id) {
+ throw new CheckObjectException(_('Sie haben kein Objekt gewählt.'));
+ }
+
+ //set visitdate for course, when coming from my_courses
+ if (Request::get('to')) {
+ object_set_visit($course_id, 0);
+ }
+
+
+ // gibt es eine Anweisung zur Umleitung?
+ $redirect_to = Request::get('redirect_to');
+ if ($redirect_to) {
+ if (!is_internal_url($redirect_to)) {
+ throw new Exception('Invalid redirection');
+ }
+
+ $this->redirect(URLHelper::getURL($redirect_to, ['cid' => $course_id]));
+ return;
+ }
+
+ // der Nutzer zum ersten
+ //Reiter der Veranstaltung weiter geleitet.
+ if (Navigation::hasItem("/course")) {
+ foreach (Navigation::getItem("/course")->getSubNavigation() as $index => $navigation) {
+ if ($index !== 'admin') {
+ $this->redirect(URLHelper::getURL($navigation->getURL()));
+ return;
+ }
+ }
+ }
+ }
+}