ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
ilCalendarPresentationGUI Class Reference
+ Collaboration diagram for ilCalendarPresentationGUI:

Public Member Functions

 __construct ($a_ref_id=0)
 Constructor. More...
 
 getRepositoryMode ()
 Get RepositoryMode. More...
 
 executeCommand ()
 Execute command. More...
 
 showViewSelection ($a_active="cal_list")
 Show view selection. 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...
 
 showToolbarAndSidebar ()
 

Protected Member Functions

 initAndRedirectToConsultationHours ()
 Init and redirect to consultation hours. More...
 
 forwardToClass ($a_class)
 forward to class More...
 
 loadHistory ()
 forward to last presentation class More...
 
 showSideBlocks ()
 show side blocks More...
 
 addCategoryTabs ()
 Add tabs for ilCategoryGUI context This cannot be done there since many views (Day Week Agenda) are initiated from ths view. More...
 
 addStandardTabs ()
 add standard tabs More...
 
 prepareOutput ()
 
 synchroniseExternalCalendars ()
 Sync external calendars. More...
 

Protected Attributes

 $ctrl
 
 $lng
 
 $tpl
 
 $tabs_gui
 
 $user
 
 $help
 
 $rbacsystem
 
 $ui
 
 $toolbar
 
 $repository_mode = false
 
 $seed
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ilCalendarPresentationGUI::__construct (   $a_ref_id = 0)

Constructor.

public

Parameters

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

References $_GET, $DIC, ilCalendarUserSettings\_getInstance(), ilCalendarCategories\_getInstance(), ilCalendarVisibility\_getInstanceByUserId(), ilCalendarUserSettings\CAL_SELECTION_MEMBERSHIP, ilCalendarActions\getInstance(), ilCalendarCategories\MODE_PERSONAL_DESKTOP_ITEMS, ilCalendarCategories\MODE_PERSONAL_DESKTOP_MEMBERSHIP, ilCalendarCategories\MODE_REPOSITORY, ilCalendarCategories\MODE_SINGLE_CALENDAR, and user().

81  {
82  global $DIC;
83 
84  $this->ctrl = $DIC->ctrl();
85  $this->lng = $DIC->language();
86  $this->lng->loadLanguageModule('dateplaner');
87 
88  $this->tpl = $DIC["tpl"];
89  $this->tabs_gui = $DIC->tabs();
90  $this->user = $DIC->user();
91  $this->rbacsystem = $DIC->rbac()->system();
92  $this->help = $DIC["ilHelp"];
93  $this->ui = $DIC->ui();
94  $this->toolbar = $DIC->toolbar();
95  $this->ref_id = $a_ref_id;
96  $this->category_id = $_GET["category_id"];
97  $this->ctrl->setParameter($this, 'category_id', $_REQUEST['category_id']);
98 
99  // show back to pd
100  $this->ctrl->saveParameter($this, 'backpd');
101 
102  include_once('./Services/Calendar/classes/class.ilCalendarCategories.php');
103  $cats = ilCalendarCategories::_getInstance($this->user->getId());
104 
105  include_once './Services/Calendar/classes/class.ilCalendarUserSettings.php';
106  if ($a_ref_id > 0) {
107  $this->repository_mode = true;
108  }
109  if ($this->category_id > 0) { // single calendar view
110  // ensure activation of this category
111  include_once("./Services/Calendar/classes/class.ilCalendarVisibility.php");
112  $vis = ilCalendarVisibility::_getInstanceByUserId($this->user->getId(), $a_ref_id);
113  $vis->forceVisibility($this->category_id);
114 
115  $cats->initialize(ilCalendarCategories::MODE_SINGLE_CALENDAR, 0, false, $this->category_id);
116  } else {
117  if ($a_ref_id > 0) {
118  $cats->initialize(ilCalendarCategories::MODE_REPOSITORY, (int) $a_ref_id, true);
119  } else {
122  } else {
124  }
125  }
126  }
127 
128  include_once("./Services/Calendar/classes/class.ilCalendarActions.php");
129  $this->actions = ilCalendarActions::getInstance();
130 
131  $this->cats = $cats;
132  }
global $DIC
Definition: saml.php:7
$_GET["client_id"]
static getInstance()
Get instance.
user()
Definition: user.php:4
static _getInstanceByUserId($a_user_id, $a_ref_id=0)
get instance by user id
static _getInstance()
get instance for logged in user
static _getInstance($a_usr_id=0)
get singleton instance
+ Here is the call graph for this function:

Member Function Documentation

◆ addCategoryTabs()

ilCalendarPresentationGUI::addCategoryTabs ( )
protected

Add tabs for ilCategoryGUI context This cannot be done there since many views (Day Week Agenda) are initiated from ths view.

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

References $ctrl, $DIC, ilObject\_lookupType(), and getRepositoryMode().

Referenced by prepareOutput().

