ILIAS  trunk Revision v11.0_alpha-2638-g80c1d007f79
ilCalendarPresentationGUI Class Reference
+ Collaboration diagram for ilCalendarPresentationGUI:

Public Member Functions

 __construct ($a_ref_id=0)
 
 getRepositoryMode ()
 
 executeCommand ()
 
 showViewSelection (string $a_active="cal_list")
 
 getNextClass ()
 
 readLastClass ()
 Read last class from history. More...
 
 setCmdClass ($a_class)
 
 initSeed ()
 init the seed date for presentations (month view, minicalendar) More...
 
 showToolbarAndSidebar ()
 

Protected Member Functions

 initAppointmentIdFromQuery ()
 
 initCategoryIdFromQuery ()
 
 initAndRedirectToConsultationHours ()
 Init and redirect to consultation hours. More...
 
 initCalendarView ()
 Initialises calendar view according to given settings. More...
 
 redirectWithParameters (string $class)
 
 forwardToClass (string $a_class)
 
 showSideBlocks ()
 
 addCategoryTabs ()
 Add tabs for ilCategoryGUI context This cannot be done there since many views (Day Week Agenda) are initiated from these view. More...
 
 addStandardTabs ()
 add standard tabs More...
 
 prepareOutput ()
 
 getRequestedSeedAsString ()
 

Protected Attributes

ilCtrlInterface $ctrl
 
ilLanguage $lng
 
ilGlobalTemplateInterface $tpl
 
ilTabsGUI $tabs_gui
 
ilObjUser $user
 
ilHelpGUI $help
 
ilRbacSystem $rbacsystem
 
ILIAS DI UIServices $ui
 
ilToolbarGUI $toolbar
 
ilAccessHandler $access
 
HttpServices $http
 
RefineryFactory $refinery
 
ilCalendarSettings $cal_settings
 
ilCalendarActions $actions
 
ilCalendarCategories $cats
 
bool $repository_mode = false
 
int $ref_id = 0
 
int $category_id = 0
 
ilDate $seed = null
 
int $cal_view = 0
 
int $cal_period = 0
 

Private Attributes

UIRenderer $renderer
 
UIFactory $ui_factory
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ilCalendarPresentationGUI::__construct (   $a_ref_id = 0)

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

References $cats, $DIC, ilCalendarUserSettings\_getInstance(), ilCalendarCategories\_getInstance(), ilCalendarSettings\_getInstance(), ilCalendarCategory\_getInstanceByObjId(), ilCalendarVisibility\_getInstanceByUserId(), ilObject\_lookupObjId(), ILIAS\Repository\access(), ilCalendarUserSettings\CAL_SELECTION_MEMBERSHIP, ILIAS\Repository\ctrl(), ilCalendarActions\getInstance(), ILIAS\Repository\help(), ILIAS\FileDelivery\http(), initCalendarView(), ilCalendarCategories\initialize(), ILIAS\Repository\lng(), ilCalendarCategories\MODE_PERSONAL_DESKTOP_ITEMS, ilCalendarCategories\MODE_PERSONAL_DESKTOP_MEMBERSHIP, ilCalendarCategories\MODE_REPOSITORY, ilCalendarCategories\MODE_SINGLE_CALENDAR, ILIAS\Repository\refinery(), renderer(), ILIAS\Repository\toolbar(), ILIAS\Repository\ui(), and ILIAS\Repository\user().

65  {
66  global $DIC;
67 
68  $this->ctrl = $DIC->ctrl();
69  $this->lng = $DIC->language();
70  $this->lng->loadLanguageModule('dateplaner');
71 
72  $this->renderer = $DIC->ui()->renderer();
73  $this->ui_factory = $DIC->ui()->factory();
74 
75  $this->http = $DIC->http();
76  $this->refinery = $DIC->refinery();
77  $this->tpl = $DIC->ui()->mainTemplate();
78  $this->tabs_gui = $DIC->tabs();
79  $this->user = $DIC->user();
80  $this->rbacsystem = $DIC->rbac()->system();
81  $this->access = $DIC->access();
82  $this->help = $DIC["ilHelp"];
83  $this->ui = $DIC->ui();
84  $this->toolbar = $DIC->toolbar();
85  $this->ref_id = $a_ref_id;
86  $this->category_id = 0;
87  if ($this->http->wrapper()->query()->has('category_id')) {
88  $this->category_id = $this->http->wrapper()->query()->retrieve(
89  'category_id',
90  $this->refinery->kindlyTo()->int()
91  );
92  }
93 
94  $this->repository_mode = $a_ref_id > 0;
95  if ($this->repository_mode && $this->category_id === 0) {
96  $obj_id = ilObject::_lookupObjId($this->ref_id);
97  $category = ilCalendarCategory::_getInstanceByObjId($obj_id);
98  $this->category_id = is_null($category) ? 0 : $category->getCategoryID();
99  }
100  $this->ctrl->setParameter($this, 'category_id', $this->category_id);
101  $this->cal_settings = ilCalendarSettings::_getInstance();
102 
103  // show back to pd
104  $this->ctrl->saveParameter($this, 'backpd');
105 
106  $this->initCalendarView();
107  $cats = ilCalendarCategories::_getInstance($this->user->getId());
108 
109  if ($this->category_id > 0 && $this->ref_id <= 0) { // single calendar view
110  // ensure activation of this category
111  $vis = ilCalendarVisibility::_getInstanceByUserId($this->user->getId(), $a_ref_id);
112  $vis->forceVisibility($this->category_id);
113 
114  $cats->initialize(ilCalendarCategories::MODE_SINGLE_CALENDAR, 0, false, $this->category_id);
115  } elseif ($a_ref_id > 0) {
116  $cats->initialize(ilCalendarCategories::MODE_REPOSITORY, (int) $a_ref_id, true);
119  } else {
121  }
122 
123  $this->actions = ilCalendarActions::getInstance();
124  $this->cats = $cats;
125  }
initialize(int $a_mode, int $a_source_ref_id=0, bool $a_use_cache=false, int $a_cat_id=0)
initialize visible categories
initCalendarView()
Initialises calendar view according to given settings.
renderer()
static getInstance()
Get instance.
static _getInstanceByObjId(int $a_obj_id)
get instance by obj_id
static _lookupObjId(int $ref_id)
static http()
Fetches the global http state from ILIAS.
global $DIC
Definition: shib_login.php:26
static _getInstance($a_usr_id=0)
get singleton instance
static _getInstanceByUserId(int $a_user_id, int $a_ref_id=0)
+ 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 these view.

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

