ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
ilCalendarPresentationGUI Class Reference
+ Collaboration diagram for ilCalendarPresentationGUI:

Public Member Functions

 __construct ()
 Constructor. More...
 
 executeCommand ()
 Execute command. More...
 
 getNextClass ()
 get next class More...
 
 readLastClass ()
 Read last class from history. More...
 
 setCmdClass ($a_class)
 
 show ()
 Show. More...
 
 initSeed ()
 init the seed date for presentations (month view, minicalendar) More...
 

Protected Member Functions

 forwardToClass ($a_class)
 forward to class More...
 
 loadHistory ()
 forward to last presentation class More...
 
 showSideBlocks ()
 show side blocks More...
 
 prepareOutput ()
 get tabs More...
 
 synchroniseExternalCalendars ()
 Sync external calendars. More...
 

Protected Attributes

 $ctrl
 
 $lng
 
 $tpl
 
 $tabs_gui
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ilCalendarPresentationGUI::__construct ( )

Constructor.

@access public

Parameters

Definition at line 52 of file class.ilCalendarPresentationGUI.php.

53 {
54 global $ilCtrl,$lng,$tpl,$ilTabs,$ilUser;
55
56 $this->ctrl = $ilCtrl;
57 $this->lng = $lng;
58 $this->lng->loadLanguageModule('dateplaner');
59
60 $this->tpl = $tpl;
61 $this->tabs_gui = $ilTabs;
62
63
64 include_once('./Services/Calendar/classes/class.ilCalendarCategories.php');
66
67 include_once './Services/Calendar/classes/class.ilCalendarUserSettings.php';
69 {
71 }
72 else
73 {
75 }
76 }
static _getInstance($a_usr_id=0)
get singleton instance
static _getInstance()
get instance for logged in user
global $ilCtrl
Definition: ilias.php:18
global $ilUser
Definition: imgupload.php:15

References $ilCtrl, $ilUser, $lng, $tpl, ilCalendarCategories\_getInstance(), ilCalendarUserSettings\_getInstance(), ilCalendarUserSettings\CAL_SELECTION_MEMBERSHIP, ilCalendarCategories\MODE_PERSONAL_DESKTOP_ITEMS, and ilCalendarCategories\MODE_PERSONAL_DESKTOP_MEMBERSHIP.

+ Here is the call graph for this function:

Member Function Documentation

◆ executeCommand()

ilCalendarPresentationGUI::executeCommand ( )

Execute command.

@access public

Parameters

Definition at line 86 of file class.ilCalendarPresentationGUI.php.