568  {
569  global $DIC;
570 
571  $ctrl = $DIC->ctrl();
572 
573  $this->tabs_gui->clearTargets();
574  $ctrl->setParameterByClass(ilCalendarCategoryGUI::class, "category_id", $_REQUEST["category_id"]);
575  if ($this->getRepositoryMode()) {
576  $came_from_pd = $_REQUEST['backpd'];
577  if ($came_from_pd) {
578  $this->tabs_gui->setBack2Target(
579  $this->lng->txt('back_to_pd'),
580  $this->ctrl->getLinkTargetByClass(ilPersonalDesktopGUI::class, 'jumpToCalendar')
581  );
582  }
583  $label = $this->lng->txt('back_to_' . ilObject::_lookupType($this->ref_id, true));
584  $this->tabs_gui->setBackTarget(
585  $label,
586  $this->ctrl->getParentReturn($this)
587  );
588  } else {
589  // no object calendar => back is back to manage view
590  if (array_key_exists('backvm', $_REQUEST)) {
591  $this->tabs_gui->setBackTarget(
592  $this->lng->txt("back"),
593  $ctrl->getLinkTargetByClass(ilCalendarCategoryGUI::class, 'manage')
594  );
595  } else {
596  $ctrl->clearParameterByClass(ilCalendarPresentationGUI::class, 'category_id');
597  $this->tabs_gui->setBackTarget(
598  $this->lng->txt("back"),
599  $ctrl->getLinkTargetByClass('ilcalendarpresentationgui', '')
600  );
601  }
602  $ctrl->setParameterByClass(ilCalendarPresentationGUI::class, "category_id", $_REQUEST["category_id"]);
603  }
604 
605  $this->tabs_gui->addTab(
606  "cal_agenda",
607  $this->lng->txt("cal_agenda"),
608  $ctrl->getLinkTargetByClass(ilCalendarPresentationGUI::class, "")
609  );
610 
611  if ($this->actions->checkShareCal($this->category_id)) {
612  $this->tabs_gui->addTab(
613  "share",
614  $this->lng->txt("cal_share"),
615  $ctrl->getLinkTargetByClass(ilCalendarCategoryGUI::class, "shareSearch")
616  );
617  }
618  if ($this->actions->checkSettingsCal($this->category_id)) {
619  $this->tabs_gui->addTab(
620  "edit",
621  $this->lng->txt("settings"),
622  $ctrl->getLinkTargetByClass(ilCalendarCategoryGUI::class, "edit")
623  );
624  }
625 
626  $this->tabs_gui->activateTab('cal_agenda');
627  return true;
628  }
global $DIC
Definition: saml.php:7
static _lookupType($a_id, $a_reference=false)
lookup object type
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ addStandardTabs()

ilCalendarPresentationGUI::addStandardTabs ( )
protected

add standard tabs

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

References $DIC, $rbacsystem, ilCalendarSettings\_getInstance(), ilCalendarCategory\_getInstanceByObjId(), ilObject\_lookupObjId(), ilObject\_lookupType(), and getRepositoryMode().

Referenced by prepareOutput().

634  {
635  global $DIC;
636 
637  $access = $DIC->access();
638  $rbacsystem = $DIC->rbac()->system();
639 
640  $came_from_pd = $_REQUEST['backpd'];
641 
642  $this->tabs_gui->clearTargets();
643  if ($this->getRepositoryMode()) {
644  if ($came_from_pd) {
645  $this->tabs_gui->setBack2Target(
646  $this->lng->txt('back_to_pd'),
647  $this->ctrl->getLinkTargetByClass(ilPersonalDesktopGUI::class, 'jumpToCalendar')
648  );
649  }
650  $label = $this->lng->txt('back_to_' . ilObject::_lookupType($this->ref_id, true));
651  $this->tabs_gui->setBackTarget(
652  $label,
653  $this->ctrl->getParentReturn($this)
654  );
655 
656  $obj_id = ilObject::_lookupObjId($this->ref_id);
657  $category = ilCalendarCategory::_getInstanceByObjId($obj_id);
658  $category_id = $category->getCategoryID();
659 
660  // agenda tab
661  $this->tabs_gui->addTab(
662  'cal_agenda',
663  $this->lng->txt('cal_agenda'),
664  $this->ctrl->getLinkTarget($this, '')
665  );
666 
667  // settings tab
668  if ($access->checkAccess('edit_event', '', $this->ref_id)) {
669  $this->ctrl->setParameterByClass(ilCalendarCategoryGUI::class, 'category_id', $category_id);
670  $this->tabs_gui->addTab(
671  'cal_manage',
672  $this->lng->txt('settings'),
673  $this->ctrl->getLinkTargetByClass(ilCalendarCategoryGUI::class, 'edit')
674  );
675  $this->ctrl->clearParameterByClass(ilCalendarCategoryGUI::class, 'category_id');
676  }
677  return true;
678  } else {
679  $this->tabs_gui->addTab(
680  'cal_agenda',
681  $this->lng->txt("cal_agenda"),
682  $this->ctrl->getLinkTarget($this, '')
683  );
684 
685  if (
686  $rbacsystem->checkAccess(
687  'add_consultation_hours',
688  ilCalendarSettings::_getInstance()->getCalendarSettingsId()
689  ) &&
690  ilCalendarSettings::_getInstance()->areConsultationHoursEnabled()
691  ) {
692  $this->tabs_gui->addTab(
693  'app_consultation_hours',
694  $this->lng->txt('app_consultation_hours'),
695  $this->ctrl->getLinkTargetByClass(ilConsultationHoursGUI::class, '')
696  );
697  }
698  /*
699  $this->tabs_gui->addTab(
700  'cal_manage',
701  $this->lng->txt('cal_manage'),
702  $this->ctrl->getLinkTargetByClass(ilCalendarCategoryGUI::class,'manage')
703  );
704  $this->tabs_gui->addTab(
705  'settings',
706  $this->lng->txt('settings'),
707  $this->ctrl->getLinkTargetByClass(ilCalendarUserSettings::class,'')
708  );
709  */
710  $this->tabs_gui->addTarget('cal_manage', $this->ctrl->getLinkTargetByClass('ilCalendarCategoryGUI', 'manage'));
711  $this->tabs_gui->addTarget('settings', $this->ctrl->getLinkTargetByClass('ilCalendarUserSettingsGUI', ''));
712  }
713  }
static _getInstance()
get singleton instance
global $DIC
Definition: saml.php:7
static _lookupObjId($a_id)
static _getInstanceByObjId($a_obj_id)
get instance by obj_id
static _lookupType($a_id, $a_reference=false)
lookup object type
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ executeCommand()