References $ctrl, ilObject\_lookupType(), ilCtrlInterface\clearParameterByClass(), ILIAS\Repository\ctrl(), ilCtrlInterface\getLinkTargetByClass(), getRepositoryMode(), ILIAS\FileDelivery\http(), initCategoryIdFromQuery(), ILIAS\Repository\lng(), and ilCtrlInterface\setParameterByClass().

Referenced by prepareOutput().

548  : void
549  {
550  $ctrl = $this->ctrl;
551  $this->tabs_gui->clearTargets();
552  $ctrl->setParameterByClass(ilCalendarCategoryGUI::class, "category_id", $this->initCategoryIdFromQuery());
553  if ($this->getRepositoryMode()) {
554  if ($this->http->wrapper()->query()->has('backpd')) {
555  $this->tabs_gui->setBack2Target(
556  $this->lng->txt('back_to_pd'),
557  $this->ctrl->getLinkTargetByClass(ilDashboardGUI::class, 'jumpToCalendar')
558  );
559  }
560  $label = $this->lng->txt('back_to_' . ilObject::_lookupType($this->ref_id, true));
561  $this->tabs_gui->setBackTarget(
562  $label,
563  $this->ctrl->getParentReturn($this)
564  );
565  } elseif ($this->http->wrapper()->query()->has('backvm')) {
566  // no object calendar => back is back to manage view
567  $this->tabs_gui->setBackTarget(
568  $this->lng->txt("back"),
569  $ctrl->getLinkTargetByClass(ilCalendarCategoryGUI::class, 'manage')
570  );
571  } else {
572  $ctrl->clearParameterByClass(ilCalendarPresentationGUI::class, 'category_id');
573  $this->tabs_gui->setBackTarget(
574  $this->lng->txt("back"),
575  $ctrl->getLinkTargetByClass('ilcalendarpresentationgui', '')
576  );
577  $ctrl->setParameterByClass(ilCalendarPresentationGUI::class, "category_id", $this->initCategoryIdFromQuery());
578  }
579 
580  $this->tabs_gui->addTab(
581  "cal_agenda",
582  $this->lng->txt("cal_agenda"),
583  $ctrl->getLinkTargetByClass(ilCalendarPresentationGUI::class, "")
584  );
585 
586  if ($this->actions->checkShareCal($this->category_id)) {
587  $this->tabs_gui->addTab(
588  "share",
589  $this->lng->txt("cal_share"),
590  $ctrl->getLinkTargetByClass(ilCalendarCategoryGUI::class, "shareSearch")
591  );
592  }
593  if ($this->actions->checkSettingsCal($this->category_id)) {
594  $ctrl->setParameterByClass(ilCalendarCategoryGUI::class, 'category_id', $this->category_id);
595  $this->tabs_gui->addTab(
596  "edit",
597  $this->lng->txt("settings"),
598  $ctrl->getLinkTargetByClass(ilCalendarCategoryGUI::class, "edit")
599  );
600  $ctrl->clearParameterByClass(ilCalendarCategoryGUI::class, 'category_id');
601  }
602  $this->tabs_gui->activateTab('cal_agenda');
603  }
setParameterByClass(string $a_class, string $a_parameter, $a_value)
Sets a parameter for the given GUI class and appends the given value as well.
getLinkTargetByClass( $a_class, ?string $a_cmd=null, ?string $a_anchor=null, bool $is_async=false, bool $has_xml_style=false)
Returns a link target for the given information.
clearParameterByClass(string $a_class, string $a_parameter)
Removes a specific parameter of a specific class that is currently set or saved.
static http()
Fetches the global http state from ILIAS.
static _lookupType(int $id, bool $reference=false)
+ 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 608 of file class.ilCalendarPresentationGUI.php.

References $access, $rbacsystem, ilCalendarSettings\_getInstance(), ilCalendarCategory\_getInstanceByObjId(), ilObject\_lookupObjId(), ilObject\_lookupType(), ilRBACAccessHandler\checkAccess(), ILIAS\Repository\ctrl(), getRepositoryMode(), ILIAS\FileDelivery\http(), and ILIAS\Repository\lng().

Referenced by prepareOutput().

