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