ilCalendarPresentationGUI::executeCommand ( )

Execute command.

public

Parameters

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

References $_GET, $_SESSION, $html, $ilUser, $seed, $user, ilCalendarSettings\_getInstance(), forwardToClass(), getNextClass(), getRepositoryMode(), initAndRedirectToConsultationHours(), initSeed(), prepareOutput(), readLastClass(), ilUtil\redirect(), ilUtil\sendFailure(), setCmdClass(), showSideBlocks(), showToolbarAndSidebar(), showViewSelection(), and synchroniseExternalCalendars().

174  {
176 
177  $cmd = $this->ctrl->getCmd();
178  // now next class is not empty, which breaks old consultation hour implementation
179  $next_class = $this->getNextClass();
180 
181  include_once('./Services/Calendar/classes/class.ilCalendarSettings.php');
182  if (!ilCalendarSettings::_getInstance()->isEnabled()) {
183  ilUtil::sendFailure($this->lng->txt('permission_denied'), true);
184  ilUtil::redirect('ilias.php?baseClass=ilPersonalDesktopGUI');
185  }
186 
187  $this->initSeed();
188  $this->prepareOutput();
189 
190  $this->help->setScreenIdComponent("cal");
191 
192  switch ($cmd) {
193  case 'selectCHCalendarOfUser':
195  break;
196  }
197 
198  switch ($next_class) {
199  case 'ilcalendarinboxgui':
200  $this->tabs_gui->activateTab('cal_agenda');
201  $inbox_gui = $this->forwardToClass('ilcalendarinboxgui');
202  if ($this->showToolbarAndSidebar()) {
203  $this->showViewSelection("cal_list");
204  $this->showSideBlocks();
205  $inbox_gui->addToolbarActions();
206  }
207 
208  break;
209 
210  case 'ilconsultationhoursgui':
211  $this->tabs_gui->activateTab('app_consultation_hours');
212  $this->tabs_gui->clearTargets();
213 
214  // No side blocks
215  $this->tabs_gui->setBackTarget(
216  $this->lng->txt('cal_back_to_cal'),
217  $this->ctrl->getLinkTargetByClass($this->readLastClass())
218  );
219 
220  include_once './Services/Calendar/classes/ConsultationHours/class.ilConsultationHoursGUI.php';
221  $gui = new ilConsultationHoursGUI();
222  $this->ctrl->forwardCommand($gui);
223  if ($this->showToolbarAndSidebar()) {
224  $this->showSideBlocks();
225  }
226  return true;
227 
228  case 'ilcalendarmonthgui':
229  $this->tabs_gui->activateTab('cal_agenda');
230  $month_gui = $this->forwardToClass('ilcalendarmonthgui');
231 
232  if ($this->showToolbarAndSidebar()) {
233  $this->showViewSelection("app_month");
234  $this->showSideBlocks();
235  $month_gui->addToolbarActions();
236  }
237  break;
238 
239  case 'ilcalendarweekgui':
240  $this->tabs_gui->activateTab('cal_agenda');
241  $week_gui = $this->forwardToClass('ilcalendarweekgui');
242  if ($this->showToolbarAndSidebar()) {
243  $this->showViewSelection("app_week");
244  $this->showSideBlocks();
245  $week_gui->addToolbarActions();
246  }
247 
248  break;
249 
250  case 'ilcalendardaygui':
251  $this->tabs_gui->activateTab('cal_agenda');
252  $day_gui = $this->forwardToClass('ilcalendardaygui');
253  if ($this->showToolbarAndSidebar()) {
254  $this->showViewSelection("app_day");
255  $this->showSideBlocks();
256  $day_gui->addToolbarActions();
257  }
258  break;
259 
260  case 'ilcalendarusersettingsgui':
261  $this->ctrl->setReturn($this, '');
262  $this->tabs_gui->activateTab('settings');
263  $this->setCmdClass('ilcalendarusersettingsgui');
264 
265  include_once('./Services/Calendar/classes/class.ilCalendarUserSettingsGUI.php');
266  $user_settings = new ilCalendarUserSettingsGUI();
267  $this->ctrl->forwardCommand($user_settings);
268  // No side blocks
269  return true;
270 
271  case 'ilcalendarappointmentgui':
272  $this->ctrl->setReturn($this, '');
273  $this->tabs_gui->activateTab($_SESSION['cal_last_tab']);
274 
275  include_once('./Services/Calendar/classes/class.ilCalendarAppointmentGUI.php');
276  $app = new ilCalendarAppointmentGUI($this->seed, $this->seed, (int) $_GET['app_id']);
277  $this->ctrl->forwardCommand($app);
278  break;
279 
280  case 'ilcalendarsubscriptiongui':
281  $this->ctrl->setReturn($this, '');
282  //$this->tabs_gui->activateTab($_SESSION['cal_last_tab']);
283  $this->tabs_gui->activateTab("cal_agenda");
284  include_once './Services/Calendar/classes/class.ilCalendarSubscriptionGUI.php';
285  $sub = new ilCalendarSubscriptionGUI((int) $_REQUEST['category_id'], (int) $_GET["ref_id"]);
286  $this->ctrl->forwardCommand($sub);
287  if ($this->showToolbarAndSidebar()) {
288  $this->showSideBlocks();
289  }
290  break;
291 
292  case 'ilcalendarcategorygui':
293  $this->ctrl->setReturn($this, '');
294  $this->tabs_gui->activateTab("cal_manage");
295  include_once('Services/Calendar/classes/class.ilCalendarCategoryGUI.php');
296  $category = new ilCalendarCategoryGUI($ilUser->getId(), $this->seed, $this->ref_id);
297  if ($this->ctrl->forwardCommand($category)) {
298  //$this->tabs_gui->activateTab("cal_manage");
299 
300  // no side blocks
301  return;
302  } else {
303  if ($this->getRepositoryMode()) {
304  #$this->tabs_gui->setBackTarget($this->lng->txt("back"), $this->ctrl->getLinkTarget($this, ""));
305  }
306  //$this->tabs_gui->activateTab($_SESSION['cal_last_tab']);
307  $this->showSideBlocks();
308  break;
309  }
310 
311  // no break
312  case 'ilcalendarblockgui':
313  $side_cal = new ilCalendarBlockGUI();
314  $side_cal->setAvailableDetailLevels(2, 2);
315  $side_cal->setRepositoryMode($this->getRepositoryMode());
316  $side_cal->setForceMonthView(true);
317  $this->ctrl->forwardCommand($side_cal);
318  $this->showSideBlocks();
319  break;
320 
321  case 'ilpdcalendarblockgui':
322  $side_cal = new ilPDCalendarBlockGUI();
323  $side_cal->setAvailableDetailLevels(2, 2);
324  $side_cal->setRepositoryMode($this->getRepositoryMode());
325  $side_cal->setForceMonthView(true);
326  $this->ctrl->forwardCommand($side_cal);
327  $this->showSideBlocks();
328  break;
329 
330  case 'ilpublicuserprofilegui':
331  include_once("./Services/User/classes/class.ilPublicUserProfileGUI.php");
332  $user_profile = new ilPublicUserProfileGUI($_GET["user_id"]);
333  $html = $this->ctrl->forwardCommand($user_profile);
334  $this->tpl->setContent($html);
335  break;
336 
337  default:
338  $cmd = $this->ctrl->getCmd("show");
339  $this->$cmd();
340  $this->showSideBlocks();
341  break;
342  }
343 
344 
346 
347  return true;
348  }
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)
forwardToClass($a_class)
forward to class
Show calendar subscription info.
Calendar blocks, displayed on personal desktop.
GUI class for public user profile presentation.
showViewSelection($a_active="cal_list")
Show view selection.
initAndRedirectToConsultationHours()
Init and redirect to consultation hours.
$ilUser
Definition: imgupload.php:18
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
Administrate calendar appointments.
Calendar blocks, displayed in different contexts, e.g.
static redirect($a_script)
$html
Definition: example_001.php:87
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 448 of file class.ilCalendarPresentationGUI.php.