608  : void
609  {
612 
613  $this->tabs_gui->clearTargets();
614  if ($this->getRepositoryMode()) {
615  if ($this->http->wrapper()->query()->has('backpd')) {
616  $this->tabs_gui->setBack2Target(
617  $this->lng->txt('back_to_pd'),
618  $this->ctrl->getLinkTargetByClass(ilDashboardGUI::class, 'jumpToCalendar')
619  );
620  }
621  $label = $this->lng->txt('back_to_' . ilObject::_lookupType($this->ref_id, true));
622  $this->tabs_gui->setBackTarget(
623  $label,
624  $this->ctrl->getParentReturn($this)
625  );
626 
627  $obj_id = ilObject::_lookupObjId($this->ref_id);
628  $category = ilCalendarCategory::_getInstanceByObjId($obj_id);
629  $category_id = $category->getCategoryID();
630 
631  // agenda tab
632  $this->tabs_gui->addTab(
633  'cal_agenda',
634  $this->lng->txt('cal_agenda'),
635  $this->ctrl->getLinkTarget($this, '')
636  );
637 
638  // settings tab
639  if ($access->checkAccess('edit_event', '', $this->ref_id)) {
640  $this->ctrl->setParameterByClass(ilCalendarCategoryGUI::class, 'category_id', $category_id);
641  $this->tabs_gui->addTab(
642  'cal_manage',
643  $this->lng->txt('settings'),
644  $this->ctrl->getLinkTargetByClass(ilCalendarCategoryGUI::class, 'edit')
645  );
646  $this->ctrl->clearParameterByClass(ilCalendarCategoryGUI::class, 'category_id');
647  }
648  } else {
649  $this->tabs_gui->addTab(
650  'cal_agenda',
651  $this->lng->txt("cal_agenda"),
652  $this->ctrl->getLinkTarget($this, '')
653  );
654 
655  if (
656  $this->rbacsystem->checkAccess(
657  'add_consultation_hours',
658  ilCalendarSettings::_getInstance()->getCalendarSettingsId()
659  ) &&
660  ilCalendarSettings::_getInstance()->areConsultationHoursEnabled()
661  ) {
662  $this->tabs_gui->addTab(
663  'app_consultation_hours',
664  $this->lng->txt('app_consultation_hours'),
665  $this->ctrl->getLinkTargetByClass(ilConsultationHoursGUI::class, '')
666  );
667  }
668  $this->tabs_gui->addTarget(
669  'cal_manage',
670  $this->ctrl->getLinkTargetByClass('ilCalendarCategoryGUI', 'manage')
671  );
672  $this->tabs_gui->addTarget('settings', $this->ctrl->getLinkTargetByClass('ilCalendarUserSettingsGUI', ''));
673  }
674  }
checkAccess(string $a_permission, string $a_cmd, int $a_ref_id, string $a_type="", ?int $a_obj_id=null, ?int $a_tree_id=null)
check access for an object (provide $a_type and $a_obj_id if available for better performance) ...
static _getInstanceByObjId(int $a_obj_id)
get instance by obj_id
static _lookupObjId(int $ref_id)
static http()
Fetches the global http state from ILIAS.
static _lookupType(int $id, bool $reference=false)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ executeCommand()

ilCalendarPresentationGUI::executeCommand ( )

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

References $ref_id, $seed, $user_id, ilCalendarSettings\_getInstance(), ILIAS\Repository\ctrl(), forwardToClass(), ilSession\get(), getNextClass(), getRepositoryMode(), ILIAS\Repository\help(), ILIAS\FileDelivery\http(), initAndRedirectToConsultationHours(), initAppointmentIdFromQuery(), initSeed(), ILIAS\Repository\lng(), prepareOutput(), readLastClass(), ilUtil\redirect(), ILIAS\Repository\refinery(), setCmdClass(), showSideBlocks(), showToolbarAndSidebar(), showViewSelection(), and ILIAS\Repository\user().

