ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
class.ilObjGroupGUI.php
Go to the documentation of this file.
1 <?php
2 
3 /* Copyright (c) 1998-2010 ILIAS open source, Extended GPL, see docs/LICENSE */
4 
5 include_once "./Services/Container/classes/class.ilContainerGUI.php";
6 include_once('./Modules/Group/classes/class.ilObjGroup.php');
7 
31 {
36  public function __construct($a_data, $a_id, $a_call_by_reference, $a_prepare_output = false)
37  {
38  global $DIC;
39 
40  $ilSetting = $DIC['ilSetting'];
41 
42  $this->type = "grp";
43  parent::__construct($a_data, $a_id, $a_call_by_reference, $a_prepare_output);
44 
45  $this->lng->loadLanguageModule('grp');
46  $this->lng->loadLanguageModule('obj');
47 
48  $this->setting = $ilSetting;
49  }
50 
51  public function executeCommand()
52  {
53  global $DIC;
54 
55  $ilUser = $DIC['ilUser'];
56  $rbacsystem = $DIC['rbacsystem'];
57  $ilAccess = $DIC['ilAccess'];
58  $ilNavigationHistory = $DIC['ilNavigationHistory'];
59  $ilErr = $DIC['ilErr'];
60  $ilToolbar = $DIC['ilToolbar'];
61 
62  $next_class = $this->ctrl->getNextClass($this);
63  $cmd = $this->ctrl->getCmd();
64  $this->prepareOutput();
65  // show repository tree
66  $this->showRepTree();
67 
68  // add entry to navigation history
69  if (!$this->getCreationMode() &&
70  $ilAccess->checkAccess("read", "", $_GET["ref_id"])) {
71  include_once("./Services/Link/classes/class.ilLink.php");
72  $ilNavigationHistory->addItem(
73  $_GET["ref_id"],
74  ilLink::_getLink($_GET["ref_id"], "grp"),
75  "grp"
76  );
77  }
78 
79  // if news timeline is landing page, redirect if necessary
80  if ($next_class == "" && $cmd == "" && $this->object->isNewsTimelineLandingPageEffective()
81  && $ilAccess->checkAccess("read", "", $_GET["ref_id"])) {
82  $this->ctrl->redirectbyclass("ilnewstimelinegui");
83  }
84 
85  switch ($next_class) {
86  case 'illtiproviderobjectsettinggui':
87  $this->setSubTabs('properties');
88  $this->tabs_gui->activateTab('settings');
89  $this->tabs_gui->activateSubTab('lti_provider');
90  $lti_gui = new ilLTIProviderObjectSettingGUI($this->object->getRefId());
91  $lti_gui->setCustomRolesForSelection($GLOBALS['DIC']->rbac()->review()->getLocalRoles($this->object->getRefId()));
92  $lti_gui->offerLTIRolesForSelection(false);
93  $this->ctrl->forwardCommand($lti_gui);
94  break;
95 
96 
97  case 'ilgroupmembershipgui':
98 
99  $this->tabs_gui->activateTab('members');
100 
101  include_once './Modules/Group/classes/class.ilGroupMembershipGUI.php';
102  $mem_gui = new ilGroupMembershipGUI($this, $this->object);
103  $this->ctrl->forwardCommand($mem_gui);
104  break;
105 
106 
107  case 'ilgroupregistrationgui':
108  $this->ctrl->setReturn($this, '');
109  $this->tabs_gui->setTabActive('join');
110  include_once('./Modules/Group/classes/class.ilGroupRegistrationGUI.php');
111  $registration = new ilGroupRegistrationGUI($this->object);
112  $this->ctrl->forwardCommand($registration);
113  break;
114 
115  case 'ilpermissiongui':
116  $this->tabs_gui->setTabActive('perm_settings');
117  include_once("Services/AccessControl/classes/class.ilPermissionGUI.php");
118  $perm_gui = new ilPermissionGUI($this);
119  $ret = &$this->ctrl->forwardCommand($perm_gui);
120  break;
121 
122  case "ilinfoscreengui":
123  $ret = &$this->infoScreen();
124  break;
125 
126  case "illearningprogressgui":
127  include_once './Services/Tracking/classes/class.ilLearningProgressGUI.php';
128 
129  $new_gui = new ilLearningProgressGUI(
131  $this->object->getRefId(),
132  $_GET['user_id'] ? $_GET['user_id'] : $ilUser->getId()
133  );
134  $this->ctrl->forwardCommand($new_gui);
135  $this->tabs_gui->setTabActive('learning_progress');
136  break;
137 
138  case 'ilobjcoursegroupinggui':
139  $this->setSubTabs('settings');
140 
141  include_once './Modules/Course/classes/class.ilObjCourseGroupingGUI.php';
142  $this->ctrl->setReturn($this, 'edit');
143  $crs_grp_gui = new ilObjCourseGroupingGUI($this->object, (int) $_GET['obj_id']);
144  $this->ctrl->forwardCommand($crs_grp_gui);
145 
146  $this->tabs_gui->setTabActive('settings');
147  $this->tabs_gui->setSubTabActive('groupings');
148  break;
149 
150  case 'ilcoursecontentgui':
151 
152  include_once './Modules/Course/classes/class.ilCourseContentGUI.php';
153  $course_content_obj = new ilCourseContentGUI($this);
154  $this->ctrl->forwardCommand($course_content_obj);
155  break;
156 
157  case 'ilpublicuserprofilegui':
158  require_once './Services/User/classes/class.ilPublicUserProfileGUI.php';
159  $this->setSubTabs('members');
160  $this->tabs_gui->setTabActive('group_members');
161  $this->tabs_gui->setSubTabActive('grp_members_gallery');
162  $profile_gui = new ilPublicUserProfileGUI($_GET["user"]);
163  if ($_GET["back_url"] == "") {
164  $profile_gui->setBackUrl($this->ctrl->getLinkTargetByClass(["ilGroupMembershipGUI", "ilUsersGalleryGUI"], 'view'));
165  }
166  $html = $this->ctrl->forwardCommand($profile_gui);
167  $this->tpl->setVariable("ADM_CONTENT", $html);
168  break;
169 
170  case "ilcolumngui":
171  $this->tabs_gui->setTabActive('none');
172  $this->checkPermission("read");
173  include_once("./Services/Style/Content/classes/class.ilObjStyleSheet.php");
174  $this->tpl->setVariable(
175  "LOCATION_CONTENT_STYLESHEET",
176  ilObjStyleSheet::getContentStylePath($this->object->getStyleSheetId())
177  );
178  $this->renderObject();
179  break;
180 
181  // container page editing
182  case "ilcontainerpagegui":
183  $ret = $this->forwardToPageObject();
184  if ($ret != "") {
185  $this->tpl->setContent($ret);
186  }
187  break;
188 
189  case 'ilobjectcopygui':
190  include_once './Services/Object/classes/class.ilObjectCopyGUI.php';
191  $cp = new ilObjectCopyGUI($this);
192  $cp->setType('grp');
193  $this->ctrl->forwardCommand($cp);
194  break;
195 
196  case "ilobjstylesheetgui":
197  $this->forwardToStyleSheet();
198  break;
199 
200  case 'ilobjectcustomuserfieldsgui':
201  include_once './Services/Membership/classes/class.ilObjectCustomUserFieldsGUI.php';
202  $cdf_gui = new ilObjectCustomUserFieldsGUI($this->object->getId());
203  $this->setSubTabs('settings');
204  $this->tabs_gui->setTabActive('settings');
205  $this->ctrl->forwardCommand($cdf_gui);
206  break;
207 
208  case 'ilmemberagreementgui':
209  include_once('Services/Membership/classes/class.ilMemberAgreementGUI.php');
210  $this->ctrl->setReturn($this, '');
211  $this->tabs_gui->setTabActive('view_content');
212  $agreement = new ilMemberAgreementGUI($this->object->getRefId());
213  $this->ctrl->forwardCommand($agreement);
214  break;
215 
216  case 'ilexportgui':
217  $this->tabs_gui->setTabActive('export');
218  include_once './Services/Export/classes/class.ilExportGUI.php';
219  $exp = new ilExportGUI($this);
220  $exp->addFormat('xml');
221  $this->ctrl->forwardCommand($exp);
222  break;
223 
224  case "ilcommonactiondispatchergui":
225  include_once("Services/Object/classes/class.ilCommonActionDispatcherGUI.php");
227  $this->ctrl->forwardCommand($gui);
228  break;
229 
230  case 'ilobjectservicesettingsgui':
231  $this->ctrl->setReturn($this, 'edit');
232  $this->setSubTabs("settings");
233  $this->tabs_gui->activateTab('settings');
234  $this->tabs_gui->activateSubTab('tool_settings');
235 
236  include_once './Services/Object/classes/class.ilObjectServiceSettingsGUI.php';
237  $service = new ilObjectServiceSettingsGUI(
238  $this,
239  $this->object->getId(),
240  array(
242  )
243  );
244  $this->ctrl->forwardCommand($service);
245  break;
246 
247  case 'ilmailmembersearchgui':
248  include_once 'Services/Mail/classes/class.ilMail.php';
249  $mail = new ilMail($ilUser->getId());
250 
251  if (!($ilAccess->checkAccess('manage_members', '', $this->object->getRefId()) ||
252  $this->object->getMailToMembersType() == ilObjGroup::MAIL_ALLOWED_ALL) &&
253  $rbacsystem->checkAccess('internal_mail', $mail->getMailObjectReferenceId())) {
254  $ilErr->raiseError($this->lng->txt("msg_no_perm_read"), $ilErr->MESSAGE);
255  }
256 
257  $this->tabs_gui->setTabActive('members');
258 
259  include_once './Services/Contact/classes/class.ilMailMemberSearchGUI.php';
260  include_once './Services/Contact/classes/class.ilMailMemberGroupRoles.php';
261 
262  $mail_search = new ilMailMemberSearchGUI($this, $this->object->getRefId(), new ilMailMemberGroupRoles());
263  $mail_search->setObjParticipants(ilCourseParticipants::_getInstanceByObjId($this->object->getId()));
264  $this->ctrl->forwardCommand($mail_search);
265  break;
266 
267  case 'ilbadgemanagementgui':
268  $this->tabs_gui->setTabActive('obj_tool_setting_badges');
269  include_once 'Services/Badge/classes/class.ilBadgeManagementGUI.php';
270  $bgui = new ilBadgeManagementGUI($this->object->getRefId(), $this->object->getId(), 'grp');
271  $this->ctrl->forwardCommand($bgui);
272  break;
273 
274  case "ilcontainernewssettingsgui":
275  $this->setSubTabs("settings");
276  $this->tabs_gui->setTabActive('settings');
277  include_once("./Services/Container/classes/class.ilContainerNewsSettingsGUI.php");
278  $news_set_gui = new ilContainerNewsSettingsGUI($this);
279  $news_set_gui->setTimeline(true);
280  $news_set_gui->setCronNotifications(true);
281  $news_set_gui->setHideByDate(true);
282  $this->ctrl->forwardCommand($news_set_gui);
283  break;
284 
285  case "ilnewstimelinegui":
286  $this->checkPermission("read");
287  $this->tabs_gui->setTabActive('news_timeline');
288  include_once("./Services/News/classes/class.ilNewsTimelineGUI.php");
289  $t = ilNewsTimelineGUI::getInstance($this->object->getRefId(), $this->object->getNewsTimelineAutoENtries());
290  $t->setUserEditAll($ilAccess->checkAccess('write', '', $this->object->getRefId(), 'grp'));
291  $this->showPermanentLink($tpl);
292  $this->ctrl->forwardCommand($t);
293  include_once 'Services/Tracking/classes/class.ilLearningProgress.php';
295  $ilUser->getId(),
296  $this->object->getId(),
297  $this->object->getRefId(),
298  'grp'
299  );
300  break;
301 
302  case "ilcontainerskillgui":
303  $this->tabs_gui->activateTab('obj_tool_setting_skills');
304  include_once("./Services/Container/Skills/classes/class.ilContainerSkillGUI.php");
305  $gui = new ilContainerSkillGUI($this);
306  $this->ctrl->forwardCommand($gui);
307  break;
308 
309  case 'ilcalendarpresentationgui':
310  include_once('./Services/Calendar/classes/class.ilCalendarPresentationGUI.php');
311  $cal = new ilCalendarPresentationGUI($this->object->getRefId());
312  $ret = $this->ctrl->forwardCommand($cal);
313  break;
314 
315  case 'ilobjectmetadatagui':
316  if (!$ilAccess->checkAccess('write', '', $this->object->getRefId())) {
317  $ilErr->raiseError($this->lng->txt('permission_denied'), $ilErr->WARNING);
318  }
319  $this->tabs_gui->activateTab('meta_data');
320  $this->ctrl->forwardCommand(new ilObjectMetaDataGUI($this->object));
321  break;
322 
323 
324  case 'ilobjecttranslationgui':
325  $this->checkPermissionBool("write");
326  $this->setSubTabs("settings");
327  $this->tabs->activateTab("settings");
328  include_once("./Services/Object/classes/class.ilObjectTranslationGUI.php");
329  $transgui = new ilObjectTranslationGUI($this);
330  $this->ctrl->forwardCommand($transgui);
331  break;
332 
333  default:
334 
335  // check visible permission
336  if (!$this->getCreationMode() and
337  !$ilAccess->checkAccess('visible', '', $this->object->getRefId(), 'grp') and
338  !$ilAccess->checkAccess('read', '', $this->object->getRefId(), 'grp')) {
339  $ilErr->raiseError($this->lng->txt("msg_no_perm_read"), $ilErr->MESSAGE);
340  }
341 
342  // #9401 - see also ilStartupGUI::_checkGoto()
343  if ($cmd == 'infoScreenGoto') {
344  if ($this->object->isRegistrationEnabled()) {
345  $cmd = 'join';
346  } else {
347  $cmd = 'infoScreen';
348  }
349  }
350 
351  // check read permission
352  if ((!$this->getCreationMode()
353  && !$rbacsystem->checkAccess('read', $this->object->getRefId()) && $cmd != 'infoScreen')
354  || $cmd == 'join') {
355  // no join permission -> redirect to info screen
356  if (!$rbacsystem->checkAccess('join', $this->object->getRefId())) {
357  $this->ctrl->redirect($this, "infoScreen");
358  } else { // no read -> show registration
359  include_once('./Modules/Group/classes/class.ilGroupRegistrationGUI.php');
360  $this->ctrl->redirectByClass("ilGroupRegistrationGUI", "show");
361  }
362  }
363  if (!$cmd) {
364  $cmd = 'view';
365  }
366  $cmd .= 'Object';
367  $this->$cmd();
368  break;
369  }
370 
371  $this->addHeaderAction();
372  }
373 
374  public function viewObject()
375  {
376  global $DIC;
377 
378  $tree = $DIC['tree'];
379  $rbacsystem = $DIC['rbacsystem'];
380  $ilUser = $DIC['ilUser'];
381 
382  include_once 'Services/Tracking/classes/class.ilLearningProgress.php';
384  $ilUser->getId(),
385  $this->object->getId(),
386  $this->object->getRefId(),
387  'grp'
388  );
389 
391  $this->object->getId(),
392  $this->object->getId(),
393  'grp'
394  );
395 
396 
397  if (strtolower($_GET["baseClass"]) == "iladministrationgui") {
398  parent::viewObject();
399  return true;
400  }
401 
402  if (!$this->checkAgreement()) {
403  include_once('Services/Membership/classes/class.ilMemberAgreementGUI.php');
404  $this->tabs_gui->setTabActive('view_content');
405  $this->ctrl->setReturn($this, 'view');
406  $agreement = new ilMemberAgreementGUI($this->object->getRefId());
407  $this->ctrl->setCmdClass(get_class($agreement));
408  $this->ctrl->forwardCommand($agreement);
409  return true;
410  }
411 
412  $this->tabs_gui->setTabActive('view_content');
413  $this->renderObject();
414  }
415 
419  public function renderObject()
420  {
421  global $DIC;
422 
423  $ilTabs = $DIC['ilTabs'];
424 
425  $ilTabs->activateTab("view_content");
426  $ret = parent::renderObject();
427  return $ret;
428  }
429 
437  public function modifyItemGUI($a_item_list_gui, $a_item_data, $a_show_path)
438  {
439  global $DIC;
440 
441  $tree = $DIC['tree'];
442 
443  // if folder is in a course, modify item list gui according to course requirements
444  if ($course_ref_id = $tree->checkForParentType($this->object->getRefId(), 'crs')) {
445  include_once("./Modules/Course/classes/class.ilObjCourse.php");
446  include_once("./Modules/Course/classes/class.ilObjCourseGUI.php");
447  $course_obj_id = ilObject::_lookupObjId($course_ref_id);
449  $a_item_list_gui,
450  'ilcoursecontentgui',
451  $a_item_data,
452  $a_show_path,
453  ilObjCourse::_lookupAboStatus($course_obj_id),
454  $course_ref_id,
455  $course_obj_id,
456  $this->object->getRefId()
457  );
458  }
459  }
460 
465  public function afterSave(\ilObject $new_object, $a_redirect = true)
466  {
467  global $DIC;
468 
469  $ilUser = $DIC['ilUser'];
470  $ilSetting = $DIC['ilSetting'];
471 
472  $new_object->setRegistrationType(GRP_REGISTRATION_DIRECT);
473  $new_object->update();
474 
475  // check for parent group or course => SORT_INHERIT
476  $sort_mode = ilContainer::SORT_TITLE;
477  if (
478  $GLOBALS['DIC']['tree']->checkForParentType($new_object->getRefId(), 'crs', true) ||
479  $GLOBALS['DIC']['tree']->checkForParentType($new_object->getRefId(), 'grp', true)
480  ) {
481  $sort_mode = ilContainer::SORT_INHERIT;
482  }
483 
484  // Save sorting
485  include_once './Services/Container/classes/class.ilContainerSortingSettings.php';
486  $sort = new ilContainerSortingSettings($new_object->getId());
487  $sort->setSortMode($sort_mode);
488  $sort->update();
489 
490 
491  // Add user as admin and enable notification
492  include_once './Modules/Group/classes/class.ilGroupParticipants.php';
493  $members_obj = ilGroupParticipants::_getInstanceByObjId($new_object->getId());
494  $members_obj->add($ilUser->getId(), IL_GRP_ADMIN);
495  $members_obj->updateNotification($ilUser->getId(), $ilSetting->get('mail_grp_admin_notification', true));
496  $members_obj->updateContact($ilUser->getId(), true);
497 
498  ilUtil::sendSuccess($this->lng->txt("object_added"), true);
499  if ($a_redirect) {
500  $this->ctrl->setParameter($this, "ref_id", $new_object->getRefId());
501  $this->ctrl->redirect($this, 'edit');
502  }
503  }
504 
512  public function editObject(ilPropertyFormGUI $a_form = null)
513  {
514  $this->checkPermission("write");
515 
516  $this->setSubTabs('settings');
517  $this->tabs_gui->setTabActive('settings');
518  $this->tabs_gui->setSubTabActive('grp_settings');
519 
520  if (!$a_form) {
521  $a_form = $this->initForm('edit');
522  }
523 
524  $this->tpl->setVariable('ADM_CONTENT', $a_form->getHTML());
525  }
526 
534  public function updateGroupTypeObject()
535  {
536  include_once './Services/DidacticTemplate/classes/class.ilDidacticTemplateUtils.php';
538  $this->object->getRefId(),
539  (int) $_REQUEST['grp_type']
540  );
541 
542  ilUtil::sendSuccess($this->lng->txt('settings_saved'), true);
543  $this->ctrl->redirect($this, 'edit');
544  }
545 
546 
552  public function updateObject()
553  {
554  $obj_service = $this->getObjectService();
555 
556  $this->checkPermission('write');
557 
558  $form = $this->initForm();
559  if ($form->checkInput()) {
560  // handle group type settings
561  include_once './Services/DidacticTemplate/classes/class.ilDidacticTemplateObjSettings.php';
562  $old_type = ilDidacticTemplateObjSettings::lookupTemplateId($this->object->getRefId());
563 
564  $modified = false;
565  $new_type_info = $form->getInput('didactic_type');
566  if ($new_type_info) {
567  $new_type = explode('_', $form->getInput('didactic_type'));
568  $new_type = $new_type[1];
569 
570  $modified = ($new_type != $old_type);
571  ilLoggerFactory::getLogger('grp')->info('Switched group type from ' . $old_type . ' to ' . $new_type);
572  }
573 
574  $old_autofill = $this->object->hasWaitingListAutoFill();
575 
576  $this->object->setTitle(ilUtil::stripSlashes($form->getInput('title')));
577  $this->object->setDescription(ilUtil::stripSlashes($form->getInput('desc')));
578  $this->object->setGroupType(ilUtil::stripSlashes($form->getInput('grp_type')));
579  $this->object->setRegistrationType(ilUtil::stripSlashes($form->getInput('registration_type')));
580  $this->object->setPassword(ilUtil::stripSlashes($form->getInput('password')));
581  $this->object->enableUnlimitedRegistration((bool) !$form->getInput('reg_limit_time'));
582  $this->object->enableMembershipLimitation((bool) $form->getInput('registration_membership_limited'));
583  $this->object->setMinMembers((int) $form->getInput('registration_min_members'));
584  $this->object->setMaxMembers((int) $form->getInput('registration_max_members'));
585  $this->object->enableRegistrationAccessCode((bool) $form->getInput('reg_code_enabled'));
586  $this->object->setRegistrationAccessCode($form->getInput('reg_code'));
587  $this->object->setViewMode($form->getInput('view_mode'));
588  $this->object->setMailToMembersType((int) $form->getInput('mail_type'));
589  $this->object->setShowMembers((int) $form->getInput('show_members'));
590 
591  // group period
592  $period = $form->getItemByPostVar('period');
593  $this->object->setStart($period->getStart());
594  $this->object->setEnd($period->getEnd());
595 
596  $reg = $form->getItemByPostVar("reg");
597  if ($reg->getStart() instanceof ilDateTime && $reg->getEnd() instanceof ilDateTime) {
598  $this->object->enableUnlimitedRegistration(false);
599  } else {
600  $this->object->enableUnlimitedRegistration(true);
601  }
602 
603  $this->object->setRegistrationStart($reg->getStart());
604  $this->object->setRegistrationEnd($reg->getEnd());
605 
606  $cancel_end = $form->getItemByPostVar("cancel_end");
607  $this->object->setCancellationEnd($cancel_end->getDate());
608 
609  switch ((int) $_POST['waiting_list']) {
610  case 2:
611  $this->object->enableWaitingList(true);
612  $this->object->setWaitingListAutoFill(true);
613  break;
614 
615  case 1:
616  $this->object->enableWaitingList(true);
617  $this->object->setWaitingListAutoFill(false);
618  break;
619 
620  default:
621  $this->object->enableWaitingList(false);
622  $this->object->setWaitingListAutoFill(false);
623  break;
624  }
625 
626  // title icon visibility
627  $obj_service->commonSettings()->legacyForm($form, $this->object)->saveTitleIconVisibility();
628 
629  // top actions visibility
630  $obj_service->commonSettings()->legacyForm($form, $this->object)->saveTopActionsVisibility();
631 
632  // custom icon
633  $obj_service->commonSettings()->legacyForm($form, $this->object)->saveIcon();
634 
635  // tile image
636  $obj_service->commonSettings()->legacyForm($form, $this->object)->saveTileImage();
637 
638  // list presentation
639  $this->saveListPresentation($form);
640 
641  // update object settings
642  $this->object->update();
643 
644 
645  include_once './Services/Object/classes/class.ilObjectServiceSettingsGUI.php';
647  $this->object->getId(),
648  $form,
649  array(
658  )
659  );
660 
661  // Save sorting
662  $this->saveSortingSettings($form);
663  // if autofill has been activated trigger process
664  if (
665  !$old_autofill &&
666  $this->object->hasWaitingListAutoFill()) {
667  $this->object->handleAutoFill();
668  }
669 
670  // BEGIN ChangeEvents: Record update Object.
671  require_once('Services/Tracking/classes/class.ilChangeEvent.php');
672  global $DIC;
673 
674  $ilUser = $DIC['ilUser'];
676  $this->object->getId(),
677  $ilUser->getId(),
678  'update'
679  );
680  ilChangeEvent::_catchupWriteEvents($this->object->getId(), $ilUser->getId());
681  // END PATCH ChangeEvents: Record update Object.
682  // Update ecs export settings
683  include_once 'Modules/Group/classes/class.ilECSGroupSettings.php';
684  $ecs = new ilECSGroupSettings($this->object);
685  $ecs->handleSettingsUpdate();
686  } else {
687  ilUtil::sendFailure($GLOBALS['DIC']->language()->txt('err_check_input')); // #16975
688 
689  $form->setValuesByPost();
690  $this->editObject($form);
691  return true;
692  }
693 
694  // group type modified
695  if ($modified) {
696  if ($new_type == 0) {
697  $new_type_txt = $GLOBALS['DIC']['lng']->txt('il_grp_status_open');
698  } else {
699  include_once './Services/DidacticTemplate/classes/class.ilDidacticTemplateSetting.php';
700  $dtpl = new ilDidacticTemplateSetting($new_type);
701  $new_type_txt = $dtpl->getPresentationTitle($GLOBALS['DIC']['lng']->getLangKey());
702  }
703 
704 
705  include_once './Services/Utilities/classes/class.ilConfirmationGUI.php';
706  ilUtil::sendQuestion($this->lng->txt('grp_warn_grp_type_changed'));
707  $confirm = new ilConfirmationGUI();
708  $confirm->setFormAction($this->ctrl->getFormAction($this));
709  $confirm->addItem(
710  'grp_type',
711  $new_type,
712  $this->lng->txt('grp_info_new_grp_type') . ': ' . $new_type_txt
713  );
714  $confirm->addButton($this->lng->txt('grp_change_type'), 'updateGroupType');
715  $confirm->setCancel($this->lng->txt('cancel'), 'edit');
716 
717  $this->tpl->setContent($confirm->getHTML());
718  return true;
719  } else {
720  ilUtil::sendSuccess($this->lng->txt("msg_obj_modified"), true);
721  $this->ctrl->redirect($this, 'edit');
722  return true;
723  }
724  }
725 
729  public function editMapSettingsObject()
730  {
731  global $DIC;
732 
733  $ilUser = $DIC['ilUser'];
734  $ilCtrl = $DIC['ilCtrl'];
735  $ilUser = $DIC['ilUser'];
736  $ilAccess = $DIC['ilAccess'];
737 
738  $this->setSubTabs("settings");
739  $this->tabs_gui->setTabActive('settings');
740  $this->tabs_gui->setSubTabActive('grp_map_settings');
741 
742  include_once('./Services/Maps/classes/class.ilMapUtil.php');
743  if (!ilMapUtil::isActivated() ||
744  !$ilAccess->checkAccess("write", "", $this->object->getRefId())) {
745  return;
746  }
747 
748  $latitude = $this->object->getLatitude();
749  $longitude = $this->object->getLongitude();
750  $zoom = $this->object->getLocationZoom();
751 
752  // Get Default settings, when nothing is set
753  if ($latitude == 0 && $longitude == 0 && $zoom == 0) {
755  $latitude = $def["latitude"];
756  $longitude = $def["longitude"];
757  $zoom = $def["zoom"];
758  }
759 
760 
761  include_once("./Services/Form/classes/class.ilPropertyFormGUI.php");
762  $form = new ilPropertyFormGUI();
763  $form->setFormAction($ilCtrl->getFormAction($this));
764 
765  $form->setTitle($this->lng->txt("grp_map_settings"));
766 
767  // enable map
768  $public = new ilCheckboxInputGUI(
769  $this->lng->txt("grp_enable_map"),
770  "enable_map"
771  );
772  $public->setValue("1");
773  $public->setChecked($this->object->getEnableGroupMap());
774  $form->addItem($public);
775 
776  // map location
777  $loc_prop = new ilLocationInputGUI(
778  $this->lng->txt("grp_map_location"),
779  "location"
780  );
781  $loc_prop->setLatitude($latitude);
782  $loc_prop->setLongitude($longitude);
783  $loc_prop->setZoom($zoom);
784  $form->addItem($loc_prop);
785 
786  $form->addCommandButton("saveMapSettings", $this->lng->txt("save"));
787 
788  $this->tpl->setVariable("ADM_CONTENT", $form->getHTML());
789  }
790 
791  public function saveMapSettingsObject()
792  {
793  global $DIC;
794 
795  $ilCtrl = $DIC['ilCtrl'];
796  $ilUser = $DIC['ilUser'];
797 
798  $this->object->setLatitude(ilUtil::stripSlashes($_POST["location"]["latitude"]));
799  $this->object->setLongitude(ilUtil::stripSlashes($_POST["location"]["longitude"]));
800  $this->object->setLocationZoom(ilUtil::stripSlashes($_POST["location"]["zoom"]));
801  $this->object->setEnableGroupMap(ilUtil::stripSlashes($_POST["enable_map"]));
802  $this->object->update();
803 
804  $ilCtrl->redirect($this, "editMapSettings");
805  }
806 
807 
814  public function editInfoObject()
815  {
816  global $DIC;
817 
818  $ilErr = $DIC['ilErr'];
819  $ilAccess = $DIC['ilAccess'];
820 
821  $this->checkPermission('write');
822 
823  $this->setSubTabs('settings');
824  $this->tabs_gui->setTabActive('settings');
825  $this->tabs_gui->setSubTabActive('grp_info_settings');
826 
827  $form = $this->initInfoEditor();
828  $this->tpl->setContent($form->getHTML());
829  }
830 
837  protected function initInfoEditor()
838  {
839  include_once("./Services/Form/classes/class.ilPropertyFormGUI.php");
840  $form = new ilPropertyFormGUI();
841  $form->setFormAction($this->ctrl->getFormAction($this, 'updateInfo'));
842  $form->setTitle($this->lng->txt('grp_general_informations'));
843  $form->addCommandButton('updateInfo', $this->lng->txt('save'));
844  $form->addCommandButton('cancel', $this->lng->txt('cancel'));
845 
846  $area = new ilTextAreaInputGUI($this->lng->txt('grp_information'), 'important');
847  $area->setInfo($this->lng->txt('grp_information_info'));
848  $area->setValue($this->object->getInformation());
849  $area->setRows(8);
850  $area->setCols(80);
851  $form->addItem($area);
852 
853  return $form;
854  }
855 
862  public function updateInfoObject()
863  {
864  $this->checkPermission('manage_members');
865 
866  $this->object->setInformation(ilUtil::stripSlashes($_POST['important']));
867  $this->object->update();
868 
869  ilUtil::sendSuccess($this->lng->txt("settings_saved"));
870  $this->editInfoObject();
871  return true;
872  }
873 
875  public function readMemberData($ids, $selected_columns = null)
876  {
877  include_once('./Services/PrivacySecurity/classes/class.ilPrivacySettings.php');
878  $privacy = ilPrivacySettings::_getInstance();
879 
880  include_once './Services/Tracking/classes/class.ilObjUserTracking.php';
881  $this->show_tracking =
882  (
885  );
886  if ($this->show_tracking) {
887  include_once('./Services/Object/classes/class.ilObjectLP.php');
888  $olp = ilObjectLP::getInstance($this->object->getId());
889  $this->show_tracking = $olp->isActive();
890  }
891 
892  if ($this->show_tracking) {
893  include_once 'Services/Tracking/classes/class.ilLPStatusWrapper.php';
894  $completed = ilLPStatusWrapper::_lookupCompletedForObject($this->object->getId());
895  $in_progress = ilLPStatusWrapper::_lookupInProgressForObject($this->object->getId());
896  $failed = ilLPStatusWrapper::_lookupFailedForObject($this->object->getId());
897  }
898 
899  if ($privacy->enabledGroupAccessTimes()) {
900  include_once('./Services/Tracking/classes/class.ilLearningProgress.php');
901  $progress = ilLearningProgress::_lookupProgressByObjId($this->object->getId());
902  }
903 
904  $do_prtf = (is_array($selected_columns) &&
905  in_array('prtf', $selected_columns) &&
906  is_array($ids));
907  if ($do_prtf) {
908  include_once "Modules/Portfolio/classes/class.ilObjPortfolio.php";
910  $ids,
911  $this->ctrl->getLinkTarget($this, "members")
912  );
913  }
914 
915  $profile_data = ilObjUser::_readUsersProfileData($ids);
916  foreach ($ids as $usr_id) {
917  $name = ilObjUser::_lookupName($usr_id);
918  $tmp_data['firstname'] = $name['firstname'];
919  $tmp_data['lastname'] = $name['lastname'];
920  $tmp_data['login'] = ilObjUser::_lookupLogin($usr_id);
921  $tmp_data['notification'] = $this->object->members_obj->isNotificationEnabled($usr_id) ? 1 : 0;
922  $tmp_data['contact'] = $this->object->members_obj->isContact($usr_id) ? 1 : 0;
923  $tmp_data['usr_id'] = $usr_id;
924  $tmp_data['login'] = ilObjUser::_lookupLogin($usr_id);
925 
926  foreach ((array) $profile_data[$usr_id] as $field => $value) {
927  $tmp_data[$field] = $value;
928  }
929 
930  if ($this->show_tracking) {
931  if (in_array($usr_id, $completed)) {
932  $tmp_data['progress'] = ilLPStatus::LP_STATUS_COMPLETED;
933  } elseif (in_array($usr_id, $in_progress)) {
934  $tmp_data['progress'] = ilLPStatus::LP_STATUS_IN_PROGRESS;
935  } elseif (in_array($usr_id, $failed)) {
936  $tmp_data['progress'] = ilLPStatus::LP_STATUS_FAILED;
937  } else {
938  $tmp_data['progress'] = ilLPStatus::LP_STATUS_NOT_ATTEMPTED;
939  }
940  }
941 
942  if ($privacy->enabledGroupAccessTimes()) {
943  if (isset($progress[$usr_id]['ts']) and $progress[$usr_id]['ts']) {
944  $tmp_data['access_time'] = ilDatePresentation::formatDate(
945  $tmp_date = new ilDateTime($progress[$usr_id]['ts'], IL_CAL_UNIX)
946  );
947  $tmp_data['access_time_unix'] = $tmp_date->get(IL_CAL_UNIX);
948  } else {
949  $tmp_data['access_time'] = $this->lng->txt('no_date');
950  $tmp_data['access_time_unix'] = 0;
951  }
952  }
953 
954  if ($do_prtf) {
955  $tmp_data['prtf'] = $all_prtf[$usr_id];
956  }
957 
958  $members[$usr_id] = $tmp_data;
959  }
960  return $members ? $members : array();
961  }
962 
967  public function leaveObject()
968  {
969  global $DIC;
970 
971  $ilUser = $DIC['ilUser'];
972 
973  $this->checkPermission('leave');
974 
975  $part = ilGroupParticipants::_getInstanceByObjId($this->object->getId());
976  if ($part->isLastAdmin($ilUser->getId())) {
977  ilUtil::sendFailure($this->lng->txt('grp_err_administrator_required'));
978  $this->viewObject();
979  return false;
980  }
981 
982  $this->tabs_gui->setTabActive('grp_btn_unsubscribe');
983 
984  include_once "Services/Utilities/classes/class.ilConfirmationGUI.php";
985  $cgui = new ilConfirmationGUI();
986  $cgui->setHeaderText($this->lng->txt('grp_dismiss_myself'));
987  $cgui->setFormAction($this->ctrl->getFormAction($this));
988  $cgui->setCancel($this->lng->txt("cancel"), "cancel");
989  $cgui->setConfirm($this->lng->txt("grp_btn_unsubscribe"), "unsubscribe");
990  $this->tpl->setContent($cgui->getHTML());
991  }
992 
999  public function unsubscribeObject()
1000  {
1001  global $DIC;
1002 
1003  $ilUser = $DIC['ilUser'];
1004  $tree = $DIC['tree'];
1005  $ilCtrl = $DIC['ilCtrl'];
1006 
1007  $this->checkPermission('leave');
1008 
1009  $this->object->members_obj->delete($ilUser->getId());
1010 
1011  include_once './Modules/Group/classes/class.ilGroupMembershipMailNotification.php';
1012  $this->object->members_obj->sendNotification(
1014  $ilUser->getId()
1015  );
1016  $this->object->members_obj->sendNotification(
1018  $ilUser->getId()
1019  );
1020 
1021  ilUtil::sendSuccess($this->lng->txt('grp_msg_membership_annulled'), true);
1022  $ilCtrl->setParameterByClass(
1023  "ilrepositorygui",
1024  "ref_id",
1025  $tree->getParentId($this->object->getRefId())
1026  );
1027  $ilCtrl->redirectByClass("ilrepositorygui", "");
1028  }
1029 
1036  public function addContentTab()
1037  {
1038  $this->tabs_gui->addTab(
1039  "view_content",
1040  $this->lng->txt("content"),
1041  $this->ctrl->getLinkTarget($this, "view")
1042  );
1043  }
1044 
1045 
1046  // get tabs
1047  public function getTabs()
1048  {
1049  global $DIC;
1050 
1051  $rbacsystem = $DIC['rbacsystem'];
1052  $ilUser = $DIC['ilUser'];
1053  $ilAccess = $DIC['ilAccess'];
1054  $lng = $DIC['lng'];
1055  $ilHelp = $DIC['ilHelp'];
1056 
1057  $ilHelp->setScreenIdComponent("grp");
1058 
1059  if ($ilAccess->checkAccess('read', '', $this->ref_id)) {
1060  if ($this->object->isNewsTimelineEffective()) {
1061  if (!$this->object->isNewsTimelineLandingPageEffective()) {
1062  $this->addContentTab();
1063  }
1064  $this->tabs_gui->addTab(
1065  "news_timeline",
1066  $lng->txt("cont_news_timeline_tab"),
1067  $this->ctrl->getLinkTargetByClass("ilnewstimelinegui", "show")
1068  );
1069  if ($this->object->isNewsTimelineLandingPageEffective()) {
1070  $this->addContentTab();
1071  }
1072  } else {
1073  $this->addContentTab();
1074  }
1075  }
1076  if (
1077  $ilAccess->checkAccess('visible', '', $this->ref_id) ||
1078  $ilAccess->checkAccess('join', '', $this->ref_id) ||
1079  $ilAccess->checkAccess('read', '', $this->ref_id)
1080  ) {
1081  $this->tabs_gui->addTarget(
1082  "info_short",
1083  $this->ctrl->getLinkTargetByClass(
1084  array("ilobjgroupgui", "ilinfoscreengui"),
1085  "showSummary"
1086  ),
1087  "infoScreen",
1088  "",
1089  "",
1090  false
1091  );
1092  }
1093 
1094 
1095  if ($ilAccess->checkAccess('write', '', $this->object->getRefId())) {
1096  $this->tabs_gui->addTarget(
1097  "settings",
1098  $this->ctrl->getLinkTarget($this, "edit"),
1099  array("edit", "editMapSettings"),
1100  get_class($this),
1101  ""
1102  );
1103  }
1104 
1105  include_once './Modules/Group/classes/class.ilGroupParticipants.php';
1106  $is_participant = ilGroupParticipants::_isParticipant($this->ref_id, $ilUser->getId());
1107 
1108  // Members
1109  include_once './Modules/Group/classes/class.ilGroupMembershipGUI.php';
1110  $membership_gui = new ilGroupMembershipGUI($this, $this->object);
1111  $membership_gui->addMemberTab($this->tabs_gui, $is_participant);
1112 
1113 
1114  // badges
1115  if ($ilAccess->checkAccess('write', '', $this->ref_id)) {
1116  include_once 'Services/Badge/classes/class.ilBadgeHandler.php';
1117  if (ilBadgeHandler::getInstance()->isObjectActive($this->object->getId())) {
1118  $this->tabs_gui->addTarget(
1119  "obj_tool_setting_badges",
1120  $this->ctrl->getLinkTargetByClass("ilbadgemanagementgui", ""),
1121  "",
1122  "ilbadgemanagementgui"
1123  );
1124  }
1125  }
1126 
1127  // skills
1128  include_once("./Services/Object/classes/class.ilObjectServiceSettingsGUI.php");
1129  if ($ilAccess->checkAccess('read', '', $this->ref_id) && ilContainer::_lookupContainerSetting(
1130  $this->object->getId(),
1132  false
1133  )) {
1134  $this->tabs_gui->addTarget(
1135  "obj_tool_setting_skills",
1136  $this->ctrl->getLinkTargetByClass(array("ilcontainerskillgui", "ilcontskillpresentationgui"), ""),
1137  "",
1138  array("ilcontainerskillgui", "ilcontskillpresentationgui", "ilcontskilladmingui")
1139  );
1140  }
1141 
1142  // learning progress
1143  include_once './Services/Tracking/classes/class.ilLearningProgressAccess.php';
1144  if (ilLearningProgressAccess::checkAccess($this->object->getRefId(), $is_participant)) {
1145  $this->tabs_gui->addTarget(
1146  'learning_progress',
1147  $this->ctrl->getLinkTargetByClass(array('ilobjgroupgui','illearningprogressgui'), ''),
1148  '',
1149  array('illplistofobjectsgui','illplistofsettingsgui','illearningprogressgui','illplistofprogressgui')
1150  );
1151  }
1152 
1153  // meta data
1154  if ($ilAccess->checkAccess('write', '', $this->ref_id)) {
1155  $md_gui = new ilObjectMetaDataGUI($this->object);
1156  $tab_link = $md_gui->getTab();
1157  if ($tab_link !== null) {
1158  $this->tabs_gui->addTab(
1159  'meta_data',
1160  $this->lng->txt('meta_data'),
1161  $tab_link,
1162  '',
1163  'ilObjectMetaDataGUI'
1164  );
1165  }
1166  }
1167 
1168 
1169  if ($ilAccess->checkAccess('write', '', $this->object->getRefId())) {
1170  $this->tabs_gui->addTarget(
1171  'export',
1172  $this->ctrl->getLinkTargetByClass('ilexportgui', ''),
1173  'export',
1174  'ilexportgui'
1175  );
1176  }
1177 
1178  // parent tabs (all container: edit_permission, clipboard, trash
1179  parent::getTabs();
1180 
1181  if ($ilAccess->checkAccess('join', '', $this->object->getRefId()) and
1182  !$this->object->members_obj->isAssigned($ilUser->getId())) {
1183  include_once './Modules/Group/classes/class.ilGroupWaitingList.php';
1184  if (ilGroupWaitingList::_isOnList($ilUser->getId(), $this->object->getId())) {
1185  $this->tabs_gui->addTab(
1186  'leave',
1187  $this->lng->txt('membership_leave'),
1188  $this->ctrl->getLinkTargetByClass('ilgroupregistrationgui', 'show', '')
1189  );
1190  } else {
1191  $this->tabs_gui->addTarget(
1192  "join",
1193  $this->ctrl->getLinkTargetByClass('ilgroupregistrationgui', "show"),
1194  'show',
1195  ""
1196  );
1197  }
1198  }
1199  if ($ilAccess->checkAccess('leave', '', $this->object->getRefId()) and
1200  $this->object->members_obj->isMember($ilUser->getId())) {
1201  $this->tabs_gui->addTarget(
1202  "grp_btn_unsubscribe",
1203  $this->ctrl->getLinkTarget($this, "leave"),
1204  '',
1205  ""
1206  );
1207  }
1208  }
1209 
1215  public function infoScreenObject()
1216  {
1217  $this->ctrl->setCmd("showSummary");
1218  $this->ctrl->setCmdClass("ilinfoscreengui");
1219  $this->infoScreen();
1220  }
1221 
1225  public function infoScreen()
1226  {
1227  global $DIC;
1228 
1229  $rbacsystem = $DIC['rbacsystem'];
1230  $ilUser = $DIC['ilUser'];
1231  $ilSetting = $DIC['ilSetting'];
1232 
1233  $this->tabs_gui->setTabActive('info_short');
1234 
1235  if (!$this->checkPermissionBool('read')) {
1236  $this->checkPermission('visible');
1237  }
1238 
1240  $this->object->getId(),
1241  $this->object->getId(),
1242  'grp'
1243  );
1244 
1245  include_once("./Services/InfoScreen/classes/class.ilInfoScreenGUI.php");
1246  $info = new ilInfoScreenGUI($this);
1247 
1248  if (strlen($this->object->getInformation())) {
1249  $info->addSection($this->lng->txt('grp_general_informations'));
1250  $info->addProperty($this->lng->txt('grp_information'), nl2br(
1251  ilUtil::makeClickable($this->object->getInformation(), true)
1252  ));
1253  }
1254 
1255  $info->enablePrivateNotes();
1256  $info->enableLearningProgress(true);
1257 
1258  $record_gui = new ilAdvancedMDRecordGUI(ilAdvancedMDRecordGUI::MODE_INFO, 'grp', $this->object->getId());
1259  $record_gui->setInfoObject($info);
1260  $record_gui->parse();
1261 
1262  // meta data
1263  $info->addMetaDataSections($this->object->getId(), 0, $this->object->getType());
1264 
1265 
1266  // support contacts
1267  $parts = ilParticipants::getInstance($this->object->getRefId());
1268  $contacts = $parts->getContacts();
1269  if (count($contacts) > 0) {
1270  $info->addSection($this->lng->txt("grp_mem_contacts"));
1271  foreach ($contacts as $c) {
1272  $pgui = new ilPublicUserProfileGUI($c);
1273  $pgui->setBackUrl($this->ctrl->getLinkTargetByClass("ilinfoscreengui"));
1274  $pgui->setEmbedded(true);
1275  $info->addProperty("", $pgui->getHTML());
1276  }
1277  }
1278 
1279 
1280  $info->addSection($this->lng->txt('group_registration'));
1281  $info->showLDAPRoleGroupMappingInfo();
1282 
1283  if (!$this->object->isRegistrationEnabled()) {
1284  $info->addProperty(
1285  $this->lng->txt('group_registration_mode'),
1286  $this->lng->txt('grp_reg_deac_info_screen')
1287  );
1288  } else {
1289  switch ($this->object->getRegistrationType()) {
1291  $info->addProperty(
1292  $this->lng->txt('group_registration_mode'),
1293  $this->lng->txt('grp_reg_direct_info_screen')
1294  );
1295  break;
1296 
1298  $info->addProperty(
1299  $this->lng->txt('group_registration_mode'),
1300  $this->lng->txt('grp_reg_req_info_screen')
1301  );
1302  break;
1303 
1305  $info->addProperty(
1306  $this->lng->txt('group_registration_mode'),
1307  $this->lng->txt('grp_reg_passwd_info_screen')
1308  );
1309  break;
1310 
1311  }
1312  /*
1313  $info->addProperty($this->lng->txt('group_registration_time'),
1314  ilDatePresentation::formatPeriod(
1315  $this->object->getRegistrationStart(),
1316  $this->object->getRegistrationEnd()));
1317  */
1318  if ($this->object->isRegistrationUnlimited()) {
1319  $info->addProperty(
1320  $this->lng->txt('group_registration_time'),
1321  $this->lng->txt('grp_registration_unlimited')
1322  );
1323  } elseif ($this->object->getRegistrationStart()->getUnixTime() < time()) {
1324  $info->addProperty(
1325  $this->lng->txt("group_registration_time"),
1326  $this->lng->txt('cal_until') . ' ' .
1327  ilDatePresentation::formatDate($this->object->getRegistrationEnd())
1328  );
1329  } elseif ($this->object->getRegistrationStart()->getUnixTime() >= time()) {
1330  $info->addProperty(
1331  $this->lng->txt("group_registration_time"),
1332  $this->lng->txt('cal_from') . ' ' .
1333  ilDatePresentation::formatDate($this->object->getRegistrationStart())
1334  );
1335  }
1336  if ($this->object->isMembershipLimited()) {
1337  if ($this->object->getMinMembers()) {
1338  $info->addProperty(
1339  $this->lng->txt("mem_min_users"),
1340  $this->object->getMinMembers()
1341  );
1342  }
1343  if ($this->object->getMaxMembers()) {
1344  include_once './Modules/Group/classes/class.ilObjGroupAccess.php';
1345  $reg_info = ilObjGroupAccess::lookupRegistrationInfo($this->object->getId());
1346 
1347  $info->addProperty(
1348  $this->lng->txt('mem_free_places'),
1349  $reg_info['reg_info_free_places']
1350  );
1351  }
1352  }
1353 
1354  if ($this->object->getCancellationEnd()) {
1355  $info->addProperty(
1356  $this->lng->txt('grp_cancellation_end'),
1357  ilDatePresentation::formatDate($this->object->getCancellationEnd())
1358  );
1359  }
1360  }
1361 
1362  if ($this->object->getStart()) {
1363  $info->addProperty(
1364  $this->lng->txt('grp_period'),
1366  $this->object->getStart(),
1367  $this->object->getEnd()
1368  )
1369  );
1370  }
1371 
1372 
1373  // Confirmation
1374  include_once('Services/PrivacySecurity/classes/class.ilPrivacySettings.php');
1375  $privacy = ilPrivacySettings::_getInstance();
1376 
1377  include_once('Modules/Course/classes/Export/class.ilCourseDefinedFieldDefinition.php');
1378  if ($privacy->groupConfirmationRequired() or ilCourseDefinedFieldDefinition::_getFields($this->object->getId()) or $privacy->enabledGroupExport()) {
1379  include_once('Services/PrivacySecurity/classes/class.ilExportFieldsInfo.php');
1380 
1381  $field_info = ilExportFieldsInfo::_getInstanceByType($this->object->getType());
1382 
1383  $this->lng->loadLanguageModule('ps');
1384  $info->addSection($this->lng->txt('grp_user_agreement_info'));
1385  $info->addProperty($this->lng->txt('ps_export_data'), $field_info->exportableFieldsToInfoString());
1386 
1387  if ($fields = ilCourseDefinedFieldDefinition::_fieldsToInfoString($this->object->getId())) {
1388  $info->addProperty($this->lng->txt('ps_grp_user_fields'), $fields);
1389  }
1390  }
1391 
1392 
1393  // forward the command
1394  $this->ctrl->forwardCommand($info);
1395  }
1396 
1400  public function saveNotificationObject()
1401  {
1402  include_once "Services/Membership/classes/class.ilMembershipNotifications.php";
1403  $noti = new ilMembershipNotifications($this->ref_id);
1404  if ($noti->canCurrentUserEdit()) {
1405  if ((bool) $_REQUEST["grp_ntf"]) {
1406  $noti->activateUser();
1407  } else {
1408  $noti->deactivateUser();
1409  }
1410  }
1411  ilUtil::sendSuccess($this->lng->txt("settings_saved"), true);
1412  $this->ctrl->redirect($this, "");
1413  }
1414 
1418  protected function membersObject()
1419  {
1420  $GLOBALS['DIC']['ilCtrl']->redirectByClass('ilgroupmembershipgui');
1421  }
1422 
1423 
1427  public static function _goto($a_target, $a_add = "")
1428  {
1429  global $DIC;
1430 
1431  $ilAccess = $DIC['ilAccess'];
1432  $ilErr = $DIC['ilErr'];
1433  $lng = $DIC['lng'];
1434  $ilUser = $DIC['ilUser'];
1435 
1436  include_once './Services/Membership/classes/class.ilMembershipRegistrationCodeUtils.php';
1437  if (substr($a_add, 0, 5) == 'rcode') {
1438  if ($ilUser->getId() == ANONYMOUS_USER_ID) {
1439  // Redirect to login for anonymous
1441  "login.php?target=" . $_GET["target"] . "&cmd=force_login&lang=" .
1442  $ilUser->getCurrentLanguage()
1443  );
1444  }
1445 
1446  // Redirects to target location after assigning user to group
1448  $a_target,
1450  substr($a_add, 5)
1451  );
1452  }
1453 
1454  if ($a_add == "mem" && $ilAccess->checkAccess("manage_members", "", $a_target)) {
1455  ilObjectGUI::_gotoRepositoryNode($a_target, "members");
1456  }
1457 
1458  if ($ilAccess->checkAccess("read", "", $a_target)) {
1460  } else {
1461  // to do: force flat view
1462  if ($ilAccess->checkAccess("visible", "", $a_target)) {
1463  ilObjectGUI::_gotoRepositoryNode($a_target, "infoScreenGoto");
1464  } else {
1465  if ($ilAccess->checkAccess("read", "", ROOT_FOLDER_ID)) {
1466  ilUtil::sendFailure(sprintf(
1467  $lng->txt("msg_no_perm_read_item"),
1469  ), true);
1471  }
1472  }
1473  }
1474  $ilErr->raiseError($lng->txt("msg_no_perm_read"), $ilErr->FATAL);
1475  }
1476 
1477 
1485  public function initForm($a_mode = 'edit', $a_omit_form_action = false)
1486  {
1487  global $DIC;
1488 
1489  $obj_service = $this->getObjectService();
1490 
1491  $tree = $DIC['tree'];
1492 
1493  include_once("./Services/Form/classes/class.ilPropertyFormGUI.php");
1494 
1495  $form = new ilPropertyFormGUI();
1496 
1497  if (!$a_omit_form_action) {
1498  switch ($a_mode) {
1499  case 'edit':
1500  $form->setFormAction($this->ctrl->getFormAction($this, 'update'));
1501  break;
1502 
1503  default:
1504  $form->setTableWidth('600px');
1505  $form->setFormAction($this->ctrl->getFormAction($this, 'save'));
1506  break;
1507  }
1508  }
1509 
1510  // title/description
1511  $this->initFormTitleDescription($form);
1512 
1513  $form = $this->initDidacticTemplate($form);
1514 
1515  if ($a_mode == 'edit') {
1516  // group period
1517  include_once 'Services/Form/classes/class.ilDateDurationInputGUI.php';
1518  $group_duration = new ilDateDurationInputGUI($this->lng->txt('grp_period'), 'period');
1519  $group_duration->setInfo($this->lng->txt('grp_period_info'));
1520  if ($this->object->getStart()) {
1521  $group_duration->setStart($this->object->getStart());
1522  }
1523  if ($this->object->getEnd()) {
1524  $group_duration->setEnd($this->object->getEnd());
1525  }
1526  $form->addItem($group_duration);
1527 
1528  // Group registration ############################################################
1529  $pres = new ilFormSectionHeaderGUI();
1530  $pres->setTitle($this->lng->txt('grp_setting_header_registration'));
1531  $form->addItem($pres);
1532 
1533  // Registration type
1534  $reg_type = new ilRadioGroupInputGUI($this->lng->txt('group_registration_mode'), 'registration_type');
1535  $reg_type->setValue($this->object->getRegistrationType());
1536 
1537  $opt_dir = new ilRadioOption($this->lng->txt('grp_reg_direct'), GRP_REGISTRATION_DIRECT);#$this->lng->txt('grp_reg_direct_info'));
1538  $reg_type->addOption($opt_dir);
1539 
1540  $opt_pass = new ilRadioOption($this->lng->txt('grp_pass_request'), GRP_REGISTRATION_PASSWORD);
1541  $pass = new ilTextInputGUI($this->lng->txt("password"), 'password');
1542  $pass->setRequired(true);
1543  $pass->setInfo($this->lng->txt('grp_reg_password_info'));
1544  $pass->setValue($this->object->getPassword());
1545  $pass->setSize(32);
1546  $pass->setMaxLength(32);
1547  $opt_pass->addSubItem($pass);
1548  $reg_type->addOption($opt_pass);
1549 
1550  $opt_req = new ilRadioOption($this->lng->txt('grp_reg_request'), GRP_REGISTRATION_REQUEST, $this->lng->txt('grp_reg_request_info'));
1551  $reg_type->addOption($opt_req);
1552 
1553  $opt_deact = new ilRadioOption($this->lng->txt('grp_reg_no_selfreg'), GRP_REGISTRATION_DEACTIVATED, $this->lng->txt('grp_reg_disabled_info'));
1554  $reg_type->addOption($opt_deact);
1555 
1556  // Registration codes
1557  $reg_code = new ilCheckboxInputGUI($this->lng->txt('grp_reg_code'), 'reg_code_enabled');
1558  $reg_code->setChecked($this->object->isRegistrationAccessCodeEnabled());
1559  $reg_code->setValue(1);
1560  $reg_code->setInfo($this->lng->txt('grp_reg_code_enabled_info'));
1561  $form->addItem($reg_type);
1562 
1563  // Registration codes
1564  if (!$this->object->getRegistrationAccessCode()) {
1565  include_once './Services/Membership/classes/class.ilMembershipRegistrationCodeUtils.php';
1566  $this->object->setRegistrationAccessCode(ilMembershipRegistrationCodeUtils::generateCode());
1567  }
1568  $reg_link = new ilHiddenInputGUI('reg_code');
1569  $reg_link->setValue($this->object->getRegistrationAccessCode());
1570  $form->addItem($reg_link);
1571 
1572  $link = new ilCustomInputGUI($this->lng->txt('grp_reg_code_link'));
1573  include_once './Services/Link/classes/class.ilLink.php';
1574  $val = ilLink::_getLink($this->object->getRefId(), $this->object->getType(), array(), '_rcode' . $this->object->getRegistrationAccessCode());
1575  $link->setHTML('<span class="small">' . $val . '</span>');
1576  $reg_code->addSubItem($link);
1577  $form->addItem($reg_code);
1578 
1579  // time limit
1580  $this->lng->loadLanguageModule('dateplaner');
1581  include_once './Services/Form/classes/class.ilDateDurationInputGUI.php';
1582  $dur = new ilDateDurationInputGUI($this->lng->txt('grp_reg_limited'), 'reg');
1583  $dur->setShowTime(true);
1584  $dur->setStart($this->object->getRegistrationStart());
1585  $dur->setEnd($this->object->getRegistrationEnd());
1586  $form->addItem($dur);
1587 
1588  // cancellation limit
1589  $cancel = new ilDateTimeInputGUI($this->lng->txt('grp_cancellation_end'), 'cancel_end');
1590  $cancel->setInfo($this->lng->txt('grp_cancellation_end_info'));
1591  $cancel->setDate($this->object->getCancellationEnd());
1592  $form->addItem($cancel);
1593 
1594  // max member
1595  $lim = new ilCheckboxInputGUI($this->lng->txt('reg_grp_max_members_short'), 'registration_membership_limited');
1596  $lim->setValue(1);
1597  // $lim->setOptionTitle($this->lng->txt('reg_grp_max_members'));
1598  $lim->setChecked($this->object->isMembershipLimited());
1599 
1600  $min = new ilTextInputGUI($this->lng->txt('reg_grp_min_members'), 'registration_min_members');
1601  $min->setSize(3);
1602  $min->setMaxLength(4);
1603  $min->setValue($this->object->getMinMembers() ? $this->object->getMinMembers() : '');
1604  $min->setInfo($this->lng->txt('grp_subscription_min_members_info'));
1605  $lim->addSubItem($min);
1606 
1607  $max = new ilTextInputGUI($this->lng->txt('reg_grp_max_members'), 'registration_max_members');
1608  $max->setValue($this->object->getMaxMembers() ? $this->object->getMaxMembers() : '');
1609  //$max->setTitle($this->lng->txt('members'));
1610  $max->setSize(3);
1611  $max->setMaxLength(4);
1612  $max->setInfo($this->lng->txt('grp_reg_max_members_info'));
1613  $lim->addSubItem($max);
1614 
1615  /*
1616  $wait = new ilCheckboxInputGUI($this->lng->txt('grp_waiting_list'),'waiting_list');
1617  $wait->setValue(1);
1618  //$wait->setOptionTitle($this->lng->txt('grp_waiting_list'));
1619  $wait->setInfo($this->lng->txt('grp_waiting_list_info'));
1620  $wait->setChecked($this->object->isWaitingListEnabled() ? true : false);
1621  $lim->addSubItem($wait);
1622  $form->addItem($lim);
1623  */
1624 
1625  $wait = new ilRadioGroupInputGUI($this->lng->txt('grp_waiting_list'), 'waiting_list');
1626 
1627  $option = new ilRadioOption($this->lng->txt('none'), 0);
1628  $wait->addOption($option);
1629 
1630  $option = new ilRadioOption($this->lng->txt('grp_waiting_list_no_autofill'), 1);
1631  $option->setInfo($this->lng->txt('grp_waiting_list_info'));
1632  $wait->addOption($option);
1633 
1634  $option = new ilRadioOption($this->lng->txt('grp_waiting_list_autofill'), 2);
1635  $option->setInfo($this->lng->txt('grp_waiting_list_autofill_info'));
1636  $wait->addOption($option);
1637 
1638  if ($this->object->hasWaitingListAutoFill()) {
1639  $wait->setValue(2);
1640  } elseif ($this->object->isWaitingListEnabled()) {
1641  $wait->setValue(1);
1642  }
1643 
1644  $lim->addSubItem($wait);
1645 
1646  $form->addItem($lim);
1647 
1648 
1649  // Group presentation
1650  $parent_membership_ref_id = 0;
1651  $hasParentMembership =
1652  (
1653  $parent_membership_ref_id = $tree->checkForParentType($this->object->getRefId(), 'crs', true)
1654  );
1655 
1656  $pres = new ilFormSectionHeaderGUI();
1657  $pres->setTitle($this->lng->txt('grp_setting_header_presentation'));
1658  $form->addItem($pres);
1659 
1660  // title and icon visibility
1661  $form = $obj_service->commonSettings()->legacyForm($form, $this->object)->addTitleIconVisibility();
1662 
1663  // top actions visibility
1664  $form = $obj_service->commonSettings()->legacyForm($form, $this->object)->addTopActionsVisibility();
1665 
1666  // custom icon
1667  $form = $obj_service->commonSettings()->legacyForm($form, $this->object)->addIcon();
1668 
1669  // tile image
1670  $form = $obj_service->commonSettings()->legacyForm($form, $this->object)->addTileImage();
1671 
1672  // list presentation
1674 
1675 
1676  // presentation type
1677  $view_type = new ilRadioGroupInputGUI($this->lng->txt('grp_presentation_type'), 'view_mode');
1678  if ($hasParentMembership) {
1679  $parent_view_mode = ilObjCourseAccess::_lookupViewMode(ilObject::_lookupObjId($parent_membership_ref_id));
1680  $course_view_mode = '';
1681  switch ($parent_view_mode) {
1683  $course_view_mode = ': ' . $this->lng->txt('cntr_view_sessions');
1684  break;
1685 
1687  $course_view_mode = ': ' . $this->lng->txt('cntr_view_simple');
1688  break;
1689 
1691  $course_view_mode = ': ' . $this->lng->txt('cntr_view_by_type');
1692  break;
1693  }
1694  if ($course_view_mode) {
1695  $opt = new ilRadioOption($this->lng->txt('grp_view_inherit') . $course_view_mode, ilContainer::VIEW_INHERIT);
1696  $opt->setInfo($this->lng->txt('grp_view_inherit_info'));
1697  $view_type->addOption($opt);
1698  }
1699  }
1700 
1701  if ($hasParentMembership && ilObjGroup::lookupViewMode($this->object->getId()) == ilContainer::VIEW_INHERIT) {
1702  $view_type->setValue(ilContainer::VIEW_INHERIT);
1703  } else {
1704  $view_type->setValue(ilObjGroup::lookupViewMode($this->object->getId()));
1705  }
1706 
1707  $opt = new ilRadioOption($this->lng->txt('cntr_view_sessions'), ilContainer::VIEW_SESSIONS);
1708  $opt->setInfo($this->lng->txt('cntr_view_info_sessions'));
1709  $view_type->addOption($opt);
1710 
1711  $opt = new ilRadioOption($this->lng->txt('cntr_view_simple'), ilContainer::VIEW_SIMPLE);
1712  $opt->setInfo($this->lng->txt('grp_view_info_simple'));
1713  $view_type->addOption($opt);
1714 
1715  $opt = new ilRadioOption($this->lng->txt('cntr_view_by_type'), ilContainer::VIEW_BY_TYPE);
1716  $opt->setInfo($this->lng->txt('grp_view_info_by_type'));
1717  $view_type->addOption($opt);
1718  $form->addItem($view_type);
1719 
1720 
1721  // Sorting
1722  $sorting_settings = array();
1723  if ($hasParentMembership) {
1724  $sorting_settings[] = ilContainer::SORT_INHERIT;
1725  }
1726  $sorting_settings[] = ilContainer::SORT_TITLE;
1727  $sorting_settings[] = ilContainer::SORT_CREATION;
1728  $sorting_settings[] = ilContainer::SORT_MANUAL;
1729  $this->initSortingForm($form, $sorting_settings);
1730 
1731  // additional features
1732  $feat = new ilFormSectionHeaderGUI();
1733  $feat->setTitle($this->lng->txt('obj_features'));
1734  $form->addItem($feat);
1735 
1736  include_once './Services/Object/classes/class.ilObjectServiceSettingsGUI.php';
1738  $this->object->getId(),
1739  $form,
1740  array(
1749  )
1750  );
1751 
1752 
1753  $mem = new ilCheckboxInputGUI($this->lng->txt('grp_show_members'), 'show_members');
1754  $mem->setChecked($this->object->getShowMembers());
1755  $mem->setInfo($this->lng->txt('grp_show_members_info'));
1756  $form->addItem($mem);
1757 
1758  // Show members type
1759  $mail_type = new ilRadioGroupInputGUI($this->lng->txt('grp_mail_type'), 'mail_type');
1760  $mail_type->setValue($this->object->getMailToMembersType());
1761 
1762  $mail_tutors = new ilRadioOption(
1763  $this->lng->txt('grp_mail_tutors_only'),
1765  $this->lng->txt('grp_mail_tutors_only_info')
1766  );
1767  $mail_type->addOption($mail_tutors);
1768 
1769  $mail_all = new ilRadioOption(
1770  $this->lng->txt('grp_mail_all'),
1772  $this->lng->txt('grp_mail_all_info')
1773  );
1774  $mail_type->addOption($mail_all);
1775  $form->addItem($mail_type);
1776  }
1777 
1778  switch ($a_mode) {
1779  case 'create':
1780  $form->setTitle($this->lng->txt('grp_new'));
1781  $form->setTitleIcon(ilUtil::getImagePath('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('icon_grp.svg'));
1790 
1791  // Edit ecs export settings
1792  include_once 'Modules/Group/classes/class.ilECSGroupSettings.php';
1793  $ecs = new ilECSGroupSettings($this->object);
1794  $ecs->addSettingsToForm($form, 'grp');
1795 
1796  $form->addCommandButton('update', $this->lng->txt('save'));
1797  $form->addCommandButton('cancel', $this->lng->txt('cancel'));
1798  break;
1799  }
1800  return $form;
1801  }
1802 
1810  protected function setSubTabs($a_tab)
1811  {
1812  global $DIC;
1813 
1814  $rbacsystem = $DIC['rbacsystem'];
1815  $ilUser = $DIC['ilUser'];
1816  $ilAccess = $DIC['ilAccess'];
1817 
1818  switch ($a_tab) {
1819 
1820  case 'settings':
1821  $this->tabs_gui->addSubTabTarget(
1822  "grp_settings",
1823  $this->ctrl->getLinkTarget($this, 'edit'),
1824  "edit",
1825  get_class($this)
1826  );
1827 
1828  $this->tabs_gui->addSubTabTarget(
1829  "grp_info_settings",
1830  $this->ctrl->getLinkTarget($this, 'editInfo'),
1831  "editInfo",
1832  get_class($this)
1833  );
1834 
1835  include_once("./Services/Maps/classes/class.ilMapUtil.php");
1836  if (ilMapUtil::isActivated()) {
1837  $this->tabs_gui->addSubTabTarget(
1838  "grp_map_settings",
1839  $this->ctrl->getLinkTarget($this, 'editMapSettings'),
1840  "editMapSettings",
1841  get_class($this)
1842  );
1843  }
1844 
1845  $this->tabs_gui->addSubTabTarget(
1846  'groupings',
1847  $this->ctrl->getLinkTargetByClass('ilobjcoursegroupinggui', 'listGroupings'),
1848  'listGroupings',
1849  get_class($this)
1850  );
1851 
1852  include_once('Services/PrivacySecurity/classes/class.ilPrivacySettings.php');
1853  include_once('Modules/Course/classes/Export/class.ilCourseDefinedFieldDefinition.php');
1854  // only show if export permission is granted
1855  if (ilPrivacySettings::_getInstance()->checkExportAccess($this->object->getRefId()) or ilCourseDefinedFieldDefinition::_hasFields($this->object->getId())) {
1856  $this->tabs_gui->addSubTabTarget(
1857  'grp_custom_user_fields',
1858  $this->ctrl->getLinkTargetByClass('ilobjectcustomuserfieldsgui'),
1859  '',
1860  'ilobjectcustomuserfieldsgui'
1861  );
1862  }
1863 
1864  // news settings
1865  if ($this->object->getUseNews()) {
1866  $this->tabs_gui->addSubTab(
1867  'obj_news_settings',
1868  $this->lng->txt("cont_news_settings"),
1869  $this->ctrl->getLinkTargetByClass('ilcontainernewssettingsgui')
1870  );
1871  }
1872 
1873  $lti_settings = new ilLTIProviderObjectSettingGUI($this->object->getRefId());
1874  if ($lti_settings->hasSettingsAccess()) {
1875  $this->tabs_gui->addSubTabTarget(
1876  'lti_provider',
1877  $this->ctrl->getLinkTargetByClass(ilLTIProviderObjectSettingGUI::class)
1878  );
1879  }
1880 
1881  $this->tabs_gui->addSubTabTarget(
1882  "obj_multilinguality",
1883  $this->ctrl->getLinkTargetByClass("ilobjecttranslationgui", ""),
1884  "",
1885  "ilobjecttranslationgui"
1886  );
1887 
1888 
1889  break;
1890 
1891 
1892  }
1893  }
1894 
1901  private function checkAgreement()
1902  {
1903  global $DIC;
1904 
1905  $ilUser = $DIC['ilUser'];
1906  $ilAccess = $DIC['ilAccess'];
1907 
1908  if ($ilAccess->checkAccess('write', '', $this->object->getRefId())) {
1909  return true;
1910  }
1911 
1912  // Disable aggrement if is not member of group
1913  if (!$this->object->members_obj->isAssigned($ilUser->getId())) {
1914  return true;
1915  }
1916 
1917  include_once './Services/Container/classes/class.ilMemberViewSettings.php';
1918  if (ilMemberViewSettings::getInstance()->isActive()) {
1919  return true;
1920  }
1921 
1922  include_once('Services/PrivacySecurity/classes/class.ilPrivacySettings.php');
1923  include_once('Services/Membership/classes/class.ilMemberAgreement.php');
1924  $privacy = ilPrivacySettings::_getInstance();
1925 
1926  // Check agreement
1927  if (($privacy->groupConfirmationRequired() or ilCourseDefinedFieldDefinition::_hasFields($this->object->getId()))
1928  and !ilMemberAgreement::_hasAccepted($ilUser->getId(), $this->object->getId())) {
1929  return false;
1930  }
1931  // Check required fields
1932  include_once('Modules/Course/classes/Export/class.ilCourseUserData.php');
1933  if (!ilCourseUserData::_checkRequired($ilUser->getId(), $this->object->getId())) {
1934  return false;
1935  }
1936  return true;
1937  }
1938 
1939 
1944  public function prepareOutput($a_show_subobjects = true)
1945  {
1946  global $DIC;
1947 
1948  $rbacsystem = $DIC['rbacsystem'];
1949  if (!$this->getCreationMode()) {
1950  /*
1951  include_once './Services/Container/classes/class.ilMemberViewSettings.php';
1952  $settings = ilMemberViewSettings::getInstance();
1953  if($settings->isActive() and $settings->getContainer() != $this->object->getRefId())
1954  {
1955  $settings->setContainer($this->object->getRefId());
1956  $rbacsystem->initMemberView();
1957  }
1958  */
1959  }
1960  parent::prepareOutput($a_show_subobjects);
1961  }
1962 
1967  public function createMailSignature()
1968  {
1969  $link = chr(13) . chr(10) . chr(13) . chr(10);
1970  $link .= $this->lng->txt('grp_mail_permanent_link');
1971  $link .= chr(13) . chr(10) . chr(13) . chr(10);
1972  include_once 'Services/Link/classes/class.ilLink.php';
1973  $link .= ilLink::_getLink($this->object->getRefId());
1974  return rawurlencode(base64_encode($link));
1975  }
1976 
1977  protected function initHeaderAction($a_sub_type = null, $a_sub_id = null)
1978  {
1979  global $DIC;
1980 
1981  $ilSetting = $DIC['ilSetting'];
1982  $ilUser = $DIC['ilUser'];
1983 
1984  $lg = parent::initHeaderAction($a_sub_type, $a_sub_id);
1985 
1986  include_once('./Modules/Group/classes/class.ilGroupParticipants.php');
1987  if (ilGroupParticipants::_isParticipant($this->ref_id, $ilUser->getId())) {
1988  include_once "Services/Membership/classes/class.ilMembershipNotifications.php";
1990  $noti = new ilMembershipNotifications($this->ref_id);
1991  if (!$noti->isCurrentUserActive()) {
1992  $lg->addHeaderIcon(
1993  "not_icon",
1994  ilUtil::getImagePath("notification_off.svg"),
1995  $this->lng->txt("grp_notification_deactivated")
1996  );
1997 
1998  $this->ctrl->setParameter($this, "grp_ntf", 1);
1999  $caption = "grp_activate_notification";
2000  } else {
2001  $lg->addHeaderIcon(
2002  "not_icon",
2003  ilUtil::getImagePath("notification_on.svg"),
2004  $this->lng->txt("grp_notification_activated")
2005  );
2006 
2007  $this->ctrl->setParameter($this, "grp_ntf", 0);
2008  $caption = "grp_deactivate_notification";
2009  }
2010 
2011  if ($noti->canCurrentUserEdit()) {
2012  $lg->addCustomCommand(
2013  $this->ctrl->getLinkTarget($this, "saveNotification"),
2014  $caption
2015  );
2016  }
2017 
2018  $this->ctrl->setParameter($this, "grp_ntf", "");
2019  }
2020  }
2021 
2022  return $lg;
2023  }
2024 
2025 
2030  public function addCustomData($a_data)
2031  {
2032  // object defined fields
2033  include_once('Modules/Course/classes/Export/class.ilCourseUserData.php');
2034  $odfs = ilCourseUserData::_getValuesByObjId($this->object->getId());
2035 
2036  $res_data = array();
2037  foreach ($a_data as $usr_id => $user_data) {
2038  $res_data[$usr_id] = $user_data;
2039 
2040  // udf
2041  include_once './Services/User/classes/class.ilUserDefinedData.php';
2042  $udf_data = new ilUserDefinedData($usr_id);
2043  foreach ($udf_data->getAll() as $field => $value) {
2044  list($f, $field_id) = explode('_', $field);
2045  $res_data[$usr_id]['udf_' . $field_id] = (string) $value;
2046  }
2047 
2048  foreach ((array) $odfs[$usr_id] as $cdf_field => $cdf_value) {
2049  $res_data[$usr_id]['cdf_' . $cdf_field] = (string) $cdf_value;
2050  }
2051  }
2052 
2053  return $res_data;
2054  }
2055 
2060  public function getLocalRoles()
2061  {
2062  $local_roles = $this->object->getLocalGroupRoles(false);
2063  $grp_member = $this->object->getDefaultMemberRole();
2064  $grp_roles = array();
2065 
2066  //put the group member role to the top of the crs_roles array
2067  if (in_array($grp_member, $local_roles)) {
2068  $grp_roles[$grp_member] = ilObjRole::_getTranslation(array_search($grp_member, $local_roles));
2069  unset($local_roles[$grp_roles[$grp_member]]);
2070  }
2071 
2072  foreach ($local_roles as $title => $role_id) {
2073  $grp_roles[$role_id] = ilObjRole::_getTranslation($title);
2074  }
2075  return $grp_roles;
2076  }
2077 
2081  protected function jump2UsersGalleryObject()
2082  {
2083  $this->ctrl->redirectByClass('ilUsersGalleryGUI');
2084  }
2085 
2089  public function setSideColumnReturn()
2090  {
2091  $this->ctrl->setReturn($this, "view");
2092  }
2093 } // END class.ilObjGroupGUI
static lookupTemplateId($a_ref_id)
Lookup template id ilDB $ilDB.
static _lookupLogin($a_user_id)
lookup login
static _lookupName($a_user_id)
lookup user name
prepareOutput($a_show_subobjects=true)
Handle member view.
setLatitude($a_latitude)
Set Latitude.
This class represents an option in a radio group.
Class ilObjectMetaDataGUI.
$lg
Definition: example_018.php:62
static isActive()
Is feature active?
renderObject()
Render group.
setSideColumnReturn()
Set return point for side column actions.
static _isParticipant($a_ref_id, $a_usr_id)
Static function to check if a user is a participant of the container object.
Class ilInfoScreenGUI.
Class ilObjGroupGUI.
infoScreenObject()
this one is called from the info button in the repository not very nice to set cmdClass/Cmd manually...
static _fieldsToInfoString($a_obj_id)
Fields to info string.
editInfoObject()
edit info
saveSortingSettings(ilPropertyFormGUI $form)
Save sorting settings.
Class ilUserDefinedData.
const GRP_REGISTRATION_DEACTIVATED
This class represents a property form user interface.
addContentTab()
Add content tab.
GUI class for the workflow of copying objects.
global $DIC
Definition: saml.php:7
getLocalRoles()
returns all local roles [role_id] => title
const IL_GRP_ADMIN
$_GET["client_id"]
initInfoEditor()
init info editor
This class represents a section header in a property form.
static _getValuesByObjId($a_obj_id)
Get values by obj_id (for all users)
const LP_STATUS_NOT_ATTEMPTED
static _recordWriteEvent($obj_id, $usr_id, $action, $parent_obj_id=null)
Records a write event.
unsubscribeObject()
unsubscribe from group
initForm($a_mode='edit', $a_omit_form_action=false)
init create/edit form
updateInfoObject()
update info
static _getInstanceByObjId($a_obj_id)
Get singleton instance.
static _gotoRepositoryRoot($a_raise_error=false)
Goto repository root.
static _lookupFailedForObject($a_obj_id, $a_user_ids=null)
Get failed users for object.
static _tracProgress($a_user_id, $a_obj_id, $a_ref_id, $a_obj_type='')
This class represents a checkbox property in a property form.
static _lookupTitle($a_id)
lookup object title
editMapSettingsObject()
Edit Map Settings.
Class ilMailMemberSearchGUI.
__construct($a_data, $a_id, $a_call_by_reference, $a_prepare_output=false)
Constructor public.
static handleCode($a_ref_id, $a_type, $a_code)
Handle target parameter.
const IL_CAL_UNIX
const GRP_REGISTRATION_PASSWORD
setInfo($a_info)
Set Info.
static formatDate(ilDateTime $date, $a_skip_day=false, $a_include_wd=false, $include_seconds=false)
Format a date public.
updateGroupTypeObject()
change group type
const GRP_REGISTRATION_REQUEST
static _readUsersProfileData($a_user_ids)
STATIC METHOD get user data of selected users.
static _hasAccepted($a_usr_id, $a_obj_id)
Check if user has accepted agreement.
Class ilMailMemberCourseRoles.
setSubTabs($a_tab)
set sub tabs
const LP_STATUS_IN_PROGRESS
This class represents a date/time property in a property form.
static _catchupWriteEvents($obj_id, $usr_id, $timestamp=null)
Catches up with all write events which occured before the specified timestamp.
global $ilCtrl
Definition: ilias.php:18
static getInstance($a_ref_id)
Get instance by ref_id.
setInfo($a_info)
Set Information Text.
infoScreen()
show information screen
setChecked($a_checked)
Set Checked.
Export User Interface Class.
static checkAccess($a_ref_id, $a_allow_only_read=true)
check access to learning progress
static _enabledUserRelatedData()
check wether user related tracking is enabled or not
setCustomRolesForSelection($a_roles)
Set custom roles for mapping to LTI roles.
This class represents a hidden form property in a property form.
static switchTemplate($a_ref_id, $a_new_tpl_id)
static _modifyItemGUI( $a_item_list_gui, $a_cmd_class, $a_item_data, $a_show_path, $a_abo_status, $a_course_ref_id, $a_course_obj_id, $a_parent_ref_id=0)
We need a static version of this, e.g.
input GUI for a time span (start and end date)
GUI class for public user profile presentation.
static _enabledLearningProgress()
check wether learing progress is enabled or not
static lookupRegistrationInfo($a_obj_id)
Lookup registration info ilDB $ilDB ilObjUser $ilUser ilLanguage $lng.
This class represents a property in a property form.
setValue($a_value)
Set Value.
const LP_STATUS_FAILED
static _lookupProgressByObjId($a_obj_id)
lookup progress for a specific object
setInfoObject($info)
get info sections
if(isset($_POST['submit'])) $form
getId()
get object id public
GUI class for LTI provider object settings.
addSubItem($a_item)
Add Subitem.
const MAIL_ALLOWED_TUTORS
static _getInstanceByType($a_type)
Get Singleton Instance.
static _gotoRepositoryNode($a_ref_id, $a_cmd="frameset")
Goto repository root.
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
Class ilECSGroupSettings.
initDidacticTemplate(ilPropertyFormGUI $form)
Show didactic template types.
static _lookupObjId($a_id)
static makeClickable($a_text, $detectGotoLinks=false)
makeClickable In Texten enthaltene URLs und Mail-Adressen klickbar machen
Skills for container (course/group) (top gui class)
setValue($a_value)
Set Value.
static getDefaultSettings()
Get default longitude, latitude and zoom.
This class represents a location property in a property form.
setSize($a_size)
Set Size.
This class represents a text property in a property form.
Date and time handling
forwardToStyleSheet()
Forward to style object.
& forwardToPageObject()
forward command to page object
$ilUser
Definition: imgupload.php:18
editObject()
edit object
setShowTime($a_showtime)
Set Show Time Information.
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
static sendQuestion($a_info="", $a_keep=false)
Send Question to Screen.
static getContentStylePath($a_style_id, $add_random=true)
get content style path
static getAvailablePortfolioLinksForUserIds(array $a_owner_ids, $a_back_url=null)
GUI class for group registrations.
static updateServiceSettingsForm($a_obj_id, ilPropertyFormGUI $form, $services)
Update service settings.
static _checkRequired($a_usr_id, $a_obj_id)
Check required fields.
static _isOnList($a_usr_id, $a_obj_id)
Check if a user on the waiting list.
$failed
Definition: Utf8Test.php:85
static _getTranslation($a_role_title)
static _getInstanceByObjId($a_obj_id)
Get singleton instance.
static _lookupType($a_id, $a_reference=false)
lookup object type
showPermanentLink()
show permanent link
Class ilObjCourseGroupingGUI.
saveListPresentation(ilPropertyFormGUI $form)
Save list presentation setting.
static _hasFields($a_container_id)
Check if there are any define fields.
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
modifyItemGUI($a_item_list_gui, $a_item_data, $a_show_path)
Modify Item ListGUI for presentation in container type $tree.
GUI class for membership features.
static _lookupInProgressForObject($a_obj_id, $a_user_ids=null)
Get in progress users for object.
createMailSignature()
Create a course mail signature.
updateObject()
update group settings
static isActivated()
Checks whether Map feature is activated.
This class represents a custom property in a property form.
checkAgreement()
Check agreement and redirect if it is not accepted.
static generateCode()
Generate new registration key.
initHeaderAction($a_sub_type=null, $a_sub_id=null)
initListPresentationForm(ilPropertyFormGUI $form)
Add list presentation settings to form.
static _lookupAboStatus($a_id)
static formatPeriod(ilDateTime $start, ilDateTime $end, $a_skip_starting_day=false)
Format a period of two date Shows: 14.
afterSave(\ilObject $new_object, $a_redirect=true)
After object creation.
static _fillHTMLMetaTags($a_rbac_id, $a_obj_id, $a_type)
Fill html meta tags.
initSortingForm(ilPropertyFormGUI $form, array $a_sorting_settings)
Append sorting settings to property form.
static _goto($a_target, $a_add="")
goto target group
global $ilSetting
Definition: privfeed.php:17
readMemberData($ids, $selected_columns=null)
static getInstance()
Get instance.
const MAIL_ALLOWED_ALL
This class represents a text area property in a property form.
Class ilCourseContentGUI.
$ret
Definition: parser.php:6
static initServiceSettingsForm($a_obj_id, ilPropertyFormGUI $form, $services)
Init service settings form.
getCreationMode()
get creation mode
getRefId()
get reference id public
Class ilContainerGUI.
$def
Definition: croninfo.php:21
checkPermission($a_perm, $a_cmd="", $a_type="", $a_ref_id=null)
Check permission and redirect on error.
New PermissionGUI (extends from old ilPermission2GUI) RBAC related output.
static getLogger($a_component_id)
Get component logger.
static _getInstance()
Get instance of ilPrivacySettings.
getObjectService()
Get object service.
GUI class for service settings (calendar, notes, comments)
static _lookupCompletedForObject($a_obj_id, $a_user_ids=null)
Get completed users for object.
update()
update object in db
$info
Definition: index.php:5
setValue($a_value)
Set Value.
static redirect($a_script)
const LP_STATUS_COMPLETED
const GRP_REGISTRATION_DIRECT
static lookupViewMode($a_obj_id)
lookup view mode $ilDB
static getInstance($a_obj_id)
addHeaderAction()
Add header action menu.
leaveObject()
leave Group public
Membership notification settings.
checkPermissionBool($a_perm, $a_cmd="", $a_type="", $a_ref_id=null)
Check permission.
Class ilObjUserTrackingGUI.
$_POST["username"]
$html
Definition: example_001.php:87
static getInstanceFromAjaxCall()
(Re-)Build instance from ajax call
$GLOBALS['JPEG_Segment_Names']
Global Variable: XMP_tag_captions.
GUI class for object translation handling.
static _lookupContainerSetting($a_id, $a_keyword, $a_default_value=null)
Lookup a container setting.
editObject(ilPropertyFormGUI $a_form=null)
Edit object.
membersObject()
Called from goto?
Confirmation screen class.
static getInstance()
Constructor.
static getInstance($a_ref_id, $a_include_auto_entries)
Get instance.
static _getFields($a_container_id, $a_sort=IL_CDF_SORT_NAME)
Get all fields of a container.
saveNotificationObject()
:TEMP: Save notification setting (from infoscreen)
static _lookupViewMode($a_id)
Lookup view mode.