References $_GET, $_SESSION, $ilUser, $user, ilSession\get(), ilSession\set(), and setCmdClass().

Referenced by executeCommand(), and loadHistory().

449  {
451 
452  switch ($a_class) {
453  case 'ilcalendarmonthgui':
454  $ilUser->writePref('cal_last_class', $a_class);
455  $_SESSION['cal_last_tab'] = 'app_month';
456  $this->setCmdClass('ilcalendarmonthgui');
457  include_once('./Services/Calendar/classes/class.ilCalendarMonthGUI.php');
458  $month_gui = new ilCalendarMonthGUI($this->seed);
459  $this->ctrl->forwardCommand($month_gui);
460  return $month_gui;
461  break;
462 
463  case 'ilcalendarweekgui':
464  $ilUser->writePref('cal_last_class', $a_class);
465  $_SESSION['cal_last_tab'] = 'app_week';
466  $this->setCmdClass('ilcalendarweekgui');
467  include_once('./Services/Calendar/classes/class.ilCalendarWeekGUI.php');
468  $week_gui = new ilCalendarWeekGUI($this->seed);
469  $this->ctrl->forwardCommand($week_gui);
470  return $week_gui;
471  break;
472 
473  case 'ilcalendardaygui':
474  $ilUser->writePref('cal_last_class', $a_class);
475  $_SESSION['cal_last_tab'] = 'app_day';
476  $this->setCmdClass('ilcalendardaygui');
477  include_once('./Services/Calendar/classes/class.ilCalendarDayGUI.php');
478  $day_gui = new ilCalendarDayGUI($this->seed);
479  $this->ctrl->forwardCommand($day_gui);
480  return $day_gui;
481  break;
482 
483  case 'ilcalendarinboxgui':
484  #21479
485  if ($view_option = $_GET['cal_agenda_per']) {
486  ilSession::set("cal_list_view", $view_option);
487  } elseif ($view_option = ilSession::get('cal_list_view')) {
488  ilSession::set("cal_list_view", $view_option);
489  }
490  $ilUser->writePref('cal_last_class', $a_class);
491  $_SESSION['cal_last_tab'] = 'cal_upcoming_events_header';
492  $this->setCmdClass('ilcalendarinboxgui');
493  include_once('./Services/Calendar/classes/class.ilCalendarInboxGUI.php');
494  $inbox_gui = new ilCalendarinboxGUI($this->seed);
495  $this->ctrl->forwardCommand($inbox_gui);
496  return $inbox_gui;
497  break;
498  }
499  }
$_SESSION["AccountId"]
$_GET["client_id"]
static get($a_var)
Get a value.
static set($a_var, $a_val)
Set a value.
$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 411 of file class.ilCalendarPresentationGUI.php.