202  : void
203  {
204  $cmd = $this->ctrl->getCmd();
205 
206  if (!ilCalendarSettings::_getInstance()->isEnabled()) {
207  $this->tpl->setOnScreenMessage('failure', $this->lng->txt('permission_denied'), true);
208  ilUtil::redirect('ilias.php?baseClass=ilDashboardGUI');
209  }
210 
211  $this->initSeed();
212  if (!$this->ctrl->isAsynch()) {
213  $this->prepareOutput();
214  }
215 
216  $this->help->setScreenIdComponent("cal");
217  switch ($cmd) {
218  case 'selectCHCalendarOfUser':
220  break;
221  }
222 
223  // now next class is not empty, which breaks old consultation hour implementation
224  $next_class = $this->getNextClass();
225 
226  switch ($next_class) {
227  case 'ilcalendarinboxgui':
228  $this->tabs_gui->activateTab('cal_agenda');
229  $inbox_gui = $this->forwardToClass('ilcalendarinboxgui');
230  if ($this->showToolbarAndSidebar()) {
231  $this->showViewSelection("cal_list");
232  $this->showSideBlocks();
233  $inbox_gui->addToolbarFileDownload();
234  }
235 
236  break;
237 
238  case 'ilconsultationhoursgui':
239  $this->tabs_gui->activateTab('app_consultation_hours');
240  $this->tabs_gui->clearTargets();
241 
242  // No side blocks
243  $this->tabs_gui->setBackTarget(
244  $this->lng->txt('cal_back_to_cal'),
245  $this->ctrl->getLinkTargetByClass($this->readLastClass())
246  );
247  $this->ctrl->forwardCommand(new ilConsultationHoursGUI());
248  if ($this->showToolbarAndSidebar()) {
249  $this->showSideBlocks();
250  }
251  return;
252 
253  case 'ilcalendarmonthgui':
254  $this->tabs_gui->activateTab('cal_agenda');
255  $month_gui = $this->forwardToClass('ilcalendarmonthgui');
256 
257  if ($this->showToolbarAndSidebar()) {
258  $this->showViewSelection("app_month");
259  $this->showSideBlocks();
260  $month_gui->addToolbarFileDownload();
261  }
262  break;
263 
264  case 'ilcalendarweekgui':
265  $this->tabs_gui->activateTab('cal_agenda');
266  $week_gui = $this->forwardToClass('ilcalendarweekgui');
267  if ($this->showToolbarAndSidebar()) {
268  $this->showViewSelection("app_week");
269  $this->showSideBlocks();
270  $week_gui->addToolbarFileDownload();
271  }
272 
273  break;
274 
275  case 'ilcalendardaygui':
276  $this->tabs_gui->activateTab('cal_agenda');
277  $day_gui = $this->forwardToClass('ilcalendardaygui');
278  if ($this->showToolbarAndSidebar()) {
279  $this->showViewSelection("app_day");
280  $this->showSideBlocks();
281  $day_gui->addToolbarFileDownload();
282  }
283  break;
284 
285  case 'ilcalendarusersettingsgui':
286  $this->ctrl->setReturn($this, '');
287  $this->tabs_gui->activateTab('settings');
288  $this->setCmdClass('ilcalendarusersettingsgui');
289 
290  $user_settings = new ilCalendarUserSettingsGUI();
291  $this->ctrl->forwardCommand($user_settings);
292  // No side blocks
293  return;
294 
295  case 'ilcalendarappointmentgui':
296  $this->ctrl->setReturn($this, '');
297  $this->tabs_gui->activateTab((string) ilSession::get('cal_last_tab'));
298 
299  $app = new ilCalendarAppointmentGUI($this->seed, $this->seed, $this->initAppointmentIdFromQuery());
300  $this->ctrl->forwardCommand($app);
301  break;
302 
303  case 'ilcalendarsubscriptiongui':
304  $this->ctrl->setReturn($this, '');
305  $this->tabs_gui->activateTab("cal_agenda");
306 
307  $ref_id = 0;
308  if ($this->http->wrapper()->query()->has('ref_id')) {
309  $ref_id = $this->http->wrapper()->query()->retrieve(
310  'ref_id',
311  $this->refinery->kindlyTo()->int()
312  );
313  }
314  $sub = new ilCalendarSubscriptionGUI($this->category_id, $ref_id);
315  $this->ctrl->forwardCommand($sub);
316  if ($this->showToolbarAndSidebar()) {
317  $this->showSideBlocks();
318  }
319  break;
320 
321  case 'ilcalendarcategorygui':
322  $this->ctrl->setReturn($this, '');
323  $this->tabs_gui->activateTab("cal_manage");
324  $category = new ilCalendarCategoryGUI($this->user->getId(), $this->seed, $this->ref_id);
325  if ($this->ctrl->forwardCommand($category)) {
326  return;
327  } else {
328  $this->showSideBlocks();
329  break;
330  }
331 
332  // no break
333  case 'ilcalendarblockgui':
334  $side_cal = new ilCalendarBlockGUI();
335  $side_cal->setRepositoryMode($this->getRepositoryMode());
336  $side_cal->setForceMonthView(true);
337  $this->ctrl->forwardCommand($side_cal);
338  $this->showSideBlocks();
339  break;
340 
341  case 'ilpdcalendarblockgui':
342  $side_cal = new ilPDCalendarBlockGUI();
343  $side_cal->setRepositoryMode($this->getRepositoryMode());
344  $side_cal->setForceMonthView(true);
345  $this->ctrl->forwardCommand($side_cal);
346  $this->showSideBlocks();
347  break;
348 
349  case 'ilpublicuserprofilegui':
350  $user_id = $this->user->getId();
351  if ($this->http->wrapper()->query()->has('user_id')) {
352  $user_id = $this->http->wrapper()->query()->retrieve(
353  'user_id',
354  $this->refinery->kindlyTo()->int()
355  );
356  }
357  $user_profile = new ilPublicUserProfileGUI($user_id);
358  $html = $this->ctrl->forwardCommand($user_profile);
359  $this->tpl->setContent($html);
360  break;
361 
362  default:
363  $cmd = $this->ctrl->getCmd("show");
364  $this->$cmd();
365  $this->showSideBlocks();
366  break;
367  }
368  }
static get(string $a_var)
readLastClass()
Read last class from history.
initSeed()
init the seed date for presentations (month view, minicalendar)
Show calendar subscription info.
Calendar blocks, displayed on personal desktop.
GUI class for public user profile presentation.
static http()
Fetches the global http state from ILIAS.
initAndRedirectToConsultationHours()
Init and redirect to consultation hours.
showViewSelection(string $a_active="cal_list")
static redirect(string $a_script)
Administrate calendar appointments.
Calendar blocks, displayed in different contexts, e.g.
Administration, Side-Block presentation of calendar categories.
+ Here is the call graph for this function:

◆ forwardToClass()

ilCalendarPresentationGUI::forwardToClass ( string  $a_class)
protected

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

References $user, ILIAS\Repository\ctrl(), null, ilSession\set(), setCmdClass(), and ILIAS\Repository\user().

Referenced by executeCommand().

487  {
488  $ilUser = $this->user;
489  switch ($a_class) {
490  case 'ilcalendarmonthgui':
491  $this->user->writePref('cal_last_class', $a_class);
492  ilSession::set('cal_last_tab', 'app_month');
493  $this->setCmdClass('ilcalendarmonthgui');
494  $month_gui = new ilCalendarMonthGUI($this->seed);
495  $this->ctrl->forwardCommand($month_gui);
496  return $month_gui;
497 
498  case 'ilcalendarweekgui':
499  $this->user->writePref('cal_last_class', $a_class);
500  ilSession::set('cal_last_tab', 'app_week');
501  $this->setCmdClass('ilcalendarweekgui');
502  $week_gui = new ilCalendarWeekGUI($this->seed);
503  $this->ctrl->forwardCommand($week_gui);
504  return $week_gui;
505 
506  case 'ilcalendardaygui':
507  $this->user->writePref('cal_last_class', $a_class);
508  ilSession::set('cal_last_tab', 'app_day');
509  $this->setCmdClass('ilcalendardaygui');
510  $day_gui = new ilCalendarDayGUI($this->seed);
511  $this->ctrl->forwardCommand($day_gui);
512  return $day_gui;
513 
514  case 'ilcalendarinboxgui':
515  $this->user->writePref('cal_last_class', $a_class);
516  ilSession::set('cal_last_tab', 'cal_upcoming_events_header');
517  $this->setCmdClass('ilcalendarinboxgui');
518  $inbox_gui = new ilCalendarInboxGUI($this->seed);
519  $this->ctrl->forwardCommand($inbox_gui);
520  return $inbox_gui;
521  }
522  return null;
523  }
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
static set(string $a_var, $a_val)
Set a value.
Presentation day view.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getNextClass()

ilCalendarPresentationGUI::getNextClass ( )

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

References ILIAS\Repository\ctrl(), readLastClass(), and redirectWithParameters().

Referenced by executeCommand().

425  : string
426  {
427  if (strlen($next_class = $this->ctrl->getNextClass())) {
428  return $next_class;
429  }
430  if (
431  strcasecmp($this->ctrl->getCmdClass(), ilCalendarPresentationGUI::class) === 0 ||
432  $this->ctrl->getCmdClass() == ''
433  ) {
434  $cmd_class = $this->readLastClass();
435  $this->redirectWithParameters($cmd_class);
436  return $cmd_class;
437  }
438  return '';
439  }
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 ( )

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

References $repository_mode.

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

127  : bool
128  {
129  return $this->repository_mode;
130  }
+ Here is the caller graph for this function:

◆ getRequestedSeedAsString()

ilCalendarPresentationGUI::getRequestedSeedAsString ( )
protected

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

References $seed, ILIAS\FileDelivery\http(), and ILIAS\Repository\refinery().

Referenced by initAndRedirectToConsultationHours(), and initSeed().

749  : string
750  {
751  $seed = '';
752  if ($this->http->wrapper()->query()->has('seed')) {
753  $seed = $this->http->wrapper()->query()->retrieve(
754  'seed',
755  $this->refinery->kindlyTo()->string()
756  );
757  }
758  return $seed;
759  }
static http()
Fetches the global http state from ILIAS.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ initAndRedirectToConsultationHours()

ilCalendarPresentationGUI::initAndRedirectToConsultationHours ( )
protected

Init and redirect to consultation hours.

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

References $info, $ref_id, ilCalendarVisibility\_getInstanceByUserId(), ILIAS\Repository\ctrl(), getRequestedSeedAsString(), ILIAS\FileDelivery\http(), ILIAS\Repository\refinery(), ilCalendarCategory\TYPE_CH, and ILIAS\Repository\user().

Referenced by executeCommand().

158  : void
159  {
160  $ch_user_id = 0;
161  if ($this->http->wrapper()->query()->has('ch_user_id')) {
162  $ch_user_id = $this->http->wrapper()->query()->retrieve(
163  'ch_user_id',
164  $this->refinery->kindlyTo()->int()
165  );
166  }
167  $visibility = ilCalendarVisibility::_getInstanceByUserId($this->user->getId(), $this->ref_id);
168  foreach ($this->cats->getCategoriesInfo() as $info) {
169  if (
170  $info["type"] == ilCalendarCategory::TYPE_CH &&
171  $info["obj_id"] == $ch_user_id
172  ) {
173  $v = $visibility->getVisible();
174  if (!in_array($info["cat_id"], $v)) {
175  $v[] = $info["cat_id"];
176  }
177  $visibility->showSelected($v);
178  $visibility->save();
179  $this->ctrl->setParameterByClass(ilCalendarMonthGUI::class, 'category_id', $info['cat_id']);
180  $this->ctrl->setParameterByClass(\ilCalendarMonthGUI::class, 'seed', $this->getRequestedSeedAsString());
181  }
182  }
183  $this->ctrl->redirectToURL(
184  $this->ctrl->getLinkTargetByClass(\ilCalendarMonthGUI::class, '')
185  );
186  }
static http()
Fetches the global http state from ILIAS.
$info
Definition: entry_point.php:21
static _getInstanceByUserId(int $a_user_id, int $a_ref_id=0)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ initAppointmentIdFromQuery()

ilCalendarPresentationGUI::initAppointmentIdFromQuery ( )
protected

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

References ILIAS\FileDelivery\http(), and ILIAS\Repository\refinery().

Referenced by executeCommand().

132  : int
133  {
134  if ($this->http->wrapper()->query()->has('app_id')) {
135  return $this->http->wrapper()->query()->retrieve(
136  'app_id',
137  $this->refinery->kindlyTo()->int()
138  );
139  }
140  return 0;
141  }
static http()
Fetches the global http state from ILIAS.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ initCalendarView()

ilCalendarPresentationGUI::initCalendarView ( )
protected

Initialises calendar view according to given settings.

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

References ILIAS\FileDelivery\http(), and ILIAS\Repository\refinery().

Referenced by __construct().

191  : void
192  {
193  $this->cal_view = $this->cal_settings->getDefaultCal();
194  if ($this->http->wrapper()->query()->has('cal_view')) {
195  $this->cal_view = $this->http->wrapper()->query()->retrieve(
196  'cal_view',
197  $this->refinery->kindlyTo()->int()
198  );
199  }
200  }
static http()
Fetches the global http state from ILIAS.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ initCategoryIdFromQuery()

ilCalendarPresentationGUI::initCategoryIdFromQuery ( )
protected

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

References ILIAS\FileDelivery\http(), and ILIAS\Repository\refinery().

Referenced by addCategoryTabs().

143  : int
144  {
145  if ($this->http->wrapper()->query()->has('category_id')) {
146  return $this->http->wrapper()->query()->retrieve(
147  'category_id',
148  $this->refinery->kindlyTo()->int()
149  );
150  }
151  return 0;
152  }
static http()
Fetches the global http state from ILIAS.
+ 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)

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

References ILIAS\Repository\ctrl(), ilSession\get(), getRepositoryMode(), getRequestedSeedAsString(), IL_CAL_DATE, IL_CAL_UNIX, and ilSession\set().

Referenced by executeCommand().

764  : void
765  {
766  $seed = $this->getRequestedSeedAsString();
767 
768  // default to today
769  $now = new \ilDate(time(), IL_CAL_UNIX);
770  $this->seed = new \ilDate($now->get(IL_CAL_DATE), IL_CAL_DATE);
771  if ($seed) {
772  $this->seed = new ilDate($seed, IL_CAL_DATE);
773  } elseif (!$this->getRepositoryMode()) {
774  $session_seed = ilSession::get('cal_seed');
775  if ($session_seed) {
776  $this->seed = new ilDate($session_seed, IL_CAL_DATE);
777  }
778  }
779  $this->ctrl->setParameter($this, 'seed', $this->seed->get(IL_CAL_DATE));
780  ilSession::set('cal_seed', $this->seed->get(IL_CAL_DATE));
781  }
static get(string $a_var)
const IL_CAL_UNIX
const IL_CAL_DATE
static set(string $a_var, $a_val)
Set a value.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ prepareOutput()

ilCalendarPresentationGUI::prepareOutput ( )
protected

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

References $ctrl, $lng, $tabs_gui, $tpl, ilObjUser\_lookupFullname(), addCategoryTabs(), addStandardTabs(), ilUtil\getImagePath(), ilCtrlInterface\getLinkTargetByClass(), ILIAS\Repository\lng(), renderer(), ILIAS\UICore\GlobalTemplate\setHeaderActionMenu(), ilCtrlInterface\setParameterByClass(), ILIAS\UICore\GlobalTemplate\setTitle(), ILIAS\UICore\GlobalTemplate\setTitleIcon(), ilCalendarCategory\TYPE_BOOK, ilCalendarCategory\TYPE_CH, ilCalendarCategory\TYPE_GLOBAL, ilCalendarCategory\TYPE_OBJ, and ilCalendarCategory\TYPE_USR.

Referenced by executeCommand().

676  : void
677  {
678  if ($this->category_id) {
679  $this->addCategoryTabs();
680  } else {
681  $this->addStandardTabs();
682  }
683 
684  // #0035566
685  $this->tpl->setTitleIcon(ilUtil::getImagePath("standard/icon_cal.svg"));
686 
687  // if we are in single calendar view
688  if ($this->category_id > 0) {
689  $tabs = $this->tabs_gui;
690  $lng = $this->lng;
691  $ctrl = $this->ctrl;
692  $tpl = $this->tpl;
693 
694  $category = new ilCalendarCategory($this->category_id);
695 
696  // Set header
697  $header = "";
698  switch ($category->getType()) {
700  $header = $this->lng->txt('cal_type_personal') . ": " . $category->getTitle();
701  break;
702 
704  $header = $this->lng->txt('cal_type_system') . ": " . $category->getTitle();
705  break;
706 
708  $header = $this->lng->txt('cal_type_' . $category->getObjType()) . ": " . $category->getTitle();
709  break;
710 
712  $header = str_replace(
713  "%1",
714  ilObjUser::_lookupFullname($category->getObjId()),
715  $this->lng->txt("cal_consultation_hours_for_user")
716  );
717  break;
718 
720  $header = $category->getTitle();
721  break;
722  }
723  $tpl->setTitleIcon(ilUtil::getImagePath("standard/icon_cal.svg"));
724  $tpl->setTitle($header);
725 
726  $dropDownItems = array();
727 
728  // iCal-Url
729  $ctrl->setParameterByClass("ilcalendarsubscriptiongui", "category_id", $this->category_id);
730  $dropDownItems[] = $this->ui_factory->button()->shy(
731  $this->lng->txt("cal_ical_url"),
732  $ctrl->getLinkTargetByClass("ilcalendarsubscriptiongui", "")
733  );
734 
735  // delete action
736  if ($this->actions->checkDeleteCal($this->category_id)) {
737  $ctrl->setParameterByClass("ilcalendarcategorygui", "category_id", $this->category_id);
738  $dropDownItems[] = $this->ui_factory->button()->shy(
739  $this->lng->txt("cal_delete_cal"),
740  $ctrl->getLinkTargetByClass("ilcalendarcategorygui", "confirmDelete")
741  );
742  }
743  $dropDown = $this->ui_factory->dropdown()->standard($dropDownItems)
744  ->withAriaLabel($this->lng->txt('actions'));
745  $tpl->setHeaderActionMenu($this->renderer->render($dropDown));
746  }
747  }
setParameterByClass(string $a_class, string $a_parameter, $a_value)
Sets a parameter for the given GUI class and appends the given value as well.
static _lookupFullname(int $a_user_id)
getLinkTargetByClass( $a_class, ?string $a_cmd=null, ?string $a_anchor=null, bool $is_async=false, bool $has_xml_style=false)
Returns a link target for the given information.
renderer()
setTitle(string $a_title, bool $hidden=false)
Sets title in standard template.
Stores calendar categories.
static getImagePath(string $image_name, string $module_path="", string $mode="output", bool $offline=false)
get image path (for images located in a template directory)
setTitleIcon(string $a_icon_path, string $a_icon_desc="")
set title icon
setHeaderActionMenu(string $a_header)
Set header action menu.
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.

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

References $user, ilCalendarSettings\DEFAULT_CAL_DAY, ilCalendarSettings\DEFAULT_CAL_LIST, ilCalendarSettings\DEFAULT_CAL_MONTH, ilCalendarSettings\DEFAULT_CAL_WEEK, ILIAS\FileDelivery\http(), and ILIAS\Repository\user().

Referenced by executeCommand(), and getNextClass().

444  : string
445  {
446  $ilUser = $this->user;
447  switch ($this->cal_view) {
449  $class = "ilcalendardaygui";
450  break;
452  $class = "ilcalendarweekgui";
453  break;
455  $class = "ilcalendarmonthgui";
456  break;
458  default:
459  $class = "ilcalendarinboxgui";
460  break;
461  }
462 
463  // see #34998, if cal_view is requested (e.g. through starting point)
464  // it must get high prio than history entry
465  $user_pref = $this->user->getPref('cal_last_class');
466  $use_pref = $user_pref && ($user_pref !== "") && !$this->http->wrapper()->query()->has('cal_view');
467 
468  return $use_pref ? $user_pref : $class;
469  }
static http()
Fetches the global http state from ILIAS.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ redirectWithParameters()

ilCalendarPresentationGUI::redirectWithParameters ( string  $class)
protected

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

References ILIAS\Repository\ctrl().

Referenced by getNextClass(), and setCmdClass().

480  : void
481  {
482  $this->ctrl->saveParameter($this, 'seed');
483  $this->ctrl->redirectByClass($class);
484  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setCmdClass()

ilCalendarPresentationGUI::setCmdClass (   $a_class)

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

References ILIAS\Repository\ctrl(), and redirectWithParameters().

Referenced by executeCommand(), and forwardToClass().

471  : void
472  {
473  // If cmd class == 'ilcalendarpresentationgui' the cmd class is set to the the new forwarded class
474  // otherwise e.g ilcalendarmonthgui tries to forward (back) to ilcalendargui.
475  if ($this->ctrl->getCmdClass() == strtolower(get_class($this))) {
476  $this->redirectWithParameters($a_class);
477  }
478  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ showSideBlocks()

ilCalendarPresentationGUI::showSideBlocks ( )
protected

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

References $ref_id, $seed, ILIAS\Repository\ctrl(), ILIAS\UICore\GlobalTemplate\get(), getRepositoryMode(), ILIAS\UICore\GlobalTemplate\setVariable(), and ILIAS\Repository\user().

Referenced by executeCommand().

525  : void
526  {
527  $tpl = new ilTemplate('tpl.cal_side_block.html', true, true, 'components/ILIAS/Calendar');
528  if ($this->getRepositoryMode()) {
529  $side_cal = new ilCalendarBlockGUI();
530  } else {
531  $side_cal = new ilPDCalendarBlockGUI();
532  }
533  $side_cal->setParentGUI("ilCalendarPresentationGUI");
534  $side_cal->setForceMonthView(true);
535  $side_cal->setRepositoryMode($this->getRepositoryMode());
536  $tpl->setVariable('MINICAL', $this->ctrl->getHTML($side_cal));
537 
538  $cat = new ilCalendarCategoryGUI($this->user->getId(), $this->seed, $this->ref_id);
539  $tpl->setVariable('CATEGORIES', $this->ctrl->getHTML($cat));
540 
541  $this->tpl->setRightContent($tpl->get());
542  }
setVariable(string $variable, $value='')
Sets the given variable to the given value.
Calendar blocks, displayed on personal desktop.
get(string $part=self::DEFAULT_BLOCK)
Renders the given block and returns the html string.
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 785 of file class.ilCalendarPresentationGUI.php.

References ILIAS\Repository\ctrl().

Referenced by executeCommand().

785  : bool
786  {
787  #21783
788  return !(
789  $this->ctrl->getCmdClass() == "ilcalendarappointmentgui" ||
790  $this->ctrl->getCmdClass() == 'ilconsultationhoursgui'
791  );
792  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ showViewSelection()

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

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

References $ctrl, Vendor\Package\$f, $lng, $toolbar, $ui, ilToolbarGUI\addComponent(), ilToolbarGUI\addSeparator(), ilCtrlInterface\clearParameterByClass(), ilCtrlInterface\getLinkTargetByClass(), IL_CAL_DATE, IL_CAL_FKT_DATE, IL_CAL_UNIX, ILIAS\Repository\lng(), ilCtrlInterface\setParameterByClass(), and ILIAS\Repository\user().

Referenced by executeCommand().

370  : void
371  {
372  $ui = $this->ui;
373  $ctrl = $this->ctrl;
374  $lng = $this->lng;
376 
377  $f = $ui->factory();
378 
379  $actions = array(
380  $this->lng->txt("app_day") => $ctrl->getLinkTargetByClass('ilCalendarDayGUI', ''),
381  $this->lng->txt("app_week") => $ctrl->getLinkTargetByClass('ilCalendarWeekGUI', ''),
382  $this->lng->txt("app_month") => $ctrl->getLinkTargetByClass('ilCalendarMonthGUI', ''),
383  $this->lng->txt("cal_list") => $ctrl->getLinkTargetByClass('ilCalendarInboxGUI', '')
384  );
385 
386 
387  $view_control = $f->viewControl()->mode($actions, "cal_change_calendar_view")->withActive($this->lng->txt($a_active));
388  $toolbar->addComponent($view_control);
389  $ctrl->setParameterByClass("ilcalendarappointmentgui", "seed", $this->seed->get(IL_CAL_DATE, ''));
390  $ctrl->setParameterByClass("ilcalendarappointmentgui", "app_id", "");
391  $ctrl->setParameterByClass("ilcalendarappointmentgui", "dt", "");
392  $ctrl->setParameterByClass("ilcalendarappointmentgui", "idate", (new ilDate(time(), IL_CAL_UNIX))->get(IL_CAL_DATE));
393 
394  $extra_button_added = false;
395  // add appointment
396  if ($this->category_id == 0 || $this->actions->checkAddEvent($this->category_id)) {
398  $extra_button_added = true;
399 
400  // create appointment should default to current hour
401  $current_hour = (new ilDateTime(time(), IL_CAL_UNIX))->get(IL_CAL_FKT_DATE, 'G', $this->user->getTimeZone());
402  $ctrl->setParameterByClass("ilcalendarappointmentgui", "hour", $current_hour);
403  $add_button = $f->button()->standard(
404  $this->lng->txt("cal_add_appointment"),
405  $ctrl->getLinkTargetByClass("ilcalendarappointmentgui", "add")
406  );
407  $ctrl->clearParameterByClass("ilcalendarappointmentgui", "hour");
408 
409  $toolbar->addComponent($add_button);
410  }
411 
412  // import appointments
413  if ($this->category_id > 0 && $this->actions->checkAddEvent($this->category_id)) {
414  if (!$extra_button_added) {
416  }
417  $add_button = $f->button()->standard(
418  $this->lng->txt("cal_import_appointments"),
419  $ctrl->getLinkTargetByClass("ilcalendarcategorygui", "importAppointments")
420  );
421  $toolbar->addComponent($add_button);
422  }
423  }
setParameterByClass(string $a_class, string $a_parameter, $a_value)
Sets a parameter for the given GUI class and appends the given value as well.
getLinkTargetByClass( $a_class, ?string $a_cmd=null, ?string $a_anchor=null, bool $is_async=false, bool $has_xml_style=false)
Returns a link target for the given information.
addComponent(\ILIAS\UI\Component\Component $a_comp)
clearParameterByClass(string $a_class, string $a_parameter)
Removes a specific parameter of a specific class that is currently set or saved.
const IL_CAL_UNIX
const IL_CAL_FKT_DATE
const IL_CAL_DATE
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Field Documentation

◆ $access

ilAccessHandler ilCalendarPresentationGUI::$access
protected

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

Referenced by addStandardTabs().

◆ $actions

ilCalendarActions ilCalendarPresentationGUI::$actions
protected

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

◆ $cal_period

int ilCalendarPresentationGUI::$cal_period = 0
protected

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

◆ $cal_settings

ilCalendarSettings ilCalendarPresentationGUI::$cal_settings
protected

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

◆ $cal_view

int ilCalendarPresentationGUI::$cal_view = 0
protected

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

◆ $category_id

int ilCalendarPresentationGUI::$category_id = 0
protected

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

◆ $cats

ilCalendarCategories ilCalendarPresentationGUI::$cats
protected

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

Referenced by __construct().

◆ $ctrl

ilCtrlInterface ilCalendarPresentationGUI::$ctrl
protected

◆ $help

ilHelpGUI ilCalendarPresentationGUI::$help
protected

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

◆ $http

HttpServices ilCalendarPresentationGUI::$http
protected

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

◆ $lng

ilLanguage ilCalendarPresentationGUI::$lng
protected

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

Referenced by prepareOutput(), and showViewSelection().

◆ $rbacsystem

ilRbacSystem ilCalendarPresentationGUI::$rbacsystem
protected

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

Referenced by addStandardTabs().

◆ $ref_id

int ilCalendarPresentationGUI::$ref_id = 0
protected

◆ $refinery

RefineryFactory ilCalendarPresentationGUI::$refinery
protected

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

◆ $renderer

UIRenderer ilCalendarPresentationGUI::$renderer
private

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

◆ $repository_mode

bool ilCalendarPresentationGUI::$repository_mode = false
protected

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

Referenced by getRepositoryMode().

◆ $seed

ilDate ilCalendarPresentationGUI::$seed = null
protected

◆ $tabs_gui

ilTabsGUI ilCalendarPresentationGUI::$tabs_gui
protected

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

Referenced by prepareOutput().

◆ $toolbar

ilToolbarGUI ilCalendarPresentationGUI::$toolbar
protected

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

Referenced by showViewSelection().

◆ $tpl

ilGlobalTemplateInterface ilCalendarPresentationGUI::$tpl
protected

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

Referenced by prepareOutput().

◆ $ui

ILIAS DI UIServices ilCalendarPresentationGUI::$ui
protected

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

Referenced by showViewSelection().

◆ $ui_factory

UIFactory ilCalendarPresentationGUI::$ui_factory
private

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

◆ $user

ilObjUser ilCalendarPresentationGUI::$user
protected

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

Referenced by forwardToClass(), and readLastClass().


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