ILIAS  release_9 Revision v9.13-25-g2c18ec4c24f
class.ilObjSessionGUI.php
Go to the documentation of this file.
1 <?php
2 
19 declare(strict_types=1);
20 
33 {
34  protected \ILIAS\DI\UIServices $ui;
36  protected \ILIAS\FileUpload\FileUpload $upload;
37  protected ilHelpGUI $help;
38  protected \ILIAS\HTTP\Services $http;
39  protected \ILIAS\Refinery\Factory $refinery;
40 
41  public ilLanguage $lng;
42  public ilCtrl $ctrl;
44  protected ilObjUser $user;
45  public ilTree $tree;
51  protected ilTabsGUI $tabs_gui;
54 
55  protected int $container_ref_id = 0;
56  protected int $container_obj_id = 0;
57  protected ?ilPropertyFormGUI $form = null;
59  protected ?ilEventRecurrence $rec = null;
60  protected ?ilEventItems $event_items = null;
61  protected ?ilEventParticipants $event_part = null;
62  protected int $requested_ref_id = 0;
63  protected int $requested_user_id = 0;
64  protected int $requested_file_id = 0;
65  protected int $requested_offset = 0;
66  protected string $requested_sort_by = "";
67  protected string $requested_sort_order = "";
68  protected array $requested_items = [];
69 
70  public function __construct($a_data, $a_id, $a_call_by_reference, $a_prepare_output = true)
71  {
72  global $DIC;
73 
74  $this->ctrl = $DIC->ctrl();
75  $this->lng = $DIC->language();
76  $this->tpl = $DIC->ui()->mainTemplate();
77  $this->user = $DIC->user();
78  $this->tree = $DIC->repositoryTree();
79  $this->access = $DIC->access();
80  $this->toolbar = $DIC->toolbar();
81  $this->ilErr = $DIC["ilErr"];
82  $this->object_service = $DIC->object();
83  $this->objDefinition = $DIC['objDefinition'];
84  $this->tabs_gui = $DIC->tabs();
85  $this->locator = $DIC["ilLocator"];
86  $this->rbacreview = $DIC->rbac()->review();
87  $this->event = $DIC->event();
88  $this->upload = $DIC->upload();
89  $this->help = $DIC->help();
90  $this->http = $DIC->http();
91  $this->refinery = $DIC->refinery();
92 
93  $this->type = "sess";
94  parent::__construct($a_data, $a_id, $a_call_by_reference, $a_prepare_output);
95 
96  $this->lng->loadLanguageModule("event");
97  $this->lng->loadLanguageModule('crs');
98  $this->lng->loadLanguageModule('trac');
99  $this->lng->loadLanguageModule('sess');
100 
101  if ($this->http->wrapper()->query()->has('ref_id')) {
102  $this->requested_ref_id = $this->http->wrapper()->query()->retrieve(
103  'ref_id',
104  $this->refinery->kindlyTo()->int()
105  );
106  }
107 
108  if ($this->http->wrapper()->query()->has('user_id')) {
109  $this->requested_user_id = $this->http->wrapper()->query()->retrieve(
110  'user_id',
111  $this->refinery->kindlyTo()->int()
112  );
113  }
114 
115  if ($this->http->wrapper()->post()->has('file_id')) {
116  $this->requested_file_id = $this->http->wrapper()->post()->retrieve(
117  'file_id',
118  $this->refinery->kindlyTo()->int()
119  );
120  } elseif ($this->http->wrapper()->query()->has('file_id')) {
121  $this->requested_file_id = $this->http->wrapper()->query()->retrieve(
122  'file_id',
123  $this->refinery->kindlyTo()->int()
124  );
125  }
126 
127  if ($this->http->wrapper()->query()->has('offset')) {
128  $this->requested_offset = $this->http->wrapper()->query()->retrieve(
129  'offset',
130  $this->refinery->kindlyTo()->int()
131  );
132  }
133 
134  if ($this->http->wrapper()->query()->has('sort_by')) {
135  $this->requested_sort_by = $this->http->wrapper()->query()->retrieve(
136  'sort_by',
137  $this->refinery->kindlyTo()->string()
138  );
139  }
140 
141  if ($this->http->wrapper()->query()->has('sort_order')) {
142  $this->requested_sort_order = $this->http->wrapper()->query()->retrieve(
143  'sort_order',
144  $this->refinery->kindlyTo()->string()
145  );
146  }
147 
148  if ($this->http->wrapper()->post()->has('items')) {
149  $this->requested_items = $this->http->wrapper()->post()->retrieve(
150  'items',
151  $this->refinery->kindlyTo()->listOf(
152  $this->refinery->kindlyTo()->int()
153  )
154  );
155  }
156  $this->ui = $DIC->ui();
157  }
158 
159  public function executeCommand(): void
160  {
161  $ilUser = $this->user;
162  $ilCtrl = $this->ctrl;
163  $ilAccess = $this->access;
164 
165  $next_class = $this->ctrl->getNextClass($this);
166  $cmd = $this->ctrl->getCmd();
167 
168  if (
169  !$this->getCreationMode() &&
170  $ilAccess->checkAccess('read', '', $this->requested_ref_id)
171  ) {
172  $GLOBALS['DIC']['ilNavigationHistory']->addItem(
173  $this->requested_ref_id,
174  ilLink::_getLink($this->requested_ref_id, 'sess'),
175  'sess',
176  $this->object->getPresentationTitle()
177  );
178  }
179 
180  $this->prepareOutput();
181  switch ($next_class) {
182  case 'ilsessionmembershipgui':
183  $this->tabs_gui->activateTab('members');
184  $mem_gui = new ilSessionMembershipGUI($this, $this->object);
185  $this->ctrl->forwardCommand($mem_gui);
186  break;
187 
188  case "ilinfoscreengui":
189  $this->checkPermission("visible");
190  $this->infoScreen(); // forwards command
191  break;
192 
193  case 'ilobjectmetadatagui':
194  $this->checkPermission('edit_metadata');
195  $this->tabs_gui->activateTab('metadata');
196  $md_gui = new ilObjectMetaDataGUI($this->object);
197  $this->ctrl->forwardCommand($md_gui);
198  break;
199 
200  case 'ilpermissiongui':
201  $this->tabs_gui->setTabActive('perm_settings');
202  $perm_gui = new ilPermissionGUI($this);
203  $ret = $this->ctrl->forwardCommand($perm_gui);
204  break;
205 
206  case 'ilobjectcopygui':
207  $cp = new ilObjectCopyGUI($this);
208  $cp->setType('sess');
209  $this->ctrl->forwardCommand($cp);
210  break;
211 
212  case "ilexportgui":
213  $this->tabs_gui->setTabActive("export");
214  $exp_gui = new ilExportGUI($this);
215  $exp_gui->addFormat("xml");
216  $ret = $this->ctrl->forwardCommand($exp_gui);
217  break;
218 
219  case "ilcommonactiondispatchergui":
221  $this->ctrl->forwardCommand($gui);
222  break;
223 
224  case 'ilmembershipgui':
225  $this->ctrl->setReturn($this, 'members');
226  $mem = new ilMembershipMailGUI($this);
227  $this->ctrl->forwardCommand($mem);
228  break;
229 
230  case "illearningprogressgui":
231  $new_gui = new ilLearningProgressGUI(
233  $this->object->getRefId(),
234  $this->requested_user_id ?: $ilUser->getId()
235  );
236  $this->ctrl->forwardCommand($new_gui);
237  $this->tabs_gui->setTabActive('learning_progress');
238  break;
239 
240  case "ilpropertyformgui":
241  // only case is currently adv metadata internal link in info settings, see #24497
242  if (!is_object($this->object)) {
243  $form = $this->initCreateForm("sess");
244  } else {
245  $form = $this->initForm("edit");
246  if ($form === true) {
247  $form = $this->form;
248  }
249  }
250  $ilCtrl->forwardCommand($form);
251  break;
252 
253  case "ilbookinggatewaygui":
254  $tree = $this->tree;
255  $parent_id = $tree->getParentId($this->requested_ref_id);
256 
257  $this->tabs_gui->activateTab('obj_tool_setting_booking');
258  $gui = new ilBookingGatewayGUI($this, $parent_id);
259  $this->ctrl->forwardCommand($gui);
260  break;
261 
262  default:
263  if ($cmd == "applyFilter") {
264  $this->$cmd();
265  } elseif ($cmd == "resetFilter") {
266  $this->$cmd();
267  }
268  if (!$cmd) {
269  $cmd = "infoScreen";
270  }
271  $cmd .= "Object";
272  $this->$cmd();
273 
274  break;
275  }
276 
277  $this->addHeaderAction();
278  }
279 
280  protected function renderObject(): void
281  {
282  $this->infoScreenObject();
283  }
284 
285  protected function membersObject(): void
286  {
287  $this->ctrl->redirectByClass('ilSessionMembershipGUI', 'participants');
288  }
289 
290  public function getCurrentObject(): ilObjSession
291  {
296 
297  return $object;
298  }
299 
300  public function prepareOutput(bool $show_sub_objects = true): bool
301  {
302  parent::prepareOutput($show_sub_objects);
303 
304  if (!$this->getCreationMode()) {
305  $title = strlen($this->object->getTitle()) ? (': ' . $this->object->getTitle()) : '';
306 
307  $this->tpl->setTitle(
308  $this->object->getFirstAppointment()->appointmentToString() . $title
309  );
310  }
311  return true;
312  }
313 
314  public function registerObject(): void
315  {
316  $ilUser = $this->user;
317  $ilAppEventHandler = $this->event;
318 
319  $this->checkPermission('visible');
320 
321  $part = ilParticipants::getInstance($this->getCurrentObject()->getRefId());
322 
323  $event_part = new ilEventParticipants($this->getCurrentObject()->getId());
324  $event_part->updateExcusedForUser($ilUser->getId(), false);
325 
326  if (
327  $this->getCurrentObject()->isRegistrationUserLimitEnabled() &&
328  $this->getCurrentObject()->getRegistrationMaxUsers() &&
329  (count($event_part->getRegisteredParticipants()) >= $this->getCurrentObject()->getRegistrationMaxUsers())
330  ) {
331  if (!$this->getCurrentObject()->isRegistrationWaitingListEnabled()) {
332  $this->tpl->setOnScreenMessage('failure', $this->lng->txt('sess_reg_max_users_exceeded'), true);
333  $this->ctrl->redirect($this, 'infoScreen');
334  }
335  $wait = new ilSessionWaitingList($this->getCurrentObject()->getId());
336  $wait->addToList($ilUser->getId());
337  $this->ctrl->redirect($this, 'infoScreen');
338  }
339 
340 
341  switch ($this->getCurrentObject()->getRegistrationType()) {
343  $this->ctrl->redirect($this, 'info');
344  break;
345 
347  $part->register($ilUser->getId());
348  $this->tpl->setOnScreenMessage('success', $this->lng->txt('event_registered'), true);
349 
350  $ilAppEventHandler->raise(
351  "Modules/Session",
352  'enter',
353  array(
354  'obj_id' => $this->getCurrentObject()->getId(),
355  'ref_id' => $this->getCurrentObject()->getRefId(),
356  'usr_id' => $ilUser->getId()
357  )
358  );
359 
360  $this->ctrl->redirect($this, 'infoScreen');
361  break;
362 
364  $this->tpl->setOnScreenMessage('success', $this->lng->txt('sess_registered_confirm'), true);
365  $part->addSubscriber($ilUser->getId());
366 
367  $ilAppEventHandler->raise(
368  "Modules/Session",
369  'register',
370  array(
371  'obj_id' => $this->getCurrentObject()->getId(),
372  'ref_id' => $this->getCurrentObject()->getRefId(),
373  'usr_id' => $ilUser->getId()
374  )
375  );
376 
377  $this->ctrl->redirect($this, 'infoScreen');
378  break;
379  }
380  }
381 
382  public function joinObject(): void
383  {
384  $ilUser = $this->user;
385 
386  $this->checkPermission('read');
387 
388  if ($ilUser->isAnonymous()) {
389  $this->ctrl->redirect($this, 'infoScreen');
390  }
391 
392  if (ilEventParticipants::_isRegistered($ilUser->getId(), $this->object->getId())) {
393  ilSession::set("sess_hide_info", true);
394  ilEventParticipants::_unregister($ilUser->getId(), $this->object->getId());
395  $this->tpl->setOnScreenMessage('success', $this->lng->txt('event_unregistered'), true);
396  } else {
397  ilEventParticipants::_register($ilUser->getId(), $this->object->getId());
398  $this->tpl->setOnScreenMessage('success', $this->lng->txt('event_registered'), true);
399  }
400 
401  $this->ctrl->redirect($this, 'infoScreen');
402  }
403 
404  public function unregisterObject(bool $a_refuse_participation = false): void
405  {
406  $ilUser = $this->user;
407  $ilAppEventHandler = $this->event;
408  $access = $this->access;
409  $tree = $this->tree;
410 
411  $part = ilSessionParticipants::getInstance($this->object->getRefId());
412  if ($part->isSubscriber($ilUser->getId())) {
413  $part->deleteSubscriber($ilUser->getId());
414  }
415 
416  $part->unregister($ilUser->getId());
417 
418  if ($a_refuse_participation) {
419  $event_part = new \ilEventParticipants($this->object->getId());
420  $event_part->updateExcusedForUser($ilUser->getId(), true);
421  }
422 
423  ilSessionWaitingList::deleteUserEntry($ilUser->getId(), $this->getCurrentObject()->getId());
424 
425  // check for visible permission of user
427  $access->clear();
428  $has_access = $access->checkAccessOfUser(
429  $ilUser->getId(),
430  'visible',
431  '',
432  $this->object->getRefId()
433  );
434  if (!$has_access) {
435  $parent = $tree->getParentId($this->object->getRefId());
436  $this->redirectToRefId($parent);
437  return;
438  }
439 
440  $ilAppEventHandler->raise(
441  "Modules/Session",
442  'unregister',
443  array(
444  'obj_id' => $this->getCurrentObject()->getId(),
445  'ref_id' => $this->getCurrentObject()->getRefId(),
446  'usr_id' => $ilUser->getId()
447  )
448  );
449  if ($a_refuse_participation) {
450  $this->tpl->setOnScreenMessage('info', $this->lng->txt('sess_participation_refused_info'), true);
451  } else {
452  $this->tpl->setOnScreenMessage('success', $this->lng->txt('event_unregistered'), true);
453  }
454  $this->ctrl->returnToParent($this);
455  }
456 
457  public static function _goto(string $a_target): void
458  {
459  global $DIC;
460  $main_tpl = $DIC->ui()->mainTemplate();
461 
462  $ilAccess = $DIC->access();
463  $lng = $DIC->language();
464 
465  $ilCtrl = $DIC->ctrl();
466  $parts = explode('_', $a_target);
467  $a_target = (int) $parts[0];
468 
469  if ($ilAccess->checkAccess('write', '', $a_target)) {
470  if (isset($parts[1]) && 'part' === $parts[1]) {
471  $ilCtrl->setTargetScript('ilias.php');
472  $ilCtrl->setParameterByClass('ilSessionMembershipGUI', 'ref_id', $a_target);
473  $ilCtrl->setTargetScript('ilias.php');
474  $ilCtrl->redirectByClass(array('ilRepositoryGUI', __CLASS__, 'ilSessionMembershipGUI'));
475  }
476  }
477 
478  if ($ilAccess->checkAccess('visible', "", $a_target)) {
479  ilObjectGUI::_gotoRepositoryNode($a_target, "infoScreen");
480  } elseif ($ilAccess->checkAccess("read", "", ROOT_FOLDER_ID)) {
481  $main_tpl->setOnScreenMessage('failure', sprintf(
482  $lng->txt("msg_no_perm_read_item"),
484  ), true);
486  }
487  }
488 
494  public function infoScreenObject(): void
495  {
496  $this->ctrl->setCmd("showSummary");
497  $this->ctrl->setCmdClass("ilinfoscreengui");
498  $this->infoScreen();
499  }
500 
501  public function modifyItemGUI(ilObjectListGUI $a_item_list_gui, array $a_item_data, bool $a_show_path): void
502  {
503  $tree = $this->tree;
504 
505  // if folder is in a course, modify item list gui according to course requirements
506  if ($course_ref_id = $tree->checkForParentType($this->object->getRefId(), 'crs')) {
507  // #10611
508  ilObjectActivation::addListGUIActivationProperty($a_item_list_gui, $a_item_data);
509 
510  $course_obj_id = ilObject::_lookupObjId($course_ref_id);
512  $a_item_list_gui,
513  get_class($this),
514  $a_item_data,
515  $a_show_path,
516  $course_ref_id,
517  $course_obj_id,
518  $this->object->getRefId()
519  );
520  }
521  }
522 
527  public function showJoinRequestButtonInCalendar(ilToolbarGUI $a_ilToolbar): bool
528  {
529  return $this->showJoinRequestButton($a_ilToolbar);
530  }
531 
532  protected function refuseParticipationObject(): void
533  {
534  $this->unregisterObject(true);
535  }
536 
537  protected function showJoinRequestButton(?ilToolbarGUI $ilToolbar = null): bool
538  {
539  $ilUser = $this->user;
540 
541  if (!$ilToolbar) {
542  $ilToolbar = $this->toolbar;
543  }
544 
545  if (!$this->getCurrentObject()->enabledRegistrationForUsers() || $ilUser->isAnonymous()) {
546  return false;
547  }
548 
549  $part = ilParticipants::getInstance($this->getCurrentObject()->getRefId());
550 
551  $this->ctrl->setParameter($this, "ref_id", $this->getCurrentObject()->getRefId());
552 
553  $btn_excused = null;
554  if ($this->object->isCannotParticipateOptionEnabled()) {
555  $btn_excused = $this->ui->factory()->button()->standard(
556  $this->lng->txt('sess_bt_refuse'),
557  $this->ctrl->getLinkTarget($this, 'refuseParticipation')
558  );
559  }
560 
561 
562  if (ilEventParticipants::_isRegistered($ilUser->getId(), $this->getCurrentObject()->getId())) {
563  if (!is_null($btn_excused)) {
564  $ilToolbar->addComponent($btn_excused);
565  }
566  return true;
567  } elseif ($part->isSubscriber($ilUser->getId())) {
568  if (!is_null($btn_excused)) {
569  $ilToolbar->addComponent($btn_excused);
570  }
571  return true;
572  } elseif (ilSessionWaitingList::_isOnList($ilUser->getId(), $this->getCurrentObject()->getId())) {
573  if (!is_null($btn_excused)) {
574  $ilToolbar->addComponent($btn_excused);
575  }
576  return true;
577  }
578 
579  $event_part = new ilEventParticipants($this->getCurrentObject()->getId());
580 
581  if (
582  $this->getCurrentObject()->isRegistrationUserLimitEnabled() &&
583  $this->getCurrentObject()->getRegistrationMaxUsers() &&
584  (count($event_part->getRegisteredParticipants()) >= $this->getCurrentObject()->getRegistrationMaxUsers())
585  ) {
586  if ($this->getCurrentObject()->isRegistrationWaitingListEnabled()) {
587  $this->tpl->setOnScreenMessage('info', $this->lng->txt('sess_reg_max_users_exceeded_wl'));
588  $btn_attend = $this->ui->factory()->button()->primary(
589  $this->lng->txt("mem_add_to_wl"),
590  $this->ctrl->getLinkTargetByClass(array("ilRepositoryGUI", "ilObjSessionGUI"), "register")
591  );
592  $ilToolbar->addComponent($btn_attend);
593  if (!$event_part->isExcused($ilUser->getId()) && !is_null($btn_excused)) {
594  $ilToolbar->addComponent($btn_excused);
595  }
596  } else {
597  $this->tpl->setOnScreenMessage('info', $this->lng->txt('sess_reg_max_users_exceeded'));
598  }
599  return true;
600  } elseif (is_null(ilSession::get("sess_hide_info"))) {
601  $this->tpl->setOnScreenMessage('info', $this->lng->txt('sess_join_info'));
602  $btn_attend = $this->ui->factory()->button()->primary(
603  $this->lng->txt("join_session"),
604  $this->ctrl->getLinkTargetByClass(array("ilRepositoryGUI", "ilObjSessionGUI"), "register")
605  );
606  $ilToolbar->addComponent($btn_attend);
607  if (!$event_part->isExcused($ilUser->getId()) && !is_null($btn_excused)) {
608  $ilToolbar->addComponent($btn_excused);
609  }
610  return true;
611  }
612  return false;
613  }
614 
615  protected function infoScreen(): void
616  {
617  $ilUser = $this->user;
618  $tree = $this->tree;
619  $lng = $this->lng;
620 
621  $this->checkPermission('visible');
622  $this->tabs_gui->setTabActive('info_short');
623 
624  $this->showJoinRequestButton();
625 
626  $info = new ilInfoScreenGUI($this);
627  $info->enableBookingInfo(true);
628 
629  $eventItems = ilObjectActivation::getItemsByEvent($this->object->getId());
630  $parent_id = $tree->getParentId($this->object->getRefId());
631  $parent_id = ilObject::_lookupObjId($parent_id);
632  $eventItems = ilContainerSorting::_getInstance($parent_id)->sortSubItems(
633  'sess',
634  $this->object->getId(),
635  $eventItems
636  );
637 
638  $lng->loadLanguageModule("cntr");// #14158
639 
640  $html = '';
641  foreach ($eventItems as $item) {
645  $list_gui = ilSessionObjectListGUIFactory::factory($item['type']);
646  $list_gui->setContainerObject($this);
647 
648  $this->modifyItemGUI($list_gui, $item, false);
649 
650  $html .= $list_gui->getListItemHTML(
651  (int) $item['ref_id'],
652  (int) $item['obj_id'],
653  (string) $item['title'],
654  (string) $item['description']
655  );
656  }
657 
658  if (strlen($html)) {
659  $info->addSection($this->lng->txt('event_materials'));
660  $info->addProperty(
661  '&nbsp;',
662  $html
663  );
664  }
665 
666 
667 
668  // Session information
669  if (strlen($this->object->getLocation()) || strlen($this->object->getDetails())) {
670  $info->addSection($this->lng->txt('event_section_information'));
671  }
672  if (strlen($location = $this->object->getLocation())) {
673  $info->addProperty(
674  $this->lng->txt('event_location'),
675  ilUtil::makeClickable(nl2br($this->object->getLocation()), true)
676  );
677  }
678  if (strlen($this->object->getDetails())) {
679  $info->addProperty(
680  $this->lng->txt('event_details_workflow'),
681  ilUtil::makeClickable(nl2br($this->object->getDetails()), true)
682  );
683  }
684 
685  $this->record_gui = new ilAdvancedMDRecordGUI(ilAdvancedMDRecordGUI::MODE_INFO, 'sess', $this->object->getId());
686  $this->record_gui->setInfoObject($info);
687  $this->record_gui->parse();
688 
689  // meta data
690  $info->addMetaDataSections($this->object->getId(), 0, $this->object->getType());
691 
692 
693  // Tutor information
694  if ($this->object->hasTutorSettings()) {
695  $info->addSection($this->lng->txt('event_tutor_data'));
696  if (strlen($fullname = $this->object->getName())) {
697  $info->addProperty(
698  $this->lng->txt('event_lecturer'),
699  $fullname
700  );
701  }
702  if (strlen($email = $this->object->getEmail())) {
703  $info->addProperty(
704  $this->lng->txt('tutor_email'),
705  $email
706  );
707  }
708  if (strlen($phone = $this->object->getPhone())) {
709  $info->addProperty(
710  $this->lng->txt('tutor_phone'),
711  $phone
712  );
713  }
714  }
715 
716  // support contacts
717  $parts = ilParticipants::getInstance($this->object->getRefId());
718  $contacts = $parts->getContacts();
719  if (count($contacts) > 0) {
720  $info->addSection($this->lng->txt("crs_mem_contacts"));
721  foreach ($contacts as $contact) {
722  $pgui = new ilPublicUserProfileGUI($contact);
723  $pgui->setBackUrl($this->ctrl->getLinkTargetByClass("ilinfoscreengui"));
724  $pgui->setEmbedded(true);
725  $info->addProperty("", $pgui->getHTML());
726  }
727  }
728 
729  // forward the command
730  $this->ctrl->forwardCommand($info);
731 
732  // store read event
734  $this->object->getType(),
735  $this->object->getRefId(),
736  $this->object->getId(),
737  $ilUser->getId()
738  );
739  }
740 
741  protected function initCreateForm($new_type): ilPropertyFormGUI
742  {
743  if (!is_object($this->object)) {
744  $this->object = new ilObjSession();
745  }
746  if (!$this->form instanceof ilPropertyFormGUI) {
747  $this->initForm('create');
748  }
749  return $this->form;
750  }
751 
752  protected function saveAndAssignMaterialsObject(): void
753  {
754  $this->checkPermission('manage_materials');
755  $this->saveObject(false);
756 
757  $this->ctrl->setParameter($this, 'ref_id', $this->object->getRefId());
758  $this->ctrl->setParameter($this, 'new_type', '');
759  $this->ctrl->redirect($this, 'materials');
760  }
761 
762  public function saveObject(bool $a_redirect_on_success = true): void
763  {
764  $this->checkPermission('write');
765  $ilUser = $this->user;
766  $object_service = $this->object_service;
767 
768  $this->object = new ilObjSession();
769 
770  $this->ctrl->saveParameter($this, "new_type");
771 
772  $this->initForm('create');
773  $this->ilErr->setMessage('');
774  if (!$this->form->checkInput()) {
775  $this->tpl->setOnScreenMessage(
777  $this->lng->txt('err_check_input')
778  );
779  $this->form->setValuesByPost();
780  $this->createObject();
781  return;
782  }
783 
784  if ($this->record_gui instanceof \ilAdvancedMDRecordGUI && !$this->record_gui->importEditFormPostValues()
785  ) {
786  $this->ilErr->setMessage($this->lng->txt('err_check_input'));
787  }
788 
789  $this->load();
790  $this->loadRecurrenceSettings();
791 
792  $this->object->validate();
793  $this->object->getFirstAppointment()->validate();
794 
795  if (strlen($this->ilErr->getMessage())) {
796  $this->tpl->setOnScreenMessage('failure', $this->ilErr->getMessage());
797  $this->form->setValuesByPost();
798  $this->createObject();
799  }
800  // Create session
801  $this->object->create();
802  $this->object->createReference();
803  $this->object->putInTree($this->requested_ref_id);
804  $this->object->setPermissions($this->requested_ref_id);
805 
807  $this->object->getId(),
808  $this->form,
809  array(
811  )
812  );
813  if ($this->record_gui instanceof \ilAdvancedMDRecordGUI) {
814  $this->record_gui->writeEditForm($this->object->getId());
815  }
816 
817 
818  // apply didactic template?
819  $dtpl = $this->getDidacticTemplateVar("dtpl");
820  if ($dtpl) {
821  $this->object->applyDidacticTemplate($dtpl);
822  }
823 
824  // #14547 - active is default
825  if (!$this->form->getInput("lp_preset")) {
826  $lp_obj_settings = new ilLPObjSettings($this->object->getId());
828  $lp_obj_settings->update(false);
829  }
830 
831  // create appointment
832  $this->object->getFirstAppointment()->setSessionId($this->object->getId());
833  $this->object->getFirstAppointment()->create();
834 
835  $this->handleFileUpload();
836 
837  $object_service->commonSettings()->legacyForm($this->form, $this->object)->saveTileImage();
838 
839  $this->createRecurringSessions((bool) $this->form->getInput("lp_preset"));
840 
841  if ($a_redirect_on_success) {
842  $this->tpl->setOnScreenMessage('info', $this->lng->txt('event_add_new_event'), true);
843  $this->ctrl->returnToParent($this);
844  }
845  }
846 
847  public function handleFileUpload(): void
848  {
849  $tree = $this->tree;
850 
851  $ev = new ilEventItems($this->object->getId());
852  $items = $ev->getItems();
853 
854  $counter = 0;
855  while (true) {
856  if (!isset($_FILES['files']['name'][$counter])) {
857  break;
858  }
859  if (!strlen($_FILES['files']['name'][$counter])) {
860  $counter++;
861  continue;
862  }
863 
864  $file = new ilObjFile();
865  $file->setTitle(ilUtil::stripSlashes($_FILES['files']['name'][$counter]));
866  $file->setDescription('');
867  $file->setFileName(ilUtil::stripSlashes($_FILES['files']['name'][$counter]));
868  $file->create();
869  $new_ref_id = $file->createReference();
870  $file->putInTree($tree->getParentId($this->object->getRefId()));
871  $file->setPermissions($tree->getParentId($this->object->getRefId()));
872 
873  $upload = $this->upload;
874  if (!$upload->hasBeenProcessed()) {
875  $upload->process();
876  }
877  $file->getUploadFile(
878  $_FILES['files']['tmp_name'][$counter],
879  $_FILES['files']['name'][$counter]
880  );
881 
882  $items[] = $new_ref_id;
883  $counter++;
884  }
885 
886  $ev->setItems($items);
887  $ev->update();
888  }
889 
890  protected function createRecurringSessions(bool $a_activate_lp = true): bool
891  {
892  $tree = $this->tree;
893 
894  if (!$this->rec->getFrequenceType()) {
895  return true;
896  }
897  $calc = new ilCalendarRecurrenceCalculator($this->object->getFirstAppointment(), $this->rec);
898 
899  $period_start = clone $this->object->getFirstAppointment()->getStart();
900 
901 
902  $period_end = clone $this->object->getFirstAppointment()->getStart();
903  $period_end->increment(IL_CAL_YEAR, 5);
904  $date_list = $calc->calculateDateList($period_start, $period_end);
905 
906  $period_diff = $this->object->getFirstAppointment()->getEnd()->get(IL_CAL_UNIX) -
907  $this->object->getFirstAppointment()->getStart()->get(IL_CAL_UNIX);
908  $parent_id = $tree->getParentId($this->object->getRefId());
909 
910  $evi = new ilEventItems($this->object->getId());
911  $eitems = $evi->getItems();
912 
913  $counter = 0;
914  foreach ($date_list->get() as $date) {
915  if (!$counter++) {
916  continue;
917  }
918 
919  $new_obj = $this->object->cloneObject($parent_id);
920 
921  // apply didactic template?
922  $dtpl = $this->getDidacticTemplateVar("dtpl");
923  if ($dtpl) {
924  $new_obj->applyDidacticTemplate($dtpl);
925  }
926 
927  $new_obj->read();
928  $new_obj->getFirstAppointment()->setStartingTime($date->get(IL_CAL_UNIX));
929  $new_obj->getFirstAppointment()->setEndingTime($date->get(IL_CAL_UNIX) + $period_diff);
930  $new_obj->getFirstAppointment()->update();
931  $new_obj->update();
932 
933  // #14547 - active is default
934  if (!$a_activate_lp) {
935  $lp_obj_settings = new ilLPObjSettings($new_obj->getId());
937  $lp_obj_settings->update(false);
938  }
939 
940  $new_evi = new ilEventItems($new_obj->getId());
941  $new_evi->setItems($eitems);
942  $new_evi->update();
943  }
944 
945  return true;
946  }
947 
948  public function editObject(): void
949  {
950  $this->checkPermission('write');
951  $this->tabs_gui->setTabActive('settings');
952 
953  $this->initForm('edit');
954  $this->tpl->addBlockFile('ADM_CONTENT', 'adm_content', 'tpl.sess_edit.html', 'Modules/Session');
955  $this->tpl->setVariable('EVENT_EDIT_TABLE', $this->form->getHTML());
956  }
957 
958  public function updateObject(): void
959  {
960  $this->checkPermission('write');
961  $object_service = $this->object_service;
962 
963  $old_autofill = $this->object->hasWaitingListAutoFill();
964 
965  $this->initForm('edit');
966  $this->ilErr->setMessage('');
967  if (!$this->form->checkInput()) {
968  $this->tpl->setOnScreenMessage(
970  $this->lng->txt('err_check_input')
971  );
972  $this->form->setValuesByPost();
973  $this->editObject();
974  return;
975  }
976 
977  //Mantis 21972: Choose didactic template on settings screen
978  $old_type = ilDidacticTemplateObjSettings::lookupTemplateId($this->object->getRefId());
979 
980  $modified = false;
981  $new_type_info = $this->form->getInput('didactic_type');
982  if ($new_type_info) {
983  $new_type = explode('_', $this->form->getInput('didactic_type'));
984  $new_type = (int) $new_type[1];
985 
986  $modified = ($new_type !== $old_type);
987  }
988 
989  if (
990  $this->record_gui instanceof \ilAdvancedMDRecordGUI &&
991  !$this->record_gui->importEditFormPostValues()
992  ) {
993  $this->tpl->setOnScreenMessage(
995  $this->lng->txt('err_check_input')
996  );
997  $this->form->setValuesByPost();
998  $this->editObject();
999  }
1000 
1001  $this->load();
1002 
1003  $this->object->validate();
1004  $this->object->getFirstAppointment()->validate();
1005 
1006  if (strlen($this->ilErr->getMessage())) {
1007  $this->tpl->setOnScreenMessage('failure', $this->ilErr->getMessage());
1008  $this->editObject();
1009  }
1010  // Update event
1011  $this->object->update();
1012  $this->object->getFirstAppointment()->update();
1013 
1015  $this->object->getId(),
1016  $this->form,
1017  array(
1019  )
1020  );
1021  if ($this->record_gui instanceof \ilAdvancedMDRecordGUI) {
1022  $this->record_gui->writeEditForm();
1023  }
1024  $this->handleFileUpload();
1025 
1026  $object_service->commonSettings()->legacyForm($this->form, $this->object)->saveTileImage();
1027 
1028  // if autofill has been activated trigger process
1029  if (!$old_autofill &&
1030  $this->object->hasWaitingListAutoFill()) {
1031  $this->object->handleAutoFill();
1032  }
1033 
1034  //Mantis 21972: Choose didactic template on settings screen
1035  if (!$modified) {
1036  $this->tpl->setOnScreenMessage('success', $this->lng->txt('event_updated'), true);
1037  $this->ctrl->redirect($this, 'edit');
1038  return;
1039  }
1040 
1041  if ($new_type == 0) {
1042  $new_type_txt = $this->lng->txt('il_sess_status_open');
1043  } else {
1044  $dtpl = new ilDidacticTemplateSetting($new_type);
1045  $new_type_txt = $dtpl->getPresentationTitle($this->lng->getLangKey());
1046  }
1047  $this->tabs_gui->activateTab('settings');
1048 
1049  $confirm = new ilConfirmationGUI();
1050  $confirm->setFormAction($this->ctrl->getFormAction($this));
1051  $confirm->setHeaderText($this->lng->txt('sess_warn_sess_type_changed'));
1052  $confirm->addItem(
1053  'sess_type',
1054  (string) $new_type,
1055  $this->lng->txt('sess_info_new_sess_type') . ': ' . $new_type_txt
1056  );
1057  $confirm->setConfirm($this->lng->txt('sess_change_type'), 'updateSessionType');
1058  $confirm->setCancel($this->lng->txt('cancel'), 'edit');
1059 
1060  $this->tpl->setContent($confirm->getHTML());
1061  }
1062 
1066  public function updateSessionTypeObject(): void
1067  {
1068  $this->checkPermission('write');
1070  $this->object->getRefId(),
1071  (int) $this->http->request()->getParsedBody()['sess_type']
1072  );
1073 
1074  $this->tpl->setOnScreenMessage('success', $this->lng->txt('settings_saved'), true);
1075  $this->ctrl->redirect($this, 'edit');
1076  }
1077 
1081  protected function initContainer(bool $a_init_participants = false)
1082  {
1083  $tree = $this->tree;
1084 
1085  $is_course = $is_group = false;
1086 
1087  // #13178
1088  $this->container_ref_id = $tree->checkForParentType($this->object->getRefId(), 'grp');
1089  if ($this->container_ref_id) {
1090  $is_group = true;
1091  }
1092  if (!$this->container_ref_id) {
1093  $this->container_ref_id = $tree->checkForParentType($this->object->getRefId(), 'crs');
1094  if ($this->container_ref_id) {
1095  $is_course = true;
1096  }
1097  }
1098  if (!$this->container_ref_id) {
1099  $this->tpl->setOnScreenMessage('failure', 'No container object found. Aborting');
1100  return true;
1101  }
1102  $this->container_obj_id = ilObject::_lookupObjId($this->container_ref_id);
1103 
1104  if ($a_init_participants && $this->container_obj_id) {
1105  if ($is_course) {
1106  return ilCourseParticipants::_getInstanceByObjId($this->container_obj_id);
1107  } elseif ($is_group) {
1108  return ilGroupParticipants::_getInstanceByObjId($this->container_obj_id);
1109  }
1110  }
1111 
1112  return false;
1113  }
1114 
1115  public function materialsObject(): void
1116  {
1117  $this->checkPermission('manage_materials');
1118  $tree = $this->tree;
1119  $objDefinition = $this->objDefinition;
1120 
1121  $this->tabs_gui->activateTab('materials');
1122 
1123  // #11337 - support ANY parent container (crs, grp, fld)
1124  $parent_ref_id = $tree->getParentId($this->object->getRefId());
1125 
1126  $gui = new ilObjectAddNewItemGUI($parent_ref_id);
1127  $gui->setDisabledObjectTypes(
1128  array_merge(
1129  [
1130  'itgr', 'sess'
1131  ],
1132  $objDefinition->getSideBlockTypes()
1133  )
1134  );
1135  $gui->setAfterCreationCallback($this->ref_id);
1136  $gui->render();
1137 
1138  $this->event_items = new ilEventItems($this->object->getId());
1139 
1140  $tbl = new ilSessionMaterialsTableGUI($this, "materials");
1141 
1142  $tbl->setDisableFilterHiding(true);
1143 
1144  $tbl->addMultiCommand('saveMaterials', $this->lng->txt('sess_assign'));
1145  $tbl->addMultiCommand("removeMaterials", $this->lng->txt("remove"));
1146 
1147  $tbl->setTitle($this->lng->txt("event_assign_materials_table"));
1148  $tbl->setDescription($this->lng->txt('event_assign_materials_info'));
1149 
1150  $tbl->setMaterialItems($this->event_items->getItems());
1151  $tbl->setContainerRefId($this->getContainerRefId());
1152  $data = $tbl->getDataFromDb();
1153  $tbl->setMaterials($data);
1154 
1155  $this->tpl->setContent($tbl->getHTML());
1156  }
1157 
1158  public function applyFilter(): void
1159  {
1160  $tbl = new ilSessionMaterialsTableGUI($this, "materials");
1161  $tbl->writeFilterToSession(); // writes filter to session
1162  $tbl->resetOffset(); // sets record offest to 0 (first page)
1163  $this->ctrl->redirect($this, "materials");
1164  }
1165 
1166  public function resetFilter(): void
1167  {
1168  $tbl = new ilSessionMaterialsTableGUI($this, "materials");
1169  $tbl->resetOffset(); // sets record offest to 0 (first page)
1170  $tbl->resetFilter(); // clears filter
1171  $this->ctrl->redirect($this, "materials");
1172  }
1173 
1174  public function removeMaterialsObject(): void
1175  {
1176  $this->checkPermission('manage_materials');
1177  $items_checked = $this->requested_items;
1178 
1179  $this->event_items = new ilEventItems($this->object->getId());
1180  $this->event_items->removeItems($items_checked);
1181 
1182  $this->postUpdateMaterials();
1183  }
1184 
1185  public function saveMaterialsObject(): void
1186  {
1187  $this->checkPermission('manage_materials');
1188  $this->event_items = new ilEventItems($this->object->getId());
1189  $db_items = $this->event_items->getItems();
1190 
1191  $list_items_checked = $this->requested_items;
1192  $list_items_checked = array_map('intval', $list_items_checked);
1193 
1194  $items_to_save = array_merge($db_items, $list_items_checked);
1195  $items_to_save = array_unique($items_to_save);
1196 
1197  $this->event_items->setItems($items_to_save);
1198  $this->event_items->update();
1199  $this->postUpdateMaterials();
1200  }
1201 
1205  public function postUpdateMaterials(): void
1206  {
1207  $tbl = new ilSessionMaterialsTableGUI($this, "materials");
1208  $tbl->setOffset(0);
1209  $tbl->storeNavParameter();//remove offset and go to page 1
1210 
1211  $this->tpl->setOnScreenMessage('success', $this->lng->txt('settings_saved'), true);
1212  $this->ctrl->redirect($this, 'materials');
1213  }
1214 
1215  public function attendanceListObject(): void
1216  {
1217  $tpl = $this->tpl;
1218  $ilTabs = $this->tabs_gui;
1219 
1220  $this->checkPermission('manage_members');
1221  $ilTabs->setTabActive('event_edit_members');
1222 
1223  $list = $this->initAttendanceList();
1224  $form = $list->initForm('printAttendanceList');
1225  $tpl->setContent($form->getHTML());
1226  }
1227 
1228  protected function initAttendanceList(): ilAttendanceList
1229  {
1230  $members_obj = $this->initContainer(true);
1231 
1232  $list = new ilAttendanceList(
1233  $this,
1234  $this->object,
1235  $members_obj
1236  );
1237  $list->setId('sessattlst');
1238 
1239  $event_app = $this->object->getFirstAppointment();
1241  $desc = ilDatePresentation::formatPeriod($event_app->getStart(), $event_app->getEnd());
1243  $desc .= " " . $this->object->getTitle();
1244  $list->setTitle($this->lng->txt('sess_attendance_list'), $desc);
1245 
1246  $list->addPreset('mark', $this->lng->txt('trac_mark'), true);
1247  $list->addPreset('comment', $this->lng->txt('trac_comment'), true);
1248  if ($this->object->enabledRegistration()) {
1249  $list->addPreset('registered', $this->lng->txt('event_tbl_registered'), true);
1250  }
1251  $list->addPreset('participated', $this->lng->txt('event_tbl_participated'), true);
1252  $list->addBlank($this->lng->txt('sess_signature'));
1253 
1254  $list->addUserFilter('registered', $this->lng->txt('event_list_registered_only'));
1255 
1256  return $list;
1257  }
1258 
1259  protected function printAttendanceListObject(): void
1260  {
1261  $this->checkPermission('manage_members');
1262 
1263  $list = $this->initAttendanceList();
1264  $list->initFromForm();
1265  $list->setCallback(array($this, 'getAttendanceListUserData'));
1266 
1267  $this->event_part = new ilEventParticipants($this->object->getId());
1268  $list->getFullscreenHTML();
1269  }
1270 
1271  public function getAttendanceListUserData(int $a_user_id, array $a_filters): ?array
1272  {
1273  $data = $this->event_part->getUser($a_user_id);
1274 
1275  if ($a_filters && $a_filters["registered"] && !$data["registered"]) {
1276  return null;
1277  }
1278 
1279  $data['registered'] = $data['registered'] ?
1280  $this->lng->txt('yes') :
1281  $this->lng->txt('no');
1282  $data['participated'] = $data['participated'] ?
1283  $this->lng->txt('yes') :
1284  $this->lng->txt('no');
1285 
1286  return $data;
1287  }
1288 
1289  public function eventsListObject(): void
1290  {
1291  $ilAccess = $this->access;
1292  $ilUser = $this->user;
1293  $tree = $this->tree;
1294 
1295  if (!$ilAccess->checkAccess('manage_members', '', $this->object->getRefId())) {
1296  $this->ilErr->raiseError($this->lng->txt('msg_no_perm_read'), $this->ilErr->MESSAGE);
1297  }
1298 
1299  $this->tpl->addBlockFile('ADM_CONTENT', 'adm_content', 'tpl.sess_list.html', 'Modules/Session');
1300  $this->__showButton($this->ctrl->getLinkTarget($this, 'exportCSV'), $this->lng->txt('event_csv_export'));
1301 
1302  $this->tpl->addBlockFile("EVENTS_TABLE", "events_table", "tpl.table.html");
1303  $this->tpl->addBlockFile('TBL_CONTENT', 'tbl_content', 'tpl.sess_list_row.html', 'Modules/Session');
1304 
1305  $members_obj = $this->initContainer(true);
1306  $members = $members_obj->getParticipants();
1307  $members = ilUtil::_sortIds($members, 'usr_data', 'lastname', 'usr_id');
1308 
1309  // Table
1310  $tbl = new ilTableGUI();
1311  $tbl->setTitle(
1312  $this->lng->txt("event_overview"),
1313  'standard/icon_usr.svg',
1314  $this->lng->txt('obj_usr')
1315  );
1316  $this->ctrl->setParameter($this, 'offset', $this->requested_offset);
1317 
1318  $course_ref_id = $tree->checkForParentType($this->object->getRefId(), 'crs');
1319  $events = [];
1320  foreach ($tree->getSubTree($tree->getNodeData($course_ref_id), false, ['sess']) as $event_id) {
1321  $tmp_event = ilObjectFactory::getInstanceByRefId($event_id, false);
1322  if (!is_object($tmp_event) || $tmp_event->getType() != 'sess') {
1323  continue;
1324  }
1325  $events[] = $tmp_event;
1326  }
1327 
1328  $headerNames = [];
1329  $headerVars = [];
1330  $colWidth = [];
1331 
1332  $headerNames[] = $this->lng->txt('name');
1333  $headerVars[] = "name";
1334  $colWidth[] = '20%';
1335 
1336  for ($i = 1; $i <= count($events); $i++) {
1337  $headerNames[] = $i;
1338  $headerVars[] = "event_" . $i;
1339  $colWidth[] = 80 / count($events) . "%";
1340  }
1341 
1342  $this->tpl->setVariable("FORMACTION", $this->ctrl->getFormAction($this));
1343  $tbl->setHeaderNames($headerNames);
1344  $tbl->setHeaderVars($headerVars, $this->ctrl->getParameterArray($this));
1345  $tbl->setColumnWidth($colWidth);
1346 
1347  $tbl->setOrderColumn($this->requested_sort_by);
1348  $tbl->setOrderDirection($this->requested_sort_order);
1349  $tbl->setOffset($this->requested_offset);
1350  $tbl->setLimit((int) $ilUser->getPref("hits_per_page"));
1351  $tbl->setMaxCount(count($members));
1352  $tbl->setFooter("tblfooter", $this->lng->txt("previous"), $this->lng->txt("next"));
1353 
1354  $sliced_users = array_slice($members, $this->requested_offset, ilSession::get("tbl_limit"));
1355  $tbl->disable('sort');
1356  $tbl->render();
1357 
1358  $counter = 0;
1359  foreach ($sliced_users as $user_id) {
1360  foreach ($events as $event_obj) {
1361  $this->tpl->setCurrentBlock("eventcols");
1362 
1363  $event_part = new ilEventParticipants($this->object->getId());
1364 
1365  {
1366  $this->tpl->setVariable("IMAGE_PARTICIPATED", $event_part->hasParticipated($user_id) ?
1367  ilUtil::getImagePath('standard/icon_ok.svg') :
1368  ilUtil::getImagePath('standard/icon_not_ok.svg'));
1369 
1370  $this->tpl->setVariable("PARTICIPATED", $event_part->hasParticipated($user_id) ?
1371  $this->lng->txt('event_participated') :
1372  $this->lng->txt('event_not_participated'));
1373  }
1374 
1375  $this->tpl->parseCurrentBlock();
1376  }
1377 
1378  $this->tpl->setCurrentBlock("tbl_content");
1379  $name = ilObjUser::_lookupName($user_id);
1380  $this->tpl->setVariable("LASTNAME", $name['lastname']);
1381  $this->tpl->setVariable("FIRSTNAME", $name['firstname']);
1382  $this->tpl->setVariable("LOGIN", ilObjUser::_lookupLogin($user_id));
1383  $this->tpl->parseCurrentBlock();
1384  }
1385 
1386  $this->tpl->setVariable("HEAD_TXT_LEGEND", $this->lng->txt("legend"));
1387  $this->tpl->setVariable("HEAD_TXT_DIGIT", $this->lng->txt("event_digit"));
1388  $this->tpl->setVariable("HEAD_TXT_EVENT", $this->lng->txt("event"));
1389  $this->tpl->setVariable("HEAD_TXT_LOCATION", $this->lng->txt("event_location"));
1390  $this->tpl->setVariable("HEAD_TXT_DATE_TIME", $this->lng->txt("event_date_time"));
1391  $i = 1;
1392  foreach ($events as $event_obj) {
1393  $this->tpl->setCurrentBlock("legend_loop");
1394  $this->tpl->setVariable("LEGEND_DIGIT", $i++);
1395  $this->tpl->setVariable("LEGEND_EVENT_TITLE", $event_obj->getTitle());
1396  $this->tpl->setVariable("LEGEND_EVENT_DESCRIPTION", $event_obj->getDescription());
1397  $this->tpl->setVariable("LEGEND_EVENT_LOCATION", $event_obj->getLocation());
1398  $this->tpl->setVariable("LEGEND_EVENT_APPOINTMENT", $event_obj->getFirstAppointment()->appointmentToString());
1399  $this->tpl->parseCurrentBlock();
1400  }
1401  }
1402 
1403  protected function __showButton(string $cmd, string $text, string $target = ''): void
1404  {
1405  $this->toolbar->addButton($text, $this->ctrl->getLinkTarget($this, $cmd), $target);
1406  }
1407 
1408  protected function initForm(string $a_mode): bool
1409  {
1410  if ($this->form instanceof ilPropertyFormGUI) {
1411  return true;
1412  }
1413  $ilUser = $this->user;
1414  $object_service = $this->object_service;
1415  $this->lng->loadLanguageModule('dateplaner');
1416 
1418 
1419  $this->form = new ilPropertyFormGUI();
1420  $this->form->setMultipart(true);
1421  $this->form->setTableWidth('600px');
1422  $this->form->setFormAction($this->ctrl->getFormAction($this));
1423  $this->form->setMultipart(true);
1424 
1425  $this->form = $this->initDidacticTemplate($this->form);
1426 
1427  $this->lng->loadLanguageModule('dateplaner');
1428  $dur = new ilDateDurationInputGUI($this->lng->txt('cal_fullday'), 'event');
1429  $dur->setRequired(true);
1430  $dur->enableToggleFullTime(
1431  $this->lng->txt('event_fulltime_info'),
1432  $this->object->getFirstAppointment()->enabledFulltime()
1433  );
1434  $dur->setShowTime(true);
1435  $dur->setStart($this->object->getFirstAppointment()->getStart());
1436  $dur->setEnd($this->object->getFirstAppointment()->getEnd());
1437 
1438  $this->form->addItem($dur);
1439 
1440 
1441  // Recurrence
1442  if ($a_mode == 'create') {
1443  if (!is_object($this->rec)) {
1444  $this->rec = new ilEventRecurrence();
1445  }
1446  $rec = new ilRecurrenceInputGUI($this->lng->txt('cal_recurrences'), 'frequence');
1447  $rec->allowUnlimitedRecurrences(false);
1448  $rec->setRecurrence($this->rec);
1449  $this->form->addItem($rec);
1450 
1451  // #14547
1452  $lp = new ilCheckboxInputGUI($this->lng->txt("sess_lp_preset"), "lp_preset");
1453  $lp->setInfo($this->lng->txt("sess_lp_preset_info"));
1454  $lp->setChecked(true);
1455  $this->form->addItem($lp);
1456  }
1457 
1458  $section = new ilFormSectionHeaderGUI();
1459  $section->setTitle($this->lng->txt('event_section_information'));
1460  $this->form->addItem($section);
1461 
1462  // title
1463  $title = new ilTextInputGUI($this->lng->txt('event_title'), 'title');
1464  $title->setRequired(true);
1465  $title->setValue($this->object->getTitle());
1466  $title->setSize(50);
1467  $title->setMaxLength(70);
1468  $this->form->addItem($title);
1469 
1470  // desc
1471  $desc = new ilTextAreaInputGUI($this->lng->txt('event_desc'), 'desc');
1472  $desc->setValue($this->object->getLongDescription());
1473  $desc->setRows(4);
1474  $desc->setCols(50);
1475  $this->form->addItem($desc);
1476 
1477  // location
1478  $desc = new ilTextAreaInputGUI($this->lng->txt('event_location'), 'location');
1479  $desc->setValue($this->object->getLocation());
1480  $desc->setRows(4);
1481  $desc->setCols(50);
1482  $this->form->addItem($desc);
1483 
1484  // workflow
1485  $details = new ilTextAreaInputGUI($this->lng->txt('event_details_workflow'), 'details');
1486  $details->setValue($this->object->getDetails());
1487  $details->setCols(50);
1488  $details->setRows(4);
1489  $this->form->addItem($details);
1490 
1491  if ($a_mode == 'create') {
1492  $this->record_gui = new ilAdvancedMDRecordGUI(
1494  'sess'
1495  );
1496  $this->record_gui->setRefId($this->requested_ref_id);
1497  $this->record_gui->setPropertyForm($this->form);
1498  $this->record_gui->parse();
1499  } elseif ($this->checkPermissionBool('edit_metadata')) {
1500  $this->record_gui = new ilAdvancedMDRecordGUI(
1502  'sess',
1503  $this->object->getId()
1504  );
1505  $this->record_gui->setPropertyForm($this->form);
1506  $this->record_gui->parse();
1507  }
1508 
1509 
1510  // section
1511  $section = new ilFormSectionHeaderGUI();
1512  $section->setTitle($this->lng->txt('event_tutor_data'));
1513  $this->form->addItem($section);
1514 
1515  // name
1516  $tutor_name = new ilTextInputGUI($this->lng->txt('tutor_name'), 'tutor_name');
1517  $tutor_name->setValue($this->object->getName());
1518  $tutor_name->setSize(20);
1519  $tutor_name->setMaxLength(70);
1520  $this->form->addItem($tutor_name);
1521 
1522  // email
1523  $tutor_email = new ilTextInputGUI($this->lng->txt('tutor_email'), 'tutor_email');
1524  $tutor_email->setValue($this->object->getEmail());
1525  $tutor_email->setSize(20);
1526  $tutor_email->setMaxLength(70);
1527  $this->form->addItem($tutor_email);
1528 
1529  // phone
1530  $tutor_phone = new ilTextInputGUI($this->lng->txt('tutor_phone'), 'tutor_phone');
1531  $tutor_phone->setValue($this->object->getPhone());
1532  $tutor_phone->setSize(20);
1533  $tutor_phone->setMaxLength(70);
1534  $this->form->addItem($tutor_phone);
1535 
1536  $section = new ilFormSectionHeaderGUI();
1537  $section->setTitle($this->lng->txt('sess_section_reg'));
1538  $this->form->addItem($section);
1539 
1540  $reg_settings = new ilSessionMembershipRegistrationSettingsGUI(
1541  $this,
1542  $this->object,
1543  array(
1549  )
1550  );
1551  $reg_settings->addMembershipFormElements($this->form, '');
1552 
1553 
1554  $section = new ilFormSectionHeaderGUI();
1555  $section->setTitle($this->lng->txt('event_assign_files'));
1556  $this->form->addItem($section);
1557 
1558  $files = new ilFileWizardInputGUI($this->lng->txt('objs_file'), 'files');
1559  $files->setFilenames(array(0 => ''));
1560  $this->form->addItem($files);
1561 
1562  $section = new ilFormSectionHeaderGUI();
1563  $section->setTitle($this->lng->txt('sess_setting_header_presentation'));
1564  $this->form->addItem($section);
1565 
1566  $object_service->commonSettings()->legacyForm($this->form, $this->object)->addTileImage();
1567 
1568  $features = new ilFormSectionHeaderGUI();
1569  $features->setTitle($this->lng->txt('obj_features'));
1570  $this->form->addItem($features);
1572  $this->object->getId(),
1573  $this->form,
1574  array(
1576  )
1577  );
1578 
1579  $gallery = new ilCheckboxInputGUI($this->lng->txt('sess_show_members'), 'show_members');
1580  $gallery->setChecked($this->object->getShowMembers());
1581  $gallery->setInfo($this->lng->txt('sess_show_participants_info'));
1582  $this->form->addItem($gallery);
1583 
1584 
1585  // Show mail to members type
1586  $mail_type = new ilRadioGroupInputGUI($this->lng->txt('sess_mail_type'), 'mail_type');
1587  $mail_type->setValue((string) $this->object->getMailToMembersType());
1588 
1589  $mail_tutors = new ilRadioOption(
1590  $this->lng->txt('sess_mail_admins_only'),
1592  $this->lng->txt('sess_mail_admins_only_info')
1593  );
1594  $mail_type->addOption($mail_tutors);
1595 
1596  $mail_all = new ilRadioOption(
1597  $this->lng->txt('sess_mail_all'),
1599  $this->lng->txt('sess_mail_all_info')
1600  );
1601  $mail_type->addOption($mail_all);
1602  $this->form->addItem($mail_type);
1603 
1604 
1605 
1606  switch ($a_mode) {
1607  case 'create':
1608  $this->form->setTitle($this->lng->txt('event_table_create'));
1609 
1610  $this->form->addCommandButton('save', $this->lng->txt('event_btn_add'));
1611  $this->form->addCommandButton('saveAndAssignMaterials', $this->lng->txt('event_btn_add_edit'));
1612  $this->form->addCommandButton('cancel', $this->lng->txt('cancel'));
1613 
1614  return true;
1615 
1616  case 'edit':
1617  $this->form->setTitle($this->lng->txt('event_table_update'));
1618 
1619  $this->form->addCommandButton('update', $this->lng->txt('save'));
1620  $this->form->addCommandButton('cancelEdit', $this->lng->txt('cancel'));
1621 
1622  return true;
1623  }
1624  return true;
1625  }
1626 
1627  protected function load(): void
1628  {
1629  $event = $this->form->getItemByPostVar('event');
1630  if ($event->getStart() && $event->getEnd()) {
1631  $this->object->getFirstAppointment()->setStartingTime($event->getStart()->get(IL_CAL_UNIX));
1632  $this->object->getFirstAppointment()->setEndingTime($event->getStart()->get(IL_CAL_UNIX));
1633  $this->object->getFirstAppointment()->setStart($event->getStart());
1634  $this->object->getFirstAppointment()->setEnd($event->getEnd());
1635  $this->object->getFirstAppointment()->toggleFulltime($event->getStart() instanceof ilDate);
1636  }
1637 
1638  $this->object->setTitle($this->form->getInput('title'));
1639  $this->object->setDescription($this->form->getInput('desc'));
1640  $this->object->setLocation($this->form->getInput('location'));
1641  $this->object->setName($this->form->getInput('tutor_name'));
1642  $this->object->setPhone($this->form->getInput('tutor_phone'));
1643  $this->object->setEmail($this->form->getInput('tutor_email'));
1644  $this->object->setDetails($this->form->getInput('details'));
1645 
1646  $this->object->setRegistrationNotificationEnabled((bool) $this->form->getInput('registration_notification'));
1647  $this->object->setRegistrationNotificationOption($this->form->getInput('notification_option'));
1648 
1649  $this->object->setRegistrationType((int) $this->form->getInput('registration_type'));
1650 
1651  switch ($this->object->getRegistrationType()) {
1653  $this->object->enableCannotParticipateOption((bool) $this->form->getInput('show_cannot_participate_direct'));
1654  break;
1656  $this->object->enableCannotParticipateOption((bool) $this->form->getInput('show_cannot_participate_request'));
1657  break;
1658  default:
1659  $this->object->enableCannotParticipateOption(false);
1660  break;
1661  }
1662 
1663  // $this->object->setRegistrationMinUsers((int) $this->form->getInput('registration_min_members'));
1664  $this->object->setRegistrationMaxUsers((int) $this->form->getInput('registration_max_members'));
1665  $this->object->enableRegistrationUserLimit((int) $this->form->getInput('registration_membership_limited'));
1666  $this->object->setShowMembers((bool) $this->form->getInput('show_members'));
1667  $this->object->setMailToMembersType((int) $this->form->getInput('mail_type'));
1668 
1669  switch ((int) $this->form->getInput('waiting_list')) {
1670  case 2:
1671  $this->object->enableRegistrationWaitingList(true);
1672  $this->object->setWaitingListAutoFill(true);
1673  break;
1674 
1675  case 1:
1676  $this->object->enableRegistrationWaitingList(true);
1677  $this->object->setWaitingListAutoFill(false);
1678  break;
1679 
1680  default:
1681  $this->object->enableRegistrationWaitingList(false);
1682  $this->object->setWaitingListAutoFill(false);
1683  break;
1684  }
1685  }
1686 
1687  protected function loadRecurrenceSettings(): void
1688  {
1689  $this->rec = new ilEventRecurrence();
1690 
1691  switch ($this->form->getInput('frequence')) {
1693  $this->rec->setFrequenceType($this->form->getInput('frequence'));
1694  $this->rec->setInterval((int) $this->form->getInput('count_DAILY'));
1695  break;
1696 
1698  $this->rec->setFrequenceType($this->form->getInput('frequence'));
1699  $this->rec->setInterval((int) $this->form->getInput('count_WEEKLY'));
1700  if (is_array($this->form->getInput('byday_WEEKLY'))) {
1701  $this->rec->setBYDAY(ilUtil::stripSlashes(implode(',', $this->form->getInput('byday_WEEKLY'))));
1702  }
1703  break;
1704 
1706  $this->rec->setFrequenceType($this->form->getInput('frequence'));
1707  $this->rec->setInterval((int) $this->form->getInput('count_MONTHLY'));
1708  switch ((int) $this->form->getInput('subtype_MONTHLY')) {
1709  case 0:
1710  // nothing to do;
1711  break;
1712 
1713  case 1:
1714  switch ((int) $this->form->getInput('monthly_byday_day')) {
1715  case 8:
1716  // Weekday
1717  $this->rec->setBYSETPOS($this->form->getInput('monthly_byday_num'));
1718  $this->rec->setBYDAY('MO,TU,WE,TH,FR');
1719  break;
1720 
1721  case 9:
1722  // Day of month
1723  $this->rec->setBYMONTHDAY($this->form->getInput('monthly_byday_num'));
1724  break;
1725 
1726  default:
1727  $this->rec->setBYDAY(($this->form->getInput('monthly_byday_num') . $this->form->getInput('monthly_byday_day')));
1728  break;
1729  }
1730  break;
1731 
1732  case 2:
1733  $this->rec->setBYMONTHDAY($this->form->getInput('monthly_bymonthday'));
1734  break;
1735  }
1736  break;
1737 
1739  $this->rec->setFrequenceType($this->form->getInput('frequence'));
1740  $this->rec->setInterval((int) $this->form->getInput('count_YEARLY'));
1741  switch ((int) $this->form->getInput('subtype_YEARLY')) {
1742  case 0:
1743  // nothing to do;
1744  break;
1745 
1746  case 1:
1747  $this->rec->setBYMONTH($this->form->getInput('yearly_bymonth_byday'));
1748  $this->rec->setBYDAY(($this->form->getInput('yearly_byday_num') . $this->form->getInput('yearly_byday')));
1749  break;
1750 
1751  case 2:
1752  $this->rec->setBYMONTH($this->form->getInput('yearly_bymonth_by_monthday'));
1753  $this->rec->setBYMONTHDAY($this->form->getInput('yearly_bymonthday'));
1754  break;
1755  }
1756  break;
1757  }
1758 
1759  // UNTIL
1760  switch ((int) $this->form->getInput('until_type')) {
1761  case 1:
1762  $this->rec->setFrequenceUntilDate(null);
1763  // nothing to do
1764  break;
1765 
1766  case 2:
1767  $this->rec->setFrequenceUntilDate(null);
1768  $this->rec->setFrequenceUntilCount((int) $this->form->getInput('count'));
1769  break;
1770 
1771  case 3:
1772  $frequence = $this->form->getItemByPostVar('frequence');
1773  $end = $frequence->getRecurrence()->getFrequenceUntilDate();
1774  $this->rec->setFrequenceUntilCount(0);
1775  $this->rec->setFrequenceUntilDate($end);
1776  break;
1777  }
1778  }
1779 
1780  protected function __toUnix(array $date, array $time): int
1781  {
1782  return mktime($time['h'], $time['m'], 0, $date['m'], $date['d'], $date['y']);
1783  }
1784 
1785  protected function addLocatorItems(): void
1786  {
1787  $ilLocator = $this->locator;
1788 
1789  if (!$this->getCreationMode()) {
1790  // see prepareOutput()
1791  $title = strlen($this->object->getTitle()) ? (': ' . $this->object->getTitle()) : '';
1792  $title = $this->object->getFirstAppointment()->appointmentToString() . $title;
1793 
1794  $ilLocator->addItem($title, $this->ctrl->getLinkTarget($this, "infoScreen"), "", $this->requested_ref_id);
1795  }
1796  }
1797 
1798  protected function redirectToParentContentPageObject(): void
1799  {
1800  $objDefinition = $this->objDefinition;
1801  $tree = $this->tree;
1802  $ctrl = $this->ctrl;
1803 
1804  $parent_id = $tree->getParentId($this->object->getRefId());
1805 
1806  // #11650
1807  $parent_type = ilObject::_lookupType($parent_id, true);
1808 
1809  $parent_class = $objDefinition->getClassName($parent_type);
1810  $parent_class = 'ilObj' . $parent_class . 'GUI';
1811 
1812  $ctrl->setParameterByClass($parent_class, "ref_id", $parent_id);
1813  $ctrl->redirectByClass($parent_class, "view");
1814  }
1815 
1816  protected function getTabs(): void
1817  {
1818  $ilAccess = $this->access;
1819  $ilTabs = $this->tabs_gui;
1820  $tree = $this->tree;
1821  $ilCtrl = $this->ctrl;
1822  $ilHelp = $this->help;
1823  $ilUser = $this->user;
1824 
1825  $ilHelp->setScreenIdComponent("sess");
1826 
1827  $parent_id = $tree->getParentId($this->object->getRefId());
1828 
1829  // #11650
1830  $parent_type = ilObject::_lookupType($parent_id, true);
1831 
1832  $this->tabs_gui->setBackTarget(
1833  $this->lng->txt('back_to_' . $parent_type . '_content'),
1834  $ilCtrl->getLinkTarget($this, "redirectToParentContentPage")
1835  );
1836 
1837  $this->tabs_gui->addTarget(
1838  'info_short',
1839  $this->ctrl->getLinkTarget($this, 'infoScreen')
1840  );
1841 
1842  if ($ilAccess->checkAccess('write', '', $this->object->getRefId())) {
1843  $this->tabs_gui->addTarget(
1844  'settings',
1845  $this->ctrl->getLinkTarget($this, 'edit')
1846  );
1847  }
1848  if ($ilAccess->checkAccess('manage_materials', '', $this->object->getRefId())) {
1849  $this->tabs_gui->addTab(
1850  'materials',
1851  $this->lng->txt('crs_materials'),
1852  $this->ctrl->getLinkTarget($this, 'materials')
1853  );
1854  }
1855 
1856  // booking
1857  $parent_id = $tree->getParentId($this->requested_ref_id);
1858 
1859  if ($ilAccess->checkAccess('write', '', $this->ref_id) && ilContainer::_lookupContainerSetting(
1860  ilObject::_lookupObjId($parent_id),
1862  )) {
1863  $this->tabs_gui->addTarget(
1864  "obj_tool_setting_booking",
1865  $this->ctrl->getLinkTargetByClass(array("ilbookinggatewaygui"), "")
1866  );
1867  }
1868 
1869  // member tab
1870  $is_participant = $this->object->getMembersObject()->isAssigned($ilUser->getId());
1871  $membership_gui = new ilSessionMembershipGUI($this, $this->object);
1872  $membership_gui->addMemberTab($this->tabs_gui, $is_participant);
1873 
1874 
1875  // learning progress
1876  if (ilLearningProgressAccess::checkAccess($this->object->getRefId())) {
1877  $this->tabs_gui->addTarget(
1878  'learning_progress',
1879  $this->ctrl->getLinkTargetByClass(array('ilobjsessiongui','illearningprogressgui'), ''),
1880  '',
1881  array('illplistofobjectsgui','illplistofsettingsgui','illearningprogressgui','illplistofprogressgui')
1882  );
1883  }
1884 
1885  // meta data
1886  if ($ilAccess->checkAccess('edit_metadata', '', $this->ref_id)) {
1887  $mdgui = new ilObjectMetaDataGUI($this->object);
1888  $mdtab = $mdgui->getTab();
1889  if ($mdtab) {
1890  $this->tabs_gui->addTab(
1891  "metadata",
1892  $this->lng->txt('meta_data'),
1893  $mdtab
1894  );
1895  }
1896  }
1897 
1898  // export
1899  if ($ilAccess->checkAccess("write", "", $this->object->getRefId())) {
1900  $this->tabs_gui->addTarget(
1901  "export",
1902  $this->ctrl->getLinkTargetByClass("ilexportgui", ""),
1903  "",
1904  "ilexportgui"
1905  );
1906  }
1907 
1908 
1909  // edit permissions
1910  if ($ilAccess->checkAccess('edit_permission', "", $this->object->getRefId())) {
1911  $this->tabs_gui->addTarget(
1912  "perm_settings",
1913  $this->ctrl->getLinkTargetByClass("ilpermissiongui", "perm"),
1914  array("perm","info","owner"),
1915  'ilpermissiongui'
1916  );
1917  }
1918  }
1919 
1923  public function afterSaveCallback(ilObject $a_obj): void
1924  {
1925  // add new object to materials
1926  $event_items = new ilEventItems($this->object->getId());
1927  $event_items->addItem($a_obj->getRefId());
1928  $event_items->update();
1929  }
1930 
1934  public function readMemberData(array $a_usr_ids): array
1935  {
1936  $tmp_data = [];
1937  foreach ($a_usr_ids as $usr_id) {
1938  $tmp_data[$usr_id] = [];
1939  }
1940  return $tmp_data;
1941  }
1942 
1943  public function getContainerRefId(): int
1944  {
1945  if (!$this->container_ref_id) {
1946  $this->initContainer();
1947  }
1948  return $this->container_ref_id;
1949  }
1950 
1951  protected function cancelEditObject(): void
1952  {
1953  $ilCtrl = $this->ctrl;
1954  $tree = $this->tree;
1955 
1956  $parent_id = $tree->getParentId($this->requested_ref_id);
1957 
1958  $ilCtrl->setParameterByClass("ilrepositorygui", "ref_id", $parent_id);
1959 
1960  $ilCtrl->redirectByClass("ilrepositorygui", "");
1961  }
1962 
1963  public function getDefaultMemberRole(): int
1964  {
1966 
1967  $local_roles = $rbac_review->getRolesOfRoleFolder($this->object->getRefId(), false);
1968 
1969  foreach ($local_roles as $role_id) {
1970  $title = ilObject::_lookupTitle($role_id);
1971  if (substr($title, 0, 19) == 'il_sess_participant') {
1972  return $role_id;
1973  }
1974  }
1975  return 0;
1976  }
1977 
1981  public function getLocalRoles(): array
1982  {
1984 
1985  return $this->rbacreview->getRolesOfRoleFolder($this->object->getRefId(), false);
1986  }
1987 
1988  public function createMailSignature(): string
1989  {
1990  $link = chr(13) . chr(10) . chr(13) . chr(10);
1991  $link .= $this->lng->txt('sess_mail_permanent_link');
1992  $link .= chr(13) . chr(10) . chr(13) . chr(10);
1993  $link .= ilLink::_getLink($this->object->getRefId());
1994  return rawurlencode(base64_encode($link));
1995  }
1996 }
static factory(string $a_type)
Get list gui by type This method caches all the returned list guis.
ilAdvancedMDRecordGUI $record_gui
getAttendanceListUserData(int $a_user_id, array $a_filters)
static get(string $a_var)
setFilenames(array $a_filenames)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Global event handler.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
setPropertyForm(ilPropertyFormGUI $form)
ilRbacReview $rbac_review
__toUnix(array $date, array $time)
getNodeData(int $a_node_id, ?int $a_tree_pk=null)
get all information of a node.
Class ilInfoScreenGUI.
redirectByClass( $a_class, string $a_cmd=null, string $a_anchor=null, bool $is_async=false)
initContainer(bool $a_init_participants=false)
afterSaveCallback(ilObject $a_obj)
Custom callback after object is created (in parent container)
static _goto(string $a_target)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
txt(string $a_topic, string $a_default_lang_fallback_mod="")
gets the text for a given topic if the topic is not in the list, the topic itself with "-" will be re...
GUI class for the workflow of copying objects.
setItems(array $a_items)
static getItemsByEvent(int $event_id)
Get session material / event items.
const ROOT_FOLDER_ID
Definition: constants.php:32
if($clientAssertionType !='urn:ietf:params:oauth:client-assertion-type:jwt-bearer'|| $grantType !='client_credentials') $parts
Definition: ltitoken.php:64
$location
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Definition: buildRTE.php:22
importEditFormPostValues()
Load edit form values from post.
static switchTemplate(int $a_ref_id, int $a_new_tpl_id)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static stripSlashes(string $a_str, bool $a_strip_html=true, string $a_allow="")
static getInstance(int $a_ref_id)
static getImagePath(string $img, string $module_path="", string $mode="output", bool $offline=false)
get image path (for images located in a template directory)
Help GUI class.
redirectToRefId(int $ref_id, string $cmd="")
redirects to (repository) view per ref id usually to a container and usually used at the end of a sav...
updateSessionTypeObject()
change session type
This class represents a file wizard property in a property form.
static initDomEvent(?ilGlobalTemplateInterface $a_main_tpl=null)
Init YUI DomEvent used in Services/Calendar, Modules/Session, Modules/Test (Jan 2022) ...
getDidacticTemplateVar(string $type)
Get didactic template setting from creation screen.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static _gotoRepositoryNode(int $ref_id, string $cmd="")
static _lookupName(int $a_user_id)
lookup user name
showJoinRequestButton(?ilToolbarGUI $ilToolbar=null)
static _register(int $a_usr_id, int $a_event_id)
This class is used for integration of the booking manager as a service into other repository objects...
setParameterByClass(string $a_class, string $a_parameter, $a_value)
loadLanguageModule(string $a_module)
Load language module.
getSideBlockTypes(bool $filter_repository_types=true)
infoScreenObject()
this one is called from the info button in the repository not very nice to set cmdClass/Cmd manually...
createObject()
create new object form
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
ilErrorHandling $ilErr
static updateServiceSettingsForm(int $obj_id, ilPropertyFormGUI $form, array $services)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static checkAccess(int $a_ref_id, bool $a_allow_only_read=true)
check access to learning progress
const IL_CAL_UNIX
createRecurringSessions(bool $a_activate_lp=true)
static resetCaches()
Reset internal caches.
saveObject(bool $a_redirect_on_success=true)
setRecurrence(int $a_type)
set type of recurrence public
static _lookupContainerSetting(int $a_id, string $a_keyword, string $a_default_value=null)
Base class for attendance lists.
unregisterObject(bool $a_refuse_participation=false)
static _lookupObjId(int $ref_id)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
global $DIC
Definition: feed.php:28
array $details
Details for error message relating to last request processed.
Definition: System.php:109
prepareOutput(bool $show_sub_objects=true)
Export User Interface Class.
parses the objects.xml it handles the xml-description of all ilias objects
GUI class for public user profile presentation.
checkForParentType(int $a_ref_id, string $a_type, bool $a_exclude_source_check=false)
Check for parent type e.g check if a folder (ref_id 3) is in a parent course obj => checkForParentTyp...
static http()
Fetches the global http state from ILIAS.
This class represents a property in a property form.
__construct(VocabulariesInterface $vocabularies)
static _isRegistered(int $a_usr_id, int $a_event_id)
static _lookupTitle(int $obj_id)
setContent(string $a_html)
Sets content for standard template.
static _getInstanceByObjId(int $a_obj_id)
$GLOBALS["DIC"]
Definition: wac.php:31
static getInstance(int $a_ref_id)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
ilPropertyFormGUI $form
ILIAS Refinery Factory $refinery
__construct($a_data, $a_id, $a_call_by_reference, $a_prepare_output=true)
initDidacticTemplate(ilPropertyFormGUI $form)
Class ilObjectGUI Basic methods of all Output classes.
static _recordReadEvent(string $a_type, int $a_ref_id, int $obj_id, int $usr_id, bool $isCatchupWriteEvents=true, $a_ext_rc=null, $a_ext_time=null)
static getInstanceByRefId(int $ref_id, bool $stop_on_error=true)
get an instance of an Ilias object by reference id
Class ilObjFile.
getClassName(string $obj_name)
static addListGUIActivationProperty(ilObjectListGUI $list_gui, array &$item)
Get timing details for list gui.
readMemberData(array $a_usr_ids)
Used for waiting list.
static deleteUserEntry(int $a_usr_id, int $a_obj_id)
getParentId(int $a_node_id)
get parent id of given node
static _modifyItemGUI(ilObjectListGUI $a_item_list_gui, string $a_cmd_class, array $a_item_data, bool $a_abo_status, int $a_course_ref_id, int $a_course_obj_id, int $a_parent_ref_id=0)
static initServiceSettingsForm(int $obj_id, ilPropertyFormGUI $form, array $services)
showJoinRequestButtonInCalendar(ilToolbarGUI $a_ilToolbar)
show join request This method is only needed to keep showJoinRequestButton method protected...
static _unregister(int $a_usr_id, int $a_event_id)
ilEventParticipants $event_part
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
checkPermissionBool(string $perm, string $cmd="", string $type="", ?int $ref_id=null)
ilAppEventHandler $event
static _sortIds(array $a_ids, string $a_table, string $a_field, string $a_id_name)
Function that sorts ids by a given table field using WHERE IN E.g: __sort(array(6,7),&#39;usr_data&#39;,&#39;lastname&#39;,&#39;usr_id&#39;) => sorts by lastname.
initForm(string $a_mode)
__showButton(string $cmd, string $text, string $target='')
form( $class_path, string $cmd, string $submit_caption="")
Error Handling & global info handling.
static formatPeriod(ilDateTime $start, ilDateTime $end, bool $a_skip_starting_day=false)
Format a period of two dates Shows: 14.
static _getInstanceByObjId(int $a_obj_id)
Get singleton instance.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
updateExcusedForUser(int $a_usr_id, bool $a_status)
This class represents a text area property in a property form.
static _getInstance(int $a_obj_id)
getRolesOfRoleFolder(int $a_ref_id, bool $a_nonassignable=true)
get all roles of a role folder including linked local roles that are created due to stopped inheritan...
addItem(string $a_title, string $a_link, string $a_frame="", int $a_ref_id=0, ?string $type=null)
setInfoObject(ilInfoScreenGUI $info)
get info sections
New PermissionGUI (extends from old ilPermission2GUI) RBAC related output.
removeItems(array $a_items)
static _isOnList(int $a_usr_id, int $a_obj_id)
ilGlobalTemplateInterface $tpl
getSubTree(array $a_node, bool $a_with_data=true, array $a_type=[])
get all nodes in the subtree under specified node
static _lookupType(int $id, bool $reference=false)
static setUseRelativeDates(bool $a_status)
set use relative dates
modifyItemGUI(ilObjectListGUI $a_item_list_gui, array $a_item_data, bool $a_show_path)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
ilObjectService $object_service
ILIAS DI UIServices $ui
addHeaderAction()
Add header action menu.
static makeClickable(string $a_text, bool $detectGotoLinks=false)
addItem(int $a_item_ref_id)
ilObjectDefinition $objDefinition
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
checkPermission(string $perm, string $cmd="", string $type="", ?int $ref_id=null)
static set(string $a_var, $a_val)
Set a value.
checkAccessOfUser(int $a_user_id, 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) ...
ilEventRecurrence $rec
static getInstanceFromAjaxCall()
(Re-)Build instance from ajax call
ilAccessHandler $access
ILIAS HTTP Services $http
calculateDateList(ilDateTime $a_start, ilDateTime $a_end, int $a_limit=-1)
calculate date list
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static _gotoRepositoryRoot(bool $raise_error=false)
Goto repository root.
const IL_CAL_YEAR
postUpdateMaterials()
redirect to list of materials without offset/page.
static _lookupLogin(int $a_user_id)
ILIAS FileUpload FileUpload $upload