References readLastClass().

Referenced by executeCommand().

412  {
413  if (strlen($next_class = $this->ctrl->getNextClass())) {
414  return $next_class;
415  }
416  if ($this->ctrl->getCmdClass() == strtolower(get_class($this)) or $this->ctrl->getCmdClass() == '') {
417  return $this->readLastClass();
418  }
419  }
readLastClass()
Read last class from history.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getRepositoryMode()

ilCalendarPresentationGUI::getRepositoryMode ( )

Get RepositoryMode.

Returns
bool repository mode

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

References $repository_mode.

Referenced by addCategoryTabs(), addStandardTabs(), executeCommand(), initSeed(), and showSideBlocks().

+ Here is the caller graph for this function:

◆ initAndRedirectToConsultationHours()

ilCalendarPresentationGUI::initAndRedirectToConsultationHours ( )
protected

Init and redirect to consultation hours.

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

References $_GET, $info, ilCalendarVisibility\_getInstanceByUserId(), ilCalendarCategory\TYPE_CH, and user().

Referenced by executeCommand().

148  {
149  $visibility = ilCalendarVisibility::_getInstanceByUserId($this->user->getId(), $this->ref_id);
150  foreach ($this->cats->getCategoriesInfo() as $info) {
151  if (
152  $info["type"] == ilCalendarCategory::TYPE_CH &&
153  $info["obj_id"] == $_GET["ch_user_id"]
154  ) {
155  $v = $visibility->getVisible();
156  if (!in_array($info["cat_id"], $v)) {
157  $v[] = $info["cat_id"];
158  }
159  $visibility->showSelected($v);
160  $visibility->save();
161  $this->ctrl->redirect($this, "");
162  }
163  }
164  }
$_GET["client_id"]
user()
Definition: user.php:4
static _getInstanceByUserId($a_user_id, $a_ref_id=0)
get instance by user id
$info
Definition: index.php:5
+ 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 800 of file class.ilCalendarPresentationGUI.php.

