blob: 83569133b0c391e5228f848ef318336bb86c8222 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
|
<?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
&& !(
str_starts_with($redirect_to, '#')
|| str_starts_with($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() . $redirect_to));
return;
}
}
}
}
}
|