blob: b17e21f28ea43e962c2c560b38087f18fb58e63c (
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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
|
<?php
/*
* This is the controller for the personal calendar
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of
* the License, or (at your option) any later version.
*
* @author Peter Thienel <thienel@data-quest.de>
* @license http://www.gnu.org/licenses/gpl-2.0.html GPL version 2
* @category Stud.IP
*/
/**
* This controller provides all functions for a calendar of an institute.
*/
class Institute_CalendarController extends AuthenticatedController
{
private $calendar_settings = [];
private $institute_id;
# see Trails_Controller#before_filter
function before_filter(&$action, &$args)
{
parent::before_filter($action, $args);
$this->institute_id = Request::option('cid');
$this->calendar_settings = Config::get()->getValue('CALENDAR_SETTINGS');
}
public function index_action()
{
// switch to the view the user has selected in his personal settings
$this->redirect('institute/calendar/'
. $this->calendar_settings['view']);
}
public function showday_action($timestamp = null)
{
$calendar = Calendar::getInstance(Calendar::RANGE_INST,
$this->institute_id);
PageLayout::setTitle(Context::getHeaderLine()
. ' - ' . _("Terminkalender - Tagesansicht"));
$_SESSION['calendar_sess_control_data']['view_prv'] = 'showday';
Navigation::activateItem("/course/calendar/day");
$atime = $timestamp ?: time();
$at = date('G', $atime);
if ($at >= $this->calendar_settings['start']
&& $at <= $this->calendar_settings['end'] || !$atime) {
$st = $this->calendar_settings['start'];
$et = $this->calendar_settings['end'];
} elseif ($at < $$this->calendar_settings['start']) {
$st = 0;
$et = $this->calendar_settings['start'] + 2;
} else {
$st = $this->calendar_settings['end'] - 2;
$et = 23;
}
$this->_calendar = $calendar;
$this->atime = $atime;
$this->cmd = 'showday';
$this->st = $st;
$this->et = $et;
}
/**
* @todo der include muss weg
*/
public function showweek_action($timestamp = null)
{
$calendar = Calendar::getInstance(Calendar::RANGE_INST,
$this->institute_id);
PageLayout::setTitle(Context::getHeaderLine()
. ' - ' . _("Terminkalender - Wochenansicht"));
$_SESSION['calendar_sess_control_data']['view_prv'] = 'showweek';
Navigation::activateItem("/course/calendar/week");
$atime = $timestamp ?: time();
$at = date('G', $atime);
if ($at >= $this->calendar_settings['start']
&& $at <= $this->calendar_settings['end'] || !$atime) {
$st = $this->calendar_settings['start'];
$et = $this->calendar_settings['end'];
} elseif ($at < $this->calendar_settings['start']) {
$st = 0;
$et = $this->calendar_settings['start'] + 2;
} else {
$st = $this->calendar_settings['end'] - 2;
$et = 23;
}
include_once 'lib/calendar/lib/DbCalendarWeek.class.php';
$this->_calendar = $calendar;
$this->atime = $atime;
$this->cmd = 'showweek';
$this->st = $st;
$this->et = $et;
}
public function showmonth_action($timestamp = null)
{
}
public function showyear_action($timestamp = null)
{
}
public function event_action($event_id = null)
{
}
public function seminar_events_action()
{
}
public function showexport_action()
{
}
public function export_action()
{
}
}
|