References $_GET, ilSession\get(), getRepositoryMode(), IL_CAL_DATE, IL_CAL_UNIX, and ilSession\set().

Referenced by executeCommand().

801  {
802  // default to today
803  $now = new \ilDate(time(), IL_CAL_UNIX);
804  $this->seed = new \ilDate($now->get(IL_CAL_DATE), IL_CAL_DATE);
805  if (array_key_exists('seed', $_REQUEST)) {
806  $this->seed = new ilDate($_GET['seed'], IL_CAL_DATE);
807  } elseif (!$this->getRepositoryMode()) {
808  $session_seed = ilSession::get('cal_seed');
809  if ($session_seed) {
810  $this->seed = new ilDate($session_seed, IL_CAL_DATE);
811  }
812  }
813  $this->ctrl->setParameter($this, 'seed', $this->seed->get(IL_CAL_DATE));
814  ilSession::set('cal_seed', $this->seed->get(IL_CAL_DATE));
815  }
$_GET["client_id"]
static get($a_var)
Get a value.
static set($a_var, $a_val)
Set a value.
const IL_CAL_UNIX
Class for single dates.
const IL_CAL_DATE
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ loadHistory()

ilCalendarPresentationGUI::loadHistory ( )
protected

forward to last presentation class

protected

Parameters

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

References $ilUser, $user, and forwardToClass().

509  {
511 
512  $this->ctrl->setCmd('');
513  $history = $ilUser->getPref('cal_last_class') ? $ilUser->getPref('cal_last_class') : 'ilcalendarmonthgui';
514  $this->forwardToClass($history);
515  }
forwardToClass($a_class)
forward to class
$ilUser
Definition: imgupload.php:18
+ Here is the call graph for this function:

◆ prepareOutput()

ilCalendarPresentationGUI::prepareOutput ( )
protected

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

References $ctrl, $DIC, $header, $lng, $tabs, $tabs_gui, $tpl, ilObjUser\_lookupFullname(), addCategoryTabs(), addStandardTabs(), ilAdvancedSelectionListGUI\DOWN_ARROW_DARK, ilUtil\getImagePath(), ilCalendarCategory\TYPE_BOOK, ilCalendarCategory\TYPE_CH, ilCalendarCategory\TYPE_GLOBAL, ilCalendarCategory\TYPE_OBJ, and ilCalendarCategory\TYPE_USR.

Referenced by executeCommand().

720  {
721  global $DIC;
722 
723  $tpl = $DIC->ui()->mainTemplate();
724 
725  if ($this->category_id) {
726  $this->addCategoryTabs();
727  } else {
728  $this->addStandardTabs();
729  }
730 
731  $tpl->setTitleIcon(ilUtil::getImagePath("icon_cals.svg"));
732 
733  // if we are in single calendar view
734  if ($this->category_id > 0) {
735  global $DIC;
736 
738  $lng = $this->lng;
739  $ctrl = $this->ctrl;
740  $tpl = $DIC["tpl"];
741 
742  $category = new ilCalendarCategory($this->category_id);
743 
744  // Set header
745  $header = "";
746  switch ($category->getType()) {
748  $header = $this->lng->txt('cal_type_personal') . ": " . $category->getTitle();
749  break;
750 
752  $header = $this->lng->txt('cal_type_system') . ": " . $category->getTitle();
753  break;
754 
756  $header = $this->lng->txt('cal_type_' . $category->getObjType()) . ": " . $category->getTitle();
757  break;
758 
760  $header = str_replace("%1", ilObjUser::_lookupFullname($category->getObjId()), $lng->txt("cal_consultation_hours_for_user"));
761  break;
762 
764  $header = $category->getTitle();
765  break;
766  }
767  $tpl->setTitleIcon(ilUtil::getImagePath("icon_cals.svg"));
768  $tpl->setTitle($header);
769 
770  $this->action_menu = new ilAdvancedSelectionListGUI();
771  $this->action_menu->setAsynch(false);
772  $this->action_menu->setAsynchUrl('');
773  $this->action_menu->setListTitle($lng->txt('actions'));
774  $this->action_menu->setId('act_cal');
775  $this->action_menu->setSelectionHeaderClass('small');
776  $this->action_menu->setItemLinkClass('xsmall');
777  $this->action_menu->setLinksMode('il_ContainerItemCommand2');
778  $this->action_menu->setHeaderIcon(ilAdvancedSelectionListGUI::DOWN_ARROW_DARK);
779  $this->action_menu->setUseImages(false);
780 
781  // iCal-Url
782  $ctrl->setParameterByClass("ilcalendarsubscriptiongui", "category_id", $this->category_id);
783  $this->action_menu->addItem($lng->txt("cal_ical_url"), "", $ctrl->getLinkTargetByClass("ilcalendarsubscriptiongui", ""));
784 
785  // delete action
786  if ($this->actions->checkDeleteCal($this->category_id)) {
787  $ctrl->setParameterByClass("ilcalendarcategorygui", "category_id", $this->category_id);
788  $this->action_menu->addItem($lng->txt("cal_delete_cal"), "", $ctrl->getLinkTargetByClass("ilcalendarcategorygui", "confirmDelete"));
789  }
790 
791  $tpl->setHeaderActionMenu($this->action_menu->getHTML());
792  }
793  }
global $DIC
Definition: saml.php:7
static _lookupFullname($a_user_id)
Lookup Full Name.
Stores calendar categories.
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
if(!empty($this->data['faventry'])) $tabs
Definition: disco.tpl.php:124
User interface class for advanced drop-down selection lists.
addCategoryTabs()
Add tabs for ilCategoryGUI context This cannot be done there since many views (Day Week Agenda) are i...
+ 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 425 of file class.ilCalendarPresentationGUI.php.