87 {
88 global $ilUser, $ilSetting,$tpl, $ilHelp;
89
90 include_once('./Services/Calendar/classes/class.ilCalendarSettings.php');
91 if(!ilCalendarSettings::_getInstance()->isEnabled())
92 {
93 ilUtil::sendFailure($this->lng->txt('permission_denied'),true);
94 ilUtil::redirect('ilias.php?baseClass=ilPersonalDesktopGUI');
95 }
96
97 $this->initSeed();
98 $this->prepareOutput();
99
100 $next_class = $this->getNextClass();
101 switch($next_class)
102 {
103 case 'ilcalendarinboxgui':
104 $this->tabs_gui->activateTab('cal_upcoming_events_header');
105 $this->forwardToClass('ilcalendarinboxgui');
106 break;
107
108 case 'ilconsultationhoursgui':
109 $this->tabs_gui->activateTab('app_consultation_hours');
110 $this->tabs_gui->clearTargets();
111
112 // No side blocks
113 $this->tabs_gui->setBackTarget(
114 $this->lng->txt('cal_back_to_cal'),
115 $this->ctrl->getLinkTargetByClass($this->readLastClass())
116 );
117
118 include_once './Services/Calendar/classes/ConsultationHours/class.ilConsultationHoursGUI.php';
119 $gui = new ilConsultationHoursGUI();
120 $this->ctrl->forwardCommand($gui);
121 return true;
122
123 case 'ilcalendarmonthgui':
124 $this->tabs_gui->activateTab('app_month');
125 $this->forwardToClass('ilcalendarmonthgui');
126 break;
127
128 case 'ilcalendarweekgui':
129 $this->tabs_gui->activateTab('app_week');
130 $this->forwardToClass('ilcalendarweekgui');
131 break;
132
133 case 'ilcalendardaygui':
134 $this->tabs_gui->activateTab('app_day');
135 $this->forwardToClass('ilcalendardaygui');
136 break;
137
138 case 'ilcalendarusersettingsgui':
139 $this->ctrl->setReturn($this,'');
140 $this->tabs_gui->activateTab('settings');
141 $this->setCmdClass('ilcalendarusersettingsgui');
142
143 include_once('./Services/Calendar/classes/class.ilCalendarUserSettingsGUI.php');
144 $user_settings = new ilCalendarUserSettingsGUI();
145 $this->ctrl->forwardCommand($user_settings);
146 // No side blocks
147 return true;
148
149 case 'ilcalendarappointmentgui':
150 $this->ctrl->setReturn($this,'');
151 $this->tabs_gui->activateTab($_SESSION['cal_last_tab']);
152
153 include_once('./Services/Calendar/classes/class.ilCalendarAppointmentGUI.php');
154 $app = new ilCalendarAppointmentGUI($this->seed, $this->seed,(int) $_GET['app_id']);
155 $this->ctrl->forwardCommand($app);
156 break;
157
158 case 'ilcalendarsubscriptiongui':
159 $this->ctrl->setReturn($this,'');
160 $this->tabs_gui->activateTab($_SESSION['cal_last_tab']);
161 include_once './Services/Calendar/classes/class.ilCalendarSubscriptionGUI.php';
162 $sub = new ilCalendarSubscriptionGUI((int) $_REQUEST['cal_id']);
163 $this->ctrl->forwardCommand($sub);
164 break;
165
166 case 'ilcalendarcategorygui':
167 $this->ctrl->setReturn($this,'');
168
169 include_once('Services/Calendar/classes/class.ilCalendarCategoryGUI.php');
170 $category = new ilCalendarCategoryGUI($ilUser->getId(),$this->seed);
171 if($this->ctrl->forwardCommand($category))
172 {
173 $this->tabs_gui->activateTab("cal_manage");
174
175 // no side blocks
176 return;
177 }
178 else
179 {
180 $this->tabs_gui->activateTab($_SESSION['cal_last_tab']);
181 break;
182 }
183
184 default:
185 $cmd = $this->ctrl->getCmd("show");
186
187 $this->$cmd();
188 break;
189 }
190
191 $this->showSideBlocks();
192
194
195 return true;
196 }
$_GET["client_id"]
$_SESSION["AccountId"]
Administrate calendar appointments.
Administration, Side-Block presentation of calendar categories.
initSeed()
init the seed date for presentations (month view, minicalendar)
synchroniseExternalCalendars()
Sync external calendars.
static _getInstance()
get singleton instance
Show calendar subscription info.
Consultation hours editor.
static redirect($a_script)
http redirect to other script
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
global $ilSetting
Definition: privfeed.php:40
$cmd
Definition: sahs_server.php:35
if($_REQUEST['ilias_path']) define('ILIAS_HTTP_PATH' $_REQUEST['ilias_path']
Definition: index.php:7

References $_GET, $_REQUEST, $_SESSION, $cmd, $ilSetting, $ilUser, $tpl, ilCalendarSettings\_getInstance(), forwardToClass(), getNextClass(), initSeed(), prepareOutput(), ilUtil\redirect(), ilUtil\sendFailure(), setCmdClass(), showSideBlocks(), and synchroniseExternalCalendars().

+ Here is the call graph for this function:

◆ forwardToClass()

ilCalendarPresentationGUI::forwardToClass (   $a_class)
protected

forward to class

@access protected

Definition at line 246 of file class.ilCalendarPresentationGUI.php.

247 {
248 global $ilUser;
249
250 switch($a_class)
251 {
252 case 'ilcalendarmonthgui':
253 $ilUser->writePref('cal_last_class',$a_class);
254 $_SESSION['cal_last_tab'] = 'app_month';
255 $this->setCmdClass('ilcalendarmonthgui');
256 include_once('./Services/Calendar/classes/class.ilCalendarMonthGUI.php');
257 $month_gui = new ilCalendarMonthGUI($this->seed);
258 $this->ctrl->forwardCommand($month_gui);
259 break;
260
261 case 'ilcalendarweekgui':
262 $ilUser->writePref('cal_last_class',$a_class);
263 $_SESSION['cal_last_tab'] = 'app_week';
264 $this->setCmdClass('ilcalendarweekgui');
265 include_once('./Services/Calendar/classes/class.ilCalendarWeekGUI.php');
266 $week_gui = new ilCalendarWeekGUI($this->seed);
267 $this->ctrl->forwardCommand($week_gui);
268 break;
269
270 case 'ilcalendardaygui':
271 $ilUser->writePref('cal_last_class',$a_class);
272 $_SESSION['cal_last_tab'] = 'app_day';
273 $this->setCmdClass('ilcalendardaygui');
274 include_once('./Services/Calendar/classes/class.ilCalendarDayGUI.php');
275 $day_gui = new ilCalendarDayGUI($this->seed);
276 $this->ctrl->forwardCommand($day_gui);
277 break;
278
279 case 'ilcalendarinboxgui':
280 $ilUser->writePref('cal_last_class',$a_class);
281 $_SESSION['cal_last_tab'] = 'cal_upcoming_events_header';
282 $this->setCmdClass('ilcalendarinboxgui');
283 include_once('./Services/Calendar/classes/class.ilCalendarInboxGUI.php');
284 $inbox_gui = new ilCalendarinboxGUI($this->seed);
285 $this->ctrl->forwardCommand($inbox_gui);
286 break;
287
288 }
289 }
Presentation day view.

References $_SESSION, $ilUser, and setCmdClass().

Referenced by executeCommand(), and loadHistory().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getNextClass()

ilCalendarPresentationGUI::getNextClass ( )

get next class

@access public

Definition at line 203 of file class.ilCalendarPresentationGUI.php.

204 {
205 global $ilUser;
206
207 if(strlen($next_class = $this->ctrl->getNextClass()))
208 {
209 return $next_class;
210 }
211 if($this->ctrl->getCmdClass() == strtolower(get_class($this)) or $this->ctrl->getCmdClass() == '')
212 {
213 return $this->readLastClass();
214 }
215 }
readLastClass()
Read last class from history.

References $ilUser, and readLastClass().

Referenced by executeCommand().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ initSeed()

ilCalendarPresentationGUI::initSeed ( )

init the seed date for presentations (month view, minicalendar)

@access public

Definition at line 378 of file class.ilCalendarPresentationGUI.php.

379 {
380 include_once('Services/Calendar/classes/class.ilDate.php');
381 $this->seed = $_REQUEST['seed'] ? new ilDate($_REQUEST['seed'],IL_CAL_DATE) : new ilDate(date('Y-m-d',time()),IL_CAL_DATE);
382 $_GET['seed'] = $this->seed->get(IL_CAL_DATE,'');
383 $this->ctrl->saveParameter($this,array('seed'));
384 }
const IL_CAL_DATE
Class for single dates.

References $_GET, $_REQUEST, and IL_CAL_DATE.

Referenced by executeCommand().

+ Here is the caller graph for this function:

◆ loadHistory()

ilCalendarPresentationGUI::loadHistory ( )
protected

forward to last presentation class

@access protected

Parameters

return

Definition at line 298 of file class.ilCalendarPresentationGUI.php.

299 {
300 global $ilUser;
301
302 $this->ctrl->setCmd('');
303 $history = $ilUser->getPref('cal_last_class') ? $ilUser->getPref('cal_last_class') : 'ilcalendarmonthgui';
304 $this->forwardToClass($history);
305 }

References $ilUser, and forwardToClass().

+ Here is the call graph for this function:

◆ prepareOutput()

ilCalendarPresentationGUI::prepareOutput ( )
protected

get tabs

@access public

Definition at line 351 of file class.ilCalendarPresentationGUI.php.

352 {
353 global $rbacsystem, $ilHelp;
354
355 $ilHelp->setScreenIdComponent("cal");
356
357 $this->tabs_gui->addTarget('cal_upcoming_events_header',$this->ctrl->getLinkTargetByClass('ilCalendarInboxGUI',''));
358
359 if(
360 $rbacsystem->checkAccess('add_consultation_hours', ilCalendarSettings::_getInstance()->getCalendarSettingsId()) and
361 ilCalendarSettings::_getInstance()->areConsultationHoursEnabled()
362 )
363 {
364 $this->tabs_gui->addTarget('app_consultation_hours',$this->ctrl->getLinkTargetByClass('ilConsultationHoursGUI',''));
365 }
366 $this->tabs_gui->addTarget('app_day',$this->ctrl->getLinkTargetByClass('ilCalendarDayGUI',''));
367 $this->tabs_gui->addTarget('app_week',$this->ctrl->getLinkTargetByClass('ilCalendarWeekGUI',''));
368 $this->tabs_gui->addTarget('app_month',$this->ctrl->getLinkTargetByClass('ilCalendarMonthGUI',''));
369 $this->tabs_gui->addTarget('cal_manage',$this->ctrl->getLinkTargetByClass('ilCalendarCategoryGUI','manage'));
370 $this->tabs_gui->addTarget('settings',$this->ctrl->getLinkTargetByClass('ilCalendarUserSettingsGUI',''));
371 }

References ilCalendarSettings\_getInstance().

Referenced by executeCommand().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ readLastClass()

ilCalendarPresentationGUI::readLastClass ( )

Read last class from history.

Returns

Definition at line 221 of file class.ilCalendarPresentationGUI.php.

222 {
223 global $ilUser;
224
225 return $ilUser->getPref('cal_last_class') ? $ilUser->getPref('cal_last_class') : 'ilcalendarinboxgui';
226
227 }

References $ilUser.

Referenced by getNextClass().

+ Here is the caller graph for this function:

◆ setCmdClass()

ilCalendarPresentationGUI::setCmdClass (   $a_class)

Definition at line 229 of file class.ilCalendarPresentationGUI.php.

230 {
231 // If cmd class == 'ilcalendarpresentationgui' the cmd class is set to the the new forwarded class
232 // otherwise e.g ilcalendarmonthgui tries to forward (back) to ilcalendargui.
233
234 if($this->ctrl->getCmdClass() == strtolower(get_class($this)))
235 {
236 $this->ctrl->setCmdClass(strtolower($a_class));
237 }
238 return true;
239 }

Referenced by executeCommand(), and forwardToClass().

+ Here is the caller graph for this function:

◆ show()

ilCalendarPresentationGUI::show ( )

Show.

@access public

Parameters

Definition at line 340 of file class.ilCalendarPresentationGUI.php.

341 {
342 $this->tpl->addCss(ilUtil::getStyleSheetLocation('filesystem','delos.css','Services/Calendar'));
343 }
static getStyleSheetLocation($mode="output", $a_css_name="", $a_css_location="")
get full style sheet file name (path inclusive) of current user

References ilUtil\getStyleSheetLocation().

+ Here is the call graph for this function:

◆ showSideBlocks()

ilCalendarPresentationGUI::showSideBlocks ( )
protected

show side blocks

@access protected

Parameters

return

Definition at line 314 of file class.ilCalendarPresentationGUI.php.

315 {
316 global $ilUser, $ilCtrl;
317
318 $tpl = new ilTemplate('tpl.cal_side_block.html',true,true,'Services/Calendar');
319
320 include_once('./Services/Calendar/classes/class.ilMiniCalendarGUI.php');
321 $mini = new ilMiniCalendarGUI($this->seed, $this);
322// $mini->setPresentationMode(ilMiniCalendarGUI::PRESENTATION_CALENDAR);
323 $tpl->setVariable('MINICAL',$mini->getHTML());
324
325 include_once('./Services/Calendar/classes/class.ilCalendarCategoryGUI.php');
326 $cat = new ilCalendarCategoryGUI($ilUser->getId(),$this->seed);
327 $tpl->setVariable('CATEGORIES', $ilCtrl->getHTML($cat));
328
329 $this->tpl->setLeftContent($tpl->get());
330 }
special template class to simplify handling of ITX/PEAR

References $ilCtrl, $ilUser, and $tpl.

Referenced by executeCommand().

+ Here is the caller graph for this function:

◆ synchroniseExternalCalendars()

ilCalendarPresentationGUI::synchroniseExternalCalendars ( )
protected

Sync external calendars.

Definition at line 389 of file class.ilCalendarPresentationGUI.php.

390 {
391 global $ilUser;
392
393
394 if(!ilCalendarSettings::_getInstance()->isWebCalSyncEnabled())
395 {
396 return false;
397 }
398 // @todo make this thread safe
399
400 $limit = new ilDateTime(time(),IL_CAL_UNIX);
401 $limit->increment(IL_CAL_HOUR, -1 * ilCalendarSettings::_getInstance()->getWebCalSyncHours());
402
404 foreach($cats->getCategoriesInfo() as $cat_id => $info)
405 {
406 if($info['remote'])
407 {
408 // Check for execution
409 $category = new ilCalendarCategory($cat_id);
410
411 if(ilDateTime::_before($category->getRemoteSyncLastExecution(), $limit))
412 {
413 // update in any case to avoid multiple updates of invalid calendar sources.
414 $category->setRemoteSyncLastExecution(new ilDateTime(time(),IL_CAL_UNIX));
415 $category->update();
416
417 include_once './Services/Calendar/classes/class.ilCalendarRemoteReader.php';
418 $remote = new ilCalendarRemoteReader($category->getRemoteUrl());
419 $remote->setUser($category->getRemoteUser());
420 $remote->setPass($category->getRemotePass());
421 $remote->read();
422 $remote->import($category);
423 break;
424 }
425 }
426 }
427 }
const IL_CAL_UNIX
const IL_CAL_HOUR
Stores calendar categories.
Reader for remote ical calendars.
@classDescription Date and time handling
static _before(ilDateTime $start, ilDateTime $end, $a_compare_field='', $a_tz='')
compare two dates and check start is before end This method does not consider tz offsets.
$info
Definition: example_052.php:80

References $ilUser, $info, ilDateTime\_before(), ilCalendarCategories\_getInstance(), ilCalendarSettings\_getInstance(), IL_CAL_HOUR, and IL_CAL_UNIX.

Referenced by executeCommand().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Field Documentation

◆ $ctrl

ilCalendarPresentationGUI::$ctrl
protected

Definition at line 40 of file class.ilCalendarPresentationGUI.php.

◆ $lng

ilCalendarPresentationGUI::$lng
protected

Definition at line 41 of file class.ilCalendarPresentationGUI.php.

Referenced by __construct().

◆ $tabs_gui

ilCalendarPresentationGUI::$tabs_gui
protected

Definition at line 43 of file class.ilCalendarPresentationGUI.php.

◆ $tpl

ilCalendarPresentationGUI::$tpl
protected

Definition at line 42 of file class.ilCalendarPresentationGUI.php.

Referenced by __construct(), executeCommand(), and showSideBlocks().


The documentation for this class was generated from the following file: