ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
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)
 
 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.

@access public

Parameters

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

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 }
user()
Definition: user.php:4
$_GET["client_id"]
static getInstance()
Get instance.
static _getInstance($a_usr_id=0)
get singleton instance
static _getInstance()
get instance for logged in user
static _getInstanceByUserId($a_user_id, $a_ref_id=0)
get instance by user id
help()
Definition: help.php:2
ui()
Definition: ui.php:5
$DIC
Definition: xapitoken.php:46

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

+ 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 554 of file class.ilCalendarPresentationGUI.php.

555 {
556 global $DIC;
557
558 $ctrl = $DIC->ctrl();
559
560 $this->tabs_gui->clearTargets();
561 $ctrl->setParameterByClass(ilCalendarCategoryGUI::class, "category_id", $_REQUEST["category_id"]);
562 if ($this->getRepositoryMode()) {
563 $came_from_pd = $_REQUEST['backpd'];
564 if ($came_from_pd) {
565 $this->tabs_gui->setBack2Target(
566 $this->lng->txt('back_to_pd'),
567 $this->ctrl->getLinkTargetByClass(ilDashboardGUI::class, 'jumpToCalendar')
568 );
569 }
570 $label = $this->lng->txt('back_to_' . ilObject::_lookupType($this->ref_id, true));
571 $this->tabs_gui->setBackTarget(
572 $label,
573 $this->ctrl->getParentReturn($this)
574 );
575 } else {
576 // no object calendar => back is back to manage view
577 if (array_key_exists('backvm', $_REQUEST)) {
578 $this->tabs_gui->setBackTarget(
579 $this->lng->txt("back"),
580 $ctrl->getLinkTargetByClass(ilCalendarCategoryGUI::class, 'manage')
581 );
582 } else {
583 $ctrl->clearParameterByClass(ilCalendarPresentationGUI::class, 'category_id');
584 $this->tabs_gui->setBackTarget(
585 $this->lng->txt("back"),
586 $ctrl->getLinkTargetByClass('ilcalendarpresentationgui', '')
587 );
588 }
589 $ctrl->setParameterByClass(ilCalendarPresentationGUI::class, "category_id", $_REQUEST["category_id"]);
590 }
591
592 $this->tabs_gui->addTab(
593 "cal_agenda",
594 $this->lng->txt("cal_agenda"),
595 $ctrl->getLinkTargetByClass(ilCalendarPresentationGUI::class, "")
596 );
597
598 if ($this->actions->checkShareCal($this->category_id)) {
599 $this->tabs_gui->addTab(
600 "share",
601 $this->lng->txt("cal_share"),
602 $ctrl->getLinkTargetByClass(ilCalendarCategoryGUI::class, "shareSearch")
603 );
604 }
605 if ($this->actions->checkSettingsCal($this->category_id)) {
606 $this->tabs_gui->addTab(
607 "edit",
608 $this->lng->txt("settings"),
609 $ctrl->getLinkTargetByClass(ilCalendarCategoryGUI::class, "edit")
610 );
611 }
612
613 $this->tabs_gui->activateTab('cal_agenda');
614 return true;
615 }
static _lookupType($a_id, $a_reference=false)
lookup object type

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

Referenced by prepareOutput().

+ 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 620 of file class.ilCalendarPresentationGUI.php.

621 {
622 global $DIC;
623
624 $access = $DIC->access();
625 $rbacsystem = $DIC->rbac()->system();
626
627 $came_from_pd = $_REQUEST['backpd'];
628
629 $this->tabs_gui->clearTargets();
630 if ($this->getRepositoryMode()) {
631 if ($came_from_pd) {
632 $this->tabs_gui->setBack2Target(
633 $this->lng->txt('back_to_pd'),
634 $this->ctrl->getLinkTargetByClass(ilDashboardGUI::class, 'jumpToCalendar')
635 );
636 }
637 $label = $this->lng->txt('back_to_' . ilObject::_lookupType($this->ref_id, true));
638 $this->tabs_gui->setBackTarget(
639 $label,
640 $this->ctrl->getParentReturn($this)
641 );
642
643 $obj_id = ilObject::_lookupObjId($this->ref_id);
644 $category = ilCalendarCategory::_getInstanceByObjId($obj_id);
645 $category_id = $category->getCategoryID();
646
647 // agenda tab
648 $this->tabs_gui->addTab(
649 'cal_agenda',
650 $this->lng->txt('cal_agenda'),
651 $this->ctrl->getLinkTarget($this, '')
652 );
653
654 // settings tab
655 if ($access->checkAccess('edit_event', '', $this->ref_id)) {
656 $this->ctrl->setParameterByClass(ilCalendarCategoryGUI::class, 'category_id', $category_id);
657 $this->tabs_gui->addTab(
658 'cal_manage',
659 $this->lng->txt('settings'),
660 $this->ctrl->getLinkTargetByClass(ilCalendarCategoryGUI::class, 'edit')
661 );
662 $this->ctrl->clearParameterByClass(ilCalendarCategoryGUI::class, 'category_id');
663 }
664 return true;
665 } else {
666 $this->tabs_gui->addTab(
667 'cal_agenda',
668 $this->lng->txt("cal_agenda"),
669 $this->ctrl->getLinkTarget($this, '')
670 );
671
672 if (
673 $rbacsystem->checkAccess(
674 'add_consultation_hours',
675 ilCalendarSettings::_getInstance()->getCalendarSettingsId()
676 ) &&
677 ilCalendarSettings::_getInstance()->areConsultationHoursEnabled()
678 ) {
679 $this->tabs_gui->addTab(
680 'app_consultation_hours',
681 $this->lng->txt('app_consultation_hours'),
682 $this->ctrl->getLinkTargetByClass(ilConsultationHoursGUI::class, '')
683 );
684 }
685 /*
686 $this->tabs_gui->addTab(
687 'cal_manage',
688 $this->lng->txt('cal_manage'),
689 $this->ctrl->getLinkTargetByClass(ilCalendarCategoryGUI::class,'manage')
690 );
691 $this->tabs_gui->addTab(
692 'settings',
693 $this->lng->txt('settings'),
694 $this->ctrl->getLinkTargetByClass(ilCalendarUserSettings::class,'')
695 );
696 */
697 $this->tabs_gui->addTarget('cal_manage', $this->ctrl->getLinkTargetByClass('ilCalendarCategoryGUI', 'manage'));
698 $this->tabs_gui->addTarget('settings', $this->ctrl->getLinkTargetByClass('ilCalendarUserSettingsGUI', ''));
699 }
700 }
static _getInstanceByObjId($a_obj_id)
get instance by obj_id
static _getInstance()
get singleton instance
static _lookupObjId($a_id)

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

Referenced by prepareOutput().

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

◆ executeCommand()

ilCalendarPresentationGUI::executeCommand ( )

Execute command.

@access public

Parameters

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

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

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

+ Here is the call graph for this function:

◆ forwardToClass()

ilCalendarPresentationGUI::forwardToClass (   $a_class)
protected

forward to class

@access protected

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

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

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

Referenced by executeCommand(), and loadHistory().

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

◆ getNextClass()

ilCalendarPresentationGUI::getNextClass ( )

get next class

@access public

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

413 {
414 if (strlen($next_class = $this->ctrl->getNextClass())) {
415 return $next_class;
416 }
417 if ($this->ctrl->getCmdClass() == strtolower(get_class($this)) or $this->ctrl->getCmdClass() == '') {
418 return $this->readLastClass();
419 }
420 }
readLastClass()
Read last class from history.

References readLastClass().

Referenced by executeCommand().

+ 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.

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->setParameterByClass(\ilCalendarMonthGUI::class, 'seed' , $this->seed);
162 $this->ctrl->redirectToURL(
163 $this->ctrl->getLinkTargetByClass(\ilCalendarMonthGUI::class,'')
164 );
165 }
166 }
167 }

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

Referenced by executeCommand().

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

◆ initSeed()

ilCalendarPresentationGUI::initSeed ( )

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

@access public

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

788 {
789 // default to today
790 $now = new \ilDate(time(), IL_CAL_UNIX);
791 $this->seed = new \ilDate($now->get(IL_CAL_DATE), IL_CAL_DATE);
792 if (array_key_exists('seed', $_REQUEST)) {
793 $this->seed = new ilDate($_GET['seed'], IL_CAL_DATE);
794 } elseif (!$this->getRepositoryMode()) {
795 $session_seed = ilSession::get('cal_seed');
796 if ($session_seed) {
797 $this->seed = new ilDate($session_seed, IL_CAL_DATE);
798 }
799 }
800 $this->ctrl->setParameter($this, 'seed', $this->seed->get(IL_CAL_DATE));
801 ilSession::set('cal_seed', $this->seed->get(IL_CAL_DATE));
802 }
const IL_CAL_DATE
const IL_CAL_UNIX
Class for single dates.

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

Referenced by executeCommand().

+ 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

@access protected

Parameters

return

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

510 {
512
513 $this->ctrl->setCmd('');
514 $history = $ilUser->getPref('cal_last_class') ? $ilUser->getPref('cal_last_class') : 'ilcalendarmonthgui';
515 $this->forwardToClass($history);
516 }

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

+ Here is the call graph for this function:

◆ prepareOutput()

ilCalendarPresentationGUI::prepareOutput ( )
protected

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

707 {
708 global $DIC;
709
710 $tpl = $DIC->ui()->mainTemplate();
711
712 if ($this->category_id) {
713 $this->addCategoryTabs();
714 } else {
715 $this->addStandardTabs();
716 }
717
718 $tpl->setTitleIcon(ilUtil::getImagePath("icon_cals.svg"));
719
720 // if we are in single calendar view
721 if ($this->category_id > 0) {
722 global $DIC;
723
724 $tabs = $this->tabs_gui;
727 $tpl = $DIC["tpl"];
728
729 $category = new ilCalendarCategory($this->category_id);
730
731 // Set header
732 $header = "";
733 switch ($category->getType()) {
735 $header = $this->lng->txt('cal_type_personal') . ": " . $category->getTitle();
736 break;
737
739 $header = $this->lng->txt('cal_type_system') . ": " . $category->getTitle();
740 break;
741
743 $header = $this->lng->txt('cal_type_' . $category->getObjType()) . ": " . $category->getTitle();
744 break;
745
747 $header = str_replace("%1", ilObjUser::_lookupFullname($category->getObjId()), $lng->txt("cal_consultation_hours_for_user"));
748 break;
749
751 $header = $category->getTitle();
752 break;
753 }
754 $tpl->setTitleIcon(ilUtil::getImagePath("icon_cals.svg"));
755 $tpl->setTitle($header);
756
757 $this->action_menu = new ilAdvancedSelectionListGUI();
758 $this->action_menu->setAsynch(false);
759 $this->action_menu->setAsynchUrl('');
760 $this->action_menu->setListTitle($lng->txt('actions'));
761 $this->action_menu->setId('act_cal');
762 $this->action_menu->setSelectionHeaderClass('small');
763 $this->action_menu->setItemLinkClass('xsmall');
764 $this->action_menu->setLinksMode('il_ContainerItemCommand2');
765 $this->action_menu->setHeaderIcon(ilAdvancedSelectionListGUI::DOWN_ARROW_DARK);
766 $this->action_menu->setUseImages(false);
767
768 // iCal-Url
769 $ctrl->setParameterByClass("ilcalendarsubscriptiongui", "category_id", $this->category_id);
770 $this->action_menu->addItem($lng->txt("cal_ical_url"), "", $ctrl->getLinkTargetByClass("ilcalendarsubscriptiongui", ""));
771
772 // delete action
773 if ($this->actions->checkDeleteCal($this->category_id)) {
774 $ctrl->setParameterByClass("ilcalendarcategorygui", "category_id", $this->category_id);
775 $this->action_menu->addItem($lng->txt("cal_delete_cal"), "", $ctrl->getLinkTargetByClass("ilcalendarcategorygui", "confirmDelete"));
776 }
777
778 $tpl->setHeaderActionMenu($this->action_menu->getHTML());
779 }
780 }
User interface class for advanced drop-down selection lists.
Stores calendar categories.
addCategoryTabs()
Add tabs for ilCategoryGUI context This cannot be done there since many views (Day Week Agenda) are i...
static _lookupFullname($a_user_id)
Lookup Full Name.
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)

References $ctrl, $DIC, $lng, $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().

+ 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 426 of file class.ilCalendarPresentationGUI.php.

427 {
429
430 return $ilUser->getPref('cal_last_class') ? $ilUser->getPref('cal_last_class') : 'ilcalendarinboxgui';
431 }

References $ilUser, and $user.

Referenced by getNextClass().

+ Here is the caller graph for this function:

◆ setCmdClass()

ilCalendarPresentationGUI::setCmdClass (   $a_class)

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

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

Referenced by executeCommand(), and forwardToClass().

+ Here is the caller graph for this function:

◆ showSideBlocks()

ilCalendarPresentationGUI::showSideBlocks ( )
protected

show side blocks

@access protected

Parameters

return

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

526 {
529
530 $tpl = new ilTemplate('tpl.cal_side_block.html', true, true, 'Services/Calendar');
531 if ($this->getRepositoryMode()) {
532 include_once("./Services/Calendar/classes/class.ilCalendarBlockGUI.php");
533 $side_cal = new ilCalendarBlockGUI();
534 } else {
535 include_once("./Services/Calendar/classes/class.ilPDCalendarBlockGUI.php");
536 $side_cal = new ilPDCalendarBlockGUI();
537 }
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 }
special template class to simplify handling of ITX/PEAR
global $ilCtrl
Definition: ilias.php:18

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

Referenced by executeCommand().

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

◆ showToolbarAndSidebar()

ilCalendarPresentationGUI::showToolbarAndSidebar ( )

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

847 {
848 #21783
849 if ($this->ctrl->getCmdClass() == "ilcalendarappointmentgui" || $this->ctrl->getCmdClass() == 'ilconsultationhoursgui') {
850 return false;
851 }
852 return true;
853 }

Referenced by executeCommand().

+ 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 356 of file class.ilCalendarPresentationGUI.php.

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

References $ctrl, Vendor\Package\$f, $lng, $toolbar, $ui, and IL_CAL_DATE.

Referenced by executeCommand().

+ Here is the caller graph for this function:

◆ synchroniseExternalCalendars()

ilCalendarPresentationGUI::synchroniseExternalCalendars ( )
protected

Sync external calendars.

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

808 {
810
811 if (!ilCalendarSettings::_getInstance()->isWebCalSyncEnabled()) {
812 return false;
813 }
814 // @todo make this thread safe
815
816 $limit = new ilDateTime(time(), IL_CAL_UNIX);
817 $limit->increment(IL_CAL_HOUR, -1 * ilCalendarSettings::_getInstance()->getWebCalSyncHours());
818
820 foreach ($cats->getCategoriesInfo() as $cat_id => $info) {
821 if ($info['remote']) {
822 // Check for execution
823 $category = new ilCalendarCategory($cat_id);
824
825 if (
826 $category->getRemoteSyncLastExecution()->isNull() ||
827 ilDateTime::_before($category->getRemoteSyncLastExecution(), $limit)
828 ) {
829 // update in any case to avoid multiple updates of invalid calendar sources.
830 $category->setRemoteSyncLastExecution(new ilDateTime(time(), IL_CAL_UNIX));
831 $category->update();
832
833 include_once './Services/Calendar/classes/class.ilCalendarRemoteReader.php';
834 $remote = new ilCalendarRemoteReader($category->getRemoteUrl());
835 $remote->setUser($category->getRemoteUser());
836 $remote->setPass($category->getRemotePass());
837 $remote->read();
838 $remote->import($category);
839 break;
840 }
841 }
842 }
843 }
const IL_CAL_HOUR
Reader for remote ical calendars.
@classDescription Date and time handling
static _before(ilDateTime $start, ilDateTime $end, $a_compare_field='', $a_tz='')
compare two dates and check start is before end This method does not consider tz offsets.

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

Referenced by executeCommand().

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

Field Documentation

◆ $ctrl

ilCalendarPresentationGUI::$ctrl
protected

◆ $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.

◆ $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: