ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
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 
66  // add entry to navigation history
67  if (!$this->getCreationMode() &&
68  $ilAccess->checkAccess("read", "", $_GET["ref_id"])) {
69  include_once("./Services/Link/classes/class.ilLink.php");
70  $ilNavigationHistory->addItem(
71  $_GET["ref_id"],
72  ilLink::_getLink($_GET["ref_id"], "grp"),
73  "grp"
74  );
75  }
76 
77  // if news timeline is landing page, redirect if necessary
78  if ($next_class == "" && $cmd == "" && $this->object->isNewsTimelineLandingPageEffective()
79  && $ilAccess->checkAccess("read", "", $_GET["ref_id"])) {
80  $this->ctrl->redirectbyclass("ilnewstimelinegui");
81  }
82 
83  switch ($next_class) {
84  case 'ilreputilgui':
85  $ru = new \ilRepUtilGUI($this);
86  $this->ctrl->setReturn($this, 'trash');
87  $this->ctrl->forwardCommand($ru);
88  break;
89 
90  case 'illtiproviderobjectsettinggui':
91  $this->setSubTabs('settings');
92  $this->tabs_gui->activateTab('settings');
93  $this->tabs_gui->activateSubTab('lti_provider');
94  $lti_gui = new ilLTIProviderObjectSettingGUI($this->object->getRefId());
95  $lti_gui->setCustomRolesForSelection($GLOBALS['DIC']->rbac()->review()->getLocalRoles($this->object->getRefId()));
96  $lti_gui->offerLTIRolesForSelection(false);
97  $this->ctrl->forwardCommand($lti_gui);
98  break;
99 
100 
101  case 'ilgroupmembershipgui':
102 
103  $this->tabs_gui->activateTab('members');
104 
105  include_once './Modules/Group/classes/class.ilGroupMembershipGUI.php';
106  $mem_gui = new ilGroupMembershipGUI($this, $this->object);
107  $this->ctrl->forwardCommand($mem_gui);
108  break;
109 
110 
111  case 'ilgroupregistrationgui':
112  $this->ctrl->setReturn($this, '');
113  $this->tabs_gui->setTabActive('join');
114  include_once('./Modules/Group/classes/class.ilGroupRegistrationGUI.php');
115  $registration = new ilGroupRegistrationGUI($this->object);
116  $this->ctrl->forwardCommand($registration);
117  break;
118 
119  case 'ilpermissiongui':
120  $this->tabs_gui->activateTab('perm_settings');
121  include_once("Services/AccessControl/classes/class.ilPermissionGUI.php");
122  $perm_gui = new ilPermissionGUI($this);
123  $ret = &$this->ctrl->forwardCommand($perm_gui);
124  break;
125 
126  case "ilinfoscreengui":
127  $ret = &$this->infoScreen();
128  break;
129 
130  case "illearningprogressgui":
131  include_once './Services/Tracking/classes/class.ilLearningProgressGUI.php';
132 
133  $new_gui = new ilLearningProgressGUI(
135  $this->object->getRefId(),
136  $_GET['user_id'] ? $_GET['user_id'] : $ilUser->getId()
137  );
138  $this->ctrl->forwardCommand($new_gui);
139  $this->tabs_gui->setTabActive('learning_progress');
140  break;
141 
142  case 'ilobjcoursegroupinggui':
143  $this->setSubTabs('settings');
144 
145  include_once './Modules/Course/classes/class.ilObjCourseGroupingGUI.php';
146  $this->ctrl->setReturn($this, 'edit');
147  $crs_grp_gui = new ilObjCourseGroupingGUI($this->object, (int) $_GET['obj_id']);
148  $this->ctrl->forwardCommand($crs_grp_gui);
149 
150  $this->tabs_gui->setTabActive('settings');
151  $this->tabs_gui->setSubTabActive('groupings');
152  break;
153 
154  case 'ilcoursecontentgui':
155 
156  include_once './Modules/Course/classes/class.ilCourseContentGUI.php';
157  $course_content_obj = new ilCourseContentGUI($this);
158  $this->ctrl->forwardCommand($course_content_obj);
159  break;
160 
161  case 'ilpublicuserprofilegui':
162  require_once './Services/User/classes/class.ilPublicUserProfileGUI.php';
163  $this->setSubTabs('members');
164  $this->tabs_gui->setTabActive('group_members');
165  $this->tabs_gui->setSubTabActive('grp_members_gallery');
166  $profile_gui = new ilPublicUserProfileGUI($_GET["user"]);
167  if ($_GET["back_url"] == "") {
168  $profile_gui->setBackUrl($this->ctrl->getLinkTargetByClass(["ilGroupMembershipGUI", "ilUsersGalleryGUI"], 'view'));
169  }
170  $html = $this->ctrl->forwardCommand($profile_gui);
171  $this->tpl->setVariable("ADM_CONTENT", $html);
172  break;
173 
174  case "ilcolumngui":
175  $this->tabs_gui->setTabActive('none');
176  $this->checkPermission("read");
177  include_once("./Services/Style/Content/classes/class.ilObjStyleSheet.php");
178  $this->tpl->setVariable(
179  "LOCATION_CONTENT_STYLESHEET",
180  ilObjStyleSheet::getContentStylePath($this->object->getStyleSheetId())
181  );
182  $this->renderObject();
183  break;
184 
185  // container page editing
186  case "ilcontainerpagegui":
187  $ret = $this->forwardToPageObject();
188  if ($ret != "") {
189  $this->tpl->setContent($ret);
190  }
191  break;
192 
193  case 'ilobjectcopygui':
194  include_once './Services/Object/classes/class.ilObjectCopyGUI.php';
195  $cp = new ilObjectCopyGUI($this);
196  $cp->setType('grp');
197  $this->ctrl->forwardCommand($cp);
198  break;
199 
200  case "ilobjstylesheetgui":
201  $this->forwardToStyleSheet();
202  break;
203 
204  case 'ilobjectcustomuserfieldsgui':
205  include_once './Services/Membership/classes/class.ilObjectCustomUserFieldsGUI.php';
206  $cdf_gui = new ilObjectCustomUserFieldsGUI($this->object->getId());
207  $this->setSubTabs('settings');
208  $this->tabs_gui->setTabActive('settings');
209  $this->tabs_gui->activateSubTab('grp_custom_user_fields');
210  $this->ctrl->forwardCommand($cdf_gui);
211  break;
212 
213  case 'ilmemberagreementgui':
214  include_once('Services/Membership/classes/class.ilMemberAgreementGUI.php');
215  $this->ctrl->setReturn($this, '');
216  $this->tabs_gui->setTabActive('view_content');
217  $agreement = new ilMemberAgreementGUI($this->object->getRefId());
218  $this->ctrl->forwardCommand($agreement);
219  break;
220 
221  case 'ilexportgui':
222  $this->tabs_gui->setTabActive('export');
223  include_once './Services/Export/classes/class.ilExportGUI.php';
224  $exp = new ilExportGUI($this);
225  $exp->addFormat('xml');
226  $this->ctrl->forwardCommand($exp);
227  break;
228 
229  case "ilcommonactiondispatchergui":
230  include_once("Services/Object/classes/class.ilCommonActionDispatcherGUI.php");
232  $this->ctrl->forwardCommand($gui);
233  break;
234 
235  case 'ilobjectservicesettingsgui':
236  $this->ctrl->setReturn($this, 'edit');
237  $this->setSubTabs("settings");
238  $this->tabs_gui->activateTab('settings');
239  $this->tabs_gui->activateSubTab('tool_settings');
240 
241  include_once './Services/Object/classes/class.ilObjectServiceSettingsGUI.php';
243  $this,
244  $this->object->getId(),
245  array(
247  )
248  );
249  $this->ctrl->forwardCommand($service);
250  break;
251 
252  case 'ilmailmembersearchgui':
253  include_once 'Services/Mail/classes/class.ilMail.php';
254  $mail = new ilMail($ilUser->getId());
255 
256  if (!($ilAccess->checkAccess('manage_members', '', $this->object->getRefId()) ||
257  $this->object->getMailToMembersType() == ilObjGroup::MAIL_ALLOWED_ALL) &&
258  $rbacsystem->checkAccess('internal_mail', $mail->getMailObjectReferenceId())) {
259  $ilErr->raiseError($this->lng->txt("msg_no_perm_read"), $ilErr->MESSAGE);
260  }
261 
262  $this->tabs_gui->setTabActive('members');
263 
264  include_once './Services/Contact/classes/class.ilMailMemberSearchGUI.php';
265  include_once './Services/Contact/classes/class.ilMailMemberGroupRoles.php';
266 
267  $mail_search = new ilMailMemberSearchGUI($this, $this->object->getRefId(), new ilMailMemberGroupRoles());
268  $mail_search->setObjParticipants(ilCourseParticipants::_getInstanceByObjId($this->object->getId()));
269  $this->ctrl->forwardCommand($mail_search);
270  break;
271 
272  case 'ilbadgemanagementgui':
273  $this->tabs_gui->setTabActive('obj_tool_setting_badges');
274  include_once 'Services/Badge/classes/class.ilBadgeManagementGUI.php';
275  $bgui = new ilBadgeManagementGUI($this->object->getRefId(), $this->object->getId(), 'grp');
276  $this->ctrl->forwardCommand($bgui);
277  break;
278 
279  case "ilcontainernewssettingsgui":
280  $this->setSubTabs("settings");
281  $this->tabs_gui->setTabActive('settings');
282  $this->tabs_gui->activateSubTab('obj_news_settings');
283  include_once("./Services/Container/classes/class.ilContainerNewsSettingsGUI.php");
284  $news_set_gui = new ilContainerNewsSettingsGUI($this);
285  $news_set_gui->setTimeline(true);
286  $news_set_gui->setCronNotifications(true);
287  $news_set_gui->setHideByDate(true);
288  $this->ctrl->forwardCommand($news_set_gui);
289  break;
290 
291  case "ilnewstimelinegui":
292  $this->checkPermission("read");
293  $this->tabs_gui->setTabActive('news_timeline');
294  include_once("./Services/News/classes/class.ilNewsTimelineGUI.php");
295  $t = ilNewsTimelineGUI::getInstance($this->object->getRefId(), $this->object->getNewsTimelineAutoENtries());
296  $t->setUserEditAll($ilAccess->checkAccess('write', '', $this->object->getRefId(), 'grp'));
297  $this->showPermanentLink($tpl);
298  $this->ctrl->forwardCommand($t);
299  include_once 'Services/Tracking/classes/class.ilLearningProgress.php';
301  $ilUser->getId(),
302  $this->object->getId(),
303  $this->object->getRefId(),
304  'grp'
305  );
306  break;
307 
308  case "ilcontainerskillgui":
309  $this->tabs_gui->activateTab('obj_tool_setting_skills');
310  include_once("./Services/Container/Skills/classes/class.ilContainerSkillGUI.php");
311  $gui = new ilContainerSkillGUI($this);
312  $this->ctrl->forwardCommand($gui);
313  break;
314 
315  case 'ilcalendarpresentationgui':
316  include_once('./Services/Calendar/classes/class.ilCalendarPresentationGUI.php');
317  $cal = new ilCalendarPresentationGUI($this->object->getRefId());
318  $ret = $this->ctrl->forwardCommand($cal);
319  break;
320 
321  case 'ilobjectmetadatagui':
322  if (!$ilAccess->checkAccess('write', '', $this->object->getRefId())) {
323  $ilErr->raiseError($this->lng->txt('permission_denied'), $ilErr->WARNING);
324  }
325  $this->tabs_gui->activateTab('meta_data');
326  $this->ctrl->forwardCommand(new ilObjectMetaDataGUI($this->object));
327  break;
328 
329 
330  case 'ilobjecttranslationgui':
331  $this->checkPermissionBool("write");
332  $this->setSubTabs("settings");
333  $this->tabs->activateTab("settings");
334  include_once("./Services/Object/classes/class.ilObjectTranslationGUI.php");
335  $transgui = new ilObjectTranslationGUI($this);
336  $this->ctrl->forwardCommand($transgui);
337  break;
338 
339  default:
340 
341  // check visible permission
342  if (!$this->getCreationMode() and
343  !$ilAccess->checkAccess('visible', '', $this->object->getRefId(), 'grp') and
344  !$ilAccess->checkAccess('read', '', $this->object->getRefId(), 'grp')) {
345  $ilErr->raiseError($this->lng->txt("msg_no_perm_read"), $ilErr->MESSAGE);
346  }
347 
348  // #9401 - see also ilStartupGUI::_checkGoto()
349  if ($cmd == 'infoScreenGoto') {
350  if ($this->object->isRegistrationEnabled()) {
351  $cmd = 'join';
352  } else {
353  $cmd = 'infoScreen';
354  }
355  }
356 
357  // check read permission
358  if ((!$this->getCreationMode()
359  && !$rbacsystem->checkAccess('read', $this->object->getRefId()) && $cmd != 'infoScreen')
360  || $cmd == 'join') {
361  // no join permission -> redirect to info screen
362  if (!$rbacsystem->checkAccess('join', $this->object->getRefId())) {
363  $this->ctrl->redirect($this, "infoScreen");
364  } else { // no read -> show registration
365  include_once('./Modules/Group/classes/class.ilGroupRegistrationGUI.php');
366  $this->ctrl->redirectByClass("ilGroupRegistrationGUI", "show");
367  }
368  }
369  if (!$cmd) {
370  $cmd = 'view';
371  }
372  $cmd .= 'Object';
373  $this->$cmd();
374  break;
375  }
376 
377  $this->addHeaderAction();
378  }
379 
380  public function viewObject()
381  {
382  global $DIC;
383 
384  $tree = $DIC['tree'];
385  $rbacsystem = $DIC['rbacsystem'];
386  $ilUser = $DIC['ilUser'];
387 
388  include_once 'Services/Tracking/classes/class.ilLearningProgress.php';
390  $ilUser->getId(),
391  $this->object->getId(),
392  $this->object->getRefId(),
393  'grp'
394  );
395 
397  $this->object->getId(),
398  $this->object->getId(),
399  'grp'
400  );
401 
402 
403  if (strtolower($_GET["baseClass"]) == "iladministrationgui") {
404  parent::viewObject();
405  return true;
406  }
407 
408  if (!$this->checkAgreement()) {
409  include_once('Services/Membership/classes/class.ilMemberAgreementGUI.php');
410  $this->tabs_gui->setTabActive('view_content');
411  $this->ctrl->setReturn($this, 'view');
412  $agreement = new ilMemberAgreementGUI($this->object->getRefId());
413  $this->ctrl->setCmdClass(get_class($agreement));
414  $this->ctrl->forwardCommand($agreement);
415  return true;
416  }
417 
418  $this->tabs_gui->setTabActive('view_content');
419  $this->renderObject();
420  }
421 
425  public function renderObject()
426  {
427  global $DIC;
428 
429  $ilTabs = $DIC['ilTabs'];
430 
431  $ilTabs->activateTab("view_content");
432  $ret = parent::renderObject();
433  return $ret;
434  }
435 
443  public function modifyItemGUI($a_item_list_gui, $a_item_data, $a_show_path)
444  {
445  global $DIC;
446 
447  $tree = $DIC['tree'];
448 
449  // if folder is in a course, modify item list gui according to course requirements
450  if ($course_ref_id = $tree->checkForParentType($this->object->getRefId(), 'crs')) {
451  include_once("./Modules/Course/classes/class.ilObjCourse.php");
452  include_once("./Modules/Course/classes/class.ilObjCourseGUI.php");
453  $course_obj_id = ilObject::_lookupObjId($course_ref_id);
455  $a_item_list_gui,
456  'ilcoursecontentgui',
457  $a_item_data,
458  $a_show_path,
459  ilObjCourse::_lookupAboStatus($course_obj_id),
460  $course_ref_id,
461  $course_obj_id,
462  $this->object->getRefId()
463  );
464  }
465  }
466 
471  public function afterSave(\ilObject $new_object, $a_redirect = true)
472  {
473  global $DIC;
474 
475  $ilUser = $DIC['ilUser'];
476  $ilSetting = $DIC['ilSetting'];
477 
478  $new_object->setRegistrationType(GRP_REGISTRATION_DIRECT);
479  $new_object->update();
480 
481  // check for parent group or course => SORT_INHERIT
482  $sort_mode = ilContainer::SORT_TITLE;
483  if (
484  $GLOBALS['DIC']['tree']->checkForParentType($new_object->getRefId(), 'crs', true) ||
485  $GLOBALS['DIC']['tree']->checkForParentType($new_object->getRefId(), 'grp', true)
486  ) {
487  $sort_mode = ilContainer::SORT_INHERIT;
488  }
489 
490  // Save sorting
491  include_once './Services/Container/classes/class.ilContainerSortingSettings.php';
492  $sort = new ilContainerSortingSettings($new_object->getId());
493  $sort->setSortMode($sort_mode);
494  $sort->update();
495 
496 
497  // Add user as admin and enable notification
498  include_once './Modules/Group/classes/class.ilGroupParticipants.php';
499  $members_obj = ilGroupParticipants::_getInstanceByObjId($new_object->getId());
500  $members_obj->add($ilUser->getId(), IL_GRP_ADMIN);
501  $members_obj->updateNotification($ilUser->getId(), $ilSetting->get('mail_grp_admin_notification', true));
502  $members_obj->updateContact($ilUser->getId(), true);
503 
504  ilUtil::sendSuccess($this->lng->txt("object_added"), true);
505  if ($a_redirect) {
506  $this->ctrl->setParameter($this, "ref_id", $new_object->getRefId());
507  $this->ctrl->redirect($this, 'edit');
508  }
509  }
510 
518  public function editObject(ilPropertyFormGUI $a_form = null)
519  {
520  $this->checkPermission("write");
521 
522  $this->setSubTabs('settings');
523  $this->tabs_gui->setTabActive('settings');
524  $this->tabs_gui->setSubTabActive('grp_settings');
525 
526  if (!$a_form) {
527  $a_form = $this->initForm('edit');
528  }
529 
530  $this->tpl->setVariable('ADM_CONTENT', $a_form->getHTML());
531  }
532 
540  public function updateGroupTypeObject()
541  {
542  include_once './Services/DidacticTemplate/classes/class.ilDidacticTemplateUtils.php';
544  $this->object->getRefId(),
545  (int) $_REQUEST['grp_type']
546  );
547 
548  ilUtil::sendSuccess($this->lng->txt('settings_saved'), true);
549  $this->ctrl->redirect($this, 'edit');
550  }
551 
552 
558  public function updateObject()
559  {
560  $obj_service = $this->getObjectService();
561 
562  $this->checkPermission('write');
563 
564  $form = $this->initForm();
565  if ($form->checkInput()) {
566  // handle group type settings
567  include_once './Services/DidacticTemplate/classes/class.ilDidacticTemplateObjSettings.php';
568  $old_type = ilDidacticTemplateObjSettings::lookupTemplateId($this->object->getRefId());
569 
570  $modified = false;
571  $new_type_info = $form->getInput('didactic_type');
572  if ($new_type_info) {
573  $new_type = explode('_', $form->getInput('didactic_type'));
574  $new_type = $new_type[1];
575 
576  $modified = ($new_type != $old_type);
577  ilLoggerFactory::getLogger('grp')->info('Switched group type from ' . $old_type . ' to ' . $new_type);
578  }
579 
580  $old_autofill = $this->object->hasWaitingListAutoFill();
581 
582  $this->object->setTitle(ilUtil::stripSlashes($form->getInput('title')));
583  $this->object->setDescription(ilUtil::stripSlashes($form->getInput('desc')));
584  $this->object->setGroupType(ilUtil::stripSlashes($form->getInput('grp_type')));
585  $this->object->setRegistrationType(ilUtil::stripSlashes($form->getInput('registration_type')));
586  $this->object->setPassword(ilUtil::stripSlashes($form->getInput('password')));
587  $this->object->enableUnlimitedRegistration((bool) !$form->getInput('reg_limit_time'));
588  $this->object->enableMembershipLimitation((bool) $form->getInput('registration_membership_limited'));
589  $this->object->setMinMembers((int) $form->getInput('registration_min_members'));
590  $this->object->setMaxMembers((int) $form->getInput('registration_max_members'));
591  $this->object->enableRegistrationAccessCode((bool) $form->getInput('reg_code_enabled'));
592  $this->object->setRegistrationAccessCode($form->getInput('reg_code'));
593  $this->object->setViewMode($form->getInput('view_mode'));
594  $this->object->setMailToMembersType((int) $form->getInput('mail_type'));
595  $this->object->setShowMembers((int) $form->getInput('show_members'));
596  $this->object->setAutoNotification((bool) $form->getInput('auto_notification'));
597 
598  // period
599  $grp_period = $form->getItemByPostVar("period");
600 
601 
602  $this->object->setPeriod(
603  $grp_period->getStart(),
604  $grp_period->getEnd()
605  );
606 
607  $reg = $form->getItemByPostVar("reg");
608  if ($reg->getStart() instanceof ilDateTime && $reg->getEnd() instanceof ilDateTime) {
609  $this->object->enableUnlimitedRegistration(false);
610  } else {
611  $this->object->enableUnlimitedRegistration(true);
612  }
613 
614  $this->object->setRegistrationStart($reg->getStart());
615  $this->object->setRegistrationEnd($reg->getEnd());
616 
617  $cancel_end = $form->getItemByPostVar("cancel_end");
618  $this->object->setCancellationEnd($cancel_end->getDate());
619 
620  switch ((int) $_POST['waiting_list']) {
621  case 2:
622  $this->object->enableWaitingList(true);
623  $this->object->setWaitingListAutoFill(true);
624  break;
625 
626  case 1:
627  $this->object->enableWaitingList(true);
628  $this->object->setWaitingListAutoFill(false);
629  break;
630 
631  default:
632  $this->object->enableWaitingList(false);
633  $this->object->setWaitingListAutoFill(false);
634  break;
635  }
636 
637  // title icon visibility
638  $obj_service->commonSettings()->legacyForm($form, $this->object)->saveTitleIconVisibility();
639 
640  // top actions visibility
641  $obj_service->commonSettings()->legacyForm($form, $this->object)->saveTopActionsVisibility();
642 
643  // custom icon
644  $obj_service->commonSettings()->legacyForm($form, $this->object)->saveIcon();
645 
646  // tile image
647  $obj_service->commonSettings()->legacyForm($form, $this->object)->saveTileImage();
648 
649  // list presentation
650  $this->saveListPresentation($form);
651 
652  // update object settings
653  $this->object->update();
654 
655 
656  include_once './Services/Object/classes/class.ilObjectServiceSettingsGUI.php';
658  $this->object->getId(),
659  $form,
660  array(
669  )
670  );
671 
672  // Save sorting
673  $this->saveSortingSettings($form);
674  // if autofill has been activated trigger process
675  if (
676  !$old_autofill &&
677  $this->object->hasWaitingListAutoFill()) {
678  $this->object->handleAutoFill();
679  }
680 
681  // BEGIN ChangeEvents: Record update Object.
682  require_once('Services/Tracking/classes/class.ilChangeEvent.php');
683  global $DIC;
684 
685  $ilUser = $DIC['ilUser'];
687  $this->object->getId(),
688  $ilUser->getId(),
689  'update'
690  );
691  ilChangeEvent::_catchupWriteEvents($this->object->getId(), $ilUser->getId());
692  // END PATCH ChangeEvents: Record update Object.
693  // Update ecs export settings
694  include_once 'Modules/Group/classes/class.ilECSGroupSettings.php';
695  $ecs = new ilECSGroupSettings($this->object);
696  $ecs->handleSettingsUpdate();
697  } else {
698  ilUtil::sendFailure($GLOBALS['DIC']->language()->txt('err_check_input')); // #16975
699 
700  $form->setValuesByPost();
701  $this->editObject($form);
702  return true;
703  }
704 
705  // group type modified
706  if ($modified) {
707  if ($new_type == 0) {
708  $new_type_txt = $GLOBALS['DIC']['lng']->txt('il_grp_status_open');
709  } else {
710  include_once './Services/DidacticTemplate/classes/class.ilDidacticTemplateSetting.php';
711  $dtpl = new ilDidacticTemplateSetting($new_type);
712  $new_type_txt = $dtpl->getPresentationTitle($GLOBALS['DIC']['lng']->getLangKey());
713  }
714 
715 
716  include_once './Services/Utilities/classes/class.ilConfirmationGUI.php';
717  ilUtil::sendQuestion($this->lng->txt('grp_warn_grp_type_changed'));
718  $confirm = new ilConfirmationGUI();
719  $confirm->setFormAction($this->ctrl->getFormAction($this));
720  $confirm->addItem(
721  'grp_type',
722  $new_type,
723  $this->lng->txt('grp_info_new_grp_type') . ': ' . $new_type_txt
724  );
725  $confirm->addButton($this->lng->txt('grp_change_type'), 'updateGroupType');
726  $confirm->setCancel($this->lng->txt('cancel'), 'edit');
727 
728  $this->tpl->setContent($confirm->getHTML());
729  return true;
730  } else {
731  ilUtil::sendSuccess($this->lng->txt("msg_obj_modified"), true);
732  $this->ctrl->redirect($this, 'edit');
733  return true;
734  }
735  }
736 
740  public function editMapSettingsObject()
741  {
742  global $DIC;
743 
744  $ilUser = $DIC['ilUser'];
745  $ilCtrl = $DIC['ilCtrl'];
746  $ilUser = $DIC['ilUser'];
747  $ilAccess = $DIC['ilAccess'];
748 
749  $this->setSubTabs("settings");
750  $this->tabs_gui->setTabActive('settings');
751  $this->tabs_gui->setSubTabActive('grp_map_settings');
752 
753  include_once('./Services/Maps/classes/class.ilMapUtil.php');
754  if (!ilMapUtil::isActivated() ||
755  !$ilAccess->checkAccess("write", "", $this->object->getRefId())) {
756  return;
757  }
758 
759  $latitude = $this->object->getLatitude();
760  $longitude = $this->object->getLongitude();
761  $zoom = $this->object->getLocationZoom();
762 
763  // Get Default settings, when nothing is set
764  if ($latitude == 0 && $longitude == 0 && $zoom == 0) {
766  $latitude = $def["latitude"];
767  $longitude = $def["longitude"];
768  $zoom = $def["zoom"];
769  }
770 
771 
772  include_once("./Services/Form/classes/class.ilPropertyFormGUI.php");
773  $form = new ilPropertyFormGUI();
774  $form->setFormAction($ilCtrl->getFormAction($this));
775 
776  $form->setTitle($this->lng->txt("grp_map_settings"));
777 
778  // enable map
779  $public = new ilCheckboxInputGUI(
780  $this->lng->txt("grp_enable_map"),
781  "enable_map"
782  );
783  $public->setValue("1");
784  $public->setChecked($this->object->getEnableGroupMap());
785  $form->addItem($public);
786 
787  // map location
788  $loc_prop = new ilLocationInputGUI(
789  $this->lng->txt("grp_map_location"),
790  "location"
791  );
792  $loc_prop->setLatitude($latitude);
793  $loc_prop->setLongitude($longitude);
794  $loc_prop->setZoom($zoom);
795  $form->addItem($loc_prop);
796 
797  $form->addCommandButton("saveMapSettings", $this->lng->txt("save"));
798 
799  $this->tpl->setVariable("ADM_CONTENT", $form->getHTML());
800  }
801 
802  public function saveMapSettingsObject()
803  {
804  global $DIC;
805 
806  $ilCtrl = $DIC['ilCtrl'];
807  $ilUser = $DIC['ilUser'];
808 
809  $this->object->setLatitude(ilUtil::stripSlashes($_POST["location"]["latitude"]));
810  $this->object->setLongitude(ilUtil::stripSlashes($_POST["location"]["longitude"]));
811  $this->object->setLocationZoom(ilUtil::stripSlashes($_POST["location"]["zoom"]));
812  $this->object->setEnableGroupMap(ilUtil::stripSlashes($_POST["enable_map"]));
813  $this->object->update();
814 
815  $ilCtrl->redirect($this, "editMapSettings");
816  }
817 
818 
825  public function editInfoObject()
826  {
827  global $DIC;
828 
829  $ilErr = $DIC['ilErr'];
830  $ilAccess = $DIC['ilAccess'];
831 
832  $this->checkPermission('write');
833 
834  $this->setSubTabs('settings');
835  $this->tabs_gui->setTabActive('settings');
836  $this->tabs_gui->setSubTabActive('grp_info_settings');
837 
838  $form = $this->initInfoEditor();
839  $this->tpl->setContent($form->getHTML());
840  }
841 
848  protected function initInfoEditor()
849  {
850  include_once("./Services/Form/classes/class.ilPropertyFormGUI.php");
851  $form = new ilPropertyFormGUI();
852  $form->setFormAction($this->ctrl->getFormAction($this, 'updateInfo'));
853  $form->setTitle($this->lng->txt('grp_general_informations'));
854  $form->addCommandButton('updateInfo', $this->lng->txt('save'));
855  $form->addCommandButton('cancel', $this->lng->txt('cancel'));
856 
857  $area = new ilTextAreaInputGUI($this->lng->txt('grp_information'), 'important');
858  $area->setInfo($this->lng->txt('grp_information_info'));
859  $area->setValue($this->object->getInformation());
860  $area->setRows(8);
861  $area->setCols(80);
862  $form->addItem($area);
863 
864  return $form;
865  }
866 
873  public function updateInfoObject()
874  {
875  $this->checkPermission('manage_members');
876 
877  $this->object->setInformation(ilUtil::stripSlashes($_POST['important']));
878  $this->object->update();
879 
880  ilUtil::sendSuccess($this->lng->txt("settings_saved"));
881  $this->editInfoObject();
882  return true;
883  }
884 
886  public function readMemberData($ids, $selected_columns = null)
887  {
888  include_once('./Services/PrivacySecurity/classes/class.ilPrivacySettings.php');
889  $privacy = ilPrivacySettings::_getInstance();
890 
891  include_once './Services/Tracking/classes/class.ilObjUserTracking.php';
892  $this->show_tracking =
893  (
896  );
897  if ($this->show_tracking) {
898  include_once('./Services/Object/classes/class.ilObjectLP.php');
899  $olp = ilObjectLP::getInstance($this->object->getId());
900  $this->show_tracking = $olp->isActive();
901  }
902 
903  if ($this->show_tracking) {
904  include_once 'Services/Tracking/classes/class.ilLPStatusWrapper.php';
905  $completed = ilLPStatusWrapper::_lookupCompletedForObject($this->object->getId());
906  $in_progress = ilLPStatusWrapper::_lookupInProgressForObject($this->object->getId());
907  $failed = ilLPStatusWrapper::_lookupFailedForObject($this->object->getId());
908  }
909 
910  if ($privacy->enabledGroupAccessTimes()) {
911  include_once('./Services/Tracking/classes/class.ilLearningProgress.php');
912  $progress = ilLearningProgress::_lookupProgressByObjId($this->object->getId());
913  }
914 
915  $do_prtf = (is_array($selected_columns) &&
916  in_array('prtf', $selected_columns) &&
917  is_array($ids));
918  if ($do_prtf) {
919  include_once "Modules/Portfolio/classes/class.ilObjPortfolio.php";
921  $ids,
922  $this->ctrl->getLinkTarget($this, "members")
923  );
924  }
925 
926  $profile_data = ilObjUser::_readUsersProfileData($ids);
927  foreach ($ids as $usr_id) {
928  $name = ilObjUser::_lookupName($usr_id);
929  $tmp_data['firstname'] = $name['firstname'];
930  $tmp_data['lastname'] = $name['lastname'];
931  $tmp_data['login'] = ilObjUser::_lookupLogin($usr_id);
932  $tmp_data['notification'] = $this->object->members_obj->isNotificationEnabled($usr_id) ? 1 : 0;
933  $tmp_data['contact'] = $this->object->members_obj->isContact($usr_id) ? 1 : 0;
934  $tmp_data['usr_id'] = $usr_id;
935  $tmp_data['login'] = ilObjUser::_lookupLogin($usr_id);
936 
937  foreach ((array) $profile_data[$usr_id] as $field => $value) {
938  $tmp_data[$field] = $value;
939  }
940 
941  if ($this->show_tracking) {
942  if (in_array($usr_id, $completed)) {
943  $tmp_data['progress'] = ilLPStatus::LP_STATUS_COMPLETED;
944  } elseif (in_array($usr_id, $in_progress)) {
945  $tmp_data['progress'] = ilLPStatus::LP_STATUS_IN_PROGRESS;
946  } elseif (in_array($usr_id, $failed)) {
947  $tmp_data['progress'] = ilLPStatus::LP_STATUS_FAILED;
948  } else {
949  $tmp_data['progress'] = ilLPStatus::LP_STATUS_NOT_ATTEMPTED;
950  }
951  }
952 
953  if ($privacy->enabledGroupAccessTimes()) {
954  if (isset($progress[$usr_id]['ts']) and $progress[$usr_id]['ts']) {
955  $tmp_data['access_time'] = ilDatePresentation::formatDate(
956  $tmp_date = new ilDateTime($progress[$usr_id]['ts'], IL_CAL_UNIX)
957  );
958  $tmp_data['access_time_unix'] = $tmp_date->get(IL_CAL_UNIX);
959  } else {
960  $tmp_data['access_time'] = $this->lng->txt('no_date');
961  $tmp_data['access_time_unix'] = 0;
962  }
963  }
964 
965  if ($do_prtf) {
966  $tmp_data['prtf'] = $all_prtf[$usr_id];
967  }
968 
969  $members[$usr_id] = $tmp_data;
970  }
971  return $members ? $members : array();
972  }
973 
978  public function leaveObject()
979  {
980  global $DIC;
981 
982  $ilUser = $DIC['ilUser'];
983 
984  $this->checkPermission('leave');
985 
986  $part = ilGroupParticipants::_getInstanceByObjId($this->object->getId());
987  if ($part->isLastAdmin($ilUser->getId())) {
988  ilUtil::sendFailure($this->lng->txt('grp_err_administrator_required'));
989  $this->viewObject();
990  return false;
991  }
992 
993  $this->tabs_gui->setTabActive('grp_btn_unsubscribe');
994 
995  include_once "Services/Utilities/classes/class.ilConfirmationGUI.php";
996  $cgui = new ilConfirmationGUI();
997  $cgui->setHeaderText($this->lng->txt('grp_dismiss_myself'));
998  $cgui->setFormAction($this->ctrl->getFormAction($this));
999  $cgui->setCancel($this->lng->txt("cancel"), "cancel");
1000  $cgui->setConfirm($this->lng->txt("grp_btn_unsubscribe"), "unsubscribe");
1001  $this->tpl->setContent($cgui->getHTML());
1002  }
1003 
1010  public function unsubscribeObject()
1011  {
1012  global $DIC;
1013 
1014  $ilUser = $DIC['ilUser'];
1015  $tree = $DIC['tree'];
1016  $ilCtrl = $DIC['ilCtrl'];
1017 
1018  $this->checkPermission('leave');
1019 
1020  $this->object->members_obj->delete($ilUser->getId());
1021 
1022  include_once './Modules/Group/classes/class.ilGroupMembershipMailNotification.php';
1023  $this->object->members_obj->sendNotification(
1025  $ilUser->getId()
1026  );
1027  $this->object->members_obj->sendNotification(
1029  $ilUser->getId()
1030  );
1031 
1032  ilUtil::sendSuccess($this->lng->txt('grp_msg_membership_annulled'), true);
1033  $ilCtrl->setParameterByClass(
1034  "ilrepositorygui",
1035  "ref_id",
1036  $tree->getParentId($this->object->getRefId())
1037  );
1038  $ilCtrl->redirectByClass("ilrepositorygui", "");
1039  }
1040 
1047  public function addContentTab()
1048  {
1049  $this->tabs_gui->addTab(
1050  "view_content",
1051  $this->lng->txt("content"),
1052  $this->ctrl->getLinkTarget($this, "view")
1053  );
1054  }
1055 
1056 
1057  // get tabs
1058  public function getTabs()
1059  {
1060  global $DIC;
1061 
1062  $rbacsystem = $DIC['rbacsystem'];
1063  $ilUser = $DIC['ilUser'];
1064  $ilAccess = $DIC['ilAccess'];
1065  $lng = $DIC['lng'];
1066  $ilHelp = $DIC['ilHelp'];
1067 
1068  $ilHelp->setScreenIdComponent("grp");
1069 
1070  if ($ilAccess->checkAccess('read', '', $this->ref_id)) {
1071  if ($this->object->isNewsTimelineEffective()) {
1072  if (!$this->object->isNewsTimelineLandingPageEffective()) {
1073  $this->addContentTab();
1074  }
1075  $this->tabs_gui->addTab(
1076  "news_timeline",
1077  $lng->txt("cont_news_timeline_tab"),
1078  $this->ctrl->getLinkTargetByClass("ilnewstimelinegui", "show")
1079  );
1080  if ($this->object->isNewsTimelineLandingPageEffective()) {
1081  $this->addContentTab();
1082  }
1083  } else {
1084  $this->addContentTab();
1085  }
1086  }
1087  if (
1088  $ilAccess->checkAccess('visible', '', $this->ref_id) ||
1089  $ilAccess->checkAccess('join', '', $this->ref_id) ||
1090  $ilAccess->checkAccess('read', '', $this->ref_id)
1091  ) {
1092  $this->tabs_gui->addTarget(
1093  "info_short",
1094  $this->ctrl->getLinkTargetByClass(
1095  array("ilobjgroupgui", "ilinfoscreengui"),
1096  "showSummary"
1097  ),
1098  "infoScreen",
1099  "",
1100  "",
1101  false
1102  );
1103  }
1104 
1105 
1106  if ($ilAccess->checkAccess('write', '', $this->object->getRefId())) {
1107  $this->tabs_gui->addTarget(
1108  "settings",
1109  $this->ctrl->getLinkTarget($this, "edit"),
1110  array("edit", "editMapSettings"),
1111  get_class($this),
1112  ""
1113  );
1114  }
1115 
1116  include_once './Modules/Group/classes/class.ilGroupParticipants.php';
1117  $is_participant = ilGroupParticipants::_isParticipant($this->ref_id, $ilUser->getId());
1118 
1119  // Members
1120  include_once './Modules/Group/classes/class.ilGroupMembershipGUI.php';
1121  $membership_gui = new ilGroupMembershipGUI($this, $this->object);
1122  $membership_gui->addMemberTab($this->tabs_gui, $is_participant);
1123 
1124 
1125  // badges
1126  if ($ilAccess->checkAccess('write', '', $this->ref_id)) {
1127  include_once 'Services/Badge/classes/class.ilBadgeHandler.php';
1128  if (ilBadgeHandler::getInstance()->isObjectActive($this->object->getId())) {
1129  $this->tabs_gui->addTarget(
1130  "obj_tool_setting_badges",
1131  $this->ctrl->getLinkTargetByClass("ilbadgemanagementgui", ""),
1132  "",
1133  "ilbadgemanagementgui"
1134  );
1135  }
1136  }
1137 
1138  // skills
1139  include_once("./Services/Object/classes/class.ilObjectServiceSettingsGUI.php");
1140  if ($ilAccess->checkAccess('read', '', $this->ref_id) && ilContainer::_lookupContainerSetting(
1141  $this->object->getId(),
1143  false
1144  )) {
1145  $this->tabs_gui->addTarget(
1146  "obj_tool_setting_skills",
1147  $this->ctrl->getLinkTargetByClass(array("ilcontainerskillgui", "ilcontskillpresentationgui"), ""),
1148  "",
1149  array("ilcontainerskillgui", "ilcontskillpresentationgui", "ilcontskilladmingui")
1150  );
1151  }
1152 
1153  // learning progress
1154  include_once './Services/Tracking/classes/class.ilLearningProgressAccess.php';
1155  if (ilLearningProgressAccess::checkAccess($this->object->getRefId(), $is_participant)) {
1156  $this->tabs_gui->addTarget(
1157  'learning_progress',
1158  $this->ctrl->getLinkTargetByClass(array('ilobjgroupgui','illearningprogressgui'), ''),
1159  '',
1160  array('illplistofobjectsgui','illplistofsettingsgui','illearningprogressgui','illplistofprogressgui')
1161  );
1162  }
1163 
1164  // meta data
1165  if ($ilAccess->checkAccess('write', '', $this->ref_id)) {
1166  $md_gui = new ilObjectMetaDataGUI($this->object);
1167  $tab_link = $md_gui->getTab();
1168  if ($tab_link !== null) {
1169  $this->tabs_gui->addTab(
1170  'meta_data',
1171  $this->lng->txt('meta_data'),
1172  $tab_link,
1173  '',
1174  'ilObjectMetaDataGUI'
1175  );
1176  }
1177  }
1178 
1179 
1180  if ($ilAccess->checkAccess('write', '', $this->object->getRefId())) {
1181  $this->tabs_gui->addTarget(
1182  'export',
1183  $this->ctrl->getLinkTargetByClass('ilexportgui', ''),
1184  'export',
1185  'ilexportgui'
1186  );
1187  }
1188 
1189  // parent tabs (all container: edit_permission, clipboard, trash
1190  parent::getTabs();
1191 
1192  if ($ilAccess->checkAccess('join', '', $this->object->getRefId()) and
1193  !$this->object->members_obj->isAssigned($ilUser->getId())) {
1194  include_once './Modules/Group/classes/class.ilGroupWaitingList.php';
1195  if (ilGroupWaitingList::_isOnList($ilUser->getId(), $this->object->getId())) {
1196  $this->tabs_gui->addTab(
1197  'leave',
1198  $this->lng->txt('membership_leave'),
1199  $this->ctrl->getLinkTargetByClass('ilgroupregistrationgui', 'show', '')
1200  );
1201  } else {
1202  $this->tabs_gui->addTarget(
1203  "join",
1204  $this->ctrl->getLinkTargetByClass('ilgroupregistrationgui', "show"),
1205  'show',
1206  ""
1207  );
1208  }
1209  }
1210  if ($ilAccess->checkAccess('leave', '', $this->object->getRefId()) and
1211  $this->object->members_obj->isMember($ilUser->getId())) {
1212  $this->tabs_gui->addTarget(
1213  "grp_btn_unsubscribe",
1214  $this->ctrl->getLinkTarget($this, "leave"),
1215  '',
1216  ""
1217  );
1218  }
1219  }
1220 
1226  public function infoScreenObject()
1227  {
1228  $this->ctrl->setCmd("showSummary");
1229  $this->ctrl->setCmdClass("ilinfoscreengui");
1230  $this->infoScreen();
1231  }
1232 
1236  public function infoScreen()
1237  {
1238  global $DIC;
1239 
1240  $rbacsystem = $DIC['rbacsystem'];
1241  $ilUser = $DIC['ilUser'];
1242  $ilSetting = $DIC['ilSetting'];
1243 
1244  $this->tabs_gui->setTabActive('info_short');
1245 
1246  if (!$this->checkPermissionBool('read')) {
1247  $this->checkPermission('visible');
1248  }
1249 
1251  $this->object->getId(),
1252  $this->object->getId(),
1253  'grp'
1254  );
1255 
1256  include_once("./Services/InfoScreen/classes/class.ilInfoScreenGUI.php");
1257  $info = new ilInfoScreenGUI($this);
1258 
1259  if (strlen($this->object->getInformation())) {
1260  $info->addSection($this->lng->txt('grp_general_informations'));
1261  $info->addProperty($this->lng->txt('grp_information'), nl2br(
1262  ilUtil::makeClickable($this->object->getInformation(), true)
1263  ));
1264  }
1265 
1266  $info->enablePrivateNotes();
1267  $info->enableLearningProgress(true);
1268 
1269  $record_gui = new ilAdvancedMDRecordGUI(ilAdvancedMDRecordGUI::MODE_INFO, 'grp', $this->object->getId());
1270  $record_gui->setInfoObject($info);
1271  $record_gui->parse();
1272 
1273  // meta data
1274  $info->addMetaDataSections($this->object->getId(), 0, $this->object->getType());
1275 
1276 
1277  // support contacts
1278  $parts = ilParticipants::getInstance($this->object->getRefId());
1279  $contacts = $parts->getContacts();
1280  if (count($contacts) > 0) {
1281  $info->addSection($this->lng->txt("grp_mem_contacts"));
1282  foreach ($contacts as $c) {
1283  $pgui = new ilPublicUserProfileGUI($c);
1284  $pgui->setBackUrl($this->ctrl->getLinkTargetByClass("ilinfoscreengui"));
1285  $pgui->setEmbedded(true);
1286  $info->addProperty("", $pgui->getHTML());
1287  }
1288  }
1289 
1290 
1291  $info->addSection($this->lng->txt('group_registration'));
1292  $info->showLDAPRoleGroupMappingInfo();
1293 
1294  if (!$this->object->isRegistrationEnabled()) {
1295  $info->addProperty(
1296  $this->lng->txt('group_registration_mode'),
1297  $this->lng->txt('grp_reg_deac_info_screen')
1298  );
1299  } else {
1300  switch ($this->object->getRegistrationType()) {
1302  $info->addProperty(
1303  $this->lng->txt('group_registration_mode'),
1304  $this->lng->txt('grp_reg_direct_info_screen')
1305  );
1306  break;
1307 
1309  $info->addProperty(
1310  $this->lng->txt('group_registration_mode'),
1311  $this->lng->txt('grp_reg_req_info_screen')
1312  );
1313  break;
1314 
1316  $info->addProperty(
1317  $this->lng->txt('group_registration_mode'),
1318  $this->lng->txt('grp_reg_passwd_info_screen')
1319  );
1320  break;
1321 
1322  }
1323  /*
1324  $info->addProperty($this->lng->txt('group_registration_time'),
1325  ilDatePresentation::formatPeriod(
1326  $this->object->getRegistrationStart(),
1327  $this->object->getRegistrationEnd()));
1328  */
1329  if ($this->object->isRegistrationUnlimited()) {
1330  $info->addProperty(
1331  $this->lng->txt('group_registration_time'),
1332  $this->lng->txt('grp_registration_unlimited')
1333  );
1334  } elseif ($this->object->getRegistrationStart()->getUnixTime() < time()) {
1335  $info->addProperty(
1336  $this->lng->txt("group_registration_time"),
1337  $this->lng->txt('cal_until') . ' ' .
1338  ilDatePresentation::formatDate($this->object->getRegistrationEnd())
1339  );
1340  } elseif ($this->object->getRegistrationStart()->getUnixTime() >= time()) {
1341  $info->addProperty(
1342  $this->lng->txt("group_registration_time"),
1343  $this->lng->txt('cal_from') . ' ' .
1344  ilDatePresentation::formatDate($this->object->getRegistrationStart())
1345  );
1346  }
1347  if ($this->object->isMembershipLimited()) {
1348  if ($this->object->getMinMembers()) {
1349  $info->addProperty(
1350  $this->lng->txt("mem_min_users"),
1351  $this->object->getMinMembers()
1352  );
1353  }
1354  if ($this->object->getMaxMembers()) {
1355  include_once './Modules/Group/classes/class.ilObjGroupAccess.php';
1356  $reg_info = ilObjGroupAccess::lookupRegistrationInfo($this->object->getId());
1357 
1358  $info->addProperty(
1359  $this->lng->txt('mem_free_places'),
1360  $reg_info['reg_info_free_places']
1361  );
1362  }
1363  }
1364 
1365  if ($this->object->getCancellationEnd()) {
1366  $info->addProperty(
1367  $this->lng->txt('grp_cancellation_end'),
1368  ilDatePresentation::formatDate($this->object->getCancellationEnd())
1369  );
1370  }
1371  }
1372 
1373  if ($this->object->getStart()) {
1374  $info->addProperty(
1375  $this->lng->txt('grp_period'),
1377  $this->object->getStart(),
1378  $this->object->getEnd()
1379  )
1380  );
1381  }
1382 
1383 
1384  // Confirmation
1385  include_once('Services/PrivacySecurity/classes/class.ilPrivacySettings.php');
1386  $privacy = ilPrivacySettings::_getInstance();
1387 
1388  include_once('Modules/Course/classes/Export/class.ilCourseDefinedFieldDefinition.php');
1389  if ($privacy->groupConfirmationRequired() or ilCourseDefinedFieldDefinition::_getFields($this->object->getId()) or $privacy->enabledGroupExport()) {
1390  include_once('Services/PrivacySecurity/classes/class.ilExportFieldsInfo.php');
1391 
1392  $field_info = ilExportFieldsInfo::_getInstanceByType($this->object->getType());
1393 
1394  $this->lng->loadLanguageModule('ps');
1395  $info->addSection($this->lng->txt('grp_user_agreement_info'));
1396  $info->addProperty($this->lng->txt('ps_export_data'), $field_info->exportableFieldsToInfoString());
1397 
1398  if ($fields = ilCourseDefinedFieldDefinition::_fieldsToInfoString($this->object->getId())) {
1399  $info->addProperty($this->lng->txt('ps_grp_user_fields'), $fields);
1400  }
1401  }
1402 
1403 
1404  // forward the command
1405  $this->ctrl->forwardCommand($info);
1406  }
1407 
1411  public function saveNotificationObject()
1412  {
1413  include_once "Services/Membership/classes/class.ilMembershipNotifications.php";
1414  $noti = new ilMembershipNotifications($this->ref_id);
1415  if ($noti->canCurrentUserEdit()) {
1416  if ((bool) $_REQUEST["grp_ntf"]) {
1417  $noti->activateUser();
1418  } else {
1419  $noti->deactivateUser();
1420  }
1421  }
1422  ilUtil::sendSuccess($this->lng->txt("settings_saved"), true);
1423  $this->ctrl->redirect($this, "");
1424  }
1425 
1429  protected function membersObject()
1430  {
1431  $GLOBALS['DIC']['ilCtrl']->redirectByClass('ilgroupmembershipgui');
1432  }
1433 
1434 
1438  public static function _goto($a_target, $a_add = "")
1439  {
1440  global $DIC;
1441 
1442  $ilAccess = $DIC['ilAccess'];
1443  $ilErr = $DIC['ilErr'];
1444  $lng = $DIC['lng'];
1445  $ilUser = $DIC['ilUser'];
1446 
1447  include_once './Services/Membership/classes/class.ilMembershipRegistrationCodeUtils.php';
1448  if (substr($a_add, 0, 5) == 'rcode') {
1449  if ($ilUser->getId() == ANONYMOUS_USER_ID) {
1450  // Redirect to login for anonymous
1452  "login.php?target=" . $_GET["target"] . "&cmd=force_login&lang=" .
1453  $ilUser->getCurrentLanguage()
1454  );
1455  }
1456 
1457  // Redirects to target location after assigning user to group
1459  $a_target,
1461  substr($a_add, 5)
1462  );
1463  }
1464 
1465  if ($a_add == "mem" && $ilAccess->checkAccess("manage_members", "", $a_target)) {
1466  ilObjectGUI::_gotoRepositoryNode($a_target, "members");
1467  }
1468 
1469  if ($ilAccess->checkAccess("read", "", $a_target)) {
1471  } else {
1472  // to do: force flat view
1473  if ($ilAccess->checkAccess("visible", "", $a_target)) {
1474  ilObjectGUI::_gotoRepositoryNode($a_target, "infoScreenGoto");
1475  } else {
1476  if ($ilAccess->checkAccess("read", "", ROOT_FOLDER_ID)) {
1477  ilUtil::sendFailure(sprintf(
1478  $lng->txt("msg_no_perm_read_item"),
1480  ), true);
1482  }
1483  }
1484  }
1485  $ilErr->raiseError($lng->txt("msg_no_perm_read"), $ilErr->FATAL);
1486  }
1487 
1488 
1496  public function initForm($a_mode = 'edit', $a_omit_form_action = false)
1497  {
1498  global $DIC;
1499 
1500  $obj_service = $this->getObjectService();
1501 
1502  $tree = $DIC['tree'];
1503 
1504  include_once("./Services/Form/classes/class.ilPropertyFormGUI.php");
1505 
1506  $form = new ilPropertyFormGUI();
1507 
1508  if (!$a_omit_form_action) {
1509  switch ($a_mode) {
1510  case 'edit':
1511  $form->setFormAction($this->ctrl->getFormAction($this, 'update'));
1512  break;
1513 
1514  default:
1515  $form->setTableWidth('600px');
1516  $form->setFormAction($this->ctrl->getFormAction($this, 'save'));
1517  break;
1518  }
1519  }
1520 
1521  // title/description
1522  $this->initFormTitleDescription($form);
1523 
1524  $form = $this->initDidacticTemplate($form);
1525 
1526  if ($a_mode == 'edit') {
1527  // group period
1528  $cdur = new ilDateDurationInputGUI($this->lng->txt('grp_period'), 'period');
1529  $this->lng->loadLanguageModule('mem');
1530  $cdur->enableToggleFullTime(
1531  $this->lng->txt('mem_period_without_time'),
1532  !$this->object->getStartTimeIndication()
1533  );
1534  $cdur->setShowTime(true);
1535  $cdur->setInfo($this->lng->txt('grp_period_info'));
1536  $cdur->setStart($this->object->getStart());
1537  $cdur->setEnd($this->object->getEnd());
1538  $form->addItem($cdur);
1539 
1540  // Group registration ############################################################
1541  $pres = new ilFormSectionHeaderGUI();
1542  $pres->setTitle($this->lng->txt('grp_setting_header_registration'));
1543  $form->addItem($pres);
1544 
1545  // Registration type
1546  $reg_type = new ilRadioGroupInputGUI($this->lng->txt('group_registration_mode'), 'registration_type');
1547  $reg_type->setValue($this->object->getRegistrationType());
1548 
1549  $opt_dir = new ilRadioOption($this->lng->txt('grp_reg_direct'), GRP_REGISTRATION_DIRECT);#$this->lng->txt('grp_reg_direct_info'));
1550  $reg_type->addOption($opt_dir);
1551 
1552  $opt_pass = new ilRadioOption($this->lng->txt('grp_pass_request'), GRP_REGISTRATION_PASSWORD);
1553  $pass = new ilTextInputGUI($this->lng->txt("password"), 'password');
1554  $pass->setRequired(true);
1555  $pass->setInfo($this->lng->txt('grp_reg_password_info'));
1556  $pass->setValue($this->object->getPassword());
1557  $pass->setSize(32);
1558  $pass->setMaxLength(32);
1559  $opt_pass->addSubItem($pass);
1560  $reg_type->addOption($opt_pass);
1561 
1562  $opt_req = new ilRadioOption($this->lng->txt('grp_reg_request'), GRP_REGISTRATION_REQUEST, $this->lng->txt('grp_reg_request_info'));
1563  $reg_type->addOption($opt_req);
1564 
1565  $opt_deact = new ilRadioOption($this->lng->txt('grp_reg_no_selfreg'), GRP_REGISTRATION_DEACTIVATED, $this->lng->txt('grp_reg_disabled_info'));
1566  $reg_type->addOption($opt_deact);
1567 
1568  // Registration codes
1569  $reg_code = new ilCheckboxInputGUI($this->lng->txt('grp_reg_code'), 'reg_code_enabled');
1570  $reg_code->setChecked($this->object->isRegistrationAccessCodeEnabled());
1571  $reg_code->setValue(1);
1572  $reg_code->setInfo($this->lng->txt('grp_reg_code_enabled_info'));
1573  $form->addItem($reg_type);
1574 
1575  // Registration codes
1576  if (!$this->object->getRegistrationAccessCode()) {
1577  include_once './Services/Membership/classes/class.ilMembershipRegistrationCodeUtils.php';
1578  $this->object->setRegistrationAccessCode(ilMembershipRegistrationCodeUtils::generateCode());
1579  }
1580  $reg_link = new ilHiddenInputGUI('reg_code');
1581  $reg_link->setValue($this->object->getRegistrationAccessCode());
1582  $form->addItem($reg_link);
1583 
1584  $link = new ilCustomInputGUI($this->lng->txt('grp_reg_code_link'));
1585  include_once './Services/Link/classes/class.ilLink.php';
1586  $val = ilLink::_getLink($this->object->getRefId(), $this->object->getType(), array(), '_rcode' . $this->object->getRegistrationAccessCode());
1587  $link->setHTML('<span class="small">' . $val . '</span>');
1588  $reg_code->addSubItem($link);
1589  $form->addItem($reg_code);
1590 
1591  // time limit
1592  $this->lng->loadLanguageModule('dateplaner');
1593  include_once './Services/Form/classes/class.ilDateDurationInputGUI.php';
1594  $dur = new ilDateDurationInputGUI($this->lng->txt('grp_reg_limited'), 'reg');
1595  $dur->setShowTime(true);
1596  $dur->setStart($this->object->getRegistrationStart());
1597  $dur->setEnd($this->object->getRegistrationEnd());
1598  $form->addItem($dur);
1599 
1600  // cancellation limit
1601  $cancel = new ilDateTimeInputGUI($this->lng->txt('grp_cancellation_end'), 'cancel_end');
1602  $cancel->setInfo($this->lng->txt('grp_cancellation_end_info'));
1603  $cancel->setDate($this->object->getCancellationEnd());
1604  $form->addItem($cancel);
1605 
1606  // max member
1607  $lim = new ilCheckboxInputGUI($this->lng->txt('reg_grp_max_members_short'), 'registration_membership_limited');
1608  $lim->setValue(1);
1609  // $lim->setOptionTitle($this->lng->txt('reg_grp_max_members'));
1610  $lim->setChecked($this->object->isMembershipLimited());
1611 
1612  $min = new ilTextInputGUI($this->lng->txt('reg_grp_min_members'), 'registration_min_members');
1613  $min->setSize(3);
1614  $min->setMaxLength(4);
1615  $min->setValue($this->object->getMinMembers() ? $this->object->getMinMembers() : '');
1616  $min->setInfo($this->lng->txt('grp_subscription_min_members_info'));
1617  $lim->addSubItem($min);
1618 
1619  $max = new ilTextInputGUI($this->lng->txt('reg_grp_max_members'), 'registration_max_members');
1620  $max->setValue($this->object->getMaxMembers() ? $this->object->getMaxMembers() : '');
1621  //$max->setTitle($this->lng->txt('members'));
1622  $max->setSize(3);
1623  $max->setMaxLength(4);
1624  $max->setInfo($this->lng->txt('grp_reg_max_members_info'));
1625  $lim->addSubItem($max);
1626 
1627  /*
1628  $wait = new ilCheckboxInputGUI($this->lng->txt('grp_waiting_list'),'waiting_list');
1629  $wait->setValue(1);
1630  //$wait->setOptionTitle($this->lng->txt('grp_waiting_list'));
1631  $wait->setInfo($this->lng->txt('grp_waiting_list_info'));
1632  $wait->setChecked($this->object->isWaitingListEnabled() ? true : false);
1633  $lim->addSubItem($wait);
1634  $form->addItem($lim);
1635  */
1636 
1637  $wait = new ilRadioGroupInputGUI($this->lng->txt('grp_waiting_list'), 'waiting_list');
1638 
1639  $option = new ilRadioOption($this->lng->txt('none'), 0);
1640  $wait->addOption($option);
1641 
1642  $option = new ilRadioOption($this->lng->txt('grp_waiting_list_no_autofill'), 1);
1643  $option->setInfo($this->lng->txt('grp_waiting_list_info'));
1644  $wait->addOption($option);
1645 
1646  $option = new ilRadioOption($this->lng->txt('grp_waiting_list_autofill'), 2);
1647  $option->setInfo($this->lng->txt('grp_waiting_list_autofill_info'));
1648  $wait->addOption($option);
1649 
1650  if ($this->object->hasWaitingListAutoFill()) {
1651  $wait->setValue(2);
1652  } elseif ($this->object->isWaitingListEnabled()) {
1653  $wait->setValue(1);
1654  }
1655 
1656  $lim->addSubItem($wait);
1657 
1658  $form->addItem($lim);
1659 
1660 
1661  // Group presentation
1662  $parent_membership_ref_id = 0;
1663  $hasParentMembership =
1664  (
1665  $parent_membership_ref_id = $tree->checkForParentType($this->object->getRefId(), 'crs', true)
1666  );
1667 
1668  $pres = new ilFormSectionHeaderGUI();
1669  $pres->setTitle($this->lng->txt('grp_setting_header_presentation'));
1670  $form->addItem($pres);
1671 
1672  // title and icon visibility
1673  $form = $obj_service->commonSettings()->legacyForm($form, $this->object)->addTitleIconVisibility();
1674 
1675  // top actions visibility
1676  $form = $obj_service->commonSettings()->legacyForm($form, $this->object)->addTopActionsVisibility();
1677 
1678  // custom icon
1679  $form = $obj_service->commonSettings()->legacyForm($form, $this->object)->addIcon();
1680 
1681  // tile image
1682  $form = $obj_service->commonSettings()->legacyForm($form, $this->object)->addTileImage();
1683 
1684  // list presentation
1685  $form = $this->initListPresentationForm($form);
1686 
1687 
1688  // presentation type
1689  $view_type = new ilRadioGroupInputGUI($this->lng->txt('grp_presentation_type'), 'view_mode');
1690  if ($hasParentMembership) {
1691  $parent_view_mode = ilObjCourseAccess::_lookupViewMode(ilObject::_lookupObjId($parent_membership_ref_id));
1692  $course_view_mode = '';
1693  switch ($parent_view_mode) {
1695  $course_view_mode = ': ' . $this->lng->txt('cntr_view_sessions');
1696  break;
1697 
1699  $course_view_mode = ': ' . $this->lng->txt('cntr_view_simple');
1700  break;
1701 
1703  $course_view_mode = ': ' . $this->lng->txt('cntr_view_by_type');
1704  break;
1705  }
1706  if ($course_view_mode) {
1707  $opt = new ilRadioOption($this->lng->txt('grp_view_inherit') . $course_view_mode, ilContainer::VIEW_INHERIT);
1708  $opt->setInfo($this->lng->txt('grp_view_inherit_info'));
1709  $view_type->addOption($opt);
1710  }
1711  }
1712 
1713  if ($hasParentMembership && ilObjGroup::lookupViewMode($this->object->getId()) == ilContainer::VIEW_INHERIT) {
1714  $view_type->setValue(ilContainer::VIEW_INHERIT);
1715  } else {
1716  $view_type->setValue(ilObjGroup::lookupViewMode($this->object->getId()));
1717  }
1718 
1719  $opt = new ilRadioOption($this->lng->txt('cntr_view_sessions'), ilContainer::VIEW_SESSIONS);
1720  $opt->setInfo($this->lng->txt('cntr_view_info_sessions'));
1721  $view_type->addOption($opt);
1722 
1723  $opt = new ilRadioOption($this->lng->txt('cntr_view_simple'), ilContainer::VIEW_SIMPLE);
1724  $opt->setInfo($this->lng->txt('grp_view_info_simple'));
1725  $view_type->addOption($opt);
1726 
1727  $opt = new ilRadioOption($this->lng->txt('cntr_view_by_type'), ilContainer::VIEW_BY_TYPE);
1728  $opt->setInfo($this->lng->txt('grp_view_info_by_type'));
1729  $view_type->addOption($opt);
1730  $form->addItem($view_type);
1731 
1732 
1733  // Sorting
1734  $sorting_settings = array();
1735  if ($hasParentMembership) {
1736  $sorting_settings[] = ilContainer::SORT_INHERIT;
1737  }
1738  $sorting_settings[] = ilContainer::SORT_TITLE;
1739  $sorting_settings[] = ilContainer::SORT_CREATION;
1740  $sorting_settings[] = ilContainer::SORT_MANUAL;
1741  $this->initSortingForm($form, $sorting_settings);
1742 
1743  // additional features
1744  $feat = new ilFormSectionHeaderGUI();
1745  $feat->setTitle($this->lng->txt('obj_features'));
1746  $form->addItem($feat);
1747 
1748  include_once './Services/Object/classes/class.ilObjectServiceSettingsGUI.php';
1750  $this->object->getId(),
1751  $form,
1752  array(
1761  )
1762  );
1763 
1764 
1765  $mem = new ilCheckboxInputGUI($this->lng->txt('grp_show_members'), 'show_members');
1766  $mem->setChecked($this->object->getShowMembers());
1767  $mem->setInfo($this->lng->txt('grp_show_members_info'));
1768  $form->addItem($mem);
1769 
1770  // Show members type
1771  $mail_type = new ilRadioGroupInputGUI($this->lng->txt('grp_mail_type'), 'mail_type');
1772  $mail_type->setValue($this->object->getMailToMembersType());
1773 
1774  $mail_tutors = new ilRadioOption(
1775  $this->lng->txt('grp_mail_tutors_only'),
1777  $this->lng->txt('grp_mail_tutors_only_info')
1778  );
1779  $mail_type->addOption($mail_tutors);
1780 
1781  $mail_all = new ilRadioOption(
1782  $this->lng->txt('grp_mail_all'),
1784  $this->lng->txt('grp_mail_all_info')
1785  );
1786  $mail_type->addOption($mail_all);
1787  $form->addItem($mail_type);
1788 
1789  // Self notification
1790  $not = new ilCheckboxInputGUI($this->lng->txt('grp_auto_notification'), 'auto_notification');
1791  $not->setValue(1);
1792  $not->setInfo($this->lng->txt('grp_auto_notification_info'));
1793  $not->setChecked($this->object->getAutoNotification());
1794  $form->addItem($not);
1795  }
1796 
1797  switch ($a_mode) {
1798  case 'create':
1799  $form->setTitle($this->lng->txt('grp_new'));
1800  $form->setTitleIcon(ilUtil::getImagePath('icon_grp.svg'));
1801 
1802  $form->addCommandButton('save', $this->lng->txt('grp_new'));
1803  $form->addCommandButton('cancel', $this->lng->txt('cancel'));
1804  break;
1805 
1806  case 'edit':
1807  $form->setTitle($this->lng->txt('grp_edit'));
1808  $form->setTitleIcon(ilUtil::getImagePath('icon_grp.svg'));
1809 
1810  // Edit ecs export settings
1811  include_once 'Modules/Group/classes/class.ilECSGroupSettings.php';
1812  $ecs = new ilECSGroupSettings($this->object);
1813  $ecs->addSettingsToForm($form, 'grp');
1814 
1815  $form->addCommandButton('update', $this->lng->txt('save'));
1816  $form->addCommandButton('cancel', $this->lng->txt('cancel'));
1817  break;
1818  }
1819  return $form;
1820  }
1821 
1829  protected function setSubTabs($a_tab)
1830  {
1831  global $DIC;
1832 
1833  $rbacsystem = $DIC['rbacsystem'];
1834  $ilUser = $DIC['ilUser'];
1835  $ilAccess = $DIC['ilAccess'];
1836 
1837  switch ($a_tab) {
1838 
1839  case 'settings':
1840  $this->tabs_gui->addSubTabTarget(
1841  "grp_settings",
1842  $this->ctrl->getLinkTarget($this, 'edit'),
1843  "edit",
1844  get_class($this)
1845  );
1846 
1847  $this->tabs_gui->addSubTabTarget(
1848  "grp_info_settings",
1849  $this->ctrl->getLinkTarget($this, 'editInfo'),
1850  "editInfo",
1851  get_class($this)
1852  );
1853 
1854  include_once("./Services/Maps/classes/class.ilMapUtil.php");
1855  if (ilMapUtil::isActivated()) {
1856  $this->tabs_gui->addSubTabTarget(
1857  "grp_map_settings",
1858  $this->ctrl->getLinkTarget($this, 'editMapSettings'),
1859  "editMapSettings",
1860  get_class($this)
1861  );
1862  }
1863 
1864  $this->tabs_gui->addSubTabTarget(
1865  'groupings',
1866  $this->ctrl->getLinkTargetByClass('ilobjcoursegroupinggui', 'listGroupings'),
1867  'listGroupings',
1868  get_class($this)
1869  );
1870 
1871  include_once('Services/PrivacySecurity/classes/class.ilPrivacySettings.php');
1872  include_once('Modules/Course/classes/Export/class.ilCourseDefinedFieldDefinition.php');
1873  // only show if export permission is granted
1874  if (ilPrivacySettings::_getInstance()->checkExportAccess($this->object->getRefId()) or ilCourseDefinedFieldDefinition::_hasFields($this->object->getId())) {
1875  $this->tabs_gui->addSubTabTarget(
1876  'grp_custom_user_fields',
1877  $this->ctrl->getLinkTargetByClass('ilobjectcustomuserfieldsgui'),
1878  '',
1879  'ilobjectcustomuserfieldsgui'
1880  );
1881  }
1882 
1883  // news settings
1884  if ($this->object->getUseNews()) {
1885  $this->tabs_gui->addSubTab(
1886  'obj_news_settings',
1887  $this->lng->txt("cont_news_settings"),
1888  $this->ctrl->getLinkTargetByClass('ilcontainernewssettingsgui')
1889  );
1890  }
1891 
1892  $lti_settings = new ilLTIProviderObjectSettingGUI($this->object->getRefId());
1893  if ($lti_settings->hasSettingsAccess()) {
1894  $this->tabs_gui->addSubTabTarget(
1895  'lti_provider',
1896  $this->ctrl->getLinkTargetByClass(ilLTIProviderObjectSettingGUI::class)
1897  );
1898  }
1899 
1900  $this->tabs_gui->addSubTabTarget(
1901  "obj_multilinguality",
1902  $this->ctrl->getLinkTargetByClass("ilobjecttranslationgui", ""),
1903  "",
1904  "ilobjecttranslationgui"
1905  );
1906 
1907 
1908  break;
1909 
1910 
1911  }
1912  }
1913 
1920  private function checkAgreement()
1921  {
1922  global $DIC;
1923 
1924  $ilUser = $DIC['ilUser'];
1925  $ilAccess = $DIC['ilAccess'];
1926 
1927  if ($ilAccess->checkAccess('write', '', $this->object->getRefId())) {
1928  return true;
1929  }
1930 
1931  // Disable aggrement if is not member of group
1932  if (!$this->object->members_obj->isAssigned($ilUser->getId())) {
1933  return true;
1934  }
1935 
1936  include_once './Services/Container/classes/class.ilMemberViewSettings.php';
1937  if (ilMemberViewSettings::getInstance()->isActive()) {
1938  return true;
1939  }
1940 
1941  include_once('Services/PrivacySecurity/classes/class.ilPrivacySettings.php');
1942  include_once('Services/Membership/classes/class.ilMemberAgreement.php');
1943  $privacy = ilPrivacySettings::_getInstance();
1944 
1945  // Check agreement
1946  if (($privacy->groupConfirmationRequired() or ilCourseDefinedFieldDefinition::_hasFields($this->object->getId()))
1947  and !ilMemberAgreement::_hasAccepted($ilUser->getId(), $this->object->getId())) {
1948  return false;
1949  }
1950  // Check required fields
1951  include_once('Modules/Course/classes/Export/class.ilCourseUserData.php');
1952  if (!ilCourseUserData::_checkRequired($ilUser->getId(), $this->object->getId())) {
1953  return false;
1954  }
1955  return true;
1956  }
1957 
1958 
1963  public function prepareOutput($a_show_subobjects = true)
1964  {
1965  global $DIC;
1966 
1967  $rbacsystem = $DIC['rbacsystem'];
1968  if (!$this->getCreationMode()) {
1969  /*
1970  include_once './Services/Container/classes/class.ilMemberViewSettings.php';
1971  $settings = ilMemberViewSettings::getInstance();
1972  if($settings->isActive() and $settings->getContainer() != $this->object->getRefId())
1973  {
1974  $settings->setContainer($this->object->getRefId());
1975  $rbacsystem->initMemberView();
1976  }
1977  */
1978  }
1979  parent::prepareOutput($a_show_subobjects);
1980  }
1981 
1986  public function createMailSignature()
1987  {
1988  $link = chr(13) . chr(10) . chr(13) . chr(10);
1989  $link .= $this->lng->txt('grp_mail_permanent_link');
1990  $link .= chr(13) . chr(10) . chr(13) . chr(10);
1991  include_once 'Services/Link/classes/class.ilLink.php';
1992  $link .= ilLink::_getLink($this->object->getRefId());
1993  return rawurlencode(base64_encode($link));
1994  }
1995 
1996  protected function initHeaderAction($a_sub_type = null, $a_sub_id = null)
1997  {
1998  global $DIC;
1999 
2000  $ilSetting = $DIC['ilSetting'];
2001  $ilUser = $DIC['ilUser'];
2002 
2003  $lg = parent::initHeaderAction($a_sub_type, $a_sub_id);
2004 
2005  include_once('./Modules/Group/classes/class.ilGroupParticipants.php');
2006  if (ilGroupParticipants::_isParticipant($this->ref_id, $ilUser->getId())) {
2007  include_once "Services/Membership/classes/class.ilMembershipNotifications.php";
2008  if (ilMembershipNotifications::isActiveForRefId($this->ref_id)) {
2009  $noti = new ilMembershipNotifications($this->ref_id);
2010  if (!$noti->isCurrentUserActive()) {
2011  $lg->addHeaderIcon(
2012  "not_icon",
2013  ilUtil::getImagePath("notification_off.svg"),
2014  $this->lng->txt("grp_notification_deactivated")
2015  );
2016 
2017  $this->ctrl->setParameter($this, "grp_ntf", 1);
2018  $caption = "grp_activate_notification";
2019  } else {
2020  $lg->addHeaderIcon(
2021  "not_icon",
2022  ilUtil::getImagePath("notification_on.svg"),
2023  $this->lng->txt("grp_notification_activated")
2024  );
2025 
2026  $this->ctrl->setParameter($this, "grp_ntf", 0);
2027  $caption = "grp_deactivate_notification";
2028  }
2029 
2030  if ($noti->canCurrentUserEdit()) {
2031  $lg->addCustomCommand(
2032  $this->ctrl->getLinkTarget($this, "saveNotification"),
2033  $caption
2034  );
2035  }
2036 
2037  $this->ctrl->setParameter($this, "grp_ntf", "");
2038  }
2039  }
2040 
2041  return $lg;
2042  }
2043 
2044 
2049  public function addCustomData($a_data)
2050  {
2051  // object defined fields
2052  include_once('Modules/Course/classes/Export/class.ilCourseUserData.php');
2053  $odfs = ilCourseUserData::_getValuesByObjId($this->object->getId());
2054 
2055  $res_data = array();
2056  foreach ($a_data as $usr_id => $user_data) {
2057  $res_data[$usr_id] = $user_data;
2058 
2059  // udf
2060  include_once './Services/User/classes/class.ilUserDefinedData.php';
2061  $udf_data = new ilUserDefinedData($usr_id);
2062  foreach ($udf_data->getAll() as $field => $value) {
2063  list($f, $field_id) = explode('_', $field);
2064  $res_data[$usr_id]['udf_' . $field_id] = (string) $value;
2065  }
2066 
2067  foreach ((array) $odfs[$usr_id] as $cdf_field => $cdf_value) {
2068  $res_data[$usr_id]['cdf_' . $cdf_field] = (string) $cdf_value;
2069  }
2070  }
2071 
2072  return $res_data;
2073  }
2074 
2079  public function getLocalRoles()
2080  {
2081  $local_roles = $this->object->getLocalGroupRoles(false);
2082  $grp_member = $this->object->getDefaultMemberRole();
2083  $grp_roles = array();
2084 
2085  //put the group member role to the top of the crs_roles array
2086  if (in_array($grp_member, $local_roles)) {
2087  $grp_roles[$grp_member] = ilObjRole::_getTranslation(array_search($grp_member, $local_roles));
2088  unset($local_roles[$grp_roles[$grp_member]]);
2089  }
2090 
2091  foreach ($local_roles as $title => $role_id) {
2092  $grp_roles[$role_id] = ilObjRole::_getTranslation($title);
2093  }
2094  return $grp_roles;
2095  }
2096 
2100  protected function jump2UsersGalleryObject()
2101  {
2102  $this->ctrl->redirectByClass('ilUsersGalleryGUI');
2103  }
2104 
2108  public function setSideColumnReturn()
2109  {
2110  $this->ctrl->setReturn($this, "view");
2111  }
2112 } // END class.ilObjGroupGUI
static lookupTemplateId($a_ref_id)
Lookup template id ilDB $ilDB.
static getContentStylePath($a_style_id, $add_random=true, $add_token=true)
get content style path
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.
renderObject()
Render group.
Class ilBadgeManagementGUI.
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.
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.
if($format !==null) $name
Definition: metadata.php:230
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
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.
$service
Definition: result.php:17
This class represents a location property in a property form.
if(!defined('PATH_SEPARATOR')) $GLOBALS['_PEAR_default_error_mode']
Definition: PEAR.php:64
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 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)
__construct(Container $dic, ilPlugin $plugin)
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.
$DIC
Definition: xapitoken.php:46
getCreationMode()
get creation mode
getRefId()
get reference id public
Class ilContainerGUI.
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
language()
Definition: language.php:2
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.
enableToggleFullTime($a_title, $a_checked)
Enable toggling between date and time.
Class ilObjUserTrackingGUI.
$_POST["username"]
static getInstanceFromAjaxCall()
(Re-)Build instance from ajax call
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.