ILIAS  trunk Revision v11.0_alpha-2638-g80c1d007f79
class.ilObjGroupGUI.php
Go to the documentation of this file.
1 <?php
2 
19 declare(strict_types=1);
20 
22 use ILIAS\News\Service as News;
24 
46 {
47  protected bool $show_tracking = false;
48 
49  protected Factory $refinery;
51  protected News $news;
52 
56  public function __construct($a_data, int $a_id, bool $a_call_by_reference, bool $a_prepare_output = false)
57  {
58  global $DIC;
59 
60  $this->type = "grp";
61  parent::__construct($a_data, $a_id, $a_call_by_reference, $a_prepare_output);
62 
63  $this->lng->loadLanguageModule('grp');
64  $this->lng->loadLanguageModule('obj');
65  $this->refinery = $DIC->refinery();
66  $this->rbacsystem = $DIC->rbac()->system();
67  $this->news = $DIC->news();
68  }
69 
70  protected function initRefIdFromQuery(): int
71  {
72  if ($this->http->wrapper()->query()->has('ref_id')) {
73  return $this->http->wrapper()->query()->retrieve(
74  'ref_id',
75  $this->refinery->kindlyTo()->int()
76  );
77  }
78  return 0;
79  }
80 
84  public function executeCommand(): void
85  {
86  global $DIC;
87 
88  $ilNavigationHistory = $DIC['ilNavigationHistory'];
89 
90  $ref_id = $this->initRefIdFromQuery();
91 
92  $next_class = $this->ctrl->getNextClass($this);
93  $cmd = $this->ctrl->getCmd();
94  $this->prepareOutput();
95 
96  // add entry to navigation history
97  if (!$this->getCreationMode() && $this->access->checkAccess("read", "", $ref_id)) {
98  $ilNavigationHistory->addItem(
99  $ref_id,
100  ilLink::_getLink($ref_id, "grp"),
101  "grp"
102  );
103  }
104 
105  // if news timeline is landing page, redirect if necessary
106  if ($next_class == "" && $cmd == "" && $this->object->isNewsTimelineLandingPageEffective()
107  && $this->access->checkAccess("read", "", $ref_id)) {
108  $this->ctrl->redirectByClass("ilnewstimelinegui");
109  }
110 
111  $header_action = true;
112  switch ($next_class) {
113  case strtolower(ilRepositoryTrashGUI::class):
114  $ru = new \ilRepositoryTrashGUI($this);
115  $this->ctrl->setReturn($this, 'trash');
116  $this->ctrl->forwardCommand($ru);
117  break;
118 
119  case 'illtiproviderobjectsettinggui':
120  $this->setSubTabs('settings');
121  $this->tabs_gui->activateTab('settings');
122  $this->tabs_gui->activateSubTab('lti_provider');
123  $lti_gui = new ilLTIProviderObjectSettingGUI($this->object->getRefId());
124  $lti_gui->setCustomRolesForSelection($GLOBALS['DIC']->rbac()->review()->getLocalRoles($this->object->getRefId()));
125  $lti_gui->offerLTIRolesForSelection(false);
126  $this->ctrl->forwardCommand($lti_gui);
127  break;
128 
129 
130  case 'ilgroupmembershipgui':
131 
132  $this->tabs_gui->activateTab('members');
133 
134  $mem_gui = new ilGroupMembershipGUI($this, $this->object);
135  $this->ctrl->forwardCommand($mem_gui);
136  break;
137 
138 
139  case 'ilgroupregistrationgui':
140  $this->ctrl->setReturn($this, '');
141  $this->tabs_gui->setTabActive('join');
142  $registration = new ilGroupRegistrationGUI($this->object);
143  $this->ctrl->forwardCommand($registration);
144  break;
145 
146  case 'ilpermissiongui':
147  $this->tabs_gui->activateTab('perm_settings');
148  $perm_gui = new ilPermissionGUI($this);
149  $this->ctrl->forwardCommand($perm_gui);
150  break;
151 
152  case "ilinfoscreengui":
153  $this->infoScreen();
154  break;
155 
156  case "illearningprogressgui":
157  $user_id = $this->user->getId();
158  if ($this->http->wrapper()->query()->has('user_id')) {
159  $user_id = $this->http->wrapper()->query()->retrieve(
160  'user_id',
161  $this->refinery->kindlyTo()->int()
162  );
163  }
164  $new_gui = new ilLearningProgressGUI(
166  $this->object->getRefId(),
167  $user_id
168  );
169  $this->ctrl->forwardCommand($new_gui);
170  $this->tabs_gui->setTabActive('learning_progress');
171  break;
172 
173  case 'ilobjcoursegroupinggui':
174  $this->setSubTabs('settings');
175  $this->ctrl->setReturn($this, 'edit');
176  $obj_id = 0;
177  if ($this->http->wrapper()->query()->has('obj_id')) {
178  $obj_id = $this->http->wrapper()->query()->retrieve(
179  'obj_id',
180  $this->refinery->kindlyTo()->int()
181  );
182  }
183  $crs_grp_gui = new ilObjCourseGroupingGUI($this->object, $obj_id);
184  $this->ctrl->forwardCommand($crs_grp_gui);
185  $this->tabs_gui->setTabActive('settings');
186  $this->tabs_gui->setSubTabActive('groupings');
187  break;
188 
189  case 'ilcoursecontentgui':
190  $course_content_obj = new ilCourseContentGUI($this);
191  $this->ctrl->forwardCommand($course_content_obj);
192  break;
193 
194  case 'ilpublicuserprofilegui':
195  $this->setSubTabs('members');
196  $this->tabs_gui->setTabActive('group_members');
197  $this->tabs_gui->setSubTabActive('grp_members_gallery');
198  $usr_id = 0;
199  if ($this->http->wrapper()->query()->has('user')) {
200  $usr_id = $this->http->wrapper()->query()->retrieve(
201  'user',
202  $this->refinery->kindlyTo()->int()
203  );
204  }
205  $profile_gui = new ilPublicUserProfileGUI($usr_id);
206  $back_url = '';
207  if ($this->http->wrapper()->query()->has('back_url')) {
208  $back_url = $this->http->wrapper()->query()->retrieve(
209  'back_url',
210  $this->refinery->kindlyTo()->string()
211  );
212  }
213  if ($back_url == '') {
214  $profile_gui->setBackUrl($this->ctrl->getLinkTargetByClass(["ilGroupMembershipGUI", "ilUsersGalleryGUI"], 'view'));
215  }
216  $html = $this->ctrl->forwardCommand($profile_gui);
217  $this->tpl->setVariable("ADM_CONTENT", $html);
218  break;
219 
220  case "ilcolumngui":
221  $this->tabs_gui->setTabActive('none');
222  $this->checkPermission("read");
223  $this->tpl->setVariable(
224  "LOCATION_CONTENT_STYLESHEET",
225  ilObjStyleSheet::getContentStylePath($this->object->getStyleSheetId())
226  );
227  $this->renderObject();
228  break;
229 
230  // container page editing
231  case "ilcontainerpagegui":
232  $ret = $this->forwardToPageObject();
233  if ($ret != "") {
234  $this->tpl->setContent($ret);
235  }
236  $header_action = false;
237  break;
238 
239  case 'ilobjectcopygui':
240  $cp = new ilObjectCopyGUI($this);
241  $cp->setType('grp');
242  $this->ctrl->forwardCommand($cp);
243  break;
244 
245  case "ilobjectcontentstylesettingsgui":
246  global $DIC;
247 
248  $this->checkPermission("write");
249  $this->setTitleAndDescription();
250  $this->showContainerPageTabs();
251  $settings_gui = $DIC->contentStyle()->gui()
252  ->objectSettingsGUIForRefId(
253  null,
254  $this->object->getRefId()
255  );
256  $this->ctrl->forwardCommand($settings_gui);
257  break;
258 
259  case 'ilobjectcustomuserfieldsgui':
260  $cdf_gui = new ilObjectCustomUserFieldsGUI($this->object->getId());
261  $this->setSubTabs('settings');
262  $this->tabs_gui->setTabActive('settings');
263  $this->tabs_gui->activateSubTab('grp_custom_user_fields');
264  $this->ctrl->forwardCommand($cdf_gui);
265  break;
266 
267  case 'ilmemberagreementgui':
268  $this->ctrl->setReturn($this, '');
269  $this->tabs_gui->setTabActive('view_content');
270  $agreement = new ilMemberAgreementGUI($this->object->getRefId());
271  $this->ctrl->forwardCommand($agreement);
272  break;
273 
274  case 'ilexportgui':
275  $this->tabs_gui->setTabActive('export');
276  $exp = new ilExportGUI($this);
277  $exp->addFormat('xml');
278  $this->ctrl->forwardCommand($exp);
279  break;
280 
281  case "ilcommonactiondispatchergui":
283  $this->ctrl->forwardCommand($gui);
284  break;
285 
286  case 'ilobjectservicesettingsgui':
287  $this->ctrl->setReturn($this, 'edit');
288  $this->setSubTabs("settings");
289  $this->tabs_gui->activateTab('settings');
290  $this->tabs_gui->activateSubTab('tool_settings');
291 
293  $this,
294  $this->object->getId(),
295  array(
297  )
298  );
299  $this->ctrl->forwardCommand($service);
300  break;
301 
302  case 'ilmailmembersearchgui':
303  $mail = new ilMail($this->user->getId());
304 
305  if (!($this->access->checkAccess('manage_members', '', $this->object->getRefId()) ||
306  $this->object->getMailToMembersType() == ilObjGroup::MAIL_ALLOWED_ALL) &&
307  $this->rbacsystem->checkAccess('internal_mail', $mail->getMailObjectReferenceId())) {
308  $this->error->raiseError($this->lng->txt("msg_no_perm_read"), $this->error->MESSAGE);
309  }
310 
311  $this->tabs_gui->setTabActive('members');
312 
313 
314  $mail_search = new ilMailMemberSearchGUI($this, $this->object->getRefId(), new ilMailMemberGroupRoles());
316  $this->ctrl->forwardCommand($mail_search);
317  break;
318 
319  case 'ilbadgemanagementgui':
320  $this->tabs_gui->setTabActive('obj_tool_setting_badges');
321  $bgui = new ilBadgeManagementGUI($this->object->getRefId(), $this->object->getId(), 'grp');
322  $this->ctrl->forwardCommand($bgui);
323  break;
324 
325  case "ilcontainernewssettingsgui":
326  $this->setSubTabs("settings");
327  $this->tabs_gui->setTabActive('settings');
328  $this->tabs_gui->activateSubTab('obj_news_settings');
329  $news_set_gui = new ilContainerNewsSettingsGUI($this);
330  $news_set_gui->setTimeline(true);
331  $news_set_gui->setCronNotifications(true);
332  $news_set_gui->setHideByDate(true);
333  $this->ctrl->forwardCommand($news_set_gui);
334  break;
335 
336  case "ilnewstimelinegui":
337  $this->checkPermission("read");
338  $this->tabs_gui->setTabActive('news_timeline');
339  $t = ilNewsTimelineGUI::getInstance($this->object->getRefId(), $this->object->getNewsTimelineAutoENtries());
340  $t->setUserEditAll($this->access->checkAccess('write', '', $this->object->getRefId(), 'grp'));
341  $this->showPermanentLink();
342  $this->ctrl->forwardCommand($t);
344  $this->user->getId(),
345  $this->object->getId(),
346  $this->object->getRefId(),
347  'grp'
348  );
349  break;
350 
351  case "ilcontainerskillgui":
352  $this->tabs_gui->activateTab('obj_tool_setting_skills');
353  $gui = new ilContainerSkillGUI($this);
354  $this->ctrl->forwardCommand($gui);
355  break;
356 
357  case 'ilcalendarpresentationgui':
358  $cal = new ilCalendarPresentationGUI($this->object->getRefId());
359  $this->ctrl->forwardCommand($cal);
360  break;
361 
362  case 'ilobjectmetadatagui':
363  if (!$this->access->checkAccess('write', '', $this->object->getRefId())) {
364  $this->error->raiseError($this->lng->txt('permission_denied'), $this->error->WARNING);
365  }
366  $this->tabs_gui->activateTab('meta_data');
367  $this->ctrl->forwardCommand(new ilObjectMetaDataGUI($this->object));
368  break;
369 
370 
371  case strtolower(TranslationGUI::class):
372  $this->checkPermissionBool("write");
373  $this->setSubTabs("settings");
374  $this->tabs->activateTab("settings");
375  $transgui = new TranslationGUI(
376  $this->getObject(),
377  $this->lng,
378  $this->access,
379  $this->user,
380  $this->ctrl,
381  $this->tpl,
382  $this->ui_factory,
383  $this->ui_renderer,
384  $this->http,
385  $this->refinery,
386  $this->toolbar
387  );
388  $this->ctrl->forwardCommand($transgui);
389  break;
390 
391  default:
392 
393  // check visible permission
394  if (!$this->getCreationMode() and
395  !$this->access->checkAccess('visible', '', $this->object->getRefId(), 'grp') and
396  !$this->access->checkAccess('read', '', $this->object->getRefId(), 'grp')) {
397  $this->error->raiseError($this->lng->txt("msg_no_perm_read"), $this->error->MESSAGE);
398  }
399 
400  // #9401 - see also ilStartupGUI::_checkGoto()
401  if ($cmd == 'infoScreenGoto') {
402  if ($this->object->isRegistrationEnabled()) {
403  $cmd = 'join';
404  } else {
405  $cmd = 'infoScreen';
406  }
407  }
408 
409  // check read permission
410  if ((!$this->getCreationMode()
411  && !$this->rbacsystem->checkAccess('read', $this->object->getRefId()) && $cmd != 'infoScreen')
412  || $cmd == 'join'
413  || $cmd === 'leaveWaitList') {
414  // no join permission -> redirect to info screen
415  if (!$this->rbacsystem->checkAccess('join', $this->object->getRefId())) {
416  $this->ctrl->redirect($this, "infoScreen");
417  } else { // no read -> show registration
418  $this->ctrl->redirectByClass("ilGroupRegistrationGUI", "show");
419  }
420  }
421  if (!$cmd) {
422  $cmd = 'view';
423  }
424  $cmd .= 'Object';
425  $this->$cmd();
426  break;
427  }
428 
429  if ($header_action) {
430  $this->addHeaderAction();
431  }
432  }
433 
434  public function enableAdministrationPanelObject(): void
435  {
436  $this->getModeManager()->setAdminMode();
437  $this->ctrl->redirect($this, "");
438  }
439 
440  public function disableAdministrationPanelObject(): void
441  {
442  $this->getModeManager()->setContentMode();
443  $this->ctrl->redirect($this, "");
444  }
445 
449  public function viewObject(): void
450  {
452  $this->user->getId(),
453  $this->object->getId(),
454  $this->object->getRefId(),
455  'grp'
456  );
457 
458  if ($this->isActiveAdministrationPanel()) {
459  parent::renderObject();
461  return;
462  }
463 
464  if (!$this->checkAgreement()) {
465  $this->ctrl->redirectByClass(ilMemberAgreementGUI::class);
466  }
467 
468  $this->tabs_gui->setTabActive('view_content');
469  $this->renderObject();
470  }
471 
472  public function renderObject(): void
473  {
474  $this->tabs->activateTab("view_content");
475  parent::renderObject();
476  }
477 
481  public function modifyItemGUI(ilObjectListGUI $a_item_list_gui, array $a_item_data): void
482  {
483  // if folder is in a course, modify item list gui according to course requirements
484  if ($course_ref_id = $this->tree->checkForParentType($this->object->getRefId(), 'crs')) {
485  $course_obj_id = ilObject::_lookupObjId($course_ref_id);
487  $a_item_list_gui,
488  'ilcoursecontentgui',
489  $a_item_data,
490  ilObjCourse::_lookupAboStatus($course_obj_id),
491  $course_ref_id,
492  $course_obj_id,
493  $this->object->getRefId()
494  );
495  }
496  }
497 
503  public function afterSave(ilObject $new_object, bool $redirect = true): void
504  {
505  $new_object->setRegistrationType(
507  );
508  $new_object->update();
509 
510  // check for parent group or course => SORT_INHERIT
511  $sort_mode = ilContainer::SORT_TITLE;
512  if (
513  $this->tree->checkForParentType($new_object->getRefId(), 'crs', true) ||
514  $this->tree->checkForParentType($new_object->getRefId(), 'grp', true)
515  ) {
516  $sort_mode = ilContainer::SORT_INHERIT;
517  }
518 
519  // Save sorting
520  $sort = new ilContainerSortingSettings($new_object->getId());
521  $sort->setSortMode($sort_mode);
522  $sort->update();
523 
524 
525  // Add user as admin and enable notification
526  $members_obj = ilGroupParticipants::_getInstanceByObjId($new_object->getId());
527  $members_obj->add($this->user->getId(), ilParticipants::IL_GRP_ADMIN);
528  $members_obj->updateNotification($this->user->getId(), (bool) $this->settings->get('mail_grp_admin_notification', '1'));
529  $members_obj->updateContact($this->user->getId(), true);
530 
531  $this->tpl->setOnScreenMessage('success', $this->lng->txt("object_added"), true);
532  if ($redirect) {
533  $this->ctrl->setParameter($this, "ref_id", $new_object->getRefId());
534  $this->ctrl->redirect($this, 'edit');
535  }
536  }
537 
541  public function editObject(?ilPropertyFormGUI $a_form = null): void
542  {
543  $this->checkPermission("write");
544 
545  $this->setSubTabs('settings');
546  $this->tabs_gui->setTabActive('settings');
547  $this->tabs_gui->setSubTabActive('general');
548 
549  if (!$a_form) {
550  $a_form = $this->initForm('edit');
551  }
552  $this->tpl->setVariable('ADM_CONTENT', $a_form->getHTML());
553  }
554 
555  public function updateGroupTypeObject(): void
556  {
558  $this->object->getRefId(),
559  (int) $_REQUEST['grp_type']
560  );
561 
562  $this->tpl->setOnScreenMessage('success', $this->lng->txt('settings_saved'), true);
563  $this->ctrl->redirect($this, 'edit');
564  }
565 
566 
567  public function updateObject(): void
568  {
569  $obj_service = $this->getObjectService();
570  $this->checkPermission('write');
571 
572  $form = $this->initForm();
573  $new_type = 0;
574  if ($form->checkInput()) {
575  // handle group type settings
576  $old_type = ilDidacticTemplateObjSettings::lookupTemplateId($this->object->getRefId());
577 
578  $modified = false;
579  $new_type_info = $form->getInput('didactic_type');
580  if ($new_type_info) {
581  $new_type = explode('_', $form->getInput('didactic_type'));
582  $new_type = (int) $new_type[1];
583 
584  $modified = ($new_type !== $old_type);
585  ilLoggerFactory::getLogger('grp')->info('Switched group type from ' . $old_type . ' to ' . $new_type);
586  }
587 
588  // Additional checks: both tile and session limitation activated (not supported)
589  if (
590  $form->getInput('sl') == "1" &&
591  $form->getInput('list_presentation') == "tile") {
593  $this->tpl->setOnScreenMessage('failure', $this->lng->txt('crs_tile_and_session_limit_not_supported'));
594  $this->editObject($form);
595  return;
596  }
597 
598  $this->object->setTitle($form->getInput('title'));
599  $this->object->setDescription($form->getInput('desc'));
600  $this->object->setGroupType((int) $form->getInput('grp_type'));
601  $this->object->setRegistrationType((int) $form->getInput('registration_type'));
602  $this->object->setPassword($form->getInput('password'));
603  $this->object->enableUnlimitedRegistration(!$form->getInput('reg_limit_time'));
604  $this->object->enableMembershipLimitation((bool) $form->getInput('registration_membership_limited'));
605  $this->object->setMinMembers((int) $form->getInput('registration_min_members'));
606  $this->object->setMaxMembers((int) $form->getInput('registration_max_members'));
607  $this->object->enableRegistrationAccessCode((bool) $form->getInput('reg_code_enabled'));
608  $this->object->setRegistrationAccessCode($form->getInput('reg_code'));
609  $this->object->setViewMode((int) $form->getInput('view_mode'));
610  $this->object->setMailToMembersType((int) $form->getInput('mail_type'));
611  $this->object->setShowMembers((bool) $form->getInput('show_members'));
612  $this->object->setAutoNotification((bool) $form->getInput('auto_notification'));
613 
614  // session limit
615  $this->object->enableSessionLimit((bool) $form->getInput('sl'));
616  $session_sp = $form->getInput('sp');
617  $this->object->setNumberOfPreviousSessions(is_numeric($session_sp) ? (int) $session_sp : -1);
618  $session_sn = $form->getInput('sn');
619  $this->object->setNumberOfnextSessions(is_numeric($session_sn) ? (int) $session_sn : -1);
620 
621  // period
622  $grp_period = $form->getItemByPostVar("period");
623  $this->object->setPeriod(
624  $grp_period->getStart(),
625  $grp_period->getEnd()
626  );
627 
628  $reg = $form->getItemByPostVar("reg");
629  if ($reg->getStart() instanceof ilDateTime && $reg->getEnd() instanceof ilDateTime) {
630  $this->object->enableUnlimitedRegistration(false);
631  } else {
632  $this->object->enableUnlimitedRegistration(true);
633  }
634 
635  $this->object->setRegistrationStart($reg->getStart());
636  $this->object->setRegistrationEnd($reg->getEnd());
637 
638  $cancel_end = $form->getItemByPostVar("cancel_end");
639  $this->object->setCancellationEnd($cancel_end->getDate());
640 
641  $waiting_list = 0;
642  if ($this->http->wrapper()->post()->has('waiting_list')) {
643  $waiting_list = $this->http->wrapper()->post()->retrieve(
644  'waiting_list',
645  $this->refinery->kindlyTo()->int()
646  );
647  }
648  switch ($waiting_list) {
649  case 2:
650  $this->object->enableWaitingList(true);
651  $this->object->setWaitingListAutoFill(true);
652  break;
653 
654  case 1:
655  $this->object->enableWaitingList(true);
656  $this->object->setWaitingListAutoFill(false);
657  break;
658 
659  default:
660  $this->object->enableWaitingList(false);
661  $this->object->setWaitingListAutoFill(false);
662  break;
663  }
664  $this->object->handleAutoFill();
665 
666  // activation
667  $property_online = $this->object->getObjectProperties()->getPropertyIsOnline();
668  $online = $form->getInput('activation_online') ?
669  $property_online->withOnline() :
670  $property_online->withOffline();
671  $this->object->getObjectProperties()->storePropertyIsOnline($online);
672 
673  // update object settings
674  $this->object->update();
675 
676  // title icon visibility
677  $obj_service->commonSettings()->legacyForm($form, $this->object)->saveTitleIconVisibility();
678 
679  // top actions visibility
680  $obj_service->commonSettings()->legacyForm($form, $this->object)->saveTopActionsVisibility();
681 
682  // custom icon
683  $obj_service->commonSettings()->legacyForm($form, $this->object)->saveIcon();
684 
685  // tile image
686  $obj_service->commonSettings()->legacyForm($form, $this->object)->saveTileImage();
687 
688  // list presentation
689  $this->saveListPresentation($form);
690 
692  $this->object->getId(),
693  $form,
694  $this->getSubServices()
695  );
696 
697  // Save sorting
698  $this->saveSortingSettings($form);
699 
700  // BEGIN ChangeEvents: Record update Object.
702  $this->object->getId(),
703  $this->user->getId(),
704  'update'
705  );
706  ilChangeEvent::_catchupWriteEvents($this->object->getId(), $this->user->getId());
707  // END PATCH ChangeEvents: Record update Object.
708  // Update ecs export settings
709  $ecs = new ilECSGroupSettings($this->object);
710  $ecs->handleSettingsUpdate($form);
711  } else {
712  $this->tpl->setOnScreenMessage('failure', $GLOBALS['DIC']->language()->txt('err_check_input')); // #16975
713 
715  $this->editObject($form);
716  return;
717  }
718 
719  // group type modified
720  if ($modified) {
721  if ($new_type == 0) {
722  $new_type_txt = $GLOBALS['DIC']['lng']->txt('il_grp_status_open');
723  } else {
724  $dtpl = new ilDidacticTemplateSetting($new_type);
725  $new_type_txt = $dtpl->getPresentationTitle($GLOBALS['DIC']['lng']->getLangKey());
726  }
727 
728 
729  $confirm = new ilConfirmationGUI();
730  $confirm->setHeaderText($this->lng->txt('grp_warn_grp_type_changed'));
731  $confirm->setFormAction($this->ctrl->getFormAction($this));
732  $confirm->addItem(
733  'grp_type',
734  (string) $new_type,
735  $this->lng->txt('grp_info_new_grp_type') . ': ' . $new_type_txt
736  );
737  $confirm->setConfirm($this->lng->txt('grp_change_type'), 'updateGroupType');
738  $confirm->setCancel($this->lng->txt('cancel'), 'edit');
739 
740  $this->tpl->setContent($confirm->getHTML());
741  } else {
742  $this->tpl->setOnScreenMessage('success', $this->lng->txt("msg_obj_modified"), true);
743  $this->ctrl->redirect($this, 'edit');
744  }
745  }
746 
747  protected function getSubServices(): array
748  {
749  $subs = array(
758  );
759  if ($this->news->isGloballyActivated()) {
761  }
762 
763  return $subs;
764  }
765 
769  public function editMapSettingsObject(): void
770  {
771  $this->setSubTabs("settings");
772  $this->tabs_gui->setTabActive('settings');
773  $this->tabs_gui->setSubTabActive('grp_map_settings');
774 
775  if (!ilMapUtil::isActivated() ||
776  !$this->access->checkAccess("write", "", $this->object->getRefId())) {
777  return;
778  }
779 
780  $latitude = $this->object->getLatitude();
781  $longitude = $this->object->getLongitude();
782  $zoom = $this->object->getLocationZoom();
783 
784  // Get Default settings, when nothing is set
785  if ($latitude == 0 && $longitude == 0 && $zoom == 0) {
787  $latitude = $def["latitude"];
788  $longitude = $def["longitude"];
789  $zoom = $def["zoom"];
790  }
791 
792 
793  $form = new ilPropertyFormGUI();
794  $form->setFormAction($this->ctrl->getFormAction($this));
795 
796  $form->setTitle($this->lng->txt("grp_map_settings"));
797 
798  // enable map
799  $public = new ilCheckboxInputGUI(
800  $this->lng->txt("grp_enable_map"),
801  "enable_map"
802  );
803  $public->setValue("1");
804  $public->setChecked($this->object->getEnableGroupMap());
805  $form->addItem($public);
806 
807  // map location
808  $loc_prop = new ilLocationInputGUI(
809  $this->lng->txt("grp_map_location"),
810  "location"
811  );
812  $loc_prop->setLatitude((float) $latitude);
813  $loc_prop->setLongitude((float) $longitude);
814  $loc_prop->setZoom((int) $zoom);
815  $form->addItem($loc_prop);
816 
817  $form->addCommandButton("saveMapSettings", $this->lng->txt("save"));
818 
819  $this->tpl->setVariable("ADM_CONTENT", $form->getHTML());
820  }
821 
825  public function saveMapSettingsObject(): void
826  {
827  $location = [];
828  if ($this->http->wrapper()->post()->has('location')) {
829  $custom_transformer = $this->refinery->custom()->transformation(
830  function ($array) {
831  return $array;
832  }
833  );
834  $location = $this->http->wrapper()->post()->retrieve(
835  'location',
836  $custom_transformer
837  );
838  }
839  $enable_map = false;
840  if ($this->http->wrapper()->post()->has('enable_map')) {
841  $enable_map = $this->http->wrapper()->post()->retrieve(
842  'enable_map',
843  $this->refinery->kindlyTo()->bool()
844  );
845  }
846 
847  $this->object->setLatitude((string) $location['latitude']);
848  $this->object->setLongitude((string) $location['longitude']);
849  $this->object->setLocationZoom((int) $location['zoom']);
850  $this->object->setEnableGroupMap($enable_map);
851  $this->object->update();
852  $this->ctrl->redirect($this, "editMapSettings");
853  }
854 
855 
856 
857  public function editInfoObject(): void
858  {
859  $this->checkPermission('write');
860 
861  $this->setSubTabs('settings');
862  $this->tabs_gui->setTabActive('settings');
863  $this->tabs_gui->setSubTabActive('grp_info_settings');
864 
865  $form = $this->initInfoEditor();
866  $this->tpl->setContent($form->getHTML());
867  }
868 
869  protected function initInfoEditor(): ilPropertyFormGUI
870  {
871  $form = new ilPropertyFormGUI();
872  $form->setFormAction($this->ctrl->getFormAction($this, 'updateInfo'));
873  $form->setTitle($this->lng->txt('grp_general_informations'));
874  $form->addCommandButton('updateInfo', $this->lng->txt('save'));
875  $form->addCommandButton('cancel', $this->lng->txt('cancel'));
876 
877  $area = new ilTextAreaInputGUI($this->lng->txt('grp_information'), 'important');
878  $area->setInfo($this->lng->txt('grp_information_info'));
879  $area->setValue($this->object->getInformation());
880  $area->setRows(8);
881  $area->setCols(80);
882  $form->addItem($area);
883 
884  return $form;
885  }
886 
887  public function updateInfoObject(): void
888  {
889  $this->checkPermission('manage_members');
890 
891  $important = '';
892  if ($this->http->wrapper()->post()->has('important')) {
893  $important = $this->http->wrapper()->post()->retrieve(
894  'important',
895  $this->refinery->kindlyTo()->string()
896  );
897  }
898  $this->object->setInformation($important);
899  $this->object->update();
900  $this->tpl->setOnScreenMessage('success', $this->lng->txt("settings_saved"));
901  $this->editInfoObject();
902  }
903 
904  public function readMemberData(array $ids, ?array $selected_columns = null): array
905  {
906  $privacy = ilPrivacySettings::getInstance();
907 
908  $this->show_tracking =
909  (
911  );
912 
913  $completed = $in_progress = $failed = [];
914  if ($this->show_tracking) {
915  $olp = ilObjectLP::getInstance($this->object->getId());
916  $this->show_tracking = $olp->isActive();
917  }
918 
919  if ($this->show_tracking) {
920  $completed = ilLPStatusWrapper::_lookupCompletedForObject($this->object->getId());
921  $in_progress = ilLPStatusWrapper::_lookupInProgressForObject($this->object->getId());
922  $failed = ilLPStatusWrapper::_lookupFailedForObject($this->object->getId());
923  }
924 
925  if ($privacy->enabledGroupAccessTimes()) {
926  $progress = ilLearningProgress::_lookupProgressByObjId($this->object->getId());
927  }
928 
929  $do_prtf = (is_array($selected_columns) &&
930  in_array('prtf', $selected_columns) &&
931  is_array($ids));
932  if ($do_prtf) {
934  $ids,
935  $this->ctrl->getLinkTarget($this, "members")
936  );
937  }
938 
944  $profile_data = ilObjUser::_readUsersProfileData($ids);
945  $members = [];
946  foreach ($ids as $usr_id) {
947  $tmp_data['notification'] = (bool) $this->object->members_obj->isNotificationEnabled((int) $usr_id) ? 1 : 0;
948  $tmp_data['contact'] = (bool) $this->object->members_obj->isContact((int) $usr_id) ? 1 : 0;
949 
950  foreach ((array) ($profile_data[$usr_id] ?? []) as $field => $value) {
951  $tmp_data[$field] = $value;
952  }
953 
954  if ($this->show_tracking) {
955  $tmp_data['progress'] = '';
956  if (in_array($usr_id, $completed)) {
957  $tmp_data['progress'] = ilLPStatus::LP_STATUS_COMPLETED;
958  } elseif (in_array($usr_id, $in_progress)) {
959  $tmp_data['progress'] = ilLPStatus::LP_STATUS_IN_PROGRESS;
960  } elseif (in_array($usr_id, $failed)) {
961  $tmp_data['progress'] = ilLPStatus::LP_STATUS_FAILED;
962  } else {
963  $tmp_data['progress'] = ilLPStatus::LP_STATUS_NOT_ATTEMPTED;
964  }
965  }
966 
967  if ($privacy->enabledGroupAccessTimes()) {
968  if (isset($progress[$usr_id]['ts']) && ($progress[$usr_id]['ts'] ?? false)) {
969  $tmp_data['access_time'] = ilDatePresentation::formatDate(
970  $tmp_date = new ilDateTime($progress[$usr_id]['ts'], IL_CAL_UNIX)
971  );
972  $tmp_data['access_time_unix'] = $tmp_date->get(IL_CAL_UNIX);
973  } else {
974  $tmp_data['access_time'] = $this->lng->txt('no_date');
975  $tmp_data['access_time_unix'] = 0;
976  }
977  }
978  $tmp_data['prtf'] = [];
979  if ($do_prtf) {
980  $tmp_data['prtf'] = ($all_prtf[$usr_id] ?? []);
981  }
982  $members[$usr_id] = $tmp_data;
983  }
984  return $members;
985  }
986 
987  public function leaveObject(): void
988  {
989  $this->checkPermission('leave');
990 
991  $part = ilGroupParticipants::_getInstanceByObjId($this->object->getId());
992  if ($part->isLastAdmin($this->user->getId())) {
993  $this->tpl->setOnScreenMessage('failure', $this->lng->txt('grp_err_administrator_required'));
994  $this->viewObject();
995  return;
996  }
997 
998  $this->tabs_gui->setTabActive('grp_btn_unsubscribe');
999 
1000  $cgui = new ilConfirmationGUI();
1001  $cgui->setHeaderText($this->lng->txt('grp_dismiss_myself'));
1002  $cgui->setFormAction($this->ctrl->getFormAction($this));
1003  $cgui->setCancel($this->lng->txt("cancel"), "cancel");
1004  $cgui->setConfirm($this->lng->txt("grp_btn_unsubscribe"), "unsubscribe");
1005  $this->tpl->setContent($cgui->getHTML());
1006  }
1007 
1008  public function unsubscribeObject(): void
1009  {
1010  $this->checkPermission('leave');
1011  $this->object->members_obj->delete($this->user->getId());
1012  $this->object->members_obj->sendNotification(
1014  $this->user->getId()
1015  );
1016  $this->object->members_obj->sendNotification(
1018  $this->user->getId()
1019  );
1020 
1021  $this->tpl->setOnScreenMessage('success', $this->lng->txt('grp_msg_membership_annulled'), true);
1022  $this->ctrl->setParameterByClass(
1023  "ilrepositorygui",
1024  "ref_id",
1025  $this->tree->getParentId($this->object->getRefId())
1026  );
1027  $this->ctrl->redirectByClass("ilrepositorygui", "");
1028  }
1029 
1030  public function addContentTab(): void
1031  {
1032  $this->tabs_gui->addTab(
1033  "view_content",
1034  $this->lng->txt("content"),
1035  $this->ctrl->getLinkTarget($this, "view")
1036  );
1037  }
1038 
1042  protected function getTabs(): void
1043  {
1044  global $DIC;
1045 
1046  $ilHelp = $DIC['ilHelp'];
1047  $ilHelp->setScreenIdComponent("grp");
1048 
1049  if ($this->access->checkAccess('read', '', $this->ref_id)) {
1050  if ($this->object->isNewsTimelineEffective()) {
1051  if (!$this->object->isNewsTimelineLandingPageEffective()) {
1052  $this->addContentTab();
1053  }
1054  $this->tabs_gui->addTab(
1055  "news_timeline",
1056  $this->lng->txt("cont_news_timeline_tab"),
1057  $this->ctrl->getLinkTargetByClass("ilnewstimelinegui", "show")
1058  );
1059  if ($this->object->isNewsTimelineLandingPageEffective()) {
1060  $this->addContentTab();
1061  }
1062  } else {
1063  $this->addContentTab();
1064  }
1065  }
1066  if (
1067  $this->access->checkAccess('visible', '', $this->ref_id) ||
1068  $this->access->checkAccess('join', '', $this->ref_id) ||
1069  $this->access->checkAccess('read', '', $this->ref_id)
1070  ) {
1071  $this->tabs_gui->addTarget(
1072  "info_short",
1073  $this->ctrl->getLinkTargetByClass(
1074  array("ilobjgroupgui", "ilinfoscreengui"),
1075  "showSummary"
1076  ),
1077  "infoScreen",
1078  "",
1079  "",
1080  false
1081  );
1082  }
1083 
1084 
1085  if ($this->access->checkAccess('write', '', $this->object->getRefId())) {
1086  $this->tabs_gui->addTarget(
1087  "settings",
1088  $this->ctrl->getLinkTarget($this, "edit"),
1089  array("edit", "editMapSettings"),
1090  get_class($this),
1091  ""
1092  );
1093  }
1094 
1095  $is_participant = ilGroupParticipants::_isParticipant($this->ref_id, $this->user->getId());
1096 
1097  // Members
1098  $membership_gui = new ilGroupMembershipGUI($this, $this->object);
1099  $membership_gui->addMemberTab($this->tabs_gui, $is_participant);
1100 
1101 
1102  // badges
1103  if ($this->access->checkAccess('write', '', $this->ref_id)) {
1104  if (ilBadgeHandler::getInstance()->isObjectActive($this->object->getId())) {
1105  $this->tabs_gui->addTarget(
1106  "obj_tool_setting_badges",
1107  $this->ctrl->getLinkTargetByClass("ilbadgemanagementgui", ""),
1108  "",
1109  "ilbadgemanagementgui"
1110  );
1111  }
1112  }
1113 
1114  // skills
1115  if ($this->access->checkAccess('read', '', $this->ref_id) && ilContainer::_lookupContainerSetting(
1116  $this->object->getId(),
1118  ''
1119  )) {
1120  $this->tabs_gui->addTarget(
1121  "obj_tool_setting_skills",
1122  $this->ctrl->getLinkTargetByClass(array("ilcontainerskillgui", "ilcontskillpresentationgui"), ""),
1123  "",
1124  array("ilcontainerskillgui", "ilcontskillpresentationgui", "ilcontskilladmingui")
1125  );
1126  }
1127 
1128  // learning progress
1129  if (ilLearningProgressAccess::checkAccess($this->object->getRefId(), $is_participant)) {
1130  $this->tabs_gui->addTarget(
1131  'learning_progress',
1132  $this->ctrl->getLinkTargetByClass(array('ilobjgroupgui','illearningprogressgui'), ''),
1133  '',
1134  array('illplistofobjectsgui','illplistofsettingsgui','illearningprogressgui','illplistofprogressgui')
1135  );
1136  }
1137 
1138  // meta data
1139  if ($this->access->checkAccess('write', '', $this->ref_id)) {
1140  $md_gui = new ilObjectMetaDataGUI($this->object);
1141  $tab_link = $md_gui->getTab();
1142  if ($tab_link !== null) {
1143  $this->tabs_gui->addTab(
1144  'meta_data',
1145  $this->lng->txt('meta_data'),
1146  $tab_link,
1147  ''
1148  );
1149  }
1150  }
1151 
1152 
1153  if ($this->access->checkAccess('write', '', $this->object->getRefId())) {
1154  $this->tabs_gui->addTarget(
1155  'export',
1156  $this->ctrl->getLinkTargetByClass('ilexportgui', ''),
1157  'export',
1158  'ilexportgui'
1159  );
1160  }
1161 
1162  // parent tabs (all container: edit_permission, clipboard, trash
1163  parent::getTabs();
1164 
1165  if ($this->access->checkAccess('join', '', $this->object->getRefId()) and
1166  !$this->object->members_obj->isAssigned($this->user->getId())) {
1167  if (ilGroupWaitingList::_isOnList($this->user->getId(), $this->object->getId())) {
1168  $this->tabs_gui->addTab(
1169  'leave',
1170  $this->lng->txt('membership_leave'),
1171  $this->ctrl->getLinkTargetByClass('ilgroupregistrationgui', 'show', '')
1172  );
1173  } else {
1174  $this->tabs_gui->addTarget(
1175  "join",
1176  $this->ctrl->getLinkTargetByClass('ilgroupregistrationgui', "show"),
1177  'show',
1178  ""
1179  );
1180  }
1181  }
1182  if ($this->access->checkAccess('leave', '', $this->object->getRefId()) and
1183  $this->object->members_obj->isMember($this->user->getId())) {
1184  $this->tabs_gui->addTarget(
1185  "grp_btn_unsubscribe",
1186  $this->ctrl->getLinkTarget($this, "leave"),
1187  '',
1188  ""
1189  );
1190  }
1191  }
1192 
1193  public function infoScreenObject(): void
1194  {
1195  $this->ctrl->redirectByClass(ilInfoScreenGUI::class, "showSummary");
1196  }
1197 
1198  public function infoScreen(): void
1199  {
1200  $this->tabs_gui->setTabActive('info_short');
1201 
1202  if (!$this->checkPermissionBool('read')) {
1203  $this->checkPermission('visible');
1204  }
1205 
1206  $info = new ilInfoScreenGUI($this);
1207 
1208  if (strlen($this->object->getInformation())) {
1209  $info->addSection($this->lng->txt('grp_general_informations'));
1210  $info->addProperty($this->lng->txt('grp_information'), nl2br(
1211  ilUtil::makeClickable($this->object->getInformation(), true)
1212  ));
1213  }
1214 
1215  $info->enablePrivateNotes();
1216  $info->enableLearningProgress(true);
1217 
1218  $record_gui = new ilAdvancedMDRecordGUI(ilAdvancedMDRecordGUI::MODE_INFO, 'grp', $this->object->getId());
1219  $record_gui->setInfoObject($info);
1220  $record_gui->parse();
1221 
1222  // meta data
1223  $info->addMetaDataSections($this->object->getId(), 0, $this->object->getType());
1224 
1225 
1226  // support contacts
1227  $parts = ilParticipants::getInstance($this->object->getRefId());
1228  $contacts = $parts->getContacts();
1229  if (count($contacts) > 0) {
1230  $info->addSection($this->lng->txt("grp_mem_contacts"));
1231  foreach ($contacts as $c) {
1232  $pgui = new ilPublicUserProfileGUI($c);
1233  $pgui->setBackUrl($this->ctrl->getLinkTargetByClass("ilinfoscreengui"));
1234  $pgui->setEmbedded(true);
1235  $info->addProperty("", $pgui->getHTML());
1236  }
1237  }
1238 
1239 
1240  $info->addSection($this->lng->txt('group_registration'));
1241  $info->showLDAPRoleGroupMappingInfo();
1242 
1243  if (!$this->object->isRegistrationEnabled()) {
1244  $info->addProperty(
1245  $this->lng->txt('group_registration_mode'),
1246  $this->lng->txt('grp_reg_deac_info_screen')
1247  );
1248  } else {
1249  switch ($this->object->getRegistrationType()) {
1251  $info->addProperty(
1252  $this->lng->txt('group_registration_mode'),
1253  $this->lng->txt('grp_reg_direct_info_screen')
1254  );
1255  break;
1256 
1258  $info->addProperty(
1259  $this->lng->txt('group_registration_mode'),
1260  $this->lng->txt('grp_reg_req_info_screen')
1261  );
1262  break;
1263 
1265  $info->addProperty(
1266  $this->lng->txt('group_registration_mode'),
1267  $this->lng->txt('grp_reg_passwd_info_screen')
1268  );
1269  break;
1270  }
1271  /*
1272  $info->addProperty($this->lng->txt('group_registration_time'),
1273  ilDatePresentation::formatPeriod(
1274  $this->object->getRegistrationStart(),
1275  $this->object->getRegistrationEnd()));
1276  */
1277  if ($this->object->isRegistrationUnlimited()) {
1278  $info->addProperty(
1279  $this->lng->txt('group_registration_time'),
1280  $this->lng->txt('grp_registration_unlimited')
1281  );
1282  } elseif ($this->object->getRegistrationStart()->getUnixTime() < time()) {
1283  $info->addProperty(
1284  $this->lng->txt("group_registration_time"),
1285  $this->lng->txt('cal_until') . ' ' .
1286  ilDatePresentation::formatDate($this->object->getRegistrationEnd())
1287  );
1288  } elseif ($this->object->getRegistrationStart()->getUnixTime() >= time()) {
1289  $info->addProperty(
1290  $this->lng->txt("group_registration_time"),
1291  $this->lng->txt('cal_from') . ' ' .
1292  ilDatePresentation::formatDate($this->object->getRegistrationStart())
1293  );
1294  }
1295  if ($this->object->isMembershipLimited()) {
1296  if ($this->object->getMinMembers()) {
1297  $info->addProperty(
1298  $this->lng->txt("mem_min_users"),
1299  (string) $this->object->getMinMembers()
1300  );
1301  }
1302  if ($this->object->getMaxMembers()) {
1303  $reg_info = ilObjGroupAccess::lookupRegistrationInfo($this->object->getId());
1304 
1305  $info->addProperty(
1306  $this->lng->txt('mem_free_places'),
1307  (string) ($reg_info['reg_info_free_places'] ?? '0')
1308  );
1309  }
1310  }
1311 
1312  if ($this->object->getCancellationEnd()) {
1313  $info->addProperty(
1314  $this->lng->txt('grp_cancellation_end'),
1315  ilDatePresentation::formatDate($this->object->getCancellationEnd())
1316  );
1317  }
1318  }
1319 
1320  if ($this->object->getStart() instanceof ilDateTime &&
1321  !$this->object->getStart()->isNull()
1322  ) {
1323  $info->addProperty(
1324  $this->lng->txt('grp_period'),
1326  $this->object->getStart(),
1327  $this->object->getEnd()
1328  )
1329  );
1330  }
1331 
1332  // Confirmation
1333  $privacy = ilPrivacySettings::getInstance();
1334 
1335  if ($privacy->groupConfirmationRequired() or ilCourseDefinedFieldDefinition::_getFields($this->object->getId()) or $privacy->enabledGroupExport()) {
1336  $field_info = ilExportFieldsInfo::_getInstanceByType($this->object->getType());
1337 
1338  $this->lng->loadLanguageModule('ps');
1339  $info->addSection($this->lng->txt('grp_user_agreement_info'));
1340  $info->addProperty($this->lng->txt('ps_export_data'), $field_info->exportableFieldsToInfoString());
1341 
1342  if ($fields = ilCourseDefinedFieldDefinition::_fieldsToInfoString($this->object->getId())) {
1343  $info->addProperty($this->lng->txt('ps_grp_user_fields'), $fields);
1344  }
1345  }
1346 
1347 
1348  // forward the command
1349  $this->ctrl->forwardCommand($info);
1350  }
1351 
1352  public function saveNotificationObject(): void
1353  {
1354  $noti = new ilMembershipNotifications($this->ref_id);
1355 
1356  $grp_notification = false;
1357  if ($this->http->wrapper()->query()->has('grp_ntf')) {
1358  $grp_notification = $this->http->wrapper()->query()->retrieve(
1359  'grp_ntf',
1360  $this->refinery->kindlyTo()->bool()
1361  );
1362  }
1363 
1364  if ($noti->canCurrentUserEdit()) {
1365  if ($grp_notification) {
1366  $noti->activateUser();
1367  } else {
1368  $noti->deactivateUser();
1369  }
1370  }
1371  $this->tpl->setOnScreenMessage('success', $this->lng->txt("settings_saved"), true);
1372  $this->ctrl->redirect($this, "");
1373  }
1374 
1375  protected function membersObject(): void
1376  {
1377  $this->ctrl->redirectByClass('ilgroupmembershipgui');
1378  }
1379 
1380 
1381  public static function _goto(string $a_target, string $a_add = ""): void
1382  {
1383  global $DIC;
1384  $main_tpl = $DIC->ui()->mainTemplate();
1385  $a_target = (int) $a_target;
1386 
1387  $ilUser = $DIC->user();
1388  $ilAccess = $DIC->access();
1389  $lng = $DIC->language();
1390  $ilErr = $DIC['ilErr'];
1391  $http = $DIC->http();
1392  $refinery = $DIC->refinery();
1393 
1394  $target = '';
1395  if ($http->wrapper()->query()->has('target')) {
1396  $target = $http->wrapper()->query()->retrieve(
1397  'target',
1398  $refinery->kindlyTo()->string()
1399  );
1400  }
1401  if (substr($a_add, 0, 5) == 'rcode') {
1402  if ($ilUser->getId() == ANONYMOUS_USER_ID) {
1403  // Redirect to login for anonymous
1405  "login.php?target=" . $target . "&cmd=force_login&lang=" .
1406  $ilUser->getCurrentLanguage()
1407  );
1408  }
1409 
1410  // Redirects to target location after assigning user to group
1412  $a_target,
1414  substr($a_add, 5)
1415  );
1416  }
1417 
1418  if ($a_add == "mem" && $ilAccess->checkAccess("manage_members", "", $a_target)) {
1419  ilObjectGUI::_gotoRepositoryNode($a_target, "members");
1420  }
1421 
1422  if ($a_add == "comp" && ilContSkillPresentationGUI::isAccessible($a_target)) {
1423  ilObjectGUI::_gotoRepositoryNode($a_target, "competences");
1424  }
1425 
1426  if ($ilAccess->checkAccess("read", "", $a_target)) {
1428  } else {
1429  // to do: force flat view
1430  if ($ilAccess->checkAccess("visible", "", $a_target)) {
1431  ilObjectGUI::_gotoRepositoryNode($a_target, "infoScreenGoto");
1432  } else {
1433  if ($ilAccess->checkAccess("read", "", ROOT_FOLDER_ID)) {
1434  $main_tpl->setOnScreenMessage('failure', sprintf(
1435  $lng->txt("msg_no_perm_read_item"),
1437  ), true);
1439  }
1440  }
1441  }
1442  $ilErr->raiseError($lng->txt("msg_no_perm_read"), $ilErr->FATAL);
1443  }
1444 
1445 
1446  public function initForm(string $a_mode = 'edit', bool $a_omit_form_action = false): ilPropertyFormGUI
1447  {
1448  $obj_service = $this->getObjectService();
1449  $form = new ilPropertyFormGUI();
1450 
1451  if (!$a_omit_form_action) {
1452  switch ($a_mode) {
1453  case 'edit':
1454  $form->setFormAction($this->ctrl->getFormAction($this, 'update'));
1455  break;
1456 
1457  default:
1458  $form->setTableWidth('600px');
1459  $form->setFormAction($this->ctrl->getFormAction($this, 'save'));
1460  break;
1461  }
1462  }
1463 
1464  // title/description
1465  $this->initFormTitleDescription($form);
1466 
1467  $form = $this->initDidacticTemplate($form);
1468 
1469  if ($a_mode == 'edit') {
1470  // group period
1471  $cdur = new ilDateDurationInputGUI($this->lng->txt('grp_period'), 'period');
1472  $this->lng->loadLanguageModule('mem');
1473  $cdur->enableToggleFullTime(
1474  $this->lng->txt('mem_period_without_time'),
1475  !$this->object->getStartTimeIndication()
1476  );
1477  $cdur->setShowTime(true);
1478  $cdur->setInfo($this->lng->txt('grp_period_info'));
1479  $cdur->setStart($this->object->getStart());
1480  $cdur->setEnd($this->object->getEnd());
1481  $form->addItem($cdur);
1482 
1483  // activation
1484  $this->lng->loadLanguageModule('rep');
1485 
1486  $section = new ilFormSectionHeaderGUI();
1487  $section->setTitle($this->lng->txt('rep_activation_availability'));
1488  $form->addItem($section);
1489 
1490  $online = new ilCheckboxInputGUI($this->lng->txt('rep_activation_online'), 'activation_online');
1491  $online->setChecked(!$this->object->getOfflineStatus());
1492  $online->setInfo($this->lng->txt('grp_activation_online_info'));
1493  $form->addItem($online);
1494 
1495 
1496  // Group registration ############################################################
1497  $pres = new ilFormSectionHeaderGUI();
1498  $pres->setTitle($this->lng->txt('grp_setting_header_registration'));
1499  $form->addItem($pres);
1500 
1501  // Registration type
1502  $reg_type = new ilRadioGroupInputGUI($this->lng->txt('group_registration_mode'), 'registration_type');
1503  $reg_type->setValue((string) $this->object->getRegistrationType());
1504 
1505  $opt_dir = new ilRadioOption(
1506  $this->lng->txt('grp_reg_direct'),
1508  );#$this->lng->txt('grp_reg_direct_info'));
1509  $reg_type->addOption($opt_dir);
1510 
1511  $opt_pass = new ilRadioOption(
1512  $this->lng->txt('grp_pass_request'),
1514  );
1515  $pass = new ilTextInputGUI($this->lng->txt("password"), 'password');
1516  $pass->setRequired(true);
1517  $pass->setInfo($this->lng->txt('grp_reg_password_info'));
1518  $pass->setValue($this->object->getPassword());
1519  $pass->setSize(32);
1520  $pass->setMaxLength(32);
1521  $opt_pass->addSubItem($pass);
1522  $reg_type->addOption($opt_pass);
1523 
1524  $opt_req = new ilRadioOption($this->lng->txt('grp_reg_request'), (string) ilGroupConstants::GRP_REGISTRATION_REQUEST, $this->lng->txt('grp_reg_request_info'));
1525  $reg_type->addOption($opt_req);
1526 
1527  $opt_deact = new ilRadioOption($this->lng->txt('grp_reg_no_selfreg'), (string) ilGroupConstants::GRP_REGISTRATION_DEACTIVATED, $this->lng->txt('grp_reg_disabled_info'));
1528  $reg_type->addOption($opt_deact);
1529 
1530  // Registration codes
1531  $reg_code = new ilCheckboxInputGUI($this->lng->txt('grp_reg_code'), 'reg_code_enabled');
1532  $reg_code->setChecked($this->object->isRegistrationAccessCodeEnabled());
1533  $reg_code->setValue('1');
1534  $reg_code->setInfo($this->lng->txt('grp_reg_code_enabled_info'));
1535  $form->addItem($reg_type);
1536 
1537  // Registration codes
1538  if (!$this->object->getRegistrationAccessCode()) {
1539  $this->object->setRegistrationAccessCode(ilMembershipRegistrationCodeUtils::generateCode());
1540  }
1541  $reg_link = new ilHiddenInputGUI('reg_code');
1542  $reg_link->setValue($this->object->getRegistrationAccessCode());
1543  $form->addItem($reg_link);
1544 
1545  $link = new ilCustomInputGUI($this->lng->txt('grp_reg_code_link'));
1546  $val = ilLink::_getLink($this->object->getRefId(), $this->object->getType(), array(), 'rcode' . $this->object->getRegistrationAccessCode());
1547  $link->setHTML('<span class="small">' . $val . '</span>');
1548  $reg_code->addSubItem($link);
1549  $form->addItem($reg_code);
1550 
1551  // time limit
1552  $this->lng->loadLanguageModule('dateplaner');
1553  $dur = new ilDateDurationInputGUI($this->lng->txt('grp_reg_limited'), 'reg');
1554  $dur->setShowTime(true);
1555  $dur->setStart($this->object->getRegistrationStart());
1556  $dur->setEnd($this->object->getRegistrationEnd());
1557  $form->addItem($dur);
1558 
1559  // cancellation limit
1560  $cancel = new ilDateTimeInputGUI($this->lng->txt('grp_cancellation_end'), 'cancel_end');
1561  $cancel->setInfo($this->lng->txt('grp_cancellation_end_info'));
1562  $cancel->setDate($this->object->getCancellationEnd());
1563  $form->addItem($cancel);
1564 
1565  // max member
1566  $lim = new ilCheckboxInputGUI($this->lng->txt('reg_grp_max_members_short'), 'registration_membership_limited');
1567  $lim->setValue('1');
1568  // $lim->setOptionTitle($this->lng->txt('reg_grp_max_members'));
1569  $lim->setChecked($this->object->isMembershipLimited());
1570 
1571  $min = new ilTextInputGUI($this->lng->txt('reg_grp_min_members'), 'registration_min_members');
1572  $min->setSize(3);
1573  $min->setMaxLength(4);
1574  $min->setValue($this->object->getMinMembers() ?: '');
1575  $min->setInfo($this->lng->txt('grp_subscription_min_members_info'));
1576  $lim->addSubItem($min);
1577 
1578  $max = new ilTextInputGUI($this->lng->txt('reg_grp_max_members'), 'registration_max_members');
1579  $max->setValue($this->object->getMaxMembers() ?: '');
1580  //$max->setTitle($this->lng->txt('members'));
1581  $max->setSize(3);
1582  $max->setMaxLength(4);
1583  $max->setInfo($this->lng->txt('grp_reg_max_members_info'));
1584  $lim->addSubItem($max);
1585 
1586  /*
1587  $wait = new ilCheckboxInputGUI($this->lng->txt('grp_waiting_list'),'waiting_list');
1588  $wait->setValue(1);
1589  //$wait->setOptionTitle($this->lng->txt('grp_waiting_list'));
1590  $wait->setInfo($this->lng->txt('grp_waiting_list_info'));
1591  $wait->setChecked($this->object->isWaitingListEnabled() ? true : false);
1592  $lim->addSubItem($wait);
1593  $form->addItem($lim);
1594  */
1595 
1596  $wait = new ilRadioGroupInputGUI($this->lng->txt('grp_waiting_list'), 'waiting_list');
1597 
1598  $option = new ilRadioOption($this->lng->txt('none'), '0');
1599  $wait->addOption($option);
1600 
1601  $option = new ilRadioOption($this->lng->txt('grp_waiting_list_no_autofill'), '1');
1602  $option->setInfo($this->lng->txt('grp_waiting_list_info'));
1603  $wait->addOption($option);
1604 
1605  $option = new ilRadioOption($this->lng->txt('grp_waiting_list_autofill'), '2');
1606  $option->setInfo($this->lng->txt('grp_waiting_list_autofill_info'));
1607  $wait->addOption($option);
1608 
1609  if ($this->object->hasWaitingListAutoFill()) {
1610  $wait->setValue('2');
1611  } elseif ($this->object->isWaitingListEnabled()) {
1612  $wait->setValue('1');
1613  } else {
1614  $wait->setValue('0');
1615  }
1616 
1617  $lim->addSubItem($wait);
1618 
1619  $form->addItem($lim);
1620 
1621 
1622  // Group presentation
1623  $parent_membership_ref_id = 0;
1624  $hasParentMembership =
1625  (
1626  $parent_membership_ref_id = $this->tree->checkForParentType($this->object->getRefId(), 'crs', true)
1627  );
1628 
1629  $pres = new ilFormSectionHeaderGUI();
1630  $pres->setTitle($this->lng->txt('grp_setting_header_presentation'));
1631  $form->addItem($pres);
1632 
1633  // title and icon visibility
1634  $form = $obj_service->commonSettings()->legacyForm($form, $this->object)->addTitleIconVisibility();
1635 
1636  // top actions visibility
1637  $form = $obj_service->commonSettings()->legacyForm($form, $this->object)->addTopActionsVisibility();
1638 
1639  // custom icon
1640  $form = $obj_service->commonSettings()->legacyForm($form, $this->object)->addIcon();
1641 
1642  // tile image
1643  $form = $obj_service->commonSettings()->legacyForm($form, $this->object)->addTileImage();
1644 
1645  // list presentation
1647 
1648 
1649  // presentation type
1650  $view_type = new ilRadioGroupInputGUI($this->lng->txt('grp_presentation_type'), 'view_mode');
1651  if ($hasParentMembership) {
1652  $parent_view_mode = ilObjCourseAccess::_lookupViewMode(ilObject::_lookupObjId($parent_membership_ref_id));
1653  $course_view_mode = '';
1654  switch ($parent_view_mode) {
1656  $course_view_mode = ': ' . $this->lng->txt('cntr_view_sessions');
1657  break;
1658 
1660  $course_view_mode = ': ' . $this->lng->txt('cntr_view_simple');
1661  break;
1662 
1664  $course_view_mode = ': ' . $this->lng->txt('cntr_view_by_type');
1665  break;
1666  }
1667  if ($course_view_mode) {
1668  $opt = new ilRadioOption($this->lng->txt('grp_view_inherit') . $course_view_mode, (string) ilContainer::VIEW_INHERIT);
1669  $opt->setInfo($this->lng->txt('grp_view_inherit_info'));
1670  $view_type->addOption($opt);
1671  }
1672  }
1673 
1674  if ($hasParentMembership && ilObjGroup::lookupViewMode($this->object->getId()) == ilContainer::VIEW_INHERIT) {
1675  $view_type->setValue((string) ilContainer::VIEW_INHERIT);
1676  } else {
1677  $view_type->setValue((string) ilObjGroup::lookupViewMode($this->object->getId()));
1678  }
1679 
1680  $opt = new ilRadioOption($this->lng->txt('cntr_view_sessions'), (string) ilContainer::VIEW_SESSIONS);
1681  $opt->setInfo($this->lng->txt('cntr_view_info_sessions'));
1682  $view_type->addOption($opt);
1683 
1684  // Limited sessions
1685  $this->lng->loadLanguageModule('crs');
1686  $sess = new ilCheckboxInputGUI($this->lng->txt('sess_limit'), 'sl');
1687  $sess->setValue('1');
1688  $sess->setChecked($this->object->isSessionLimitEnabled());
1689  $sess->setInfo($this->lng->txt('sess_limit_info'));
1690 
1691  $prev = new ilNumberInputGUI($this->lng->txt('sess_num_prev'), 'sp');
1692  $prev->setMinValue(0);
1693  $prev->setValue((string) (
1694  $this->object->getNumberOfPreviousSessions() == -1 ?
1695  '' :
1696  $this->object->getNumberOfPreviousSessions()
1697  ));
1698  $prev->setSize(2);
1699  $prev->setMaxLength(3);
1700  $sess->addSubItem($prev);
1701 
1702  $next = new ilNumberInputGUI($this->lng->txt('sess_num_next'), 'sn');
1703  $next->setMinValue(0);
1704  $next->setValue((string) (
1705  $this->object->getNumberOfNextSessions() == -1 ?
1706  '' :
1707  $this->object->getNumberOfNextSessions()
1708  ));
1709  $next->setSize(2);
1710  $next->setMaxLength(3);
1711  $sess->addSubItem($next);
1712  $opt->addSubItem($sess);
1713 
1714  $opt = new ilRadioOption($this->lng->txt('cntr_view_simple'), (string) ilContainer::VIEW_SIMPLE);
1715  $opt->setInfo($this->lng->txt('grp_view_info_simple'));
1716  $view_type->addOption($opt);
1717 
1718  $opt = new ilRadioOption($this->lng->txt('cntr_view_by_type'), (string) ilContainer::VIEW_BY_TYPE);
1719  $opt->setInfo($this->lng->txt('grp_view_info_by_type'));
1720  $view_type->addOption($opt);
1721  $form->addItem($view_type);
1722 
1723 
1724  // Sorting
1725  $sorting_settings = array();
1726  if ($hasParentMembership) {
1727  $sorting_settings[] = ilContainer::SORT_INHERIT;
1728  }
1729  $sorting_settings[] = ilContainer::SORT_TITLE;
1730  $sorting_settings[] = ilContainer::SORT_CREATION;
1731  $sorting_settings[] = ilContainer::SORT_MANUAL;
1732  $this->initSortingForm($form, $sorting_settings);
1733 
1734  // additional features
1735  $feat = new ilFormSectionHeaderGUI();
1736  $feat->setTitle($this->lng->txt('obj_features'));
1737  $form->addItem($feat);
1738 
1740  $this->object->getId(),
1741  $form,
1742  $this->getSubServices()
1743  );
1744 
1745 
1746  $mem = new ilCheckboxInputGUI($this->lng->txt('grp_show_members'), 'show_members');
1747  $mem->setChecked($this->object->getShowMembers());
1748  $mem->setInfo($this->lng->txt('grp_show_members_info'));
1749  $form->addItem($mem);
1750 
1751  // Show members type
1752  $mail_type = new ilRadioGroupInputGUI($this->lng->txt('grp_mail_type'), 'mail_type');
1753  $mail_type->setValue((string) $this->object->getMailToMembersType());
1754 
1755  $mail_tutors = new ilRadioOption(
1756  $this->lng->txt('grp_mail_tutors_only'),
1758  $this->lng->txt('grp_mail_tutors_only_info')
1759  );
1760  $mail_type->addOption($mail_tutors);
1761 
1762  $mail_all = new ilRadioOption(
1763  $this->lng->txt('grp_mail_all'),
1765  $this->lng->txt('grp_mail_all_info')
1766  );
1767  $mail_type->addOption($mail_all);
1768  $form->addItem($mail_type);
1769 
1770  // Self notification
1771  $not = new ilCheckboxInputGUI($this->lng->txt('grp_auto_notification'), 'auto_notification');
1772  $not->setValue('1');
1773  $not->setInfo($this->lng->txt('grp_auto_notification_info'));
1774  $not->setChecked($this->object->getAutoNotification());
1775  $form->addItem($not);
1776  }
1777 
1778  switch ($a_mode) {
1779  case 'create':
1780  $form->setTitle($this->lng->txt('grp_new'));
1781  $form->setTitleIcon(ilUtil::getImagePath('standard/icon_grp.svg'));
1782 
1783  $form->addCommandButton('save', $this->lng->txt('grp_new'));
1784  $form->addCommandButton('cancel', $this->lng->txt('cancel'));
1785  break;
1786 
1787  case 'edit':
1788  $form->setTitle($this->lng->txt('grp_edit'));
1789  $form->setTitleIcon(ilUtil::getImagePath('standard/icon_grp.svg'));
1790 
1791  // Edit ecs export settings
1792  $ecs = new ilECSGroupSettings($this->object);
1793  $ecs->addSettingsToForm($form, 'grp');
1794 
1795  $form->addCommandButton('update', $this->lng->txt('save'));
1796  $form->addCommandButton('cancel', $this->lng->txt('cancel'));
1797  break;
1798  }
1799  return $form;
1800  }
1801 
1802  protected function setSubTabs(string $a_tab): void
1803  {
1804  switch ($a_tab) {
1805  case 'settings':
1806  $this->tabs_gui->addSubTabTarget(
1807  "grp_settings",
1808  $this->ctrl->getLinkTarget($this, 'edit'),
1809  "edit",
1810  get_class($this)
1811  );
1812 
1813  $this->tabs_gui->addSubTabTarget(
1814  "grp_info_settings",
1815  $this->ctrl->getLinkTarget($this, 'editInfo'),
1816  "editInfo",
1817  get_class($this)
1818  );
1819 
1820  if (ilMapUtil::isActivated()) {
1821  $this->tabs_gui->addSubTabTarget(
1822  "grp_map_settings",
1823  $this->ctrl->getLinkTarget($this, 'editMapSettings'),
1824  "editMapSettings",
1825  get_class($this)
1826  );
1827  }
1828 
1829  $this->tabs_gui->addSubTabTarget(
1830  'groupings',
1831  $this->ctrl->getLinkTargetByClass('ilobjcoursegroupinggui', 'listGroupings'),
1832  'listGroupings',
1833  get_class($this)
1834  );
1835 
1836  // only show if export permission is granted
1837  if (ilPrivacySettings::getInstance()->checkExportAccess($this->object->getRefId()) or ilCourseDefinedFieldDefinition::_hasFields($this->object->getId())) {
1838  $this->tabs_gui->addSubTabTarget(
1839  'grp_custom_user_fields',
1840  $this->ctrl->getLinkTargetByClass('ilobjectcustomuserfieldsgui'),
1841  '',
1842  'ilobjectcustomuserfieldsgui'
1843  );
1844  }
1845 
1846  // news settings
1847  if ($this->object->getUseNews()) {
1848  $this->tabs_gui->addSubTab(
1849  'obj_news_settings',
1850  $this->lng->txt("cont_news_settings"),
1851  $this->ctrl->getLinkTargetByClass('ilcontainernewssettingsgui')
1852  );
1853  }
1854 
1855  $lti_settings = new ilLTIProviderObjectSettingGUI($this->object->getRefId());
1856  if ($lti_settings->hasSettingsAccess()) {
1857  $this->tabs_gui->addSubTabTarget(
1858  'lti_provider',
1859  $this->ctrl->getLinkTargetByClass(ilLTIProviderObjectSettingGUI::class)
1860  );
1861  }
1862 
1863  $this->tabs_gui->addSubTabTarget(
1864  "obj_multilinguality",
1865  $this->ctrl->getLinkTargetByClass(TranslationGUI::class, ""),
1866  "",
1867  TranslationGUI::class
1868  );
1869 
1870 
1871  break;
1872  }
1873  }
1874 
1875  private function checkAgreement(): bool
1876  {
1877  if ($this->access->checkAccess('write', '', $this->object->getRefId())) {
1878  return true;
1879  }
1880 
1881  // Disable aggrement if is not member of group
1882  if (!$this->object->members_obj->isAssigned($this->user->getId())) {
1883  return true;
1884  }
1885 
1886  if (ilMemberViewSettings::getInstance()->isActive()) {
1887  return true;
1888  }
1889 
1890  $privacy = ilPrivacySettings::getInstance();
1891 
1892  // Check agreement
1893  if (($privacy->groupConfirmationRequired() or ilCourseDefinedFieldDefinition::_hasFields($this->object->getId()))
1894  and !ilMemberAgreement::_hasAccepted($this->user->getId(), $this->object->getId())) {
1895  return false;
1896  }
1897  // Check required fields
1898  if (!ilCourseUserData::_checkRequired($this->user->getId(), $this->object->getId())) {
1899  return false;
1900  }
1901  return true;
1902  }
1903 
1907  public function prepareOutput(bool $show_subobjects = true): bool
1908  {
1909  return parent::prepareOutput($show_subobjects);
1910  }
1911 
1912  public function createMailSignature(): string
1913  {
1914  $link = chr(13) . chr(10) . chr(13) . chr(10);
1915  $link .= $this->lng->txt('grp_mail_permanent_link');
1916  $link .= chr(13) . chr(10) . chr(13) . chr(10);
1917  $link .= ilLink::_getLink($this->object->getRefId());
1918  return rawurlencode(base64_encode($link));
1919  }
1920 
1924  protected function initHeaderAction(?string $sub_type = null, ?int $sub_id = null): ?ilObjectListGUI
1925  {
1926  global $DIC;
1927 
1928  $ilSetting = $DIC['ilSetting'];
1929  $ilUser = $DIC['ilUser'];
1930 
1931  $lg = parent::initHeaderAction($sub_type, $sub_id);
1932 
1933  if (ilGroupParticipants::_isParticipant($this->ref_id, $ilUser->getId())) {
1934  if (ilMembershipNotifications::isActiveForRefId($this->ref_id)) {
1935  $noti = new ilMembershipNotifications($this->ref_id);
1936  if (!$noti->isCurrentUserActive()) {
1937  $lg->addHeaderIcon(
1938  "not_icon",
1939  ilUtil::getImagePath("object/notification_off.svg"),
1940  $this->lng->txt("grp_notification_deactivated")
1941  );
1942 
1943  $this->ctrl->setParameter($this, "grp_ntf", 1);
1944  $caption = "grp_activate_notification";
1945  } else {
1946  $lg->addHeaderIcon(
1947  "not_icon",
1948  ilUtil::getImagePath("object/notification_on.svg"),
1949  $this->lng->txt("grp_notification_activated")
1950  );
1951 
1952  $this->ctrl->setParameter($this, "grp_ntf", 0);
1953  $caption = "grp_deactivate_notification";
1954  }
1955 
1956  if ($noti->canCurrentUserEdit()) {
1957  $lg->addCustomCommand(
1958  $this->ctrl->getLinkTarget($this, "saveNotification"),
1959  $caption
1960  );
1961  }
1962 
1963  $this->ctrl->setParameter($this, "grp_ntf", "");
1964  }
1965  }
1966 
1967  return $lg;
1968  }
1969 
1970 
1971  public function addCustomData(array $a_data): array
1972  {
1973  // object defined fields
1974  $odfs = ilCourseUserData::_getValuesByObjId($this->object->getId());
1975 
1976  $res_data = array();
1977  foreach ($a_data as $usr_id => $user_data) {
1978  $res_data[$usr_id] = $user_data;
1979 
1980  // udf
1981  $udf_data = new ilUserDefinedData($usr_id);
1982  foreach ($udf_data->getAll() as $field => $value) {
1983  list($f, $field_id) = explode('_', $field);
1984  $res_data[$usr_id]['udf_' . $field_id] = (string) $value;
1985  }
1986 
1987  foreach ((array) ($odfs[$usr_id] ?? []) as $cdf_field => $cdf_value) {
1988  $res_data[$usr_id]['cdf_' . $cdf_field] = (string) $cdf_value;
1989  }
1990  }
1991 
1992  return $res_data;
1993  }
1994 
1995  public function getLocalRoles(): array
1996  {
1997  $local_roles = $this->object->getLocalGroupRoles();
1998  $grp_member = $this->object->getDefaultMemberRole();
1999  $grp_roles = array();
2000 
2001  //put the group member role to the top of the crs_roles array
2002  if (in_array($grp_member, $local_roles)) {
2003  $grp_roles[$grp_member] = ilObjRole::_getTranslation(array_search($grp_member, $local_roles));
2004  unset($local_roles[$grp_roles[$grp_member]]);
2005  }
2006 
2007  foreach ($local_roles as $title => $role_id) {
2008  $grp_roles[(int) $role_id] = ilObjRole::_getTranslation($title);
2009  }
2010  return $grp_roles;
2011  }
2012 
2013  protected function jump2UsersGalleryObject(): void
2014  {
2015  $this->ctrl->redirectByClass('ilUsersGalleryGUI');
2016  }
2017 
2021  public function setSideColumnReturn(): void
2022  {
2023  $this->ctrl->setReturn($this, "view");
2024  }
2025 } // END class.ilObjGroupGUI
static handleCode(int $a_ref_id, string $a_type, string $a_code)
static lookupRegistrationInfo(int $a_obj_id)
This class represents an option in a radio group.
static getInstance(int $a_ref_id, bool $a_include_auto_entries)
Class ilObjectMetaDataGUI.
static _isParticipant(int $a_ref_id, int $a_usr_id)
Static function to check if a user is a participant of the container object.
GlobalHttpState $http
ilBadgeManagementGUI: ilPropertyFormGUI
Class ilObjGroupGUI.
const ANONYMOUS_USER_ID
Definition: constants.php:27
static getLogger(string $a_component_id)
Get component logger.
saveSortingSettings(ilPropertyFormGUI $form)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
setSubTabs(string $a_tab)
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.
getItemByPostVar(string $a_post_var)
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
initHeaderAction(?string $sub_type=null, ?int $sub_id=null)
static switchTemplate(int $a_ref_id, int $a_new_tpl_id)
static _goto(string $a_target, string $a_add="")
const LP_STATUS_NOT_ATTEMPTED
static _lookupInProgressForObject(int $a_obj_id, ?array $a_user_ids=null)
static getInstance(int $a_ref_id)
static _getValuesByObjId(int $a_obj_id)
static _gotoRepositoryNode(int $ref_id, string $cmd="")
editMapSettingsObject()
Edit Map Settings.
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
static _getFields(int $a_container_id, $a_sort=self::IL_CDF_SORT_NAME)
Get all fields of a container.
const IL_CAL_UNIX
$c
Definition: deliver.php:25
getInput(string $a_post_var, bool $ensureValidation=true)
Returns the input of an item, if item provides getInput method and as fallback the value of the HTTP-...
Class ilMailMemberCourseRoles.
$ilErr
Definition: raiseError.php:33
const LP_STATUS_IN_PROGRESS
static _lookupCompletedForObject(int $a_obj_id, ?array $a_user_ids=null)
This class represents a date/time property in a property form.
static _lookupObjId(int $ref_id)
static _tracProgress(int $a_user_id, int $a_obj_id, int $a_ref_id, string $a_obj_type='')
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
ilLanguage $lng
static _checkRequired(int $a_usr_id, int $a_obj_id)
This class represents a hidden form property in a property form.
GUI class for public user profile presentation.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static http()
Fetches the global http state from ILIAS.
This class represents a property in a property form.
__construct($a_data, int $a_id, bool $a_call_by_reference, bool $a_prepare_output=false)
const LP_STATUS_FAILED
static _lookupTitle(int $obj_id)
static _getInstanceByObjId(int $a_obj_id)
$GLOBALS["DIC"]
Definition: wac.php:53
GUI class for LTI provider object settings.
setFormAction(string $a_formaction)
const MAIL_ALLOWED_TUTORS
This class represents a number property in a property form.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Class ilECSGroupSettings.
static _getTranslation(string $a_role_title)
initDidacticTemplate(ilPropertyFormGUI $form)
Skills for container (course/group) (top gui class)
static _lookupViewMode(int $a_id)
static getDefaultSettings()
Get default longitude, latitude and zoom.
This class represents a location property in a property form.
global $DIC
Definition: shib_login.php:26
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 _recordWriteEvent(int $obj_id, int $usr_id, string $action, ?int $parent_obj_id=null)
Records a write event.
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)
GUI class for group registrations.
setTitleIcon(string $a_titleicon)
setTableWidth(string $a_width)
static getContentStylePath(int $a_style_id, bool $add_random=true, bool $add_token=true)
get content style path static (to avoid full reading)
addCommandButton(string $a_cmd, string $a_text, string $a_id="")
setCustomRolesForSelection(array $a_roles)
Set custom roles for mapping to LTI roles.
Class ilObjCourseGroupingGUI.
saveListPresentation(ilPropertyFormGUI $form)
checkPermissionBool(string $perm, string $cmd="", string $type="", ?int $ref_id=null)
ilPropertyFormGUI $form
GUI class for membership features.
static redirect(string $a_script)
setObjParticipants(ilParticipants $objParticipants)
static isActivated()
Checks whether Map feature is activated.
static generateCode()
Generate new registration key.
initListPresentationForm(ilPropertyFormGUI $form)
Add list presentation settings to form.
static _getInstanceByType(string $a_type)
Get Singleton Instance.
setMinValue(float $a_minvalue, bool $a_display_always=false)
static _getInstanceByObjId(int $a_obj_id)
Get singleton instance.
setLatitude(?float $a_latitude)
initSortingForm(ilPropertyFormGUI $form, array $a_sorting_settings)
Append sorting settings to property form.
initForm(string $a_mode='edit', bool $a_omit_form_action=false)
static _readUsersProfileData(array $a_user_ids)
global $ilSetting
Definition: privfeed.php:31
__construct(Container $dic, ilPlugin $plugin)
const MAIL_ALLOWED_ALL
This class represents a text area property in a property form.
Class ilCourseContentGUI.
static formatDate(ilDateTime $date, bool $a_skip_day=false, bool $a_include_wd=false, bool $include_seconds=false, ?ilObjUser $user=null,)
static _lookupProgressByObjId(int $a_obj_id)
lookup progress for a specific object
setInfoObject(ilInfoScreenGUI $info)
get info sections
ILIAS Container InternalGUIService $gui
static getAvailablePortfolioLinksForUserIds(array $a_owner_ids, ?string $a_back_url=null)
static _lookupFailedForObject(int $a_obj_id, ?array $a_user_ids=null)
$info
Definition: entry_point.php:21
static _lookupAboStatus(int $a_id)
static _lookupContainerSetting(int $a_id, string $a_keyword, ?string $a_default_value=null)
static _isOnList(int $a_usr_id, int $a_obj_id)
language()
description: > Example for rendring a language glyph.
Definition: language.php:41
GUI class for service settings (calendar, notes, comments)
static _hasAccepted(int $a_usr_id, int $a_obj_id)
Check if user has accepted agreement.
editObject(?ilPropertyFormGUI $a_form=null)
readMemberData(array $ids, ?array $selected_columns=null)
static _lookupType(int $id, bool $reference=false)
const LP_STATUS_COMPLETED
static lookupViewMode($a_obj_id)
static _catchupWriteEvents(int $obj_id, int $usr_id, ?string $timestamp=null)
Catches up with all write events which occured before the specified timestamp.
addHeaderAction()
Add header action menu.
$service
Definition: ltiservices.php:40
static getInstance(int $obj_id)
static makeClickable(string $a_text, bool $detectGotoLinks=false)
Membership notification settings.
kindlyTo()
Combined validations and transformations for primitive data types that establish a baseline for furth...
Definition: Factory.php:55
Class ilObjUserTrackingGUI.
checkPermission(string $perm, string $cmd="", string $type="", ?int $ref_id=null)
static _hasFields(int $a_container_id)
Check if there are any define fields.
modifyItemGUI(ilObjectListGUI $a_item_list_gui, array $a_item_data)
static getInstanceFromAjaxCall()
(Re-)Build instance from ajax call
afterSave(ilObject $new_object, bool $redirect=true)
public
static _gotoRepositoryRoot(bool $raise_error=false)
Goto repository root.
ilRbacSystem $rbacsystem
static formatPeriod(ilDateTime $start, ilDateTime $end, bool $a_skip_starting_day=false, ?ilObjUser $user=null)
Format a period of two dates Shows: 14.
addCustomData(array $a_data)
prepareOutput(bool $show_subobjects=true)