References $ilUser, and $user.

Referenced by executeCommand(), and getNextClass().

426  {
428 
429  return $ilUser->getPref('cal_last_class') ? $ilUser->getPref('cal_last_class') : 'ilcalendarinboxgui';
430  }
$ilUser
Definition: imgupload.php:18
+ Here is the caller graph for this function:

◆ setCmdClass()

ilCalendarPresentationGUI::setCmdClass (   $a_class)

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

Referenced by executeCommand(), and forwardToClass().

433  {
434  // If cmd class == 'ilcalendarpresentationgui' the cmd class is set to the the new forwarded class
435  // otherwise e.g ilcalendarmonthgui tries to forward (back) to ilcalendargui.
436 
437  if ($this->ctrl->getCmdClass() == strtolower(get_class($this))) {
438  $this->ctrl->setCmdClass(strtolower($a_class));
439  }
440  return true;
441  }
+ Here is the caller graph for this function:

◆ show()

ilCalendarPresentationGUI::show ( )

Show.

public

Parameters

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

References ilUtil\getStyleSheetLocation().

559  {
560  $this->tpl->addCss(ilUtil::getStyleSheetLocation('filesystem', 'delos.css', 'Services/Calendar'));
561  }
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 524 of file class.ilCalendarPresentationGUI.php.

References $ctrl, $ilCtrl, $ilUser, $seed, $tpl, $user, and getRepositoryMode().

Referenced by executeCommand().

525  {
528 
529  $tpl = new ilTemplate('tpl.cal_side_block.html', true, true, 'Services/Calendar');
530  if ($this->getRepositoryMode()) {
531  include_once("./Services/Calendar/classes/class.ilCalendarBlockGUI.php");
532  $side_cal = new ilCalendarBlockGUI();
533  } else {
534  include_once("./Services/Calendar/classes/class.ilPDCalendarBlockGUI.php");
535  $side_cal = new ilPDCalendarBlockGUI();
536  }
537  $side_cal->setAvailableDetailLevels(2, 2);
538  $side_cal->setParentGUI("ilCalendarPresentationGUI");
539  $side_cal->setForceMonthView(true);
540  $side_cal->setRepositoryMode($this->getRepositoryMode());
541  $tpl->setVariable('MINICAL', $ilCtrl->getHTML($side_cal));
542 
543  include_once('./Services/Calendar/classes/class.ilCalendarCategoryGUI.php');
544  $cat = new ilCalendarCategoryGUI($ilUser->getId(), $this->seed, $this->ref_id);
545  $tpl->setVariable('CATEGORIES', $ilCtrl->getHTML($cat));
546 
547  $this->tpl->setRightContent($tpl->get());
548  }
global $ilCtrl
Definition: ilias.php:18
Calendar blocks, displayed on personal desktop.
special template class to simplify handling of ITX/PEAR
$ilUser
Definition: imgupload.php:18
Calendar blocks, displayed in different contexts, e.g.
Administration, Side-Block presentation of calendar categories.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ showToolbarAndSidebar()

ilCalendarPresentationGUI::showToolbarAndSidebar ( )

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

Referenced by executeCommand().

857  {
858  #21783
859  if ($this->ctrl->getCmdClass() == "ilcalendarappointmentgui" || $this->ctrl->getCmdClass() == 'ilconsultationhoursgui') {
860  return false;
861  }
862  return true;
863  }
+ Here is the caller graph for this function:

◆ showViewSelection()

ilCalendarPresentationGUI::showViewSelection (   $a_active = "cal_list")

Show view selection.

Parameters
string$a_active

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

References $ctrl, $f, $lng, $toolbar, $ui, and IL_CAL_DATE.

Referenced by executeCommand().

