ILIAS  release_8 Revision v8.23
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 array $files = [];
58  protected ?ilPropertyFormGUI $form = null;
60  protected ?ilEventRecurrence $rec = null;
61  protected ?ilEventItems $event_items = null;
62  protected ?ilEventParticipants $event_part = null;
63  protected int $requested_ref_id = 0;
64  protected int $requested_user_id = 0;
65  protected int $requested_file_id = 0;
66  protected int $requested_offset = 0;
67  protected string $requested_sort_by = "";
68  protected string $requested_sort_order = "";
69  protected array $requested_items = [];
70 
71  public function __construct($a_data, $a_id, $a_call_by_reference, $a_prepare_output = true)
72  {
73  global $DIC;
74 
75  $this->ctrl = $DIC->ctrl();
76  $this->lng = $DIC->language();
77  $this->tpl = $DIC->ui()->mainTemplate();
78  $this->user = $DIC->user();
79  $this->tree = $DIC->repositoryTree();
80  $this->access = $DIC->access();
81  $this->toolbar = $DIC->toolbar();
82  $this->ilErr = $DIC["ilErr"];
83  $this->object_service = $DIC->object();
84  $this->objDefinition = $DIC['objDefinition'];
85  $this->tabs_gui = $DIC->tabs();
86  $this->locator = $DIC["ilLocator"];
87  $this->rbacreview = $DIC->rbac()->review();
88  $this->event = $DIC->event();
89  $this->upload = $DIC->upload();
90  $this->help = $DIC->help();
91  $this->http = $DIC->http();
92  $this->refinery = $DIC->refinery();
93 
94  $this->type = "sess";
95  parent::__construct($a_data, $a_id, $a_call_by_reference, $a_prepare_output);
96 
97  $this->lng->loadLanguageModule("event");
98  $this->lng->loadLanguageModule('crs');
99  $this->lng->loadLanguageModule('trac');
100  $this->lng->loadLanguageModule('sess');
101 
102  if ($this->http->wrapper()->query()->has('ref_id')) {
103  $this->requested_ref_id = $this->http->wrapper()->query()->retrieve(
104  'ref_id',
105  $this->refinery->kindlyTo()->int()
106  );
107  }
108 
109  if ($this->http->wrapper()->query()->has('user_id')) {
110  $this->requested_user_id = $this->http->wrapper()->query()->retrieve(
111  'user_id',
112  $this->refinery->kindlyTo()->int()
113  );
114  }
115 
116  if ($this->http->wrapper()->post()->has('file_id')) {
117  $this->requested_file_id = $this->http->wrapper()->post()->retrieve(
118  'file_id',
119  $this->refinery->kindlyTo()->int()
120  );
121  } elseif ($this->http->wrapper()->query()->has('file_id')) {
122  $this->requested_file_id = $this->http->wrapper()->query()->retrieve(
123  'file_id',
124  $this->refinery->kindlyTo()->int()
125  );
126  }
127 
128  if ($this->http->wrapper()->query()->has('offset')) {
129  $this->requested_offset = $this->http->wrapper()->query()->retrieve(
130  'offset',
131  $this->refinery->kindlyTo()->int()
132  );
133  }
134 
135  if ($this->http->wrapper()->query()->has('sort_by')) {
136  $this->requested_sort_by = $this->http->wrapper()->query()->retrieve(
137  'sort_by',
138  $this->refinery->kindlyTo()->string()
139  );
140  }
141 
142  if ($this->http->wrapper()->query()->has('sort_order')) {
143  $this->requested_sort_order = $this->http->wrapper()->query()->retrieve(
144  'sort_order',
145  $this->refinery->kindlyTo()->string()
146  );
147  }
148 
149  if ($this->http->wrapper()->post()->has('items')) {
150  $this->requested_items = $this->http->wrapper()->post()->retrieve(
151  'items',
152  $this->refinery->kindlyTo()->listOf(
153  $this->refinery->kindlyTo()->int()
154  )
155  );
156  }
157  $this->ui = $DIC->ui();
158  }
159 
160  public function executeCommand(): void
161  {
163  $ilCtrl = $this->ctrl;
164  $ilAccess = $this->access;
165 
166  $next_class = $this->ctrl->getNextClass($this);
167  $cmd = $this->ctrl->getCmd();
168 
169  if (
170  !$this->getCreationMode() &&
171  $ilAccess->checkAccess('read', '', $this->requested_ref_id)
172  ) {
173  $GLOBALS['DIC']['ilNavigationHistory']->addItem(
174  $this->requested_ref_id,
175  ilLink::_getLink($this->requested_ref_id, 'sess'),
176  'sess',
177  $this->object->getPresentationTitle()
178  );
179  }
180 
181  $this->prepareOutput();
182  switch ($next_class) {
183  case 'ilsessionmembershipgui':
184  $this->tabs_gui->activateTab('members');
185  $mem_gui = new ilSessionMembershipGUI($this, $this->object);
186  $this->ctrl->forwardCommand($mem_gui);
187  break;
188 
189  case "ilinfoscreengui":
190  $this->checkPermission("visible");
191  $this->infoScreen(); // forwards command
192  break;
193 
194  case 'ilobjectmetadatagui':
195  $this->checkPermission('edit_metadata');
196  $this->tabs_gui->activateTab('metadata');
197  $md_gui = new ilObjectMetaDataGUI($this->object);
198  $this->ctrl->forwardCommand($md_gui);
199  break;
200 
201  case 'ilpermissiongui':
202  $this->tabs_gui->setTabActive('perm_settings');
203  $perm_gui = new ilPermissionGUI($this);
204  $ret = $this->ctrl->forwardCommand($perm_gui);
205  break;
206 
207  case 'ilobjectcopygui':
208  $cp = new ilObjectCopyGUI($this);
209  $cp->setType('sess');
210  $this->ctrl->forwardCommand($cp);
211  break;
212 
213  case "ilexportgui":
214  // $this->prepareOutput();
215  $this->tabs_gui->setTabActive("export");
216  $exp_gui = new ilExportGUI($this);
217  $exp_gui->addFormat("xml");
218  $ret = $this->ctrl->forwardCommand($exp_gui);
219  // $this->tpl->show();
220  break;
221 
222  case "ilcommonactiondispatchergui":
224  $this->ctrl->forwardCommand($gui);
225  break;
226 
227  case 'ilmembershipgui':
228  $this->ctrl->setReturn($this, 'members');
229  $mem = new ilMembershipMailGUI($this);
230  $this->ctrl->forwardCommand($mem);
231  break;
232 
233  case "illearningprogressgui":
234  $new_gui = new ilLearningProgressGUI(
236  $this->object->getRefId(),
237  $this->requested_user_id ?: $ilUser->getId()
238  );
239  $this->ctrl->forwardCommand($new_gui);
240  $this->tabs_gui->setTabActive('learning_progress');
241  break;
242 
243  case "ilpropertyformgui":
244  // only case is currently adv metadata internal link in info settings, see #24497
245  if (!is_object($this->object)) {
246  $form = $this->initCreateForm("sess");
247  } else {
248  $form = $this->initForm("edit");
249  if ($form === true) {
250  $form = $this->form;
251  }
252  }
253  $ilCtrl->forwardCommand($form);
254  break;
255 
256  case "ilbookinggatewaygui":
257  $tree = $this->tree;
258  $parent_id = $tree->getParentId($this->requested_ref_id);
259 
260  $this->tabs_gui->activateTab('obj_tool_setting_booking');
261  $gui = new ilBookingGatewayGUI($this, $parent_id);
262  $this->ctrl->forwardCommand($gui);
263  break;
264 
265  default:
266  if ($cmd == "applyFilter") {
267  $this->$cmd();
268  } elseif ($cmd == "resetFilter") {
269  $this->$cmd();
270  }
271  if (!$cmd) {
272  $cmd = "infoScreen";
273  }
274  $cmd .= "Object";
275  $this->$cmd();
276 
277  break;
278  }
279 
280  $this->addHeaderAction();
281  }
282 
283  protected function membersObject(): void
284  {
285  $this->ctrl->redirectByClass('ilSessionMembershipGUI', 'participants');
286  }
287 
288  public function getCurrentObject(): ilObjSession
289  {
294 
295  return $object;
296  }
297 
298  public function prepareOutput(bool $show_subobjects = true): bool
299  {
300  parent::prepareOutput($show_subobjects);
301 
302  if (!$this->getCreationMode()) {
303  $title = strlen($this->object->getTitle()) ? (': ' . $this->object->getTitle()) : '';
304 
305  $this->tpl->setTitle(
306  $this->object->getFirstAppointment()->appointmentToString() . $title
307  );
308  }
309  return true;
310  }
311 
312  public function registerObject(): void
313  {
315  $ilAppEventHandler = $this->event;
316 
317  $this->checkPermission('visible');
318 
319  $part = ilParticipants::getInstance($this->getCurrentObject()->getRefId());
320 
321  $event_part = new ilEventParticipants($this->getCurrentObject()->getId());
322  $event_part->updateExcusedForUser($ilUser->getId(), false);
323 
324  if (
325  $this->getCurrentObject()->isRegistrationUserLimitEnabled() &&
326  $this->getCurrentObject()->getRegistrationMaxUsers() &&
327  (count($event_part->getRegisteredParticipants()) >= $this->getCurrentObject()->getRegistrationMaxUsers())
328  ) {
329  if (!$this->getCurrentObject()->isRegistrationWaitingListEnabled()) {
330  $this->tpl->setOnScreenMessage('failure', $this->lng->txt('sess_reg_max_users_exceeded'), true);
331  $this->ctrl->redirect($this, 'infoScreen');
332  }
333  $wait = new ilSessionWaitingList($this->getCurrentObject()->getId());
334  $wait->addToList($ilUser->getId());
335  $this->ctrl->redirect($this, 'infoScreen');
336  }
337 
338 
339  switch ($this->getCurrentObject()->getRegistrationType()) {
341  $this->ctrl->redirect($this, 'info');
342  break;
343 
345  $part->register($ilUser->getId());
346  $this->tpl->setOnScreenMessage('success', $this->lng->txt('event_registered'), true);
347 
348  $ilAppEventHandler->raise(
349  "Modules/Session",
350  'enter',
351  array(
352  'obj_id' => $this->getCurrentObject()->getId(),
353  'ref_id' => $this->getCurrentObject()->getRefId(),
354  'usr_id' => $ilUser->getId()
355  )
356  );
357 
358  $this->ctrl->redirect($this, 'infoScreen');
359  break;
360 
362  $this->tpl->setOnScreenMessage('success', $this->lng->txt('sess_registered_confirm'), true);
363  $part->addSubscriber($ilUser->getId());
364 
365  $ilAppEventHandler->raise(
366  "Modules/Session",
367  'register',
368  array(
369  'obj_id' => $this->getCurrentObject()->getId(),
370  'ref_id' => $this->getCurrentObject()->getRefId(),
371  'usr_id' => $ilUser->getId()
372  )
373  );
374 
375  $this->ctrl->redirect($this, 'infoScreen');
376  break;
377  }
378  }
379 
380  public function joinObject(): void
381  {
383 
384  $this->checkPermission('read');
385 
386  if ($ilUser->isAnonymous()) {
387  $this->ctrl->redirect($this, 'infoScreen');
388  }
389 
390  if (ilEventParticipants::_isRegistered($ilUser->getId(), $this->object->getId())) {
391  ilSession::set("sess_hide_info", true);
392  ilEventParticipants::_unregister($ilUser->getId(), $this->object->getId());
393  $this->tpl->setOnScreenMessage('success', $this->lng->txt('event_unregistered'), true);
394  } else {
395  ilEventParticipants::_register($ilUser->getId(), $this->object->getId());
396  $this->tpl->setOnScreenMessage('success', $this->lng->txt('event_registered'), true);
397  }
398 
399  $this->ctrl->redirect($this, 'infoScreen');
400  }
401 
402  public function unregisterObject(bool $a_refuse_participation = false): void
403  {
405  $ilAppEventHandler = $this->event;
406  $access = $this->access;
407  $tree = $this->tree;
408 
409  $part = ilSessionParticipants::getInstance($this->object->getRefId());
410  if ($part->isSubscriber($ilUser->getId())) {
411  $part->deleteSubscriber($ilUser->getId());
412  }
413 
414  $part->unregister($ilUser->getId());
415 
416  if ($a_refuse_participation) {
417  $event_part = new \ilEventParticipants($this->object->getId());
418  $event_part->updateExcusedForUser($ilUser->getId(), true);
419  }
420 
421  ilSessionWaitingList::deleteUserEntry($ilUser->getId(), $this->getCurrentObject()->getId());
422 
423  // check for visible permission of user
425  $access->clear();
426  $has_access = $access->checkAccessOfUser(
427  $ilUser->getId(),
428  'visible',
429  '',
430  $this->object->getRefId()
431  );
432  if (!$has_access) {
433  $parent = $tree->getParentId($this->object->getRefId());
434  $this->redirectToRefId($parent);
435  return;
436  }
437 
438  $ilAppEventHandler->raise(
439  "Modules/Session",
440  'unregister',
441  array(
442  'obj_id' => $this->getCurrentObject()->getId(),
443  'ref_id' => $this->getCurrentObject()->getRefId(),
444  'usr_id' => $ilUser->getId()
445  )
446  );
447  if ($a_refuse_participation) {
448  $this->tpl->setOnScreenMessage('info', $this->lng->txt('sess_participation_refused_info'), true);
449  } else {
450  $this->tpl->setOnScreenMessage('success', $this->lng->txt('event_unregistered'), true);
451  }
452  $this->ctrl->returnToParent($this);
453  }
454 
455  public static function _goto(string $a_target): void
456  {
457  global $DIC;
458  $main_tpl = $DIC->ui()->mainTemplate();
459 
460  $ilAccess = $DIC->access();
461  $lng = $DIC->language();
462 
463  $ilCtrl = $DIC->ctrl();
464  $parts = explode('_', $a_target);
465  $a_target = (int) $parts[0];
466 
467  if ($ilAccess->checkAccess('write', '', $a_target)) {
468  if (isset($parts[1]) && 'part' === $parts[1]) {
469  $ilCtrl->setTargetScript('ilias.php');
470  $ilCtrl->setParameterByClass('ilSessionMembershipGUI', 'ref_id', $a_target);
471  $ilCtrl->setTargetScript('ilias.php');
472  $ilCtrl->redirectByClass(array('ilRepositoryGUI', __CLASS__, 'ilSessionMembershipGUI'));
473  }
474  }
475 
476  if ($ilAccess->checkAccess('visible', "", $a_target)) {
477  ilObjectGUI::_gotoRepositoryNode($a_target, "infoScreen");
478  } elseif ($ilAccess->checkAccess("read", "", ROOT_FOLDER_ID)) {
479  $main_tpl->setOnScreenMessage('failure', sprintf(
480  $lng->txt("msg_no_perm_read_item"),
482  ), true);
484  }
485  }
486 
492  public function infoScreenObject(): void
493  {
494  $this->ctrl->setCmd("showSummary");
495  $this->ctrl->setCmdClass("ilinfoscreengui");
496  $this->infoScreen();
497  }
498 
499  public function modifyItemGUI(ilObjectListGUI $a_item_list_gui, array $a_item_data, bool $a_show_path): void
500  {
501  $tree = $this->tree;
502 
503  // if folder is in a course, modify item list gui according to course requirements
504  if ($course_ref_id = $tree->checkForParentType($this->object->getRefId(), 'crs')) {
505  // #10611
506  ilObjectActivation::addListGUIActivationProperty($a_item_list_gui, $a_item_data);
507 
508  $course_obj_id = ilObject::_lookupObjId($course_ref_id);
510  $a_item_list_gui,
511  get_class($this),
512  $a_item_data,
513  $a_show_path,
514  $course_ref_id,
515  $course_obj_id,
516  $this->object->getRefId()
517  );
518  }
519  }
520 
525  public function showJoinRequestButtonInCalendar(ilToolbarGUI $a_ilToolbar): bool
526  {
527  return $this->showJoinRequestButton($a_ilToolbar);
528  }
529 
530  protected function refuseParticipationObject(): void
531  {
532  $this->unregisterObject(true);
533  }
534 
535  protected function showJoinRequestButton(?ilToolbarGUI $ilToolbar = null): bool
536  {
538 
539  if (!$ilToolbar) {
540  $ilToolbar = $this->toolbar;
541  }
542 
543  if (!$this->getCurrentObject()->enabledRegistrationForUsers() || $ilUser->isAnonymous()) {
544  return false;
545  }
546 
547  $part = ilParticipants::getInstance($this->getCurrentObject()->getRefId());
548 
549  $this->ctrl->setParameter($this, "ref_id", $this->getCurrentObject()->getRefId());
550 
551  $btn_excused = null;
552  if ($this->object->isCannotParticipateOptionEnabled()) {
553  $btn_excused = $this->ui->factory()->button()->standard(
554  $this->lng->txt('sess_bt_refuse'),
555  $this->ctrl->getLinkTarget($this, 'refuseParticipation')
556  );
557  }
558 
559 
560  if (ilEventParticipants::_isRegistered($ilUser->getId(), $this->getCurrentObject()->getId())) {
561  if (!is_null($btn_excused)) {
562  $ilToolbar->addComponent($btn_excused);
563  }
564  return true;
565  } elseif ($part->isSubscriber($ilUser->getId())) {
566  if (!is_null($btn_excused)) {
567  $ilToolbar->addComponent($btn_excused);
568  }
569  return true;
570  } elseif (ilSessionWaitingList::_isOnList($ilUser->getId(), $this->getCurrentObject()->getId())) {
571  if (!is_null($btn_excused)) {
572  $ilToolbar->addComponent($btn_excused);
573  }
574  return true;
575  }
576 
577  $event_part = new ilEventParticipants($this->getCurrentObject()->getId());
578 
579  if (
580  $this->getCurrentObject()->isRegistrationUserLimitEnabled() &&
581  $this->getCurrentObject()->getRegistrationMaxUsers() &&
582  (count($event_part->getRegisteredParticipants()) >= $this->getCurrentObject()->getRegistrationMaxUsers())
583  ) {
584  if ($this->getCurrentObject()->isRegistrationWaitingListEnabled()) {
585  $this->tpl->setOnScreenMessage('info', $this->lng->txt('sess_reg_max_users_exceeded_wl'));
586  $btn_attend = $this->ui->factory()->button()->primary(
587  $this->lng->txt("mem_add_to_wl"),
588  $this->ctrl->getLinkTargetByClass(array("ilRepositoryGUI", "ilObjSessionGUI"), "register")
589  );
590  $ilToolbar->addComponent($btn_attend);
591  if (!$event_part->isExcused($ilUser->getId()) && !is_null($btn_excused)) {
592  $ilToolbar->addComponent($btn_excused);
593  }
594  } else {
595  $this->tpl->setOnScreenMessage('info', $this->lng->txt('sess_reg_max_users_exceeded'));
596  }
597  return true;
598  } else {
599  if (is_null(ilSession::get("sess_hide_info"))) {
600  $this->tpl->setOnScreenMessage('info', $this->lng->txt('sess_join_info'));
601  $btn_attend = $this->ui->factory()->button()->primary(
602  $this->lng->txt("join_session"),
603  $this->ctrl->getLinkTargetByClass(array("ilRepositoryGUI", "ilObjSessionGUI"), "register")
604  );
605  $ilToolbar->addComponent($btn_attend);
606  if (!$event_part->isExcused($ilUser->getId()) && !is_null($btn_excused)) {
607  $ilToolbar->addComponent($btn_excused);
608  }
609  return true;
610  }
611  }
612  return false;
613  }
614 
615  protected function infoScreen(): void
616  {
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  public function sendFileObject(): bool
742  {
743  $file = new ilSessionFile($this->requested_file_id);
744 
745  ilFileDelivery::deliverFileLegacy($file->getAbsolutePath(), $file->getFileName(), $file->getFileType());
746  return true;
747  }
748 
749  protected function initCreateForm($a_new_type): ilPropertyFormGUI
750  {
751  if (!is_object($this->object)) {
752  $this->object = new ilObjSession();
753  }
754  if (!$this->form instanceof ilPropertyFormGUI) {
755  $this->initForm('create');
756  }
757  return $this->form;
758  }
759 
760  protected function saveAndAssignMaterialsObject(): void
761  {
762  $this->checkPermission('manage_materials');
763  $this->saveObject(false);
764 
765  $this->ctrl->setParameter($this, 'ref_id', $this->object->getRefId());
766  $this->ctrl->setParameter($this, 'new_type', '');
767  $this->ctrl->redirect($this, 'materials');
768  }
769 
770  public function saveObject(bool $a_redirect_on_success = true): void
771  {
772  $this->checkPermission('write');
774  $object_service = $this->object_service;
775 
776  $this->object = new ilObjSession();
777 
778  $this->ctrl->saveParameter($this, "new_type");
779 
780  $this->initForm('create');
781  $this->ilErr->setMessage('');
782  if (!$this->form->checkInput()) {
783  $this->tpl->setOnScreenMessage(
785  $this->lng->txt('err_check_input')
786  );
787  $this->form->setValuesByPost();
788  $this->createObject();
789  return;
790  }
791 
792  if ($this->record_gui instanceof \ilAdvancedMDRecordGUI && !$this->record_gui->importEditFormPostValues()
793  ) {
794  $this->ilErr->setMessage($this->lng->txt('err_check_input'));
795  }
796 
797  $this->load();
798  $this->loadRecurrenceSettings();
799 
800  $this->object->validate();
801  $this->object->getFirstAppointment()->validate();
802 
803  if (strlen($this->ilErr->getMessage())) {
804  $this->tpl->setOnScreenMessage('failure', $this->ilErr->getMessage());
805  $this->form->setValuesByPost();
806  $this->createObject();
807  }
808  // Create session
809  $this->object->create();
810  $this->object->createReference();
811  $this->object->putInTree($this->requested_ref_id);
812  $this->object->setPermissions($this->requested_ref_id);
813 
815  $this->object->getId(),
816  $this->form,
817  array(
819  )
820  );
821  if ($this->record_gui instanceof \ilAdvancedMDRecordGUI) {
822  $this->record_gui->writeEditForm($this->object->getId());
823  }
824 
825 
826  // apply didactic template?
827  $dtpl = $this->getDidacticTemplateVar("dtpl");
828  if ($dtpl) {
829  $this->object->applyDidacticTemplate($dtpl);
830  }
831 
832  // #14547 - active is default
833  if (!$this->form->getInput("lp_preset")) {
834  $lp_obj_settings = new ilLPObjSettings($this->object->getId());
836  $lp_obj_settings->update(false);
837  }
838 
839  // create appointment
840  $this->object->getFirstAppointment()->setSessionId($this->object->getId());
841  $this->object->getFirstAppointment()->create();
842 
843  $this->handleFileUpload();
844 
845  $object_service->commonSettings()->legacyForm($this->form, $this->object)->saveTileImage();
846 
847  $this->createRecurringSessions((bool) $this->form->getInput("lp_preset"));
848 
849  if ($a_redirect_on_success) {
850  $this->tpl->setOnScreenMessage('info', $this->lng->txt('event_add_new_event'), true);
851  $this->ctrl->returnToParent($this);
852  }
853  }
854 
855  public function handleFileUpload(): void
856  {
857  $tree = $this->tree;
858 
859  $ev = new ilEventItems($this->object->getId());
860  $items = $ev->getItems();
861 
862  $counter = 0;
863  while (true) {
864  if (!isset($_FILES['files']['name'][$counter])) {
865  break;
866  }
867  if (!strlen($_FILES['files']['name'][$counter])) {
868  $counter++;
869  continue;
870  }
871 
872  $file = new ilObjFile();
873  $file->setTitle(ilUtil::stripSlashes($_FILES['files']['name'][$counter]));
874  $file->setDescription('');
875  $file->setFileName(ilUtil::stripSlashes($_FILES['files']['name'][$counter]));
876  $file->create();
877  $new_ref_id = $file->createReference();
878  $file->putInTree($tree->getParentId($this->object->getRefId()));
879  $file->setPermissions($tree->getParentId($this->object->getRefId()));
880 
881  $upload = $this->upload;
882  if (!$upload->hasBeenProcessed()) {
883  $upload->process();
884  }
885  $file->getUploadFile(
886  $_FILES['files']['tmp_name'][$counter],
887  $_FILES['files']['name'][$counter]
888  );
889 
890  $items[] = $new_ref_id;
891  $counter++;
892  }
893 
894  $ev->setItems($items);
895  $ev->update();
896  }
897 
898  protected function createRecurringSessions(bool $a_activate_lp = true): bool
899  {
900  $tree = $this->tree;
901 
902  if (!$this->rec->getFrequenceType()) {
903  return true;
904  }
905  $calc = new ilCalendarRecurrenceCalculator($this->object->getFirstAppointment(), $this->rec);
906 
907  $period_start = clone $this->object->getFirstAppointment()->getStart();
908 
909 
910  $period_end = clone $this->object->getFirstAppointment()->getStart();
911  $period_end->increment(IL_CAL_YEAR, 5);
912  $date_list = $calc->calculateDateList($period_start, $period_end);
913 
914  $period_diff = $this->object->getFirstAppointment()->getEnd()->get(IL_CAL_UNIX) -
915  $this->object->getFirstAppointment()->getStart()->get(IL_CAL_UNIX);
916  $parent_id = $tree->getParentId($this->object->getRefId());
917 
918  $evi = new ilEventItems($this->object->getId());
919  $eitems = $evi->getItems();
920 
921  $counter = 0;
922  foreach ($date_list->get() as $date) {
923  if (!$counter++) {
924  continue;
925  }
926 
927  $new_obj = $this->object->cloneObject($parent_id);
928 
929  // apply didactic template?
930  $dtpl = $this->getDidacticTemplateVar("dtpl");
931  if ($dtpl) {
932  $new_obj->applyDidacticTemplate($dtpl);
933  }
934 
935  $new_obj->read();
936  $new_obj->getFirstAppointment()->setStartingTime($date->get(IL_CAL_UNIX));
937  $new_obj->getFirstAppointment()->setEndingTime($date->get(IL_CAL_UNIX) + $period_diff);
938  $new_obj->getFirstAppointment()->update();
939  $new_obj->update(true);
940 
941  // #14547 - active is default
942  if (!$a_activate_lp) {
943  $lp_obj_settings = new ilLPObjSettings($new_obj->getId());
945  $lp_obj_settings->update(false);
946  }
947 
948  $new_evi = new ilEventItems($new_obj->getId());
949  $new_evi->setItems($eitems);
950  $new_evi->update();
951  }
952 
953  return true;
954  }
955 
956  public function editObject(): void
957  {
958  $this->checkPermission('write');
959  $this->tabs_gui->setTabActive('settings');
960 
961  $this->initForm('edit');
962  $this->tpl->addBlockFile('ADM_CONTENT', 'adm_content', 'tpl.sess_edit.html', 'Modules/Session');
963  $this->tpl->setVariable('EVENT_EDIT_TABLE', $this->form->getHTML());
964 
965  if (!count($this->object->getFiles())) {
966  return;
967  }
968  $rows = [];
969  foreach ($this->object->getFiles() as $file) {
970  $table_data['id'] = $file->getFileId();
971  $table_data['filename'] = $file->getFileName();
972  $table_data['filetype'] = $file->getFileType();
973  $table_data['filesize'] = $file->getFileSize();
974 
975  $rows[] = $table_data;
976  }
977 
978  $table_gui = new ilSessionFileTableGUI($this, "edit");
979  $table_gui->setTitle($this->lng->txt("event_files"));
980  $table_gui->setData($rows);
981  $table_gui->addCommandButton("cancel", $this->lng->txt("cancel"));
982  $table_gui->addMultiCommand("confirmDeleteFiles", $this->lng->txt("delete"));
983  $table_gui->setSelectAllCheckbox("file_id");
984  $this->tpl->setVariable('EVENT_FILE_TABLE', $table_gui->getHTML());
985  }
986 
987  public function updateObject(): void
988  {
989  $this->checkPermission('write');
990  $object_service = $this->object_service;
991 
992  $old_autofill = $this->object->hasWaitingListAutoFill();
993 
994  $this->initForm('edit');
995  $this->ilErr->setMessage('');
996  if (!$this->form->checkInput()) {
997  $this->tpl->setOnScreenMessage(
999  $this->lng->txt('err_check_input')
1000  );
1001  $this->form->setValuesByPost();
1002  $this->editObject();
1003  return;
1004  }
1005 
1006  //Mantis 21972: Choose didactic template on settings screen
1007  $old_type = ilDidacticTemplateObjSettings::lookupTemplateId($this->object->getRefId());
1008 
1009  $modified = false;
1010  $new_type_info = $this->form->getInput('didactic_type');
1011  if ($new_type_info) {
1012  $new_type = explode('_', $this->form->getInput('didactic_type'));
1013  $new_type = (int) $new_type[1];
1014 
1015  $modified = ($new_type !== $old_type);
1016  }
1017 
1018  if (
1019  $this->record_gui instanceof \ilAdvancedMDRecordGUI &&
1020  !$this->record_gui->importEditFormPostValues()
1021  ) {
1022  $this->tpl->setOnScreenMessage(
1024  $this->lng->txt('err_check_input')
1025  );
1026  $this->form->setValuesByPost();
1027  $this->editObject();
1028  }
1029 
1030  $this->load();
1031 
1032  $this->object->validate();
1033  $this->object->getFirstAppointment()->validate();
1034 
1035  if (strlen($this->ilErr->getMessage())) {
1036  $this->tpl->setOnScreenMessage('failure', $this->ilErr->getMessage());
1037  $this->editObject();
1038  }
1039  // Update event
1040  $this->object->update();
1041  $this->object->getFirstAppointment()->update();
1042 
1044  $this->object->getId(),
1045  $this->form,
1046  array(
1048  )
1049  );
1050  if ($this->record_gui instanceof \ilAdvancedMDRecordGUI) {
1051  $this->record_gui->writeEditForm();
1052  }
1053  $this->handleFileUpload();
1054 
1055  $object_service->commonSettings()->legacyForm($this->form, $this->object)->saveTileImage();
1056 
1057  // if autofill has been activated trigger process
1058  if (!$old_autofill &&
1059  $this->object->hasWaitingListAutoFill()) {
1060  $this->object->handleAutoFill();
1061  }
1062 
1063  //Mantis 21972: Choose didactic template on settings screen
1064  if (!$modified) {
1065  $this->tpl->setOnScreenMessage('success', $this->lng->txt('event_updated'), true);
1066  $this->ctrl->redirect($this, 'edit');
1067  return;
1068  }
1069 
1070  if ($new_type == 0) {
1071  $new_type_txt = $this->lng->txt('il_sess_status_open');
1072  } else {
1073  $dtpl = new ilDidacticTemplateSetting($new_type);
1074  $new_type_txt = $dtpl->getPresentationTitle($this->lng->getLangKey());
1075  }
1076  $this->tabs_gui->activateTab('settings');
1077 
1078  $confirm = new ilConfirmationGUI();
1079  $confirm->setFormAction($this->ctrl->getFormAction($this));
1080  $confirm->setHeaderText($this->lng->txt('sess_warn_sess_type_changed'));
1081  $confirm->addItem(
1082  'sess_type',
1083  (string) $new_type,
1084  $this->lng->txt('sess_info_new_sess_type') . ': ' . $new_type_txt
1085  );
1086  $confirm->setConfirm($this->lng->txt('sess_change_type'), 'updateSessionType');
1087  $confirm->setCancel($this->lng->txt('cancel'), 'edit');
1088 
1089  $this->tpl->setContent($confirm->getHTML());
1090  }
1091 
1095  public function updateSessionTypeObject(): void
1096  {
1097  $this->checkPermission('write');
1099  $this->object->getRefId(),
1100  (int) $this->http->request()->getParsedBody()['sess_type']
1101  );
1102 
1103  $this->tpl->setOnScreenMessage('success', $this->lng->txt('settings_saved'), true);
1104  $this->ctrl->redirect($this, 'edit');
1105  }
1106 
1107  public function confirmDeleteFilesObject(): bool
1108  {
1109  $this->checkPermission('write');
1110  $this->tabs_gui->setTabActive('settings');
1111 
1112  if (!count($this->requested_file_id)) {
1113  $this->tpl->setOnScreenMessage('failure', $this->lng->txt('select_one'));
1114  $this->editObject();
1115  return false;
1116  }
1117 
1118  $c_gui = new ilConfirmationGUI();
1119 
1120  // set confirm/cancel commands
1121  $c_gui->setFormAction($this->ctrl->getFormAction($this, "deleteFiles"));
1122  $c_gui->setHeaderText($this->lng->txt("info_delete_sure"));
1123  $c_gui->setCancel($this->lng->txt("cancel"), "edit");
1124  $c_gui->setConfirm($this->lng->txt("confirm"), "deleteFiles");
1125 
1126  // add items to delete
1127  foreach ($this->requested_file_id as $file_id) {
1128  $file = new ilSessionFile($file_id);
1129  if ($file->getSessionId() != $this->object->getEventId()) {
1130  $this->tpl->setOnScreenMessage('failure', $this->lng->txt('select_one'));
1131  $this->editObject();
1132  return false;
1133  }
1134  $c_gui->addItem("file_id[]", $file_id, $file->getFileName());
1135  }
1136 
1137  $this->tpl->setContent($c_gui->getHTML());
1138  return true;
1139  }
1140 
1141  public function deleteFilesObject(): bool
1142  {
1143  $this->checkPermission('write');
1144  if (!count($this->requested_file_id)) {
1145  $this->tpl->setOnScreenMessage('failure', $this->lng->txt('select_one'));
1146  $this->editObject();
1147  return false;
1148  }
1149  foreach ($this->requested_file_id as $id) {
1150  $file = new ilSessionFile($id);
1151  $file->delete();
1152  }
1153  $this->object->initFiles();
1154  $this->editObject();
1155  return true;
1156  }
1157 
1161  protected function initContainer(bool $a_init_participants = false)
1162  {
1163  $tree = $this->tree;
1164 
1165  $is_course = $is_group = false;
1166 
1167  // #13178
1168  $this->container_ref_id = $tree->checkForParentType($this->object->getRefId(), 'grp');
1169  if ($this->container_ref_id) {
1170  $is_group = true;
1171  }
1172  if (!$this->container_ref_id) {
1173  $this->container_ref_id = $tree->checkForParentType($this->object->getRefId(), 'crs');
1174  if ($this->container_ref_id) {
1175  $is_course = true;
1176  }
1177  }
1178  if (!$this->container_ref_id) {
1179  $this->tpl->setOnScreenMessage('failure', 'No container object found. Aborting');
1180  return true;
1181  }
1182  $this->container_obj_id = ilObject::_lookupObjId($this->container_ref_id);
1183 
1184  if ($a_init_participants && $this->container_obj_id) {
1185  if ($is_course) {
1186  return ilCourseParticipants::_getInstanceByObjId($this->container_obj_id);
1187  } elseif ($is_group) {
1188  return ilGroupParticipants::_getInstanceByObjId($this->container_obj_id);
1189  }
1190  }
1191 
1192  return false;
1193  }
1194 
1195  public function materialsObject(): void
1196  {
1197  $this->checkPermission('manage_materials');
1198  $tree = $this->tree;
1199  $objDefinition = $this->objDefinition;
1200 
1201  $this->tabs_gui->activateTab('materials');
1202 
1203  // #11337 - support ANY parent container (crs, grp, fld)
1204  $parent_ref_id = $tree->getParentId($this->object->getRefId());
1205 
1206  $gui = new ilObjectAddNewItemGUI($parent_ref_id);
1207  $gui->setDisabledObjectTypes(
1208  array_merge(
1209  [
1210  'itgr', 'sess'
1211  ],
1212  $objDefinition->getSideBlockTypes()
1213  )
1214  );
1215  $gui->setAfterCreationCallback($this->ref_id);
1216  $gui->render();
1217 
1218  $this->event_items = new ilEventItems($this->object->getId());
1219 
1220  $tbl = new ilSessionMaterialsTableGUI($this, "materials");
1221 
1222  $tbl->setDisableFilterHiding(true);
1223 
1224  $tbl->addMultiCommand('saveMaterials', $this->lng->txt('sess_assign'));
1225  $tbl->addMultiCommand("removeMaterials", $this->lng->txt("remove"));
1226 
1227  $tbl->setTitle($this->lng->txt("event_assign_materials_table"));
1228  $tbl->setDescription($this->lng->txt('event_assign_materials_info'));
1229 
1230  $tbl->setMaterialItems($this->event_items->getItems());
1231  $tbl->setContainerRefId($this->getContainerRefId());
1232  $data = $tbl->getDataFromDb();
1233  $tbl->setMaterials($data);
1234 
1235  $this->tpl->setContent($tbl->getHTML());
1236  }
1237 
1238  public function applyFilter(): void
1239  {
1240  $tbl = new ilSessionMaterialsTableGUI($this, "materials");
1241  $tbl->writeFilterToSession(); // writes filter to session
1242  $tbl->resetOffset(); // sets record offest to 0 (first page)
1243  $this->ctrl->redirect($this, "materials");
1244  }
1245 
1246  public function resetFilter(): void
1247  {
1248  $tbl = new ilSessionMaterialsTableGUI($this, "materials");
1249  $tbl->resetOffset(); // sets record offest to 0 (first page)
1250  $tbl->resetFilter(); // clears filter
1251  $this->ctrl->redirect($this, "materials");
1252  }
1253 
1254  public function removeMaterialsObject(): void
1255  {
1256  $this->checkPermission('manage_materials');
1257  $items_checked = $this->requested_items;
1258 
1259  $this->event_items = new ilEventItems($this->object->getId());
1260  $this->event_items->removeItems($items_checked);
1261 
1262  $this->postUpdateMaterials();
1263  }
1264 
1265  public function saveMaterialsObject(): void
1266  {
1267  $this->checkPermission('manage_materials');
1268  $this->event_items = new ilEventItems($this->object->getId());
1269  $db_items = $this->event_items->getItems();
1270 
1271  $list_items_checked = $this->requested_items;
1272  $list_items_checked = array_map('intval', $list_items_checked);
1273 
1274  $items_to_save = array_merge($db_items, $list_items_checked);
1275  $items_to_save = array_unique($items_to_save);
1276 
1277  $this->event_items->setItems($items_to_save);
1278  $this->event_items->update();
1279  $this->postUpdateMaterials();
1280  }
1281 
1285  public function postUpdateMaterials(): void
1286  {
1287  $tbl = new ilSessionMaterialsTableGUI($this, "materials");
1288  $tbl->setOffset(0);
1289  $tbl->storeNavParameter();//remove offset and go to page 1
1290 
1291  $this->tpl->setOnScreenMessage('success', $this->lng->txt('settings_saved'), true);
1292  $this->ctrl->redirect($this, 'materials');
1293  }
1294 
1295  public function attendanceListObject(): void
1296  {
1297  $tpl = $this->tpl;
1298  $ilTabs = $this->tabs_gui;
1299 
1300  $this->checkPermission('manage_members');
1301  $ilTabs->setTabActive('event_edit_members');
1302 
1303  $list = $this->initAttendanceList();
1304  $form = $list->initForm('printAttendanceList');
1305  $tpl->setContent($form->getHTML());
1306  }
1307 
1308  protected function initAttendanceList(): ilAttendanceList
1309  {
1310  $members_obj = $this->initContainer(true);
1311 
1312  $list = new ilAttendanceList(
1313  $this,
1314  $this->object,
1315  $members_obj
1316  );
1317  $list->setId('sessattlst');
1318 
1319  $event_app = $this->object->getFirstAppointment();
1321  $desc = ilDatePresentation::formatPeriod($event_app->getStart(), $event_app->getEnd());
1323  $desc .= " " . $this->object->getTitle();
1324  $list->setTitle($this->lng->txt('sess_attendance_list'), $desc);
1325 
1326  $list->addPreset('mark', $this->lng->txt('trac_mark'), true);
1327  $list->addPreset('comment', $this->lng->txt('trac_comment'), true);
1328  if ($this->object->enabledRegistration()) {
1329  $list->addPreset('registered', $this->lng->txt('event_tbl_registered'), true);
1330  }
1331  $list->addPreset('participated', $this->lng->txt('event_tbl_participated'), true);
1332  $list->addBlank($this->lng->txt('sess_signature'));
1333 
1334  $list->addUserFilter('registered', $this->lng->txt('event_list_registered_only'));
1335 
1336  return $list;
1337  }
1338 
1339  protected function printAttendanceListObject(): void
1340  {
1341  $this->checkPermission('manage_members');
1342 
1343  $list = $this->initAttendanceList();
1344  $list->initFromForm();
1345  $list->setCallback(array($this, 'getAttendanceListUserData'));
1346 
1347  $this->event_part = new ilEventParticipants($this->object->getId());
1348  $list->getFullscreenHTML();
1349  }
1350 
1351  public function getAttendanceListUserData(int $a_user_id, array $a_filters): ?array
1352  {
1353  $data = $this->event_part->getUser($a_user_id);
1354 
1355  if ($a_filters && $a_filters["registered"] && !$data["registered"]) {
1356  return null;
1357  }
1358 
1359  $data['registered'] = $data['registered'] ?
1360  $this->lng->txt('yes') :
1361  $this->lng->txt('no');
1362  $data['participated'] = $data['participated'] ?
1363  $this->lng->txt('yes') :
1364  $this->lng->txt('no');
1365 
1366  return $data;
1367  }
1368 
1369  public function eventsListObject(): void
1370  {
1371  $ilAccess = $this->access;
1372  $ilUser = $this->user;
1373  $tree = $this->tree;
1374 
1375  if (!$ilAccess->checkAccess('manage_members', '', $this->object->getRefId())) {
1376  $this->ilErr->raiseError($this->lng->txt('msg_no_perm_read'), $this->ilErr->MESSAGE);
1377  }
1378 
1379  $this->tpl->addBlockFile('ADM_CONTENT', 'adm_content', 'tpl.sess_list.html', 'Modules/Session');
1380  $this->__showButton($this->ctrl->getLinkTarget($this, 'exportCSV'), $this->lng->txt('event_csv_export'));
1381 
1382  $this->tpl->addBlockFile("EVENTS_TABLE", "events_table", "tpl.table.html");
1383  $this->tpl->addBlockFile('TBL_CONTENT', 'tbl_content', 'tpl.sess_list_row.html', 'Modules/Session');
1384 
1385  $members_obj = $this->initContainer(true);
1386  $members = $members_obj->getParticipants();
1387  $members = ilUtil::_sortIds($members, 'usr_data', 'lastname', 'usr_id');
1388 
1389  // Table
1390  $tbl = new ilTableGUI();
1391  $tbl->setTitle(
1392  $this->lng->txt("event_overview"),
1393  'icon_usr.svg',
1394  $this->lng->txt('obj_usr')
1395  );
1396  $this->ctrl->setParameter($this, 'offset', $this->requested_offset);
1397 
1398  $course_ref_id = $tree->checkForParentType($this->object->getRefId(), 'crs');
1399  $events = [];
1400  foreach ($tree->getSubTree($tree->getNodeData($course_ref_id), false, ['sess']) as $event_id) {
1401  $tmp_event = ilObjectFactory::getInstanceByRefId($event_id, false);
1402  if (!is_object($tmp_event) || $tmp_event->getType() != 'sess') {
1403  continue;
1404  }
1405  $events[] = $tmp_event;
1406  }
1407 
1408  $headerNames = [];
1409  $headerVars = [];
1410  $colWidth = [];
1411 
1412  $headerNames[] = $this->lng->txt('name');
1413  $headerVars[] = "name";
1414  $colWidth[] = '20%';
1415 
1416  for ($i = 1; $i <= count($events); $i++) {
1417  $headerNames[] = $i;
1418  $headerVars[] = "event_" . $i;
1419  $colWidth[] = 80 / count($events) . "%";
1420  }
1421 
1422  $this->tpl->setVariable("FORMACTION", $this->ctrl->getFormAction($this));
1423  $tbl->setHeaderNames($headerNames);
1424  $tbl->setHeaderVars($headerVars, $this->ctrl->getParameterArray($this));
1425  $tbl->setColumnWidth($colWidth);
1426 
1427  $tbl->setOrderColumn($this->requested_sort_by);
1428  $tbl->setOrderDirection($this->requested_sort_order);
1429  $tbl->setOffset($this->requested_offset);
1430  $tbl->setLimit((int) $ilUser->getPref("hits_per_page"));
1431  $tbl->setMaxCount(count($members));
1432  $tbl->setFooter("tblfooter", $this->lng->txt("previous"), $this->lng->txt("next"));
1433 
1434  $sliced_users = array_slice($members, $this->requested_offset, ilSession::get("tbl_limit"));
1435  $tbl->disable('sort');
1436  $tbl->render();
1437 
1438  $counter = 0;
1439  foreach ($sliced_users as $user_id) {
1440  foreach ($events as $event_obj) {
1441  $this->tpl->setCurrentBlock("eventcols");
1442 
1443  $event_part = new ilEventParticipants($this->object->getId());
1444 
1445  {
1446  $this->tpl->setVariable("IMAGE_PARTICIPATED", $event_part->hasParticipated($user_id) ?
1447  ilUtil::getImagePath('icon_ok.svg') :
1448  ilUtil::getImagePath('icon_not_ok.svg'));
1449 
1450  $this->tpl->setVariable("PARTICIPATED", $event_part->hasParticipated($user_id) ?
1451  $this->lng->txt('event_participated') :
1452  $this->lng->txt('event_not_participated'));
1453  }
1454 
1455  $this->tpl->parseCurrentBlock();
1456  }
1457 
1458  $this->tpl->setCurrentBlock("tbl_content");
1459  $name = ilObjUser::_lookupName($user_id);
1460  $this->tpl->setVariable("LASTNAME", $name['lastname']);
1461  $this->tpl->setVariable("FIRSTNAME", $name['firstname']);
1462  $this->tpl->setVariable("LOGIN", ilObjUser::_lookupLogin($user_id));
1463  $this->tpl->parseCurrentBlock();
1464  }
1465 
1466  $this->tpl->setVariable("HEAD_TXT_LEGEND", $this->lng->txt("legend"));
1467  $this->tpl->setVariable("HEAD_TXT_DIGIT", $this->lng->txt("event_digit"));
1468  $this->tpl->setVariable("HEAD_TXT_EVENT", $this->lng->txt("event"));
1469  $this->tpl->setVariable("HEAD_TXT_LOCATION", $this->lng->txt("event_location"));
1470  $this->tpl->setVariable("HEAD_TXT_DATE_TIME", $this->lng->txt("event_date_time"));
1471  $i = 1;
1472  foreach ($events as $event_obj) {
1473  $this->tpl->setCurrentBlock("legend_loop");
1474  $this->tpl->setVariable("LEGEND_DIGIT", $i++);
1475  $this->tpl->setVariable("LEGEND_EVENT_TITLE", $event_obj->getTitle());
1476  $this->tpl->setVariable("LEGEND_EVENT_DESCRIPTION", $event_obj->getDescription());
1477  $this->tpl->setVariable("LEGEND_EVENT_LOCATION", $event_obj->getLocation());
1478  $this->tpl->setVariable("LEGEND_EVENT_APPOINTMENT", $event_obj->getFirstAppointment()->appointmentToString());
1479  $this->tpl->parseCurrentBlock();
1480  }
1481  }
1482 
1483  protected function __showButton(string $cmd, string $text, string $target = ''): void
1484  {
1485  $this->toolbar->addButton($text, $this->ctrl->getLinkTarget($this, $cmd), $target);
1486  }
1487 
1488  protected function initForm(string $a_mode): bool
1489  {
1490  if ($this->form instanceof ilPropertyFormGUI) {
1491  return true;
1492  }
1493  $ilUser = $this->user;
1494  $object_service = $this->object_service;
1495  $this->lng->loadLanguageModule('dateplaner');
1496 
1498 
1499  $this->form = new ilPropertyFormGUI();
1500  $this->form->setMultipart(true);
1501  $this->form->setTableWidth('600px');
1502  $this->form->setFormAction($this->ctrl->getFormAction($this));
1503  $this->form->setMultipart(true);
1504 
1505  $this->form = $this->initDidacticTemplate($this->form);
1506 
1507  $this->lng->loadLanguageModule('dateplaner');
1508  $dur = new ilDateDurationInputGUI($this->lng->txt('cal_fullday'), 'event');
1509  $dur->setRequired(true);
1510  $dur->enableToggleFullTime(
1511  $this->lng->txt('event_fulltime_info'),
1512  $this->object->getFirstAppointment()->enabledFulltime()
1513  );
1514  $dur->setShowTime(true);
1515  $dur->setStart($this->object->getFirstAppointment()->getStart());
1516  $dur->setEnd($this->object->getFirstAppointment()->getEnd());
1517 
1518  $this->form->addItem($dur);
1519 
1520 
1521  // Recurrence
1522  if ($a_mode == 'create') {
1523  if (!is_object($this->rec)) {
1524  $this->rec = new ilEventRecurrence();
1525  }
1526  $rec = new ilRecurrenceInputGUI($this->lng->txt('cal_recurrences'), 'frequence');
1527  $rec->allowUnlimitedRecurrences(false);
1528  $rec->setRecurrence($this->rec);
1529  $this->form->addItem($rec);
1530 
1531  // #14547
1532  $lp = new ilCheckboxInputGUI($this->lng->txt("sess_lp_preset"), "lp_preset");
1533  $lp->setInfo($this->lng->txt("sess_lp_preset_info"));
1534  $lp->setChecked(true);
1535  $this->form->addItem($lp);
1536  }
1537 
1538  $section = new ilFormSectionHeaderGUI();
1539  $section->setTitle($this->lng->txt('event_section_information'));
1540  $this->form->addItem($section);
1541 
1542  // title
1543  $title = new ilTextInputGUI($this->lng->txt('event_title'), 'title');
1544  $title->setRequired(true);
1545  $title->setValue($this->object->getTitle());
1546  $title->setSize(50);
1547  $title->setMaxLength(70);
1548  $this->form->addItem($title);
1549 
1550  // desc
1551  $desc = new ilTextAreaInputGUI($this->lng->txt('event_desc'), 'desc');
1552  $desc->setValue($this->object->getLongDescription());
1553  $desc->setRows(4);
1554  $desc->setCols(50);
1555  $this->form->addItem($desc);
1556 
1557  // location
1558  $desc = new ilTextAreaInputGUI($this->lng->txt('event_location'), 'location');
1559  $desc->setValue($this->object->getLocation());
1560  $desc->setRows(4);
1561  $desc->setCols(50);
1562  $this->form->addItem($desc);
1563 
1564  // workflow
1565  $details = new ilTextAreaInputGUI($this->lng->txt('event_details_workflow'), 'details');
1566  $details->setValue($this->object->getDetails());
1567  $details->setCols(50);
1568  $details->setRows(4);
1569  $this->form->addItem($details);
1570 
1571  if ($a_mode == 'create') {
1572  $this->record_gui = new ilAdvancedMDRecordGUI(
1574  'sess'
1575  );
1576  $this->record_gui->setRefId($this->requested_ref_id);
1577  $this->record_gui->setPropertyForm($this->form);
1578  $this->record_gui->parse();
1579  } elseif ($this->checkPermissionBool('edit_metadata')) {
1580  $this->record_gui = new ilAdvancedMDRecordGUI(
1582  'sess',
1583  $this->object->getId()
1584  );
1585  $this->record_gui->setPropertyForm($this->form);
1586  $this->record_gui->parse();
1587  }
1588 
1589 
1590  // section
1591  $section = new ilFormSectionHeaderGUI();
1592  $section->setTitle($this->lng->txt('event_tutor_data'));
1593  $this->form->addItem($section);
1594 
1595  // name
1596  $tutor_name = new ilTextInputGUI($this->lng->txt('tutor_name'), 'tutor_name');
1597  $tutor_name->setValue($this->object->getName());
1598  $tutor_name->setSize(20);
1599  $tutor_name->setMaxLength(70);
1600  $this->form->addItem($tutor_name);
1601 
1602  // email
1603  $tutor_email = new ilTextInputGUI($this->lng->txt('tutor_email'), 'tutor_email');
1604  $tutor_email->setValue($this->object->getEmail());
1605  $tutor_email->setSize(20);
1606  $tutor_email->setMaxLength(70);
1607  $this->form->addItem($tutor_email);
1608 
1609  // phone
1610  $tutor_phone = new ilTextInputGUI($this->lng->txt('tutor_phone'), 'tutor_phone');
1611  $tutor_phone->setValue($this->object->getPhone());
1612  $tutor_phone->setSize(20);
1613  $tutor_phone->setMaxLength(70);
1614  $this->form->addItem($tutor_phone);
1615 
1616  $section = new ilFormSectionHeaderGUI();
1617  $section->setTitle($this->lng->txt('sess_section_reg'));
1618  $this->form->addItem($section);
1619 
1620  $reg_settings = new ilSessionMembershipRegistrationSettingsGUI(
1621  $this,
1622  $this->object,
1623  array(
1629  )
1630  );
1631  $reg_settings->addMembershipFormElements($this->form, '');
1632 
1633 
1634  $section = new ilFormSectionHeaderGUI();
1635  $section->setTitle($this->lng->txt('event_assign_files'));
1636  $this->form->addItem($section);
1637 
1638  $files = new ilFileWizardInputGUI($this->lng->txt('objs_file'), 'files');
1639  $files->setFilenames(array(0 => ''));
1640  $this->form->addItem($files);
1641 
1642  $section = new ilFormSectionHeaderGUI();
1643  $section->setTitle($this->lng->txt('sess_setting_header_presentation'));
1644  $this->form->addItem($section);
1645 
1646  $object_service->commonSettings()->legacyForm($this->form, $this->object)->addTileImage();
1647 
1648  $features = new ilFormSectionHeaderGUI();
1649  $features->setTitle($this->lng->txt('obj_features'));
1650  $this->form->addItem($features);
1652  $this->object->getId(),
1653  $this->form,
1654  array(
1656  )
1657  );
1658 
1659  $gallery = new ilCheckboxInputGUI($this->lng->txt('sess_show_members'), 'show_members');
1660  $gallery->setChecked($this->object->getShowMembers());
1661  $gallery->setInfo($this->lng->txt('sess_show_participants_info'));
1662  $this->form->addItem($gallery);
1663 
1664 
1665  // Show mail to members type
1666  $mail_type = new ilRadioGroupInputGUI($this->lng->txt('sess_mail_type'), 'mail_type');
1667  $mail_type->setValue((string) $this->object->getMailToMembersType());
1668 
1669  $mail_tutors = new ilRadioOption(
1670  $this->lng->txt('sess_mail_admins_only'),
1672  $this->lng->txt('sess_mail_admins_only_info')
1673  );
1674  $mail_type->addOption($mail_tutors);
1675 
1676  $mail_all = new ilRadioOption(
1677  $this->lng->txt('sess_mail_all'),
1679  $this->lng->txt('sess_mail_all_info')
1680  );
1681  $mail_type->addOption($mail_all);
1682  $this->form->addItem($mail_type);
1683 
1684 
1685 
1686  switch ($a_mode) {
1687  case 'create':
1688  $this->form->setTitle($this->lng->txt('event_table_create'));
1689 
1690  $this->form->addCommandButton('save', $this->lng->txt('event_btn_add'));
1691  $this->form->addCommandButton('saveAndAssignMaterials', $this->lng->txt('event_btn_add_edit'));
1692  $this->form->addCommandButton('cancel', $this->lng->txt('cancel'));
1693 
1694  return true;
1695 
1696  case 'edit':
1697  $this->form->setTitle($this->lng->txt('event_table_update'));
1698 
1699  $this->form->addCommandButton('update', $this->lng->txt('save'));
1700  $this->form->addCommandButton('cancelEdit', $this->lng->txt('cancel'));
1701 
1702  return true;
1703  }
1704  return true;
1705  }
1706 
1707  protected function load(): void
1708  {
1709  $event = $this->form->getItemByPostVar('event');
1710  if ($event->getStart() && $event->getEnd()) {
1711  $this->object->getFirstAppointment()->setStartingTime($event->getStart()->get(IL_CAL_UNIX));
1712  $this->object->getFirstAppointment()->setEndingTime($event->getStart()->get(IL_CAL_UNIX));
1713  $this->object->getFirstAppointment()->setStart($event->getStart());
1714  $this->object->getFirstAppointment()->setEnd($event->getEnd());
1715  $this->object->getFirstAppointment()->toggleFulltime($event->getStart() instanceof ilDate);
1716  }
1717 
1718  $this->object->setTitle($this->form->getInput('title'));
1719  $this->object->setDescription($this->form->getInput('desc'));
1720  $this->object->setLocation($this->form->getInput('location'));
1721  $this->object->setName($this->form->getInput('tutor_name'));
1722  $this->object->setPhone($this->form->getInput('tutor_phone'));
1723  $this->object->setEmail($this->form->getInput('tutor_email'));
1724  $this->object->setDetails($this->form->getInput('details'));
1725 
1726  $this->object->setRegistrationNotificationEnabled((bool) $this->form->getInput('registration_notification'));
1727  $this->object->setRegistrationNotificationOption($this->form->getInput('notification_option'));
1728 
1729  $this->object->setRegistrationType((int) $this->form->getInput('registration_type'));
1730 
1731  switch ($this->object->getRegistrationType()) {
1733  $this->object->enableCannotParticipateOption((bool) $this->form->getInput('show_cannot_participate_direct'));
1734  break;
1736  $this->object->enableCannotParticipateOption((bool) $this->form->getInput('show_cannot_participate_request'));
1737  break;
1738  default:
1739  $this->object->enableCannotParticipateOption(false);
1740  break;
1741  }
1742 
1743  // $this->object->setRegistrationMinUsers((int) $this->form->getInput('registration_min_members'));
1744  $this->object->setRegistrationMaxUsers((int) $this->form->getInput('registration_max_members'));
1745  $this->object->enableRegistrationUserLimit((int) $this->form->getInput('registration_membership_limited'));
1746  $this->object->setShowMembers((bool) $this->form->getInput('show_members'));
1747  $this->object->setMailToMembersType((int) $this->form->getInput('mail_type'));
1748 
1749  switch ((int) $this->form->getInput('waiting_list')) {
1750  case 2:
1751  $this->object->enableRegistrationWaitingList(true);
1752  $this->object->setWaitingListAutoFill(true);
1753  break;
1754 
1755  case 1:
1756  $this->object->enableRegistrationWaitingList(true);
1757  $this->object->setWaitingListAutoFill(false);
1758  break;
1759 
1760  default:
1761  $this->object->enableRegistrationWaitingList(false);
1762  $this->object->setWaitingListAutoFill(false);
1763  break;
1764  }
1765  }
1766 
1767  protected function loadRecurrenceSettings(): void
1768  {
1769  $this->rec = new ilEventRecurrence();
1770 
1771  switch ($this->form->getInput('frequence')) {
1773  $this->rec->setFrequenceType($this->form->getInput('frequence'));
1774  $this->rec->setInterval((int) $this->form->getInput('count_DAILY'));
1775  break;
1776 
1778  $this->rec->setFrequenceType($this->form->getInput('frequence'));
1779  $this->rec->setInterval((int) $this->form->getInput('count_WEEKLY'));
1780  if (is_array($this->form->getInput('byday_WEEKLY'))) {
1781  $this->rec->setBYDAY(ilUtil::stripSlashes(implode(',', $this->form->getInput('byday_WEEKLY'))));
1782  }
1783  break;
1784 
1786  $this->rec->setFrequenceType($this->form->getInput('frequence'));
1787  $this->rec->setInterval((int) $this->form->getInput('count_MONTHLY'));
1788  switch ((int) $this->form->getInput('subtype_MONTHLY')) {
1789  case 0:
1790  // nothing to do;
1791  break;
1792 
1793  case 1:
1794  switch ((int) $this->form->getInput('monthly_byday_day')) {
1795  case 8:
1796  // Weekday
1797  $this->rec->setBYSETPOS($this->form->getInput('monthly_byday_num'));
1798  $this->rec->setBYDAY('MO,TU,WE,TH,FR');
1799  break;
1800 
1801  case 9:
1802  // Day of month
1803  $this->rec->setBYMONTHDAY($this->form->getInput('monthly_byday_num'));
1804  break;
1805 
1806  default:
1807  $this->rec->setBYDAY(($this->form->getInput('monthly_byday_num') . $this->form->getInput('monthly_byday_day')));
1808  break;
1809  }
1810  break;
1811 
1812  case 2:
1813  $this->rec->setBYMONTHDAY($this->form->getInput('monthly_bymonthday'));
1814  break;
1815  }
1816  break;
1817 
1819  $this->rec->setFrequenceType($this->form->getInput('frequence'));
1820  $this->rec->setInterval((int) $this->form->getInput('count_YEARLY'));
1821  switch ((int) $this->form->getInput('subtype_YEARLY')) {
1822  case 0:
1823  // nothing to do;
1824  break;
1825 
1826  case 1:
1827  $this->rec->setBYMONTH($this->form->getInput('yearly_bymonth_byday'));
1828  $this->rec->setBYDAY(($this->form->getInput('yearly_byday_num') . $this->form->getInput('yearly_byday')));
1829  break;
1830 
1831  case 2:
1832  $this->rec->setBYMONTH($this->form->getInput('yearly_bymonth_by_monthday'));
1833  $this->rec->setBYMONTHDAY($this->form->getInput('yearly_bymonthday'));
1834  break;
1835  }
1836  break;
1837  }
1838 
1839  // UNTIL
1840  switch ((int) $this->form->getInput('until_type')) {
1841  case 1:
1842  $this->rec->setFrequenceUntilDate(null);
1843  // nothing to do
1844  break;
1845 
1846  case 2:
1847  $this->rec->setFrequenceUntilDate(null);
1848  $this->rec->setFrequenceUntilCount((int) $this->form->getInput('count'));
1849  break;
1850 
1851  case 3:
1852  $frequence = $this->form->getItemByPostVar('frequence');
1853  $end = $frequence->getRecurrence()->getFrequenceUntilDate();
1854  $this->rec->setFrequenceUntilCount(0);
1855  $this->rec->setFrequenceUntilDate($end);
1856  break;
1857  }
1858  }
1859 
1860  protected function __toUnix(array $date, array $time): int
1861  {
1862  return mktime($time['h'], $time['m'], 0, $date['m'], $date['d'], $date['y']);
1863  }
1864 
1865  protected function addLocatorItems(): void
1866  {
1867  $ilLocator = $this->locator;
1868 
1869  if (!$this->getCreationMode()) {
1870  // see prepareOutput()
1871  $title = strlen($this->object->getTitle()) ? (': ' . $this->object->getTitle()) : '';
1872  $title = $this->object->getFirstAppointment()->appointmentToString() . $title;
1873 
1874  $ilLocator->addItem($title, $this->ctrl->getLinkTarget($this, "infoScreen"), "", $this->requested_ref_id);
1875  }
1876  }
1877 
1878  protected function redirectToParentContentPageObject(): void
1879  {
1880  $objDefinition = $this->objDefinition;
1881  $tree = $this->tree;
1882  $ctrl = $this->ctrl;
1883 
1884  $parent_id = $tree->getParentId($this->object->getRefId());
1885 
1886  // #11650
1887  $parent_type = ilObject::_lookupType($parent_id, true);
1888 
1889  $parent_class = $objDefinition->getClassName($parent_type);
1890  $parent_class = 'ilObj' . $parent_class . 'GUI';
1891 
1892  $ctrl->setParameterByClass($parent_class, "ref_id", $parent_id);
1893  $ctrl->redirectByClass($parent_class, "view");
1894  }
1895 
1896  protected function getTabs(): void
1897  {
1898  $ilAccess = $this->access;
1899  $ilTabs = $this->tabs_gui;
1900  $tree = $this->tree;
1901  $ilCtrl = $this->ctrl;
1902  $ilHelp = $this->help;
1903  $ilUser = $this->user;
1904 
1905  $ilHelp->setScreenIdComponent("sess");
1906 
1907  $parent_id = $tree->getParentId($this->object->getRefId());
1908 
1909  // #11650
1910  $parent_type = ilObject::_lookupType($parent_id, true);
1911 
1912  $this->tabs_gui->setBackTarget(
1913  $this->lng->txt('back_to_' . $parent_type . '_content'),
1914  $ilCtrl->getLinkTarget($this, "redirectToParentContentPage")
1915  );
1916 
1917  $this->tabs_gui->addTarget(
1918  'info_short',
1919  $this->ctrl->getLinkTarget($this, 'infoScreen')
1920  );
1921 
1922  if ($ilAccess->checkAccess('write', '', $this->object->getRefId())) {
1923  $this->tabs_gui->addTarget(
1924  'settings',
1925  $this->ctrl->getLinkTarget($this, 'edit')
1926  );
1927  }
1928  if ($ilAccess->checkAccess('manage_materials', '', $this->object->getRefId())) {
1929  $this->tabs_gui->addTab(
1930  'materials',
1931  $this->lng->txt('crs_materials'),
1932  $this->ctrl->getLinkTarget($this, 'materials')
1933  );
1934  }
1935 
1936  // booking
1937  $parent_id = $tree->getParentId($this->requested_ref_id);
1938 
1939  if ($ilAccess->checkAccess('write', '', $this->ref_id) && ilContainer::_lookupContainerSetting(
1940  ilObject::_lookupObjId($parent_id),
1942  )) {
1943  $this->tabs_gui->addTarget(
1944  "obj_tool_setting_booking",
1945  $this->ctrl->getLinkTargetByClass(array("ilbookinggatewaygui"), "")
1946  );
1947  }
1948 
1949  // member tab
1950  $is_participant = $this->object->getMembersObject()->isAssigned($ilUser->getId());
1951  $membership_gui = new ilSessionMembershipGUI($this, $this->object);
1952  $membership_gui->addMemberTab($this->tabs_gui, $is_participant);
1953 
1954 
1955  // learning progress
1956  if (ilLearningProgressAccess::checkAccess($this->object->getRefId())) {
1957  $this->tabs_gui->addTarget(
1958  'learning_progress',
1959  $this->ctrl->getLinkTargetByClass(array('ilobjsessiongui','illearningprogressgui'), ''),
1960  '',
1961  array('illplistofobjectsgui','illplistofsettingsgui','illearningprogressgui','illplistofprogressgui')
1962  );
1963  }
1964 
1965  // meta data
1966  if ($ilAccess->checkAccess('edit_metadata', '', $this->ref_id)) {
1967  $mdgui = new ilObjectMetaDataGUI($this->object);
1968  $mdtab = $mdgui->getTab();
1969  if ($mdtab) {
1970  $this->tabs_gui->addTab(
1971  "metadata",
1972  $this->lng->txt('meta_data'),
1973  $mdtab
1974  );
1975  }
1976  }
1977 
1978  // export
1979  if ($ilAccess->checkAccess("write", "", $this->object->getRefId())) {
1980  $this->tabs_gui->addTarget(
1981  "export",
1982  $this->ctrl->getLinkTargetByClass("ilexportgui", ""),
1983  "",
1984  "ilexportgui"
1985  );
1986  }
1987 
1988 
1989  // edit permissions
1990  if ($ilAccess->checkAccess('edit_permission', "", $this->object->getRefId())) {
1991  $this->tabs_gui->addTarget(
1992  "perm_settings",
1993  $this->ctrl->getLinkTargetByClass("ilpermissiongui", "perm"),
1994  array("perm","info","owner"),
1995  'ilpermissiongui'
1996  );
1997  }
1998  }
1999 
2003  public function afterSaveCallback(ilObject $a_obj): void
2004  {
2005  // add new object to materials
2006  $event_items = new ilEventItems($this->object->getId());
2007  $event_items->addItem($a_obj->getRefId());
2008  $event_items->update();
2009  }
2010 
2014  public function readMemberData(array $a_usr_ids): array
2015  {
2016  $tmp_data = [];
2017  foreach ($a_usr_ids as $usr_id) {
2018  $tmp_data[$usr_id] = [];
2019  }
2020  return $tmp_data;
2021  }
2022 
2023  public function getContainerRefId(): int
2024  {
2025  if (!$this->container_ref_id) {
2026  $this->initContainer();
2027  }
2028  return $this->container_ref_id;
2029  }
2030 
2031  protected function cancelEditObject(): void
2032  {
2033  $ilCtrl = $this->ctrl;
2034  $tree = $this->tree;
2035 
2036  $parent_id = $tree->getParentId($this->requested_ref_id);
2037 
2038  $ilCtrl->setParameterByClass("ilrepositorygui", "ref_id", $parent_id);
2039 
2040  $ilCtrl->redirectByClass("ilrepositorygui", "");
2041  }
2042 
2043  public function getDefaultMemberRole(): int
2044  {
2046 
2047  $local_roles = $rbac_review->getRolesOfRoleFolder($this->object->getRefId(), false);
2048 
2049  foreach ($local_roles as $role_id) {
2050  $title = ilObject::_lookupTitle($role_id);
2051  if (substr($title, 0, 19) == 'il_sess_participant') {
2052  return $role_id;
2053  }
2054  }
2055  return 0;
2056  }
2057 
2061  public function getLocalRoles(): array
2062  {
2064 
2065  return $this->rbacreview->getRolesOfRoleFolder($this->object->getRefId(), false);
2066  }
2067 
2068  public function createMailSignature(): string
2069  {
2070  $link = chr(13) . chr(10) . chr(13) . chr(10);
2071  $link .= $this->lng->txt('sess_mail_permanent_link');
2072  $link .= chr(13) . chr(10) . chr(13) . chr(10);
2073  $link .= ilLink::_getLink($this->object->getRefId());
2074  return rawurlencode(base64_encode($link));
2075  }
2076 }
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...
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 represents a checkbox property in a property form.
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.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
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...
static deliverFileLegacy(string $a_file, ?string $a_filename=null, ?string $a_mime=null, ?bool $isInline=false, ?bool $removeAfterDelivery=false, ?bool $a_exit_after=true)
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
if($format !==null) $name
Definition: metadata.php:247
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
parses the objects.xml it handles the xml-description of all ilias objects
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...
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.
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)
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.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
if(!defined('PATH_SEPARATOR')) $GLOBALS['_PEAR_default_error_mode']
Definition: PEAR.php:64
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...
setRequired(bool $a_required)
form( $class_path, string $cmd)
static _unregister(int $a_usr_id, int $a_event_id)
if($orgName !==null) if($spconfig->hasValue('contacts')) $email
Definition: metadata.php:302
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)
$rows
Definition: xhr_table.php:10
__showButton(string $cmd, string $text, string $target='')
prepareOutput(bool $show_subobjects=true)
Error Handling & global info handling uses PEAR error class.
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...
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)
__construct(Container $dic, ilPlugin $plugin)
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...
$ilUser
Definition: imgupload.php:34
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
$i
Definition: metadata.php:41
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
postUpdateMaterials()
redirect to list of materials without offset/page.
static _lookupLogin(int $a_user_id)
ILIAS FileUpload FileUpload $upload