ILIAS  trunk Revision v11.0_alpha-1723-g8e69f309bab
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
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;
59  protected ?ilEventRecurrence $rec = 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 membersObject(): void
281  {
282  $this->ctrl->redirectByClass('ilSessionMembershipGUI', 'participants');
283  }
284 
285  public function getCurrentObject(): ilObjSession
286  {
291 
292  return $object;
293  }
294 
295  public function prepareOutput(bool $show_sub_objects = true): bool
296  {
297  parent::prepareOutput($show_sub_objects);
298 
299  if (!$this->getCreationMode()) {
300  $title = strlen($this->object->getTitle()) ? (': ' . $this->object->getTitle()) : '';
301 
302  $this->tpl->setTitle(
303  $this->object->getFirstAppointment()->appointmentToString() . $title
304  );
305  }
306  return true;
307  }
308 
309  public function registerObject(): void
310  {
311  $ilUser = $this->user;
312  $ilAppEventHandler = $this->event;
313 
314  $this->checkPermission('visible');
315 
316  $part = ilParticipants::getInstance($this->getCurrentObject()->getRefId());
317 
318  $event_part = new ilEventParticipants($this->getCurrentObject()->getId());
319  $event_part->updateExcusedForUser($ilUser->getId(), false);
320 
321  if (
322  $this->getCurrentObject()->isRegistrationUserLimitEnabled() &&
323  $this->getCurrentObject()->getRegistrationMaxUsers() &&
324  (count($event_part->getRegisteredParticipants()) >= $this->getCurrentObject()->getRegistrationMaxUsers())
325  ) {
326  if (!$this->getCurrentObject()->isRegistrationWaitingListEnabled()) {
327  $this->tpl->setOnScreenMessage('failure', $this->lng->txt('sess_reg_max_users_exceeded'), true);
328  $this->ctrl->redirect($this, 'infoScreen');
329  }
330  $wait = new ilSessionWaitingList($this->getCurrentObject()->getId());
331  $wait->addToList($ilUser->getId());
332  $this->ctrl->redirect($this, 'infoScreen');
333  }
334 
335 
336  switch ($this->getCurrentObject()->getRegistrationType()) {
338  $this->ctrl->redirect($this, 'info');
339  break;
340 
342  $part->register($ilUser->getId());
343  $this->tpl->setOnScreenMessage('success', $this->lng->txt('event_registered'), true);
344 
345  $ilAppEventHandler->raise(
346  "components/ILIAS/Session",
347  'enter',
348  array(
349  'obj_id' => $this->getCurrentObject()->getId(),
350  'ref_id' => $this->getCurrentObject()->getRefId(),
351  'usr_id' => $ilUser->getId()
352  )
353  );
354 
355  $this->ctrl->redirect($this, 'infoScreen');
356  break;
357 
359  $this->tpl->setOnScreenMessage('success', $this->lng->txt('sess_registered_confirm'), true);
360  $part->addSubscriber($ilUser->getId());
361 
362  $ilAppEventHandler->raise(
363  "components/ILIAS/Session",
364  'register',
365  array(
366  'obj_id' => $this->getCurrentObject()->getId(),
367  'ref_id' => $this->getCurrentObject()->getRefId(),
368  'usr_id' => $ilUser->getId()
369  )
370  );
371 
372  $this->ctrl->redirect($this, 'infoScreen');
373  break;
374  }
375  }
376 
377  public function joinObject(): void
378  {
379  $ilUser = $this->user;
380 
381  $this->checkPermission('read');
382 
383  if ($ilUser->isAnonymous()) {
384  $this->ctrl->redirect($this, 'infoScreen');
385  }
386 
387  if (ilEventParticipants::_isRegistered($ilUser->getId(), $this->object->getId())) {
388  ilSession::set("sess_hide_info", true);
389  ilEventParticipants::_unregister($ilUser->getId(), $this->object->getId());
390  $this->tpl->setOnScreenMessage('success', $this->lng->txt('event_unregistered'), true);
391  } else {
392  ilEventParticipants::_register($ilUser->getId(), $this->object->getId());
393  $this->tpl->setOnScreenMessage('success', $this->lng->txt('event_registered'), true);
394  }
395 
396  $this->ctrl->redirect($this, 'infoScreen');
397  }
398 
399  public function unregisterObject(bool $a_refuse_participation = false): void
400  {
401  $ilUser = $this->user;
402  $ilAppEventHandler = $this->event;
403  $access = $this->access;
404  $tree = $this->tree;
405 
406  $part = ilSessionParticipants::getInstance($this->object->getRefId());
407  if ($part->isSubscriber($ilUser->getId())) {
408  $part->deleteSubscriber($ilUser->getId());
409  }
410 
411  $part->unregister($ilUser->getId());
412 
413  if ($a_refuse_participation) {
414  $event_part = new \ilEventParticipants($this->object->getId());
415  $event_part->updateExcusedForUser($ilUser->getId(), true);
416  }
417 
418  ilSessionWaitingList::deleteUserEntry($ilUser->getId(), $this->getCurrentObject()->getId());
419 
420  // check for visible permission of user
422  $access->clear();
423  $has_access = $access->checkAccessOfUser(
424  $ilUser->getId(),
425  'visible',
426  '',
427  $this->object->getRefId()
428  );
429  if (!$has_access) {
430  $parent = $tree->getParentId($this->object->getRefId());
431  $this->redirectToRefId($parent);
432  return;
433  }
434 
435  $ilAppEventHandler->raise(
436  "components/ILIAS/Session",
437  'unregister',
438  array(
439  'obj_id' => $this->getCurrentObject()->getId(),
440  'ref_id' => $this->getCurrentObject()->getRefId(),
441  'usr_id' => $ilUser->getId()
442  )
443  );
444  if ($a_refuse_participation) {
445  $this->tpl->setOnScreenMessage('info', $this->lng->txt('sess_participation_refused_info'), true);
446  } else {
447  $this->tpl->setOnScreenMessage('success', $this->lng->txt('event_unregistered'), true);
448  }
449  $this->ctrl->returnToParent($this);
450  }
451 
452  public static function _goto(string $a_target): void
453  {
454  global $DIC;
455  $main_tpl = $DIC->ui()->mainTemplate();
456 
457  $ilAccess = $DIC->access();
458  $lng = $DIC->language();
459 
460  $ilCtrl = $DIC->ctrl();
461  $parts = explode('_', $a_target);
462  $a_target = (int) $parts[0];
463 
464  if ($ilAccess->checkAccess('write', '', $a_target)) {
465  if (isset($parts[1]) && 'part' === $parts[1]) {
466  $ilCtrl->setTargetScript('ilias.php');
467  $ilCtrl->setParameterByClass('ilSessionMembershipGUI', 'ref_id', $a_target);
468  $ilCtrl->setTargetScript('ilias.php');
469  $ilCtrl->redirectByClass(array('ilRepositoryGUI', __CLASS__, 'ilSessionMembershipGUI'));
470  }
471  }
472 
473  if ($ilAccess->checkAccess('visible', "", $a_target)) {
474  ilObjectGUI::_gotoRepositoryNode($a_target, "infoScreen");
475  } elseif ($ilAccess->checkAccess("read", "", ROOT_FOLDER_ID)) {
476  $main_tpl->setOnScreenMessage('failure', sprintf(
477  $lng->txt("msg_no_perm_read_item"),
479  ), true);
481  }
482  }
483 
489  public function infoScreenObject(): void
490  {
491  $this->ctrl->redirectByClass(
492  [self::class, ilInfoScreenGUI::class],
493  'showSummary'
494  );
495  }
496 
497  public function modifyItemGUI(ilObjectListGUI $a_item_list_gui, array $a_item_data, bool $a_show_path): void
498  {
499  $tree = $this->tree;
500 
501  // if folder is in a course, modify item list gui according to course requirements
502  if ($course_ref_id = $tree->checkForParentType($this->object->getRefId(), 'crs')) {
503  // #10611
504  ilObjectActivation::addListGUIActivationProperty($a_item_list_gui, $a_item_data);
505 
506  $course_obj_id = ilObject::_lookupObjId($course_ref_id);
508  $a_item_list_gui,
509  get_class($this),
510  $a_item_data,
511  $a_show_path,
512  $course_ref_id,
513  $course_obj_id,
514  $this->object->getRefId()
515  );
516  }
517  }
518 
523  public function showJoinRequestButtonInCalendar(ilToolbarGUI $a_ilToolbar): bool
524  {
525  return $this->showJoinRequestButton($a_ilToolbar);
526  }
527 
528  protected function refuseParticipationObject(): void
529  {
530  $this->unregisterObject(true);
531  }
532 
533  protected function showJoinRequestButton(?ilToolbarGUI $ilToolbar = null): bool
534  {
535  $ilUser = $this->user;
536 
537  if (!$ilToolbar) {
538  $ilToolbar = $this->toolbar;
539  }
540 
541  if (!$this->getCurrentObject()->enabledRegistrationForUsers() || $ilUser->isAnonymous()) {
542  return false;
543  }
544 
545  $part = ilParticipants::getInstance($this->getCurrentObject()->getRefId());
546 
547  $this->ctrl->setParameter($this, "ref_id", $this->getCurrentObject()->getRefId());
548 
549  $btn_excused = null;
550  if ($this->object->isCannotParticipateOptionEnabled()) {
551  $btn_excused = $this->ui->factory()->button()->standard(
552  $this->lng->txt('sess_bt_refuse'),
553  $this->ctrl->getLinkTarget($this, 'refuseParticipation')
554  );
555  }
556 
557 
558  if (ilEventParticipants::_isRegistered($ilUser->getId(), $this->getCurrentObject()->getId())) {
559  if (!is_null($btn_excused)) {
560  $ilToolbar->addComponent($btn_excused);
561  }
562  return true;
563  } elseif ($part->isSubscriber($ilUser->getId())) {
564  if (!is_null($btn_excused)) {
565  $ilToolbar->addComponent($btn_excused);
566  }
567  return true;
568  } elseif (ilSessionWaitingList::_isOnList($ilUser->getId(), $this->getCurrentObject()->getId())) {
569  if (!is_null($btn_excused)) {
570  $ilToolbar->addComponent($btn_excused);
571  }
572  return true;
573  }
574 
575  $event_part = new ilEventParticipants($this->getCurrentObject()->getId());
576 
577  if (
578  $this->getCurrentObject()->isRegistrationUserLimitEnabled() &&
579  $this->getCurrentObject()->getRegistrationMaxUsers() &&
580  (count($event_part->getRegisteredParticipants()) >= $this->getCurrentObject()->getRegistrationMaxUsers())
581  ) {
582  if ($this->getCurrentObject()->isRegistrationWaitingListEnabled()) {
583  $this->tpl->setOnScreenMessage('info', $this->lng->txt('sess_reg_max_users_exceeded_wl'));
584  $btn_attend = $this->ui->factory()->button()->primary(
585  $this->lng->txt("mem_add_to_wl"),
586  $this->ctrl->getLinkTargetByClass(array("ilRepositoryGUI", "ilObjSessionGUI"), "register")
587  );
588  $ilToolbar->addComponent($btn_attend);
589  if (!$event_part->isExcused($ilUser->getId()) && !is_null($btn_excused)) {
590  $ilToolbar->addComponent($btn_excused);
591  }
592  } else {
593  $this->tpl->setOnScreenMessage('info', $this->lng->txt('sess_reg_max_users_exceeded'));
594  }
595  return true;
596  } elseif (is_null(ilSession::get("sess_hide_info"))) {
597  $this->tpl->setOnScreenMessage('info', $this->lng->txt('sess_join_info'));
598  $btn_attend = $this->ui->factory()->button()->primary(
599  $this->lng->txt("join_session"),
600  $this->ctrl->getLinkTargetByClass(array("ilRepositoryGUI", "ilObjSessionGUI"), "register")
601  );
602  $ilToolbar->addComponent($btn_attend);
603  if (!$event_part->isExcused($ilUser->getId()) && !is_null($btn_excused)) {
604  $ilToolbar->addComponent($btn_excused);
605  }
606  return true;
607  }
608  return false;
609  }
610 
611  protected function infoScreen(): void
612  {
613  $ilUser = $this->user;
614  $tree = $this->tree;
615  $lng = $this->lng;
616 
617  $this->checkPermission('visible');
618  $this->tabs_gui->setTabActive('info_short');
619 
620  $this->showJoinRequestButton();
621 
622  $info = new ilInfoScreenGUI($this);
623  $info->enableBookingInfo(true);
624 
625  $eventItems = ilObjectActivation::getItemsByEvent($this->object->getId());
626  $parent_id = $tree->getParentId($this->object->getRefId());
627  $parent_id = ilObject::_lookupObjId($parent_id);
628  $eventItems = ilContainerSorting::_getInstance($parent_id)->sortSubItems(
629  'sess',
630  $this->object->getId(),
631  $eventItems
632  );
633 
634  $lng->loadLanguageModule("cntr");// #14158
635 
636  $html = '';
637  foreach ($eventItems as $item) {
641  $list_gui = ilSessionObjectListGUIFactory::factory($item['type']);
642  $list_gui->setContainerObject($this);
643 
644  $this->modifyItemGUI($list_gui, $item, false);
645 
646  $html .= $list_gui->getListItemHTML(
647  (int) $item['ref_id'],
648  (int) $item['obj_id'],
649  (string) $item['title'],
650  (string) $item['description']
651  );
652  }
653 
654  if (strlen($html)) {
655  $info->addSection($this->lng->txt('event_materials'));
656  $info->addProperty(
657  '&nbsp;',
658  $html
659  );
660  }
661 
662 
663 
664  // Session information
665  if (strlen($this->object->getLocation()) || strlen($this->object->getDetails())) {
666  $info->addSection($this->lng->txt('event_section_information'));
667  }
668  if (strlen($location = $this->object->getLocation())) {
669  $info->addProperty(
670  $this->lng->txt('event_location'),
671  ilUtil::makeClickable(nl2br($this->object->getLocation()), true)
672  );
673  }
674  if (strlen($this->object->getDetails())) {
675  $info->addProperty(
676  $this->lng->txt('event_details_workflow'),
677  ilUtil::makeClickable(nl2br($this->object->getDetails()), true)
678  );
679  }
680 
681  $this->record_gui = new ilAdvancedMDRecordGUI(ilAdvancedMDRecordGUI::MODE_INFO, 'sess', $this->object->getId());
682  $this->record_gui->setInfoObject($info);
683  $this->record_gui->parse();
684 
685  // meta data
686  $info->addMetaDataSections($this->object->getId(), 0, $this->object->getType());
687 
688 
689  // Tutor information
690  if ($this->object->hasTutorSettings()) {
691  $info->addSection($this->lng->txt('event_tutor_data'));
692  if (strlen($fullname = $this->object->getName())) {
693  $info->addProperty(
694  $this->lng->txt('event_lecturer'),
695  $fullname
696  );
697  }
698  if (strlen($email = $this->object->getEmail())) {
699  $info->addProperty(
700  $this->lng->txt('tutor_email'),
701  $email
702  );
703  }
704  if (strlen($phone = $this->object->getPhone())) {
705  $info->addProperty(
706  $this->lng->txt('tutor_phone'),
707  $phone
708  );
709  }
710  }
711 
712  // support contacts
713  $parts = ilParticipants::getInstance($this->object->getRefId());
714  $contacts = $parts->getContacts();
715  if (count($contacts) > 0) {
716  $info->addSection($this->lng->txt("crs_mem_contacts"));
717  foreach ($contacts as $contact) {
718  $pgui = new ilPublicUserProfileGUI($contact);
719  $pgui->setBackUrl($this->ctrl->getLinkTargetByClass("ilinfoscreengui"));
720  $pgui->setEmbedded(true);
721  $info->addProperty("", $pgui->getHTML());
722  }
723  }
724 
725  // forward the command
726  $this->ctrl->forwardCommand($info);
727 
728  // store read event
730  $this->object->getType(),
731  $this->object->getRefId(),
732  $this->object->getId(),
733  $ilUser->getId()
734  );
735  }
736 
737  protected function initCreateForm($new_type): ilPropertyFormGUI
738  {
739  if (!is_object($this->object)) {
740  $this->object = new ilObjSession();
741  }
742  if (!$this->form instanceof ilPropertyFormGUI) {
743  $this->initForm('create');
744  }
745  return $this->form;
746  }
747 
748  protected function saveAndAssignMaterialsObject(): void
749  {
750  $this->saveObject(false);
751 
752  $this->ctrl->setParameter($this, 'ref_id', $this->object->getRefId());
753  $this->ctrl->setParameter($this, 'new_type', '');
754  $this->ctrl->redirect($this, 'materials');
755  }
756 
757  public function saveObject(bool $a_redirect_on_success = true): void
758  {
759  $ilUser = $this->user;
760  $object_service = $this->object_service;
761 
762  $this->object = new ilObjSession();
763 
764  $this->ctrl->saveParameter($this, "new_type");
765 
766  $this->initForm('create');
767  $this->ilErr->setMessage('');
768  if (!$this->form->checkInput()) {
769  $this->tpl->setOnScreenMessage(
771  $this->lng->txt('err_check_input')
772  );
773  $this->form->setValuesByPost();
774  $this->createObject();
775  return;
776  }
777 
778  if ($this->record_gui instanceof \ilAdvancedMDRecordGUI && !$this->record_gui->importEditFormPostValues()
779  ) {
780  $this->ilErr->setMessage($this->lng->txt('err_check_input'));
781  }
782 
783  $this->load();
784  $this->loadRecurrenceSettings();
785 
786  $this->object->validate();
787  $this->object->getFirstAppointment()->validate();
788 
789  if (strlen($this->ilErr->getMessage())) {
790  $this->tpl->setOnScreenMessage('failure', $this->ilErr->getMessage());
791  $this->form->setValuesByPost();
792  $this->createObject();
793  }
794  // Create session
795  $this->object->create();
796  $this->object->createReference();
797  $this->object->putInTree($this->requested_ref_id);
798  $this->object->setPermissions($this->requested_ref_id);
799 
801  $this->object->getId(),
802  $this->form,
803  array(
805  )
806  );
807  if ($this->record_gui instanceof \ilAdvancedMDRecordGUI) {
808  $this->record_gui->writeEditForm($this->object->getId());
809  }
810 
811 
812  // apply didactic template?
813  $dtpl = $this->getDidacticTemplateVar("dtpl");
814  if ($dtpl) {
815  $this->object->applyDidacticTemplate($dtpl);
816  }
817 
818  // #14547 - active is default
819  if (!$this->form->getInput("lp_preset")) {
820  $lp_obj_settings = new ilLPObjSettings($this->object->getId());
821  $lp_obj_settings->setMode(ilLPObjSettings::LP_MODE_DEACTIVATED);
822  $lp_obj_settings->update(false);
823  }
824 
825  // create appointment
826  $this->object->getFirstAppointment()->setSessionId($this->object->getId());
827  $this->object->getFirstAppointment()->create();
828 
829  $this->handleFileUpload();
830 
831  $object_service->commonSettings()->legacyForm($this->form, $this->object)->saveTileImage();
832 
833  $this->createRecurringSessions((bool) $this->form->getInput("lp_preset"));
834 
835  if ($a_redirect_on_success) {
836  $this->tpl->setOnScreenMessage('info', $this->lng->txt('event_add_new_event'), true);
837  $this->ctrl->returnToParent($this);
838  }
839  }
840 
841  public function handleFileUpload(): void
842  {
843  $tree = $this->tree;
844 
845  $ev = new ilEventItems($this->object->getId());
846  $items = $ev->getItems();
847 
848  $counter = 0;
849  while (true) {
850  if (!isset($_FILES['files']['name'][$counter])) {
851  break;
852  }
853  if (!strlen($_FILES['files']['name'][$counter])) {
854  $counter++;
855  continue;
856  }
857 
858  $file = new ilObjFile();
859  $file->setTitle(ilUtil::stripSlashes($_FILES['files']['name'][$counter]));
860  $file->setDescription('');
861  $file->setFileName(ilUtil::stripSlashes($_FILES['files']['name'][$counter]));
862  $file->create();
863  $new_ref_id = $file->createReference();
864  $file->putInTree($tree->getParentId($this->object->getRefId()));
865  $file->setPermissions($tree->getParentId($this->object->getRefId()));
866 
867  $upload = $this->upload;
868  if (!$upload->hasBeenProcessed()) {
869  $upload->process();
870  }
871  $file->getUploadFile(
872  $_FILES['files']['tmp_name'][$counter],
873  $_FILES['files']['name'][$counter]
874  );
875 
876  $items[] = $new_ref_id;
877  $counter++;
878  }
879 
880  $ev->setItems($items);
881  $ev->update();
882  }
883 
884  protected function createRecurringSessions(bool $a_activate_lp = true): bool
885  {
886  $tree = $this->tree;
887 
888  if (!$this->rec->getFrequenceType()) {
889  return true;
890  }
891  $calc = new ilCalendarRecurrenceCalculator($this->object->getFirstAppointment(), $this->rec);
892 
893  $period_start = clone $this->object->getFirstAppointment()->getStart();
894 
895 
896  $period_end = clone $this->object->getFirstAppointment()->getStart();
897  $period_end->increment(IL_CAL_YEAR, 5);
898  $date_list = $calc->calculateDateList($period_start, $period_end);
899 
900  $period_diff = $this->object->getFirstAppointment()->getEnd()->get(IL_CAL_UNIX) -
901  $this->object->getFirstAppointment()->getStart()->get(IL_CAL_UNIX);
902  $parent_id = $tree->getParentId($this->object->getRefId());
903 
904  $evi = new ilEventItems($this->object->getId());
905  $eitems = $evi->getItems();
906 
907  $counter = 0;
908  foreach ($date_list->get() as $date) {
909  if (!$counter++) {
910  continue;
911  }
912 
913  $new_obj = $this->object->cloneObject($parent_id);
914 
915  // apply didactic template?
916  $dtpl = $this->getDidacticTemplateVar("dtpl");
917  if ($dtpl) {
918  $new_obj->applyDidacticTemplate($dtpl);
919  }
920 
921  $new_obj->read();
922  $new_obj->getFirstAppointment()->setStartingTime($date->get(IL_CAL_UNIX));
923  $new_obj->getFirstAppointment()->setEndingTime($date->get(IL_CAL_UNIX) + $period_diff);
924  $new_obj->getFirstAppointment()->update();
925  $new_obj->update();
926 
927  // #14547 - active is default
928  if (!$a_activate_lp) {
929  $lp_obj_settings = new ilLPObjSettings($new_obj->getId());
930  $lp_obj_settings->setMode(ilLPObjSettings::LP_MODE_DEACTIVATED);
931  $lp_obj_settings->update(false);
932  }
933 
934  $new_evi = new ilEventItems($new_obj->getId());
935  $new_evi->setItems($eitems);
936  $new_evi->update();
937  }
938 
939  return true;
940  }
941 
942  public function editObject(): void
943  {
944  $this->tabs_gui->setTabActive('settings');
945 
946  $this->initForm('edit');
947  $this->tpl->addBlockFile('ADM_CONTENT', 'adm_content', 'tpl.sess_edit.html', 'components/ILIAS/Session');
948  $this->tpl->setVariable('EVENT_EDIT_TABLE', $this->form->getHTML());
949  }
950 
951  public function updateObject(): void
952  {
953  $object_service = $this->object_service;
954 
955  $old_autofill = $this->object->hasWaitingListAutoFill();
956 
957  $this->initForm('edit');
958  $this->ilErr->setMessage('');
959  if (!$this->form->checkInput()) {
960  $this->tpl->setOnScreenMessage(
962  $this->lng->txt('err_check_input')
963  );
964  $this->form->setValuesByPost();
965  $this->editObject();
966  return;
967  }
968 
969  //Mantis 21972: Choose didactic template on settings screen
970  $old_type = ilDidacticTemplateObjSettings::lookupTemplateId($this->object->getRefId());
971 
972  $modified = false;
973  $new_type_info = $this->form->getInput('didactic_type');
974  if ($new_type_info) {
975  $new_type = explode('_', $this->form->getInput('didactic_type'));
976  $new_type = (int) $new_type[1];
977 
978  $modified = ($new_type !== $old_type);
979  }
980 
981  if (
982  $this->record_gui instanceof \ilAdvancedMDRecordGUI &&
983  !$this->record_gui->importEditFormPostValues()
984  ) {
985  $this->tpl->setOnScreenMessage(
987  $this->lng->txt('err_check_input')
988  );
989  $this->form->setValuesByPost();
990  $this->editObject();
991  }
992 
993  $this->load();
994 
995  $this->object->validate();
996  $this->object->getFirstAppointment()->validate();
997 
998  if (strlen($this->ilErr->getMessage())) {
999  $this->tpl->setOnScreenMessage('failure', $this->ilErr->getMessage());
1000  $this->editObject();
1001  }
1002  // Update event
1003  $this->object->update();
1004  $this->object->getFirstAppointment()->update();
1005 
1007  $this->object->getId(),
1008  $this->form,
1009  array(
1011  )
1012  );
1013  if ($this->record_gui instanceof \ilAdvancedMDRecordGUI) {
1014  $this->record_gui->writeEditForm();
1015  }
1016  $this->handleFileUpload();
1017 
1018  $object_service->commonSettings()->legacyForm($this->form, $this->object)->saveTileImage();
1019 
1020  // if autofill has been activated trigger process
1021  if (!$old_autofill &&
1022  $this->object->hasWaitingListAutoFill()) {
1023  $this->object->handleAutoFill();
1024  }
1025 
1026  //Mantis 21972: Choose didactic template on settings screen
1027  if (!$modified) {
1028  $this->tpl->setOnScreenMessage('success', $this->lng->txt('event_updated'), true);
1029  $this->ctrl->redirect($this, 'edit');
1030  return;
1031  }
1032 
1033  if ($new_type == 0) {
1034  $new_type_txt = $this->lng->txt('il_sess_status_open');
1035  } else {
1036  $dtpl = new ilDidacticTemplateSetting($new_type);
1037  $new_type_txt = $dtpl->getPresentationTitle($this->lng->getLangKey());
1038  }
1039  $this->tabs_gui->activateTab('settings');
1040 
1041  $confirm = new ilConfirmationGUI();
1042  $confirm->setFormAction($this->ctrl->getFormAction($this));
1043  $confirm->setHeaderText($this->lng->txt('sess_warn_sess_type_changed'));
1044  $confirm->addItem(
1045  'sess_type',
1046  (string) $new_type,
1047  $this->lng->txt('sess_info_new_sess_type') . ': ' . $new_type_txt
1048  );
1049  $confirm->setConfirm($this->lng->txt('sess_change_type'), 'updateSessionType');
1050  $confirm->setCancel($this->lng->txt('cancel'), 'edit');
1051 
1052  $this->tpl->setContent($confirm->getHTML());
1053  }
1054 
1058  public function updateSessionTypeObject(): void
1059  {
1061  $this->object->getRefId(),
1062  (int) $this->http->request()->getParsedBody()['sess_type']
1063  );
1064 
1065  $this->tpl->setOnScreenMessage('success', $this->lng->txt('settings_saved'), true);
1066  $this->ctrl->redirect($this, 'edit');
1067  }
1068 
1072  protected function initContainer(bool $a_init_participants = false)
1073  {
1074  $tree = $this->tree;
1075 
1076  $is_course = $is_group = false;
1077 
1078  // #13178
1079  $this->container_ref_id = $tree->checkForParentType($this->object->getRefId(), 'grp');
1080  if ($this->container_ref_id) {
1081  $is_group = true;
1082  }
1083  if (!$this->container_ref_id) {
1084  $this->container_ref_id = $tree->checkForParentType($this->object->getRefId(), 'crs');
1085  if ($this->container_ref_id) {
1086  $is_course = true;
1087  }
1088  }
1089  if (!$this->container_ref_id) {
1090  $this->tpl->setOnScreenMessage('failure', 'No container object found. Aborting');
1091  return true;
1092  }
1093  $this->container_obj_id = ilObject::_lookupObjId($this->container_ref_id);
1094 
1095  if ($a_init_participants && $this->container_obj_id) {
1096  if ($is_course) {
1097  return ilCourseParticipants::_getInstanceByObjId($this->container_obj_id);
1098  } elseif ($is_group) {
1099  return ilGroupParticipants::_getInstanceByObjId($this->container_obj_id);
1100  }
1101  }
1102 
1103  return false;
1104  }
1105 
1106  public function materialsObject(): void
1107  {
1108  $this->tabs_gui->activateTab('materials');
1109 
1110  $parent_ref_id = $this->tree->getParentId($this->object->getRefId());
1111  $parent_type = ilObject::_lookupType($parent_ref_id, true);
1112  $parent_gui_class = 'ilObj' . $this->obj_definition->getClassName($parent_type) . 'GUI';
1113  $this->ctrl->setParameterByClass($parent_gui_class, 'ref_id', $parent_ref_id);
1115  $this->buildAddNewItemElements(
1116  $this->getCreatableObjectTypes(),
1117  $parent_gui_class,
1118  $this->object->getRefId()
1119  )
1120  );
1121  $gui->render();
1122  $this->ctrl->clearParameterByClass($parent_gui_class, 'ref_id');
1123 
1124  $this->event_items = new ilEventItems($this->object->getId());
1125 
1126  $tbl = new ilSessionMaterialsTableGUI($this, "materials");
1127 
1128  $tbl->setDisableFilterHiding(true);
1129 
1130  $tbl->addMultiCommand('saveMaterials', $this->lng->txt('sess_assign'));
1131  $tbl->addMultiCommand("removeMaterials", $this->lng->txt("remove"));
1132 
1133  $tbl->setTitle($this->lng->txt("event_assign_materials_table"));
1134  $tbl->setDescription($this->lng->txt('event_assign_materials_info'));
1135 
1136  $tbl->setMaterialItems($this->event_items->getItems());
1137  $tbl->setContainerRefId($this->getContainerRefId());
1138  $data = $tbl->getDataFromDb();
1139  $tbl->setMaterials($data);
1140 
1141  $this->tpl->setContent($tbl->getHTML());
1142  }
1143 
1144  public function getCreatableObjectTypes(): array
1145  {
1146  $parent_ref_id = $this->tree->getParentId($this->object->getRefId());
1147  $parent_type = ilObject::_lookupType($parent_ref_id, true);
1148  $parent_gui_class = 'ilObj' . $this->obj_definition->getClassName($parent_type) . 'GUI';
1149  $parent_gui = new $parent_gui_class('', $parent_ref_id, true, false);
1150  $types = $parent_gui->getCreatableObjectTypes();
1151  foreach (array_merge(['itgr', 'sess' ], $this->objDefinition->getSideBlockTypes()) as $type_to_remove) {
1152  unset($types[$type_to_remove]);
1153  }
1154  return $types;
1155  }
1156 
1157  public function applyFilter(): void
1158  {
1159  $tbl = new ilSessionMaterialsTableGUI($this, "materials");
1160  $tbl->writeFilterToSession(); // writes filter to session
1161  $tbl->resetOffset(); // sets record offest to 0 (first page)
1162  $this->ctrl->redirect($this, "materials");
1163  }
1164 
1165  public function resetFilter(): void
1166  {
1167  $tbl = new ilSessionMaterialsTableGUI($this, "materials");
1168  $tbl->resetOffset(); // sets record offest to 0 (first page)
1169  $tbl->resetFilter(); // clears filter
1170  $this->ctrl->redirect($this, "materials");
1171  }
1172 
1173  public function removeMaterialsObject(): void
1174  {
1175  $items_checked = $this->requested_items;
1176 
1177  $this->event_items = new ilEventItems($this->object->getId());
1178  $this->event_items->removeItems($items_checked);
1179 
1180  $this->postUpdateMaterials();
1181  }
1182 
1183  public function saveMaterialsObject(): void
1184  {
1185  $this->event_items = new ilEventItems($this->object->getId());
1186  $db_items = $this->event_items->getItems();
1187 
1188  $list_items_checked = $this->requested_items;
1189  $list_items_checked = array_map('intval', $list_items_checked);
1190 
1191  $items_to_save = array_merge($db_items, $list_items_checked);
1192  $items_to_save = array_unique($items_to_save);
1193 
1194  $this->event_items->setItems($items_to_save);
1195  $this->event_items->update();
1196  $this->postUpdateMaterials();
1197  }
1198 
1202  public function postUpdateMaterials(): void
1203  {
1204  $tbl = new ilSessionMaterialsTableGUI($this, "materials");
1205  $tbl->setOffset(0);
1206  $tbl->storeNavParameter();//remove offset and go to page 1
1207 
1208  $this->tpl->setOnScreenMessage('success', $this->lng->txt('settings_saved'), true);
1209  $this->ctrl->redirect($this, 'materials');
1210  }
1211 
1212  public function attendanceListObject(): void
1213  {
1214  $tpl = $this->tpl;
1215  $ilTabs = $this->tabs_gui;
1216 
1217  $this->checkPermission('manage_members');
1218  $ilTabs->setTabActive('event_edit_members');
1219 
1220  $list = $this->initAttendanceList();
1221  $form = $list->initForm('printAttendanceList');
1222  $tpl->setContent($form->getHTML());
1223  }
1224 
1225  protected function initAttendanceList(): ilAttendanceList
1226  {
1227  $members_obj = $this->initContainer(true);
1228 
1229  $list = new ilAttendanceList(
1230  $this,
1231  $this->object,
1232  $members_obj
1233  );
1234  $list->setId('sessattlst');
1235 
1236  $event_app = $this->object->getFirstAppointment();
1238  $desc = ilDatePresentation::formatPeriod($event_app->getStart(), $event_app->getEnd());
1240  $desc .= " " . $this->object->getTitle();
1241  $list->setTitle($this->lng->txt('sess_attendance_list'), $desc);
1242 
1243  $list->addPreset('mark', $this->lng->txt('trac_mark'), true);
1244  $list->addPreset('comment', $this->lng->txt('trac_comment'), true);
1245  if ($this->object->enabledRegistration()) {
1246  $list->addPreset('registered', $this->lng->txt('event_tbl_registered'), true);
1247  }
1248  $list->addPreset('participated', $this->lng->txt('event_tbl_participated'), true);
1249  $list->addBlank($this->lng->txt('sess_signature'));
1250 
1251  $list->addUserFilter('registered', $this->lng->txt('event_list_registered_only'));
1252 
1253  return $list;
1254  }
1255 
1256  protected function printAttendanceListObject(): void
1257  {
1258  $this->checkPermission('manage_members');
1259 
1260  $list = $this->initAttendanceList();
1261  $list->initFromForm();
1262  $list->setCallback(array($this, 'getAttendanceListUserData'));
1263 
1264  $this->event_part = new ilEventParticipants($this->object->getId());
1265  $list->getFullscreenHTML();
1266  }
1267 
1268  public function getAttendanceListUserData(int $a_user_id, array $a_filters): ?array
1269  {
1270  $data = $this->event_part->getUser($a_user_id);
1271 
1272  if ($a_filters && $a_filters["registered"] && !$data["registered"]) {
1273  return null;
1274  }
1275 
1276  $data['registered'] = $data['registered'] ?
1277  $this->lng->txt('yes') :
1278  $this->lng->txt('no');
1279  $data['participated'] = $data['participated'] ?
1280  $this->lng->txt('yes') :
1281  $this->lng->txt('no');
1282 
1283  return $data;
1284  }
1285 
1286  public function eventsListObject(): void
1287  {
1288  $ilAccess = $this->access;
1289  $ilUser = $this->user;
1290  $tree = $this->tree;
1291 
1292  if (!$ilAccess->checkAccess('manage_members', '', $this->object->getRefId())) {
1293  $this->ilErr->raiseError($this->lng->txt('msg_no_perm_read'), $this->ilErr->MESSAGE);
1294  }
1295 
1296  $this->tpl->addBlockFile('ADM_CONTENT', 'adm_content', 'tpl.sess_list.html', 'components/ILIAS/Session');
1297  $this->__showButton($this->ctrl->getLinkTarget($this, 'exportCSV'), $this->lng->txt('event_csv_export'));
1298 
1299  $this->tpl->addBlockFile("EVENTS_TABLE", "events_table", "tpl.table.html");
1300  $this->tpl->addBlockFile('TBL_CONTENT', 'tbl_content', 'tpl.sess_list_row.html', 'components/ILIAS/Session');
1301 
1302  $members_obj = $this->initContainer(true);
1303  $members = $members_obj->getParticipants();
1304  $members = ilUtil::_sortIds($members, 'usr_data', 'lastname', 'usr_id');
1305 
1306  // Table
1307  $tbl = new ilTableGUI();
1308  $tbl->setTitle(
1309  $this->lng->txt("event_overview"),
1310  'standard/icon_usr.svg',
1311  $this->lng->txt('obj_usr')
1312  );
1313  $this->ctrl->setParameter($this, 'offset', $this->requested_offset);
1314 
1315  $course_ref_id = $tree->checkForParentType($this->object->getRefId(), 'crs');
1316  $events = [];
1317  foreach ($tree->getSubTree($tree->getNodeData($course_ref_id), false, ['sess']) as $event_id) {
1318  $tmp_event = ilObjectFactory::getInstanceByRefId($event_id, false);
1319  if (!is_object($tmp_event) || $tmp_event->getType() != 'sess') {
1320  continue;
1321  }
1322  $events[] = $tmp_event;
1323  }
1324 
1325  $headerNames = [];
1326  $headerVars = [];
1327  $colWidth = [];
1328 
1329  $headerNames[] = $this->lng->txt('name');
1330  $headerVars[] = "name";
1331  $colWidth[] = '20%';
1332 
1333  for ($i = 1; $i <= count($events); $i++) {
1334  $headerNames[] = $i;
1335  $headerVars[] = "event_" . $i;
1336  $colWidth[] = 80 / count($events) . "%";
1337  }
1338 
1339  $this->tpl->setVariable("FORMACTION", $this->ctrl->getFormAction($this));
1340  $tbl->setHeaderNames($headerNames);
1341  $tbl->setHeaderVars($headerVars, $this->ctrl->getParameterArray($this));
1342  $tbl->setColumnWidth($colWidth);
1343 
1344  $tbl->setOrderColumn($this->requested_sort_by);
1345  $tbl->setOrderDirection($this->requested_sort_order);
1346  $tbl->setOffset($this->requested_offset);
1347  $tbl->setMaxCount(count($members));
1348  $tbl->setFooter("tblfooter", $this->lng->txt("previous"), $this->lng->txt("next"));
1349 
1350  $sliced_users = array_slice($members, $this->requested_offset, ilSession::get("tbl_limit"));
1351  $tbl->disable('sort');
1352  $tbl->render();
1353 
1354  $counter = 0;
1355  foreach ($sliced_users as $user_id) {
1356  foreach ($events as $event_obj) {
1357  $this->tpl->setCurrentBlock("eventcols");
1358 
1359  $event_part = new ilEventParticipants($this->object->getId());
1360 
1361  {
1362  $this->tpl->setVariable("IMAGE_PARTICIPATED", $event_part->hasParticipated($user_id) ?
1363  ilUtil::getImagePath('standard/icon_ok.svg') :
1364  ilUtil::getImagePath('standard/icon_not_ok.svg'));
1365 
1366  $this->tpl->setVariable("PARTICIPATED", $event_part->hasParticipated($user_id) ?
1367  $this->lng->txt('event_participated') :
1368  $this->lng->txt('event_not_participated'));
1369  }
1370 
1371  $this->tpl->parseCurrentBlock();
1372  }
1373 
1374  $this->tpl->setCurrentBlock("tbl_content");
1375  $name = ilObjUser::_lookupName($user_id);
1376  $this->tpl->setVariable("LASTNAME", $name['lastname']);
1377  $this->tpl->setVariable("FIRSTNAME", $name['firstname']);
1378  $this->tpl->setVariable("LOGIN", ilObjUser::_lookupLogin($user_id));
1379  $this->tpl->parseCurrentBlock();
1380  }
1381 
1382  $this->tpl->setVariable("HEAD_TXT_LEGEND", $this->lng->txt("legend"));
1383  $this->tpl->setVariable("HEAD_TXT_DIGIT", $this->lng->txt("event_digit"));
1384  $this->tpl->setVariable("HEAD_TXT_EVENT", $this->lng->txt("event"));
1385  $this->tpl->setVariable("HEAD_TXT_LOCATION", $this->lng->txt("event_location"));
1386  $this->tpl->setVariable("HEAD_TXT_DATE_TIME", $this->lng->txt("event_date_time"));
1387  $i = 1;
1388  foreach ($events as $event_obj) {
1389  $this->tpl->setCurrentBlock("legend_loop");
1390  $this->tpl->setVariable("LEGEND_DIGIT", $i++);
1391  $this->tpl->setVariable("LEGEND_EVENT_TITLE", $event_obj->getTitle());
1392  $this->tpl->setVariable("LEGEND_EVENT_DESCRIPTION", $event_obj->getDescription());
1393  $this->tpl->setVariable("LEGEND_EVENT_LOCATION", $event_obj->getLocation());
1394  $this->tpl->setVariable("LEGEND_EVENT_APPOINTMENT", $event_obj->getFirstAppointment()->appointmentToString());
1395  $this->tpl->parseCurrentBlock();
1396  }
1397  }
1398 
1399  protected function __showButton(string $cmd, string $text, string $target = ''): void
1400  {
1401  $this->toolbar->addButton($text, $this->ctrl->getLinkTarget($this, $cmd), $target);
1402  }
1403 
1404  protected function initForm(string $a_mode): bool
1405  {
1406  if ($this->form instanceof ilPropertyFormGUI) {
1407  return true;
1408  }
1409  $ilUser = $this->user;
1410  $object_service = $this->object_service;
1411  $this->lng->loadLanguageModule('dateplaner');
1412 
1414 
1415  $this->form = new ilPropertyFormGUI();
1416  $this->form->setMultipart(true);
1417  $this->form->setTableWidth('600px');
1418  $this->form->setFormAction($this->ctrl->getFormAction($this));
1419  $this->form->setMultipart(true);
1420 
1421  $this->form = $this->initDidacticTemplate($this->form);
1422 
1423  $this->lng->loadLanguageModule('dateplaner');
1424  $dur = new ilDateDurationInputGUI($this->lng->txt('cal_fullday'), 'event');
1425  $dur->setRequired(true);
1426  $dur->enableToggleFullTime(
1427  $this->lng->txt('event_fulltime_info'),
1428  $this->object->getFirstAppointment()->enabledFulltime()
1429  );
1430  $dur->setShowTime(true);
1431  $dur->setStart($this->object->getFirstAppointment()->getStart());
1432  $dur->setEnd($this->object->getFirstAppointment()->getEnd());
1433 
1434  $this->form->addItem($dur);
1435 
1436 
1437  // Recurrence
1438  if ($a_mode == 'create') {
1439  if (!is_object($this->rec)) {
1440  $this->rec = new ilEventRecurrence();
1441  }
1442  $rec = new ilRecurrenceInputGUI($this->lng->txt('cal_recurrences'), 'frequence');
1443  $rec->allowUnlimitedRecurrences(false);
1444  $rec->setRecurrence($this->rec);
1445  $this->form->addItem($rec);
1446 
1447  // #14547
1448  $lp = new ilCheckboxInputGUI($this->lng->txt("sess_lp_preset"), "lp_preset");
1449  $lp->setInfo($this->lng->txt("sess_lp_preset_info"));
1450  $lp->setChecked(true);
1451  $this->form->addItem($lp);
1452  }
1453 
1454  $section = new ilFormSectionHeaderGUI();
1455  $section->setTitle($this->lng->txt('event_section_information'));
1456  $this->form->addItem($section);
1457 
1458  // title
1459  $title = new ilTextInputGUI($this->lng->txt('event_title'), 'title');
1460  $title->setRequired(true);
1461  $title->setValue($this->object->getTitle());
1462  $title->setSize(50);
1463  $title->setMaxLength(70);
1464  $this->form->addItem($title);
1465 
1466  // desc
1467  $desc = new ilTextAreaInputGUI($this->lng->txt('event_desc'), 'desc');
1468  $desc->setValue($this->object->getLongDescription());
1469  $desc->setRows(4);
1470  $desc->setCols(50);
1471  $this->form->addItem($desc);
1472 
1473  // location
1474  $desc = new ilTextAreaInputGUI($this->lng->txt('event_location'), 'location');
1475  $desc->setValue($this->object->getLocation());
1476  $desc->setRows(4);
1477  $desc->setCols(50);
1478  $this->form->addItem($desc);
1479 
1480  // workflow
1481  $details = new ilTextAreaInputGUI($this->lng->txt('event_details_workflow'), 'details');
1482  $details->setValue($this->object->getDetails());
1483  $details->setCols(50);
1484  $details->setRows(4);
1485  $this->form->addItem($details);
1486 
1487  if ($a_mode == 'create') {
1488  $this->record_gui = new ilAdvancedMDRecordGUI(
1490  'sess'
1491  );
1492  $this->record_gui->setRefId($this->requested_ref_id);
1493  $this->record_gui->setPropertyForm($this->form);
1494  $this->record_gui->parse();
1495  } elseif ($this->checkPermissionBool('edit_metadata')) {
1496  $this->record_gui = new ilAdvancedMDRecordGUI(
1498  'sess',
1499  $this->object->getId()
1500  );
1501  $this->record_gui->setPropertyForm($this->form);
1502  $this->record_gui->parse();
1503  }
1504 
1505 
1506  // section
1507  $section = new ilFormSectionHeaderGUI();
1508  $section->setTitle($this->lng->txt('event_tutor_data'));
1509  $this->form->addItem($section);
1510 
1511  // name
1512  $tutor_name = new ilTextInputGUI($this->lng->txt('tutor_name'), 'tutor_name');
1513  $tutor_name->setValue($this->object->getName());
1514  $tutor_name->setSize(20);
1515  $tutor_name->setMaxLength(70);
1516  $this->form->addItem($tutor_name);
1517 
1518  // email
1519  $tutor_email = new ilTextInputGUI($this->lng->txt('tutor_email'), 'tutor_email');
1520  $tutor_email->setValue($this->object->getEmail());
1521  $tutor_email->setSize(20);
1522  $tutor_email->setMaxLength(70);
1523  $this->form->addItem($tutor_email);
1524 
1525  // phone
1526  $tutor_phone = new ilTextInputGUI($this->lng->txt('tutor_phone'), 'tutor_phone');
1527  $tutor_phone->setValue($this->object->getPhone());
1528  $tutor_phone->setSize(20);
1529  $tutor_phone->setMaxLength(70);
1530  $this->form->addItem($tutor_phone);
1531 
1532  $section = new ilFormSectionHeaderGUI();
1533  $section->setTitle($this->lng->txt('sess_section_reg'));
1534  $this->form->addItem($section);
1535 
1536  $reg_settings = new ilSessionMembershipRegistrationSettingsGUI(
1537  $this,
1538  $this->object,
1539  array(
1545  )
1546  );
1547  $reg_settings->addMembershipFormElements($this->form, '');
1548 
1549 
1550  $section = new ilFormSectionHeaderGUI();
1551  $section->setTitle($this->lng->txt('event_assign_files'));
1552  $this->form->addItem($section);
1553 
1554  $files = new ilFileWizardInputGUI($this->lng->txt('objs_file'), 'files');
1555  $files->setFilenames(array(0 => ''));
1556  $this->form->addItem($files);
1557 
1558  $section = new ilFormSectionHeaderGUI();
1559  $section->setTitle($this->lng->txt('sess_setting_header_presentation'));
1560  $this->form->addItem($section);
1561 
1562  $object_service->commonSettings()->legacyForm($this->form, $this->object)->addTileImage();
1563 
1564  $features = new ilFormSectionHeaderGUI();
1565  $features->setTitle($this->lng->txt('obj_features'));
1566  $this->form->addItem($features);
1568  $this->object->getId(),
1569  $this->form,
1570  array(
1572  )
1573  );
1574 
1575  $gallery = new ilCheckboxInputGUI($this->lng->txt('sess_show_members'), 'show_members');
1576  $gallery->setChecked($this->object->getShowMembers());
1577  $gallery->setInfo($this->lng->txt('sess_show_participants_info'));
1578  $this->form->addItem($gallery);
1579 
1580 
1581  // Show mail to members type
1582  $mail_type = new ilRadioGroupInputGUI($this->lng->txt('sess_mail_type'), 'mail_type');
1583  $mail_type->setValue((string) $this->object->getMailToMembersType());
1584 
1585  $mail_tutors = new ilRadioOption(
1586  $this->lng->txt('sess_mail_admins_only'),
1588  $this->lng->txt('sess_mail_admins_only_info')
1589  );
1590  $mail_type->addOption($mail_tutors);
1591 
1592  $mail_all = new ilRadioOption(
1593  $this->lng->txt('sess_mail_all'),
1595  $this->lng->txt('sess_mail_all_info')
1596  );
1597  $mail_type->addOption($mail_all);
1598  $this->form->addItem($mail_type);
1599 
1600 
1601 
1602  switch ($a_mode) {
1603  case 'create':
1604  $this->form->setTitle($this->lng->txt('event_table_create'));
1605 
1606  $this->form->addCommandButton('save', $this->lng->txt('event_btn_add'));
1607  $this->form->addCommandButton('saveAndAssignMaterials', $this->lng->txt('event_btn_add_edit'));
1608  $this->form->addCommandButton('cancel', $this->lng->txt('cancel'));
1609 
1610  return true;
1611 
1612  case 'edit':
1613  $this->form->setTitle($this->lng->txt('event_table_update'));
1614 
1615  $this->form->addCommandButton('update', $this->lng->txt('save'));
1616  $this->form->addCommandButton('cancelEdit', $this->lng->txt('cancel'));
1617 
1618  return true;
1619  }
1620  return true;
1621  }
1622 
1623  protected function load(): void
1624  {
1625  $event = $this->form->getItemByPostVar('event');
1626  if ($event->getStart() && $event->getEnd()) {
1627  $this->object->getFirstAppointment()->setStartingTime($event->getStart()->get(IL_CAL_UNIX));
1628  $this->object->getFirstAppointment()->setEndingTime($event->getStart()->get(IL_CAL_UNIX));
1629  $this->object->getFirstAppointment()->setStart($event->getStart());
1630  $this->object->getFirstAppointment()->setEnd($event->getEnd());
1631  $this->object->getFirstAppointment()->toggleFulltime($event->getStart() instanceof ilDate);
1632  }
1633 
1634  $this->object->setTitle($this->form->getInput('title'));
1635  $this->object->setDescription($this->form->getInput('desc'));
1636  $this->object->setLocation($this->form->getInput('location'));
1637  $this->object->setName($this->form->getInput('tutor_name'));
1638  $this->object->setPhone($this->form->getInput('tutor_phone'));
1639  $this->object->setEmail($this->form->getInput('tutor_email'));
1640  $this->object->setDetails($this->form->getInput('details'));
1641 
1642  $this->object->setRegistrationNotificationEnabled((bool) $this->form->getInput('registration_notification'));
1643  $this->object->setRegistrationNotificationOption($this->form->getInput('notification_option'));
1644 
1645  $this->object->setRegistrationType((int) $this->form->getInput('registration_type'));
1646 
1647  switch ($this->object->getRegistrationType()) {
1649  $this->object->enableCannotParticipateOption((bool) $this->form->getInput('show_cannot_participate_direct'));
1650  break;
1652  $this->object->enableCannotParticipateOption((bool) $this->form->getInput('show_cannot_participate_request'));
1653  break;
1654  default:
1655  $this->object->enableCannotParticipateOption(false);
1656  break;
1657  }
1658 
1659  // $this->object->setRegistrationMinUsers((int) $this->form->getInput('registration_min_members'));
1660  $this->object->setRegistrationMaxUsers((int) $this->form->getInput('registration_max_members'));
1661  $this->object->enableRegistrationUserLimit((int) $this->form->getInput('registration_membership_limited'));
1662  $this->object->setShowMembers((bool) $this->form->getInput('show_members'));
1663  $this->object->setMailToMembersType((int) $this->form->getInput('mail_type'));
1664 
1665  switch ((int) $this->form->getInput('waiting_list')) {
1666  case 2:
1667  $this->object->enableRegistrationWaitingList(true);
1668  $this->object->setWaitingListAutoFill(true);
1669  break;
1670 
1671  case 1:
1672  $this->object->enableRegistrationWaitingList(true);
1673  $this->object->setWaitingListAutoFill(false);
1674  break;
1675 
1676  default:
1677  $this->object->enableRegistrationWaitingList(false);
1678  $this->object->setWaitingListAutoFill(false);
1679  break;
1680  }
1681  }
1682 
1683  protected function loadRecurrenceSettings(): void
1684  {
1685  $this->rec = new ilEventRecurrence();
1686 
1687  switch ($this->form->getInput('frequence')) {
1689  $this->rec->setFrequenceType($this->form->getInput('frequence'));
1690  $this->rec->setInterval((int) $this->form->getInput('count_DAILY'));
1691  break;
1692 
1694  $this->rec->setFrequenceType($this->form->getInput('frequence'));
1695  $this->rec->setInterval((int) $this->form->getInput('count_WEEKLY'));
1696  if (is_array($this->form->getInput('byday_WEEKLY'))) {
1697  $this->rec->setBYDAY(ilUtil::stripSlashes(implode(',', $this->form->getInput('byday_WEEKLY'))));
1698  }
1699  break;
1700 
1702  $this->rec->setFrequenceType($this->form->getInput('frequence'));
1703  $this->rec->setInterval((int) $this->form->getInput('count_MONTHLY'));
1704  switch ((int) $this->form->getInput('subtype_MONTHLY')) {
1705  case 0:
1706  // nothing to do;
1707  break;
1708 
1709  case 1:
1710  switch ((int) $this->form->getInput('monthly_byday_day')) {
1711  case 8:
1712  // Weekday
1713  $this->rec->setBYSETPOS($this->form->getInput('monthly_byday_num'));
1714  $this->rec->setBYDAY('MO,TU,WE,TH,FR');
1715  break;
1716 
1717  case 9:
1718  // Day of month
1719  $this->rec->setBYMONTHDAY($this->form->getInput('monthly_byday_num'));
1720  break;
1721 
1722  default:
1723  $this->rec->setBYDAY(($this->form->getInput('monthly_byday_num') . $this->form->getInput('monthly_byday_day')));
1724  break;
1725  }
1726  break;
1727 
1728  case 2:
1729  $this->rec->setBYMONTHDAY($this->form->getInput('monthly_bymonthday'));
1730  break;
1731  }
1732  break;
1733 
1735  $this->rec->setFrequenceType($this->form->getInput('frequence'));
1736  $this->rec->setInterval((int) $this->form->getInput('count_YEARLY'));
1737  switch ((int) $this->form->getInput('subtype_YEARLY')) {
1738  case 0:
1739  // nothing to do;
1740  break;
1741 
1742  case 1:
1743  $this->rec->setBYMONTH($this->form->getInput('yearly_bymonth_byday'));
1744  $this->rec->setBYDAY(($this->form->getInput('yearly_byday_num') . $this->form->getInput('yearly_byday')));
1745  break;
1746 
1747  case 2:
1748  $this->rec->setBYMONTH($this->form->getInput('yearly_bymonth_by_monthday'));
1749  $this->rec->setBYMONTHDAY($this->form->getInput('yearly_bymonthday'));
1750  break;
1751  }
1752  break;
1753  }
1754 
1755  // UNTIL
1756  switch ((int) $this->form->getInput('until_type')) {
1757  case 1:
1758  $this->rec->setFrequenceUntilDate(null);
1759  // nothing to do
1760  break;
1761 
1762  case 2:
1763  $this->rec->setFrequenceUntilDate(null);
1764  $this->rec->setFrequenceUntilCount((int) $this->form->getInput('count'));
1765  break;
1766 
1767  case 3:
1768  $frequence = $this->form->getItemByPostVar('frequence');
1769  $end = $frequence->getRecurrence()->getFrequenceUntilDate();
1770  $this->rec->setFrequenceUntilCount(0);
1771  $this->rec->setFrequenceUntilDate($end);
1772  break;
1773  }
1774  }
1775 
1776  protected function __toUnix(array $date, array $time): int
1777  {
1778  return mktime($time['h'], $time['m'], 0, $date['m'], $date['d'], $date['y']);
1779  }
1780 
1781  protected function addLocatorItems(): void
1782  {
1783  $ilLocator = $this->locator;
1784 
1785  if (!$this->getCreationMode()) {
1786  // see prepareOutput()
1787  $title = strlen($this->object->getTitle()) ? (': ' . $this->object->getTitle()) : '';
1788  $title = $this->object->getFirstAppointment()->appointmentToString() . $title;
1789 
1790  $ilLocator->addItem($title, $this->ctrl->getLinkTarget($this, "infoScreen"), "", $this->requested_ref_id);
1791  }
1792  }
1793 
1794  protected function redirectToParentContentPageObject(): void
1795  {
1796  $objDefinition = $this->objDefinition;
1797  $tree = $this->tree;
1798  $ctrl = $this->ctrl;
1799 
1800  $parent_id = $tree->getParentId($this->object->getRefId());
1801 
1802  // #11650
1803  $parent_type = ilObject::_lookupType($parent_id, true);
1804 
1805  $parent_class = $objDefinition->getClassName($parent_type);
1806  $parent_class = 'ilObj' . $parent_class . 'GUI';
1807 
1808  $ctrl->setParameterByClass($parent_class, "ref_id", $parent_id);
1809  $ctrl->redirectByClass($parent_class, "view");
1810  }
1811 
1812  protected function getTabs(): void
1813  {
1814  $ilAccess = $this->access;
1815  $ilTabs = $this->tabs_gui;
1816  $tree = $this->tree;
1817  $ilCtrl = $this->ctrl;
1818  $ilHelp = $this->help;
1819  $ilUser = $this->user;
1820 
1821  $ilHelp->setScreenIdComponent("sess");
1822 
1823  $parent_id = $tree->getParentId($this->object->getRefId());
1824 
1825  // #11650
1826  $parent_type = ilObject::_lookupType($parent_id, true);
1827 
1828  $this->tabs_gui->setBackTarget(
1829  $this->lng->txt('back_to_' . $parent_type . '_content'),
1830  $ilCtrl->getLinkTarget($this, "redirectToParentContentPage")
1831  );
1832 
1833  $this->tabs_gui->addTarget(
1834  'info_short',
1835  $this->ctrl->getLinkTarget($this, 'infoScreen')
1836  );
1837 
1838  if ($ilAccess->checkAccess('write', '', $this->object->getRefId())) {
1839  $this->tabs_gui->addTarget(
1840  'settings',
1841  $this->ctrl->getLinkTarget($this, 'edit')
1842  );
1843  }
1844  if ($ilAccess->checkAccess('manage_materials', '', $this->object->getRefId())) {
1845  $this->tabs_gui->addTab(
1846  'materials',
1847  $this->lng->txt('crs_materials'),
1848  $this->ctrl->getLinkTarget($this, 'materials')
1849  );
1850  }
1851 
1852  // booking
1853  $parent_id = $tree->getParentId($this->requested_ref_id);
1854 
1855  if ($ilAccess->checkAccess('write', '', $this->ref_id) && ilContainer::_lookupContainerSetting(
1856  ilObject::_lookupObjId($parent_id),
1858  )) {
1859  $this->tabs_gui->addTarget(
1860  "obj_tool_setting_booking",
1861  $this->ctrl->getLinkTargetByClass(array("ilbookinggatewaygui"), "")
1862  );
1863  }
1864 
1865  // member tab
1866  $is_participant = $this->object->getMembersObject()->isAssigned($ilUser->getId());
1867  $membership_gui = new ilSessionMembershipGUI($this, $this->object);
1868  $membership_gui->addMemberTab($this->tabs_gui, $is_participant);
1869 
1870 
1871  // learning progress
1872  if (ilLearningProgressAccess::checkAccess($this->object->getRefId())) {
1873  $this->tabs_gui->addTarget(
1874  'learning_progress',
1875  $this->ctrl->getLinkTargetByClass(array('ilobjsessiongui','illearningprogressgui'), ''),
1876  '',
1877  array('illplistofobjectsgui','illplistofsettingsgui','illearningprogressgui','illplistofprogressgui')
1878  );
1879  }
1880 
1881  // meta data
1882  if ($ilAccess->checkAccess('edit_metadata', '', $this->ref_id)) {
1883  $mdgui = new ilObjectMetaDataGUI($this->object);
1884  $mdtab = $mdgui->getTab();
1885  if ($mdtab) {
1886  $this->tabs_gui->addTab(
1887  "metadata",
1888  $this->lng->txt('meta_data'),
1889  $mdtab
1890  );
1891  }
1892  }
1893 
1894  // export
1895  if ($ilAccess->checkAccess("write", "", $this->object->getRefId())) {
1896  $this->tabs_gui->addTarget(
1897  "export",
1898  $this->ctrl->getLinkTargetByClass("ilexportgui", ""),
1899  "",
1900  "ilexportgui"
1901  );
1902  }
1903 
1904 
1905  // edit permissions
1906  if ($ilAccess->checkAccess('edit_permission', "", $this->object->getRefId())) {
1907  $this->tabs_gui->addTarget(
1908  "perm_settings",
1909  $this->ctrl->getLinkTargetByClass("ilpermissiongui", "perm"),
1910  array("perm","info","owner"),
1911  'ilpermissiongui'
1912  );
1913  }
1914  }
1915 
1919  public function afterSaveCallback(ilObject $a_obj): void
1920  {
1921  // add new object to materials
1922  $event_items = new ilEventItems($this->object->getId());
1923  $event_items->addItem($a_obj->getRefId());
1924  $event_items->update();
1925  }
1926 
1930  public function readMemberData(array $a_usr_ids): array
1931  {
1932  $tmp_data = [];
1933  foreach ($a_usr_ids as $usr_id) {
1934  $tmp_data[$usr_id] = [];
1935  }
1936  return $tmp_data;
1937  }
1938 
1939  public function getContainerRefId(): int
1940  {
1941  if (!$this->container_ref_id) {
1942  $this->initContainer();
1943  }
1944  return $this->container_ref_id;
1945  }
1946 
1947  protected function cancelEditObject(): void
1948  {
1949  $ilCtrl = $this->ctrl;
1950  $tree = $this->tree;
1951 
1952  $parent_id = $tree->getParentId($this->requested_ref_id);
1953 
1954  $ilCtrl->setParameterByClass("ilrepositorygui", "ref_id", $parent_id);
1955 
1956  $ilCtrl->redirectByClass("ilrepositorygui", "");
1957  }
1958 
1959  public function getDefaultMemberRole(): int
1960  {
1962 
1963  $local_roles = $rbac_review->getRolesOfRoleFolder($this->object->getRefId(), false);
1964 
1965  foreach ($local_roles as $role_id) {
1966  $title = ilObject::_lookupTitle($role_id);
1967  if (substr($title, 0, 19) == 'il_sess_participant') {
1968  return $role_id;
1969  }
1970  }
1971  return 0;
1972  }
1973 
1977  public function getLocalRoles(): array
1978  {
1980 
1981  return $this->rbacreview->getRolesOfRoleFolder($this->object->getRefId(), false);
1982  }
1983 
1984  public function createMailSignature(): string
1985  {
1986  $link = chr(13) . chr(10) . chr(13) . chr(10);
1987  $link .= $this->lng->txt('sess_mail_permanent_link');
1988  $link .= chr(13) . chr(10) . chr(13) . chr(10);
1989  $link .= ilLink::_getLink($this->object->getRefId());
1990  return rawurlencode(base64_encode($link));
1991  }
1992 }
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)
static array static setUseRelativeDates(bool $a_status)
set use relative dates
This class represents an option in a radio group.
Global event handler.
Class ilObjectMetaDataGUI.
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.
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:61
$location
Definition: buildRTE.php:22
importEditFormPostValues()
Load edit form values from post.
static switchTemplate(int $a_ref_id, int $a_new_tpl_id)
This class represents an input GUI for recurring events/appointments (course events or calendar appoi...
static stripSlashes(string $a_str, bool $a_strip_html=true, string $a_allow="")
static getInstance(int $a_ref_id)
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.
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...
setContent(string $a_html)
Sets content for standard template.
setParameterByClass(string $a_class, string $a_parameter, $a_value)
loadLanguageModule(string $a_module)
Load language module.
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)
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.
redirectByClass( $a_class, ?string $a_cmd=null, ?string $a_anchor=null, bool $is_async=false)
saveObject(bool $a_redirect_on_success=true)
setRecurrence(int $a_type)
set type of recurrence public
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...
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
prepareOutput(bool $show_sub_objects=true)
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.
static _isRegistered(int $a_usr_id, int $a_event_id)
static _lookupTitle(int $obj_id)
static _getInstanceByObjId(int $a_obj_id)
$GLOBALS["DIC"]
Definition: wac.php:53
static getInstance(int $a_ref_id)
GUI class for membership features.
Calculates an ilDateList for a given calendar entry and recurrence rule.
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.
global $DIC
Definition: shib_login.php:22
getClassName(string $obj_name)
static getImagePath(string $image_name, string $module_path="", string $mode="output", bool $offline=false)
get image path (for images located in a template directory)
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
class ilEventParticipants
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='')
buildAddNewItemElements(array $subtypes, string $create_target_class=ilRepositoryGUI::class, ?int $redirect_target_ref_id=null,)
form( $class_path, string $cmd, string $submit_caption="")
Render add new item selector.
static _getInstanceByObjId(int $a_obj_id)
Get singleton instance.
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...
setInfoObject(ilInfoScreenGUI $info)
get info sections
static _lookupContainerSetting(int $a_id, string $a_keyword, ?string $a_default_value=null)
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)
modifyItemGUI(ilObjectListGUI $a_item_list_gui, array $a_item_data, bool $a_show_path)
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
Class ilObjUserTrackingGUI.
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
class ilEventItems
static _gotoRepositoryRoot(bool $raise_error=false)
Goto repository root.
const IL_CAL_YEAR
static formatPeriod(ilDateTime $start, ilDateTime $end, bool $a_skip_starting_day=false, ?ilObjUser $user=null)
Format a period of two dates Shows: 14.
postUpdateMaterials()
redirect to list of materials without offset/page.
static _lookupLogin(int $a_user_id)
ILIAS FileUpload FileUpload $upload