356  {
357  $ui = $this->ui;
358  $ctrl = $this->ctrl;
359  $lng = $this->lng;
361 
362  $f = $ui->factory();
363 
364  $actions = array(
365  $lng->txt("app_day") => $ctrl->getLinkTargetByClass('ilCalendarDayGUI', ''),
366  $lng->txt("app_week") => $ctrl->getLinkTargetByClass('ilCalendarWeekGUI', ''),
367  $lng->txt("app_month") => $ctrl->getLinkTargetByClass('ilCalendarMonthGUI', ''),
368  $lng->txt("cal_list") => $ctrl->getLinkTargetByClass('ilCalendarInboxGUI', '')
369  );
370 
371  $aria_label = $lng->txt("cal_change_calendar_view");
372  $view_control = $f->viewControl()->mode($actions, $aria_label)->withActive($lng->txt($a_active));
373 
374  $toolbar->addComponent($view_control);
375 
376  $ctrl->setParameterByClass("ilcalendarappointmentgui", "seed", $this->seed->get(IL_CAL_DATE, ''));
377  $ctrl->setParameterByClass("ilcalendarappointmentgui", "app_id", "");
378  $ctrl->setParameterByClass("ilcalendarappointmentgui", "dt", "");
379 
380  $extra_button_added = false;
381  // add appointment
382  if ($this->category_id == 0 || $this->actions->checkAddEvent($this->category_id)) {
383  $toolbar->addSeparator();
384  $extra_button_added = true;
385  $add_button = $f->button()->standard(
386  $lng->txt("cal_add_appointment"),
387  $ctrl->getLinkTargetByClass("ilcalendarappointmentgui", "add")
388  );
389  $toolbar->addComponent($add_button);
390  }
391 
392  // import appointments
393  if ($this->category_id > 0 && $this->actions->checkAddEvent($this->category_id)) {
394  if (!$extra_button_added) {
395  $toolbar->addSeparator();
396  }
397  $add_button = $f->button()->standard(
398  $lng->txt("cal_import_appointments"),
399  $ctrl->getLinkTargetByClass("ilcalendarcategorygui", "importAppointments")
400  );
401  $toolbar->addComponent($add_button);
402  }
403  }
const IL_CAL_DATE
+ Here is the caller graph for this function:

◆ synchroniseExternalCalendars()

ilCalendarPresentationGUI::synchroniseExternalCalendars ( )
protected

Sync external calendars.

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

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

Referenced by executeCommand().

821  {
823 
824  if (!ilCalendarSettings::_getInstance()->isWebCalSyncEnabled()) {
825  return false;
826  }
827  // @todo make this thread safe
828 
829  $limit = new ilDateTime(time(), IL_CAL_UNIX);
830  $limit->increment(IL_CAL_HOUR, -1 * ilCalendarSettings::_getInstance()->getWebCalSyncHours());
831 
833  foreach ($cats->getCategoriesInfo() as $cat_id => $info) {
834  if ($info['remote']) {
835  // Check for execution
836  $category = new ilCalendarCategory($cat_id);
837 
838  if (ilDateTime::_before($category->getRemoteSyncLastExecution(), $limit)) {
839  // update in any case to avoid multiple updates of invalid calendar sources.
840  $category->setRemoteSyncLastExecution(new ilDateTime(time(), IL_CAL_UNIX));
841  $category->update();
842 
843  include_once './Services/Calendar/classes/class.ilCalendarRemoteReader.php';
844  $remote = new ilCalendarRemoteReader($category->getRemoteUrl());
845  $remote->setUser($category->getRemoteUser());
846  $remote->setPass($category->getRemotePass());
847  $remote->read();
848  $remote->import($category);
849  break;
850  }
851  }
852  }
853  }
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
Date and time handling
$ilUser
Definition: imgupload.php:18
static _getInstance($a_usr_id=0)
get singleton instance
$info
Definition: index.php:5
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Field Documentation

◆ $ctrl

ilCalendarPresentationGUI::$ctrl
protected

◆ $help

ilCalendarPresentationGUI::$help
protected

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

◆ $lng

ilCalendarPresentationGUI::$lng
protected

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

Referenced by prepareOutput(), and showViewSelection().

◆ $rbacsystem

ilCalendarPresentationGUI::$rbacsystem
protected

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

Referenced by addStandardTabs().

◆ $repository_mode

ilCalendarPresentationGUI::$repository_mode = false
protected

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

Referenced by getRepositoryMode().

◆ $seed

ilCalendarPresentationGUI::$seed
protected

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

Referenced by executeCommand(), and showSideBlocks().

◆ $tabs_gui

ilCalendarPresentationGUI::$tabs_gui
protected

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

Referenced by prepareOutput().

◆ $toolbar

ilCalendarPresentationGUI::$toolbar
protected

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

Referenced by showViewSelection().

◆ $tpl

ilCalendarPresentationGUI::$tpl
protected

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

Referenced by prepareOutput(), and showSideBlocks().

◆ $ui

ilCalendarPresentationGUI::$ui
protected

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

Referenced by showViewSelection().

◆ $user

ilCalendarPresentationGUI::$user
protected

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