ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
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.

public

Parameters

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

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

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');
65  $cats = ilCalendarCategories::_getInstance($ilUser->getId());
66 
67  include_once './Services/Calendar/classes/class.ilCalendarUserSettings.php';
69  {
71  }
72  else
73  {
75  }
76  }
global $ilCtrl
Definition: ilias.php:18
static _getInstance()
get instance for logged in user
$ilUser
Definition: imgupload.php:18
static _getInstance($a_usr_id=0)
get singleton instance
+ Here is the call graph for this function:

Member Function Documentation

◆ executeCommand()

ilCalendarPresentationGUI::executeCommand ( )

Execute command.

public

Parameters

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

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

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  }
synchroniseExternalCalendars()
Sync external calendars.
Consultation hours editor.
static _getInstance()
get singleton instance
$_SESSION["AccountId"]
readLastClass()
Read last class from history.
$_GET["client_id"]
initSeed()
init the seed date for presentations (month view, minicalendar)
$cmd
Definition: sahs_server.php:35
forwardToClass($a_class)
forward to class
Show calendar subscription info.
$ilUser
Definition: imgupload.php:18
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
Administrate calendar appointments.
global $ilSetting
Definition: privfeed.php:17
static redirect($a_script)
http redirect to other script
Administration, Side-Block presentation of calendar categories.
+ Here is the call graph for this function:

◆ forwardToClass()

ilCalendarPresentationGUI::forwardToClass (   $a_class)
protected

forward to class

protected

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

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

Referenced by executeCommand(), and loadHistory().

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  }
$_SESSION["AccountId"]
$ilUser
Definition: imgupload.php:18
Presentation day view.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getNextClass()

ilCalendarPresentationGUI::getNextClass ( )

get next class

public

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

References $ilUser, and readLastClass().

Referenced by executeCommand().

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.
$ilUser
Definition: imgupload.php:18
+ 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)

public

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

References $_GET, array, date, IL_CAL_DATE, and time.

Referenced by executeCommand().

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  }
$_GET["client_id"]
Class for single dates.
date( 'd-M-Y', $objPHPExcel->getProperties() ->getCreated())
Create styles array
The data for the language used.
const IL_CAL_DATE
Add data(end) time
Method that wraps PHPs time in order to allow simulations with the workflow.
+ Here is the caller graph for this function:

◆ loadHistory()

ilCalendarPresentationGUI::loadHistory ( )
protected

forward to last presentation class

protected

Parameters

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

References $ilUser, and forwardToClass().

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  }
forwardToClass($a_class)
forward to class
$ilUser
Definition: imgupload.php:18
+ Here is the call graph for this function:

◆ prepareOutput()

ilCalendarPresentationGUI::prepareOutput ( )
protected

get tabs

public

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

References ilCalendarSettings\_getInstance().

Referenced by executeCommand().

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  }
static _getInstance()
get singleton instance
+ 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.

References $ilUser.

Referenced by executeCommand(), and getNextClass().

222  {
223  global $ilUser;
224 
225  return $ilUser->getPref('cal_last_class') ? $ilUser->getPref('cal_last_class') : 'ilcalendarinboxgui';
226 
227  }
$ilUser
Definition: imgupload.php:18
+ Here is the caller graph for this function:

◆ setCmdClass()

ilCalendarPresentationGUI::setCmdClass (   $a_class)

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

Referenced by executeCommand(), and forwardToClass().

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  }
+ Here is the caller graph for this function:

◆ show()

ilCalendarPresentationGUI::show ( )

Show.

public

Parameters

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

References ilUtil\getStyleSheetLocation().

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
+ Here is the call graph for this function:

◆ showSideBlocks()

ilCalendarPresentationGUI::showSideBlocks ( )
protected

show side blocks

protected

Parameters

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

References $ilCtrl, $ilUser, and $tpl.

Referenced by executeCommand().

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  }
global $ilCtrl
Definition: ilias.php:18
special template class to simplify handling of ITX/PEAR
$ilUser
Definition: imgupload.php:18
Administration, Side-Block presentation of calendar categories.
+ Here is the caller graph for this function:

◆ synchroniseExternalCalendars()

ilCalendarPresentationGUI::synchroniseExternalCalendars ( )
protected

Sync external calendars.

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

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

Referenced by executeCommand().

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 
403  $cats = ilCalendarCategories::_getInstance($ilUser->getId());
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  }
static _getInstance()
get singleton instance
const IL_CAL_HOUR
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.
Stores calendar categories.
Reader for remote ical calendars.
const IL_CAL_UNIX
$info
Definition: example_052.php:80
Date and time handling
$ilUser
Definition: imgupload.php:18
static _getInstance($a_usr_id=0)
get singleton instance
Add data(end) time
Method that wraps PHPs time in order to allow simulations with the workflow.
+ 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: