ILIAS  release_10 Revision v10.1-43-ga1241a92c2f
class.ilObjCourseGUI.php
Go to the documentation of this file.
1 <?php
2 
19 declare(strict_types=0);
20 
23 use ILIAS\News\Service as News;
24 
47 {
48  public const BREADCRUMB_DEFAULT = 0;
49  public const BREADCRUMB_CRS_ONLY = 1;
50  public const BREADCRUMB_FULL_PATH = 2;
51  protected News $news;
52 
55 
56  private ilLogger $logger;
58  protected Factory $refinery;
59  protected ilHelpGUI $help;
61 
62  public function __construct($a_data, int $a_id, bool $a_call_by_reference = true, bool $a_prepare_output = true)
63  {
64  global $DIC;
65 
66  $this->type = "crs";
67  parent::__construct($a_data, $a_id, $a_call_by_reference, $a_prepare_output);
68 
69  $this->help = $DIC->help();
70  $this->logger = $DIC->logger()->crs();
71  $this->navigation_history = $DIC['ilNavigationHistory'];
72  $this->ctrl->saveParameter($this, ['ref_id']);
73  $this->lng->loadLanguageModule('crs');
74  $this->lng->loadLanguageModule('cert');
75  $this->lng->loadLanguageModule('obj');
76 
77  $this->http = $DIC->http();
78  $this->refinery = $DIC->refinery();
79  $this->news = $DIC->news();
80  }
81 
85  public function gatewayObject(): void
86  {
87  $this->viewObject();
88  }
89 
90  protected function afterImport(ilObject $new_object): void
91  {
92  $part = ilCourseParticipants::_getInstanceByObjId($new_object->getId());
93  $part->add($this->user->getId(), ilCourseConstants::CRS_ADMIN);
94  $part->updateNotification(
95  $this->user->getId(),
96  (bool) $this->settings->get('mail_crs_admin_notification', '1')
97  );
98  parent::afterImport($new_object);
99  }
100 
101  public function renderObject(): void
102  {
103  $this->viewObject();
104  }
105 
106  public function viewObject(): void
107  {
108  if (strtolower($this->std_request->getBaseClass()) === "iladministrationgui") {
109  parent::viewObject();
110  return;
111  }
112 
113  $this->tabs_gui->setTabActive('view_content');
114  $this->checkPermission('read', 'view');
115 
116  if (strtolower($this->std_request->getBaseClass()) === "iladministrationgui") {
117  parent::viewObject();
118  return;
119  }
120 
121  // Trac access
122  if ($this->ctrl->getNextClass() != "ilcolumngui") {
124  $this->user->getId(),
125  $this->object->getId(),
126  $this->object->getRefId(),
127  'crs'
128  );
129  }
130 
131  if (!$this->checkAgreement()) {
132  $this->ctrl->redirectByClass(ilMemberAgreementGUI::class);
133  }
134 
135  if (!$this->__checkStartObjects()) {
137  $obj = $this->object;
138  $stgui = new ilContainerStartObjectsContentGUI($this, $obj);
139  $stgui->enableDesktop($this->object->getAboStatus(), $this);
140  $stgui->getHTML();
141  return;
142  }
143  // views handled by general container logic
144  if (
145  $this->object->getViewMode() == ilContainer::VIEW_SIMPLE ||
146  $this->object->getViewMode() == ilContainer::VIEW_BY_TYPE ||
147  $this->object->getViewMode() == ilContainer::VIEW_SESSIONS ||
148  $this->object->getViewMode() == ilContainer::VIEW_TIMING ||
149  $this->object->getViewMode() == ilContainer::VIEW_OBJECTIVE
150  ) {
151  parent::renderObject();
152  }
153 
154  if ($this->isActiveAdministrationPanel()) {
156  }
157  }
158 
159  public function deleteObject(bool $error = false): void
160  {
161  $this->tabs_gui->activateTab('view_content');
162  parent::deleteObject($error);
163  }
164 
165  public function renderContainer(): void
166  {
167  parent::renderObject();
168  }
169 
176  public function infoScreenObject(): void
177  {
178  $this->ctrl->redirectByClass([
179  static::class,
180  ilInfoScreenGUI::class
181  ]);
182  }
183 
184  public function infoScreen(): void
185  {
186  if (!$this->checkPermissionBool('read')) {
187  $this->checkPermission('visible');
188  }
189 
190  $this->tabs_gui->setTabActive('info_short');
191  $files = ilCourseFile::_readFilesByCourse($this->object->getId());
192 
193  $info = new ilInfoScreenGUI($this);
194  $info->enablePrivateNotes();
195  $info->enableFeedback();
196  $info->enableNews();
197  $info->enableBookingInfo(true);
198  if ($this->access->checkAccess("write", "", $this->ref_id)) {
199  $info->enableNewsEditing();
200  }
201 
202  if (
203  strlen($this->object->getImportantInformation()) ||
204  strlen($this->object->getSyllabus()) ||
205  strlen((string) $this->object->getTargetGroup()) ||
206  count($files)) {
207  $info->addSection($this->lng->txt('crs_general_informations'));
208  }
209 
210  if (strlen($this->object->getImportantInformation())) {
211  $info->addProperty(
212  $this->lng->txt('crs_important_info'),
213  "<strong>" . nl2br(
214  ilUtil::makeClickable($this->object->getImportantInformation(), true) . "</strong>"
215  )
216  );
217  }
218  if (strlen($this->object->getSyllabus())) {
219  $info->addProperty($this->lng->txt('crs_syllabus'), nl2br(
220  ilUtil::makeClickable($this->object->getSyllabus(), true)
221  ));
222  }
223  if (strlen((string) $this->object->getTargetGroup())) {
224  $info->addProperty(
225  $this->lng->txt('crs_target_group'),
226  nl2br(
227  \ilUtil::makeClickable($this->object->getTargetGroup(), true)
228  )
229  );
230  }
231  // files
232  if ($files !== []) {
233  $tpl = new ilTemplate('tpl.event_info_file.html', true, true, 'components/ILIAS/Course');
234 
235  foreach ($files as $file) {
236  $tpl->setCurrentBlock("files");
237  $this->ctrl->setParameter($this, 'file_id', $file->getFileId());
238  $tpl->setVariable("DOWN_LINK", $this->ctrl->getLinkTarget($this, 'sendfile'));
239  $tpl->setVariable("DOWN_NAME", $file->getFileName());
240  $tpl->setVariable("DOWN_INFO_TXT", $this->lng->txt('crs_file_size_info'));
241  $tpl->setVariable("DOWN_SIZE", $file->getFileSize());
242  $tpl->setVariable("TXT_BYTES", $this->lng->txt('bytes'));
244  }
245  $info->addProperty(
246  $this->lng->txt('crs_file_download'),
247  $tpl->get()
248  );
249  }
250 
251  $record_gui = new ilAdvancedMDRecordGUI(ilAdvancedMDRecordGUI::MODE_INFO, 'crs', $this->object->getId());
252  $record_gui->setInfoObject($info);
253  $record_gui->parse();
254 
255  // meta data
256  $info->addMetaDataSections($this->object->getId(), 0, $this->object->getType());
257 
258  // contact
259  if ($this->object->hasContactData()) {
260  $info->addSection($this->lng->txt("crs_contact"));
261  }
262  if (strlen($this->object->getContactName())) {
263  $info->addProperty(
264  $this->lng->txt("crs_contact_name"),
265  $this->object->getContactName()
266  );
267  }
268  if (strlen($this->object->getContactResponsibility())) {
269  $info->addProperty(
270  $this->lng->txt("crs_contact_responsibility"),
271  $this->object->getContactResponsibility()
272  );
273  }
274  if (strlen($this->object->getContactPhone())) {
275  $info->addProperty(
276  $this->lng->txt("crs_contact_phone"),
277  $this->object->getContactPhone()
278  );
279  }
280  if ($this->object->getContactEmail()) {
281  /* needs to be rbacsystem, does not work with ilAccess */
282  $has_mail_access = $this->rbacsystem->checkAccessOfUser(
283  $this->user->getId(),
284  'internal_mail',
286  );
287  $emails = explode(",", $this->object->getContactEmail());
288  $mailString = '';
289  foreach ($emails as $email) {
290  $email = trim($email);
291  if (!$has_mail_access) {
292  $mailString .= $email . "<br />";
293  continue;
294  }
295  $etpl = new ilTemplate("tpl.crs_contact_email.html", true, true, 'components/ILIAS/Course');
296  $etpl->setVariable(
297  "EMAIL_LINK",
299  $info,
300  'showSummary',
301  array(),
302  array(
303  'type' => 'new',
304  'rcp_to' => $email,
305  'sig' => $this->createMailSignature()
306  ),
307  array(
309  'ref_id' => $this->object->getRefId(),
310  'ts' => time()
311  )
312  )
313  );
314  $etpl->setVariable("CONTACT_EMAIL", $email);
315  $mailString .= $etpl->get() . "<br />";
316  }
317  $info->addProperty($this->lng->txt("crs_contact_email"), $mailString);
318  }
319  if (strlen($this->object->getContactConsultation())) {
320  $info->addProperty(
321  $this->lng->txt("crs_contact_consultation"),
322  nl2br($this->object->getContactConsultation())
323  );
324  }
325  // support contacts
327  $conts = $parts->getContacts();
328  if ($conts !== []) {
329  $info->addSection($this->lng->txt("crs_mem_contacts"));
330  foreach ($conts as $c) {
331  $pgui = new ilPublicUserProfileGUI($c);
332  $pgui->setBackUrl($this->ctrl->getLinkTargetByClass("ilinfoscreengui"));
333  $pgui->setEmbedded(true);
334  $info->addProperty("", $pgui->getHTML());
335  }
336  }
337 
338  // #10360
339  $info->enableAvailability(false);
340  $this->lng->loadLanguageModule("rep");
341  $info->addSection($this->lng->txt("rep_activation_availability"));
342  $info->showLDAPRoleGroupMappingInfo();
343 
344  // activation
345  $info->addAccessPeriodProperty();
346 
347  $txt = '';
348  switch ($this->object->getSubscriptionLimitationType()) {
350  $txt = $this->lng->txt("crs_info_reg_deactivated");
351  break;
352 
353  default:
354  switch ($this->object->getSubscriptionType()) {
356  $txt = $this->lng->txt("crs_info_reg_confirmation");
357  break;
359  $txt = $this->lng->txt("crs_info_reg_direct");
360  break;
362  $txt = $this->lng->txt("crs_info_reg_password");
363  break;
364  }
365  }
366 
367  // subscription
368  $info->addProperty($this->lng->txt("crs_info_reg"), $txt);
369  if ($this->object->getSubscriptionLimitationType() != ilCourseConstants::IL_CRS_SUBSCRIPTION_DEACTIVATED) {
370  if ($this->object->getSubscriptionUnlimitedStatus()) {
371  $info->addProperty(
372  $this->lng->txt("crs_reg_until"),
373  $this->lng->txt('crs_unlimited')
374  );
375  } elseif ($this->object->getSubscriptionStart() < time()) {
376  $info->addProperty(
377  $this->lng->txt("crs_reg_until"),
378  $this->lng->txt('crs_to') . ' ' .
379  ilDatePresentation::formatDate(new ilDateTime($this->object->getSubscriptionEnd(), IL_CAL_UNIX))
380  );
381  } elseif ($this->object->getSubscriptionStart() > time()) {
382  $info->addProperty(
383  $this->lng->txt("crs_reg_until"),
384  $this->lng->txt('crs_from') . ' ' .
385  ilDatePresentation::formatDate(new ilDateTime($this->object->getSubscriptionStart(), IL_CAL_UNIX))
386  );
387  }
388  if ($this->object->isSubscriptionMembershipLimited()) {
389  if ($this->object->getSubscriptionMinMembers()) {
390  $info->addProperty(
391  $this->lng->txt("mem_min_users"),
392  $this->object->getSubscriptionMinMembers()
393  );
394  }
395  if ($this->object->getSubscriptionMaxMembers()) {
396  $reg_info = ilObjCourseAccess::lookupRegistrationInfo($this->object->getId());
397  $info->addProperty(
398  $this->lng->txt('mem_free_places'),
399  (string) ($reg_info['reg_info_free_places'] ?? '0')
400  );
401  }
402  }
403  }
404 
405  if ($this->object->getCancellationEnd()) {
406  $info->addProperty(
407  $this->lng->txt('crs_cancellation_end'),
408  ilDatePresentation::formatDate($this->object->getCancellationEnd())
409  );
410  }
411 
412  if (
413  $this->object->getCourseStart() instanceof ilDateTime &&
414  !$this->object->getCourseStart()->isNull()
415  ) {
416  $info->addProperty(
417  $this->lng->txt('crs_period'),
419  $this->object->getCourseStart(),
420  $this->object->getCourseEnd()
421  )
422  );
423  }
424 
425  // Confirmation
426  $privacy = ilPrivacySettings::getInstance();
427 
428  if ($privacy->courseConfirmationRequired() || ilCourseDefinedFieldDefinition::_getFields($this->object->getId()) || $privacy->enabledCourseExport()) {
429  $field_info = ilExportFieldsInfo::_getInstanceByType($this->object->getType());
430 
431  $this->lng->loadLanguageModule('ps');
432  $info->addSection($this->lng->txt('crs_user_agreement_info'));
433  $info->addProperty($this->lng->txt('ps_export_data'), $field_info->exportableFieldsToInfoString());
434 
435  if ($fields = ilCourseDefinedFieldDefinition::_fieldsToInfoString($this->object->getId())) {
436  $info->addProperty($this->lng->txt('ps_crs_user_fields'), $fields);
437  }
438  }
439  $info->enableLearningProgress(true);
440 
441  // forward the command
442  $this->ctrl->forwardCommand($info);
443  }
444 
445  public function saveNotificationObject(): void
446  {
447  $noti = new ilMembershipNotifications($this->ref_id);
448  if ($noti->canCurrentUserEdit()) {
449  $crs_ntf = false;
450  if ($this->http->wrapper()->query()->has('crs_ntf')) {
451  $crs_ntf = $this->http->wrapper()->query()->retrieve(
452  'crs_ntf',
453  $this->refinery->kindlyTo()->bool()
454  );
455  }
456  if ($crs_ntf) {
457  $noti->activateUser();
458  } else {
459  $noti->deactivateUser();
460  }
461  }
462  $this->tpl->setOnScreenMessage('success', $this->lng->txt("settings_saved"), true);
463  $this->ctrl->redirect($this, "");
464  }
465 
466  public function editInfoObject(ilPropertyFormGUI $a_form = null): void
467  {
468  $this->checkPermission('write');
469  $this->setSubTabs('properties');
470  $this->tabs_gui->setTabActive('settings');
471  $this->tabs_gui->setSubTabActive('crs_info_settings');
472 
473  if (!$a_form) {
474  $a_form = $this->initInfoEditor();
475  }
476  $this->tpl->addBlockFile('ADM_CONTENT', 'adm_content', 'tpl.edit_info.html', 'components/ILIAS/Course');
477  $this->tpl->setVariable('INFO_TABLE', $a_form->getHTML());
478 
479  if (!count($files = ilCourseFile::_readFilesByCourse($this->object->getId()))) {
480  return;
481  }
482  $rows = array();
483  foreach ($files as $file) {
484  $table_data['id'] = $file->getFileId();
485  $table_data['filename'] = $file->getFileName();
486  $table_data['filetype'] = $file->getFileType();
487  $table_data['filesize'] = $file->getFileSize();
488 
489  $rows[] = $table_data;
490  }
491  $table_gui = new ilCourseInfoFileTableGUI($this, 'editInfo');
492  $table_gui->setTitle($this->lng->txt("crs_info_download"));
493  $table_gui->setData($rows);
494  $table_gui->addCommandButton("cancel", $this->lng->txt("cancel"));
495  $table_gui->addMultiCommand("confirmDeleteInfoFiles", $this->lng->txt("delete"));
496  $table_gui->setSelectAllCheckbox("file_id");
497  $this->tpl->setVariable('INFO_FILE_TABLE', $table_gui->getHTML());
498  }
499 
500  public function confirmDeleteInfoFilesObject(): void
501  {
502  $file_ids = [];
503  if ($this->http->wrapper()->post()->has('file_id')) {
504  $file_ids = $this->http->wrapper()->post()->retrieve(
505  'file_id',
506  $this->refinery->kindlyTo()->listOf(
507  $this->refinery->kindlyTo()->int()
508  )
509  );
510  }
511  if (count($file_ids) === 0) {
512  $this->tpl->setOnScreenMessage('failure', $this->lng->txt('select_one'));
513  $this->editInfoObject();
514  return;
515  }
516 
517  $this->setSubTabs('properties');
518  $this->tabs_gui->setTabActive('settings');
519  $this->tabs_gui->setSubTabActive('crs_info_settings');
520 
521  $c_gui = new ilConfirmationGUI();
522 
523  // set confirm/cancel commands
524  $c_gui->setFormAction($this->ctrl->getFormAction($this, "deleteInfoFiles"));
525  $c_gui->setHeaderText($this->lng->txt("info_delete_sure"));
526  $c_gui->setCancel($this->lng->txt("cancel"), "editInfo");
527  $c_gui->setConfirm($this->lng->txt("confirm"), "deleteInfoFiles");
528 
529  // add items to delete
530  foreach ($file_ids as $file_id) {
531  $file = new ilCourseFile($file_id);
532  $c_gui->addItem("file_id[]", $file_id, $file->getFileName());
533  }
534  $this->tpl->setContent($c_gui->getHTML());
535  }
536 
537  public function deleteInfoFilesObject(): void
538  {
539  $file_ids = [];
540  if ($this->http->wrapper()->post()->has('file_id')) {
541  $file_ids = $this->http->wrapper()->post()->retrieve(
542  'file_id',
543  $this->refinery->kindlyTo()->listOf(
544  $this->refinery->kindlyTo()->int()
545  )
546  );
547  }
548 
549  if (count($file_ids) === 0) {
550  $this->tpl->setOnScreenMessage('failure', $this->lng->txt('select_one'));
551  $this->editInfoObject();
552  return;
553  }
554 
555  foreach ($file_ids as $file_id) {
556  $file = new ilCourseFile($file_id);
557  if ($this->object->getId() == $file->getCourseId()) {
558  $file->delete();
559  }
560  }
561  $this->tpl->setOnScreenMessage('success', $this->lng->txt('settings_saved'));
562  $this->editInfoObject();
563  }
564 
566  {
567  $form = new ilPropertyFormGUI();
568  $form->setFormAction($this->ctrl->getFormAction($this, 'updateInfo'));
569  $form->setMultipart(true);
570  $form->setTitle($this->lng->txt('crs_general_info'));
571  $form->addCommandButton('updateInfo', $this->lng->txt('save'));
572  $form->addCommandButton('cancel', $this->lng->txt('cancel'));
573 
574  $area = new ilTextAreaInputGUI($this->lng->txt('crs_important_info'), 'important');
575  $area->setValue($this->object->getImportantInformation());
576  $area->setRows(6);
577  $area->setCols(80);
578  $form->addItem($area);
579 
580  $area = new ilTextAreaInputGUI($this->lng->txt('crs_syllabus'), 'syllabus');
581  $area->setValue($this->object->getSyllabus());
582  $area->setRows(6);
583  $area->setCols(80);
584  $form->addItem($area);
585 
586  $tg = new \ilTextAreaInputGUI($this->lng->txt('crs_target_group'), 'target_group');
587  $tg->setValue($this->object->getTargetGroup() ?? "");
588  $tg->setRows(6);
589  $form->addItem($tg);
590 
591  $section = new ilFormSectionHeaderGUI();
592  $section->setTitle($this->lng->txt('crs_info_download'));
593  $form->addItem($section);
594 
595  $file = new ilFileInputGUI($this->lng->txt('crs_file'), 'file');
596  $file->enableFileNameSelection('file_name');
597  $form->addItem($file);
598 
599  $section = new ilFormSectionHeaderGUI();
600  $section->setTitle($this->lng->txt('crs_contact'));
601  $form->addItem($section);
602 
603  $text = new ilTextInputGUI($this->lng->txt('crs_contact_name'), 'contact_name');
604  $text->setValue($this->object->getContactName());
605  $text->setSize(40);
606  $text->setMaxLength(70);
607  $form->addItem($text);
608 
609  $text = new ilTextInputGUI($this->lng->txt('crs_contact_responsibility'), 'contact_responsibility');
610  $text->setValue($this->object->getContactResponsibility());
611  $text->setSize(40);
612  $text->setMaxLength(70);
613  $form->addItem($text);
614 
615  $text = new ilTextInputGUI($this->lng->txt('crs_contact_phone'), 'contact_phone');
616  $text->setValue($this->object->getContactPhone());
617  $text->setSize(40);
618  $text->setMaxLength(40);
619  $form->addItem($text);
620 
621  $text = new ilTextInputGUI($this->lng->txt('crs_contact_email'), 'contact_email');
622  $text->setValue($this->object->getContactEmail());
623  $text->setInfo($this->lng->txt('crs_contact_email_info'));
624  $text->setSize(40);
625  $text->setMaxLength(255);
626  $form->addItem($text);
627 
628  $area = new ilTextAreaInputGUI($this->lng->txt('crs_contact_consultation'), 'contact_consultation');
629  $area->setValue($this->object->getContactConsultation());
630  $area->setRows(6);
631  $area->setCols(80);
632  $form->addItem($area);
633 
634  $this->record_gui = new ilAdvancedMDRecordGUI(
636  'crs',
637  $this->object->getId()
638  );
639  $this->record_gui->setPropertyForm($form);
640  $this->record_gui->parse();
641  return $form;
642  }
643 
647  public function updateInfoObject(): void
648  {
649  $this->checkPermission('write');
650 
651  $form = $this->initInfoEditor();
652  if ($form->checkInput()) {
653  $this->object->setImportantInformation((string) $form->getInput('important'));
654  $this->object->setSyllabus((string) $form->getInput('syllabus'));
655  $this->object->setTargetGroup((string) $form->getInput('target_group'));
656  $this->object->setContactName((string) $form->getInput('contact_name'));
657  $this->object->setContactResponsibility((string) $form->getInput('contact_responsibility'));
658  $this->object->setContactPhone((string) $form->getInput('contact_phone'));
659  $this->object->setContactEmail((string) $form->getInput('contact_email'));
660  $this->object->setContactConsultation((string) $form->getInput('contact_consultation'));
661 
662  $file_info = $form->getInput('file');
663  $file_name = $form->getItemByPostVar('file')->getFilename();
664  $file_name = ilFileUtils::getValidFilename($file_name);
665 
666  $file_obj = new ilCourseFile();
667  $file_obj->setCourseId($this->object->getId());
668  $file_obj->setFileName((string) $file_name);
669  $file_obj->setFileSize((int) $file_info['size']);
670  $file_obj->setFileType((string) $file_info['type']);
671  $file_obj->setTemporaryName((string) $file_info['tmp_name']);
672  $file_obj->setErrorCode((int) $file_info['error']);
673 
674  $error = false;
675  $this->error->setMessage('');
676  $file_obj->validate();
677  $this->object->validateInfoSettings();
678  if (strlen($this->error->getMessage())) {
679  $error = $this->error->getMessage();
680  }
681  if (!$this->record_gui->importEditFormPostValues()) {
682  $error = true;
683  }
684  if ($error) {
685  if ($error !== true) {
686  $this->tpl->setOnScreenMessage('failure', $this->error->getMessage());
687  }
689  $this->editInfoObject($form);
690  return;
691  }
692  $this->object->update();
693  $file_obj->create();
694  $this->record_gui->writeEditForm();
695 
696  // Update ecs content
697  $ecs = new ilECSCourseSettings($this->object);
698  $ecs->handleContentUpdate();
699 
700  $this->tpl->setOnScreenMessage('success', $this->lng->txt("crs_settings_saved"));
701  $this->editInfoObject();
702  } else {
703  $this->tpl->setOnScreenMessage(
705  $this->lng->txt('settings_saved')
706  );
707  }
708  }
709 
710  public function updateObject(): void
711  {
712  $obj_service = $this->getObjectService();
713  $setting = $this->settings;
714 
715  $form = $this->initEditForm();
716 
717  if (!$form->checkInput()) {
719  $this->tpl->setOnScreenMessage('failure', $GLOBALS['DIC']->language()->txt('err_check_input'));
720  $this->editObject($form);
721  return;
722  }
723 
724  // Additional checks: subsription min/max
725  if (
726  $form->getInput('subscription_max') &&
727  $form->getInput('subscription_min') &&
728  ($form->getInput('subscription_max') < $form->getInput('subscription_min'))
729  ) {
730  $min = $form->getItemByPostVar('subscription_min');
731  $min->setAlert($this->lng->txt('crs_subscription_min_members_err'));
732  $this->tpl->setOnScreenMessage('failure', $GLOBALS['DIC']->language()->txt('err_check_input'));
733  $this->editObject($form);
734  return;
735  }
736 
737  // Additional checks: both tile and objective view activated (not supported)
738  if (
739  $form->getInput('list_presentation') == "tile" &&
741  $this->tpl->setOnScreenMessage(
742  'failure',
743  $GLOBALS['DIC']->language()->txt('crs_tile_and_objective_view_not_supported')
744  );
745  $this->editObject($form);
746  return;
747  }
748 
749  // Additional checks: both tile and session limitation activated (not supported)
750  if ($form->getInput('sl') == "1" &&
751  $form->getInput('list_presentation') == "tile") {
752  $this->tpl->setOnScreenMessage(
753  'failure',
754  $GLOBALS['DIC']->language()->txt('crs_tile_and_session_limit_not_supported')
755  );
756  $this->editObject($form);
757  return;
758  }
759 
760  // check successful
761  // title/desc
762  $this->object->setTitle($form->getInput('title'));
763  $this->object->setDescription($form->getInput('desc'));
764 
765  // period
766  $crs_period = $form->getItemByPostVar("period");
767 
768  $this->object->setCoursePeriod(
769  $crs_period->getStart(),
770  $crs_period->getEnd()
771  );
772 
773  // activation period
774  $period = $form->getItemByPostVar("access_period");
775  if ($period->getStart() && $period->getEnd()) {
776  $this->object->setActivationStart($period->getStart()->get(IL_CAL_UNIX));
777  $this->object->setActivationEnd($period->getEnd()->get(IL_CAL_UNIX));
778  $this->object->setActivationVisibility((int) $form->getInput('activation_visibility'));
779  } else {
780  $this->object->setActivationStart(0);
781  $this->object->setActivationEnd(0);
782  }
783 
784  // subscription settings
785  $this->object->setSubscriptionPassword($form->getInput('subscription_password'));
786  $this->object->setSubscriptionStart(0);
787  $this->object->setSubscriptionEnd(0);
788 
789  $sub_type = (int) $form->getInput('subscription_type');
790  $sub_reg_type = (int) $form->getInput('subscription_limitation_type');
791  $sub_period = $form->getItemByPostVar('subscription_period');
792 
793  $this->object->setSubscriptionType(
795  ? $sub_type
797  );
798  if ($sub_reg_type !== ilCourseConstants::IL_CRS_SUBSCRIPTION_DEACTIVATED) {
799  if ($sub_period->getStart() && $sub_period->getEnd()) {
800  $this->object->setSubscriptionLimitationType(ilCourseConstants::IL_CRS_SUBSCRIPTION_LIMITED);
801  $this->object->setSubscriptionStart($sub_period->getStart()->get(IL_CAL_UNIX));
802  $this->object->setSubscriptionEnd($sub_period->getEnd()->get(IL_CAL_UNIX));
803  } else {
804  $this->object->setSubscriptionLimitationType(ilCourseConstants::IL_CRS_SUBSCRIPTION_UNLIMITED);
805  }
806  } else {
807  $this->object->setSubscriptionType(ilCourseConstants::IL_CRS_SUBSCRIPTION_DIRECT);
808  $this->object->setSubscriptionLimitationType(ilCourseConstants::IL_CRS_SUBSCRIPTION_DEACTIVATED);
809  }
810 
811  // registration code
812  $this->object->enableRegistrationAccessCode((bool) $form->getInput('reg_code_enabled'));
813  $this->object->setRegistrationAccessCode($form->getInput('reg_code'));
814 
815  // cancellation end
816  $this->object->setCancellationEnd($form->getItemByPostVar("cancel_end")->getDate());
817 
818  // waiting list
819  $this->object->enableSubscriptionMembershipLimitation((bool) $form->getInput('subscription_membership_limitation'));
820  $this->object->setSubscriptionMaxMembers((int) $form->getInput('subscription_max'));
821  $this->object->setSubscriptionMinMembers((int) $form->getInput('subscription_min'));
822  switch ((int) $form->getInput('waiting_list')) {
823  case 2:
824  $this->object->enableWaitingList(true);
825  $this->object->setWaitingListAutoFill(true);
826  break;
827 
828  case 1:
829  $this->object->enableWaitingList(true);
830  $this->object->setWaitingListAutoFill(false);
831  break;
832 
833  default:
834  $this->object->enableWaitingList(false);
835  $this->object->setWaitingListAutoFill(false);
836  break;
837  }
838  $this->object->handleAutoFill();
839 
840  $property_online = $this->object->getObjectProperties()->getPropertyIsOnline();
841  $online = $form->getInput('activation_online') ? $property_online->withOnline() : $property_online->withOffline();
842  $this->object->getObjectProperties()->storePropertyIsOnline($online);
843 
844  $obj_service->commonSettings()->legacyForm($form, $this->object)->saveTitleIconVisibility();
845  $obj_service->commonSettings()->legacyForm($form, $this->object)->saveTopActionsVisibility();
846  ilContainer::_writeContainerSetting($this->object->getId(), "rep_breacrumb", $form->getInput('rep_breacrumb'));
847  $obj_service->commonSettings()->legacyForm($form, $this->object)->saveIcon();
848  $obj_service->commonSettings()->legacyForm($form, $this->object)->saveTileImage();
849  $this->saveListPresentation($form);
850 
851  $this->object->setViewMode((int) $form->getInput('view_mode'));
852  if ($this->object->getViewMode() == ilCourseConstants::IL_CRS_VIEW_TIMING) {
853  $this->object->setOrderType(ilContainer::SORT_ACTIVATION);
854  $this->object->setTimingMode((int) $form->getInput('timing_mode'));
855  }
856  $this->object->setTimingMode((int) $form->getInput('timing_mode'));
857  $this->object->setOrderType((int) $form->getInput('sorting'));
858  $this->saveSortingSettings($form);
859 
860  $this->log->debug(
861  "\n\n\nValue: " . (int) $form->getInput('tutorial_support_block_checkbox') . "\n\n\n"
862  );
863  $this->object->setTutorialSupportBlockSettingValue(
864  (int) $form->getInput('tutorial_support_block_checkbox')
865  );
866 
867  $this->object->setAboStatus((bool) $form->getInput('abo'));
868  $this->object->setShowMembers((bool) $form->getInput('show_members'));
869 
870  if (\ilPrivacySettings::getInstance()->participantsListInCoursesEnabled()) {
871  $this->object->setShowMembersExport((bool) $form->getInput('show_members_export'));
872  }
873  $this->object->setMailToMembersType((int) $form->getInput('mail_type'));
874 
875  $this->object->enableSessionLimit((int) $form->getInput('sl'));
876 
877  $session_sp = $form->getInput('sp');
878  $this->object->setNumberOfPreviousSessions(is_numeric($session_sp) ? (int) $session_sp : -1);
879  $session_sn = $form->getInput('sn');
880  $this->object->setNumberOfnextSessions(is_numeric($session_sn) ? (int) $session_sn : -1);
881  $this->object->setAutoNotification($form->getInput('auto_notification') == 1 ? true : false);
882 
883  // lp sync
884  $show_lp_sync_confirmation = false;
885 
886  // could be hidden in form
887  if ($this->http->wrapper()->post()->has('status_dt')) {
888  $status_dt = $this->http->wrapper()->post()->retrieve(
889  'status_dt',
890  $this->refinery->kindlyTo()->int()
891  );
892  if (
893  $this->object->getStatusDetermination() != ilObjCourse::STATUS_DETERMINATION_LP &&
895  ) {
896  $show_lp_sync_confirmation = true;
897  } else {
898  $this->object->setStatusDetermination($status_dt);
899  }
900  }
901 
902  $this->object->update();
903 
905  $this->object->getId(),
906  $form,
907  $this->getSubServices()
908  );
909 
910  ilChangeEvent::_recordWriteEvent($this->object->getId(), $this->user->getId(), 'update');
911  ilChangeEvent::_catchupWriteEvents($this->object->getId(), $this->user->getId());
912 
913  // lp sync confirmation required
914  if ($show_lp_sync_confirmation) {
915  $this->confirmLPSync();
916  return;
917  }
918 
919  // Update ecs export settings
920  $ecs = new ilECSCourseSettings($this->object);
921  if (!$ecs->handleSettingsUpdate($form)) {
923  $this->tpl->setOnScreenMessage('failure', $GLOBALS['DIC']->language()->txt('err_check_input'));
924  $this->editObject($form);
925  return;
926  }
927 
928  // 29589
929  if (
930  $sub_type === ilCourseConstants::IL_CRS_SUBSCRIPTION_DEACTIVATED &&
931  (
932  !is_null($sub_period->getStart()) ||
933  !is_null($sub_period->getEnd())
934  )
935  ) {
936  $this->tpl->setOnScreenMessage(
937  'failure',
938  $this->lng->txt('crs_msg_no_self_registration_period_if_self_enrolment_disabled'),
939  true
940  );
942  $this->tpl->setOnScreenMessage('failure', $GLOBALS['DIC']->language()->txt('err_check_input'));
943  $this->editObject($form);
944  return;
945  }
946 
947  $this->afterUpdate();
948  }
949 
950  protected function getSubServices(): array
951  {
952  $subs = array(
962  );
963  if ($this->news->isGloballyActivated()) {
965  }
966 
967  return $subs;
968  }
969 
970  protected function confirmLPSync(): void
971  {
972  $cgui = new ilConfirmationGUI();
973  $cgui->setFormAction($this->ctrl->getFormAction($this, "setLPSync"));
974  $cgui->setHeaderText($this->lng->txt("crs_status_determination_sync"));
975  $cgui->setCancel($this->lng->txt("cancel"), "edit");
976  $cgui->setConfirm($this->lng->txt("confirm"), "setLPSync");
977  $this->tpl->setContent($cgui->getHTML());
978  }
979 
980  protected function setLPSyncObject(): void
981  {
982  $this->object->setStatusDetermination(ilObjCourse::STATUS_DETERMINATION_LP);
983  $this->object->update();
984  $this->object->syncMembersStatusWithLP();
985  $this->tpl->setOnScreenMessage('success', $this->lng->txt("settings_saved"), true);
986  $this->ctrl->redirect($this, "edit");
987  }
988 
989  public function editObject(ilPropertyFormGUI $form = null): void
990  {
991  $this->setSubTabs('properties');
992  $this->tabs_gui->setSubTabActive('general');
993 
994  if ($form instanceof ilPropertyFormGUI) {
995  $GLOBALS['DIC']['tpl']->setContent($form->getHTML());
996  } else {
997  parent::editObject();
998  }
999  }
1000 
1005  protected function getEditFormValues(): array
1006  {
1007  return [];
1008  }
1009 
1010  protected function initEditForm(): ilPropertyFormGUI
1011  {
1012  $obj_service = $this->getObjectService();
1013  $setting = $this->settings;
1014 
1015  $form = new ilPropertyFormGUI();
1016  $form->setTitle($this->lng->txt('crs_edit'));
1017 
1018  $form->addCommandButton('update', $this->lng->txt('save'));
1019  $form->addCommandButton('cancel', $this->lng->txt('cancel'));
1020 
1021  $form->setFormAction($this->ctrl->getFormAction($this, 'update'));
1022 
1023  // title and description
1024  $this->initFormTitleDescription($form);
1025 
1026  // Show didactic template type
1027  $this->initDidacticTemplate($form);
1028 
1029  // period
1030  $cdur = new ilDateDurationInputGUI($this->lng->txt('crs_period'), 'period');
1031  $this->lng->loadLanguageModule('mem');
1032  $cdur->enableToggleFullTime(
1033  $this->lng->txt('mem_period_without_time'),
1034  !$this->object->getCourseStartTimeIndication()
1035  );
1036  $cdur->setShowTime(true);
1037  $cdur->setInfo($this->lng->txt('crs_period_info'));
1038  $cdur->setStart($this->object->getCourseStart());
1039  $cdur->setEnd($this->object->getCourseEnd());
1040  $form->addItem($cdur);
1041 
1042  // activation/availability
1043 
1044  $this->lng->loadLanguageModule('rep');
1045 
1046  $section = new ilFormSectionHeaderGUI();
1047  $section->setTitle($this->lng->txt('rep_activation_availability'));
1048  $form->addItem($section);
1049 
1050  $online = new ilCheckboxInputGUI($this->lng->txt('rep_activation_online'), 'activation_online');
1051  $online->setChecked(!$this->object->getOfflineStatus());
1052  $online->setInfo($this->lng->txt('crs_activation_online_info'));
1053  $form->addItem($online);
1054 
1055  $dur = new ilDateDurationInputGUI($this->lng->txt('rep_time_period'), "access_period");
1056  $dur->setShowTime(true);
1057  $dur->setStart(new ilDateTime($this->object->getActivationStart(), IL_CAL_UNIX));
1058  $dur->setEnd(new ilDateTime($this->object->getActivationEnd(), IL_CAL_UNIX));
1059  $form->addItem($dur);
1060 
1061  $visible = new ilCheckboxInputGUI(
1062  $this->lng->txt('rep_activation_limited_visibility'),
1063  'activation_visibility'
1064  );
1065  $visible->setInfo($this->lng->txt('crs_activation_limited_visibility_info'));
1066  $visible->setChecked((bool) $this->object->getActivationVisibility());
1067  $dur->addSubItem($visible);
1068 
1069  $section = new ilFormSectionHeaderGUI();
1070  $section->setTitle($this->lng->txt('crs_reg'));
1071  $form->addItem($section);
1072 
1073  // time limit
1074  $sdur = new ilDateDurationInputGUI($this->lng->txt('crs_registration_limited'), "subscription_period");
1075  $sdur->setShowTime(true);
1076  if ($this->object->getSubscriptionStart()) {
1077  $sdur->setStart(new ilDateTime($this->object->getSubscriptionStart(), IL_CAL_UNIX));
1078  }
1079  if ($this->object->getSubscriptionEnd()) {
1080  $sdur->setEnd(new ilDateTime($this->object->getSubscriptionEnd(), IL_CAL_UNIX));
1081  }
1082 
1083  $reg_proc = new ilRadioGroupInputGUI('', 'subscription_type');
1084  $reg_proc->setValue(
1085  ($this->object->getSubscriptionLimitationType() != ilCourseConstants::IL_CRS_SUBSCRIPTION_DEACTIVATED)
1086  ? (string) $this->object->getSubscriptionType()
1088  );
1089 
1090  $opt = new ilRadioOption(
1091  $this->lng->txt('crs_subscription_options_direct'),
1093  );
1094  $reg_proc->addOption($opt);
1095 
1096  $opt = new ilRadioOption(
1097  $this->lng->txt('crs_subscription_options_password'),
1099  );
1100 
1101  $pass = new ilTextInputGUI($this->lng->txt("password"), 'subscription_password');
1102  $pass->setRequired(true);
1103  $pass->setInfo($this->lng->txt('crs_reg_password_info'));
1104  $pass->setSubmitFormOnEnter(true);
1105  $pass->setSize(32);
1106  $pass->setMaxLength(32);
1107  $pass->setValue($this->object->getSubscriptionPassword());
1108 
1109  $opt->addSubItem($pass);
1110  $reg_proc->addOption($opt);
1111 
1112  $opt = new ilRadioOption(
1113  $this->lng->txt('crs_subscription_options_confirmation'),
1115  );
1116  $opt->setInfo($this->lng->txt('crs_registration_confirmation_info'));
1117  $reg_proc->addOption($opt);
1118 
1119  $opt_self_enrollment_enabled = new ilRadioOption(
1120  $this->lng->txt('crs_reg_selfreg'),
1122  );
1123  $opt_self_enrollment_enabled->addSubItem($reg_proc);
1124  $opt_self_enrollment_enabled->addSubItem($sdur);
1125  $opt_self_enrollment_disabled = new ilRadioOption(
1126  $this->lng->txt('crs_reg_no_selfreg'),
1128  );
1129  $opt_self_enrollment_disabled->setInfo($this->lng->txt('crs_registration_deactivated'));
1130  $reg_proc_subscription_reg_type = new ilRadioGroupInputGUI(
1131  $this->lng->txt('crs_registration_type'),
1132  'subscription_limitation_type'
1133  );
1134  $reg_proc_subscription_reg_type->setValue(
1135  $this->object->getSubscriptionLimitationType() !== ilCourseConstants::IL_CRS_SUBSCRIPTION_DEACTIVATED
1138  );
1139  $reg_proc_subscription_reg_type->addOption($opt_self_enrollment_enabled);
1140  $reg_proc_subscription_reg_type->addOption($opt_self_enrollment_disabled);
1141  $form->addItem($reg_proc_subscription_reg_type);
1142 
1143  // Registration codes
1144  $reg_code = new ilCheckboxInputGUI($this->lng->txt('crs_reg_code'), 'reg_code_enabled');
1145  $reg_code->setChecked($this->object->isRegistrationAccessCodeEnabled());
1146  $reg_code->setValue('1');
1147  $reg_code->setInfo($this->lng->txt('crs_reg_code_enabled_info'));
1148 
1149  // Create default access code
1150  if (!$this->object->getRegistrationAccessCode()) {
1151  $this->object->setRegistrationAccessCode(ilMembershipRegistrationCodeUtils::generateCode());
1152  }
1153  $reg_link = new ilHiddenInputGUI('reg_code');
1154  $reg_link->setValue($this->object->getRegistrationAccessCode());
1155  $form->addItem($reg_link);
1156 
1157  $link = new ilCustomInputGUI($this->lng->txt('crs_reg_code_link'));
1158  $val = ilLink::_getLink(
1159  $this->object->getRefId(),
1160  $this->object->getType(),
1161  array(),
1162  'rcode' . $this->object->getRegistrationAccessCode()
1163  );
1164  $link->setHtml('<span class="small">' . $val . '</span>');
1165  $reg_code->addSubItem($link);
1166 
1167  $form->addItem($reg_code);
1168 
1169  // cancellation limit
1170  $cancel = new ilDateTimeInputGUI($this->lng->txt('crs_cancellation_end'), 'cancel_end');
1171  $cancel->setInfo($this->lng->txt('crs_cancellation_end_info'));
1172  $cancel_end = $this->object->getCancellationEnd();
1173  if ($cancel_end) {
1174  $cancel->setDate($cancel_end);
1175  }
1176  $form->addItem($cancel);
1177 
1178  // Max members
1179  $lim = new ilCheckboxInputGUI(
1180  $this->lng->txt('crs_subscription_max_members_short'),
1181  'subscription_membership_limitation'
1182  );
1183  $lim->setInfo($this->lng->txt('crs_subscription_max_members_short_info'));
1184  $lim->setValue((string) 1);
1185  $lim->setChecked($this->object->isSubscriptionMembershipLimited());
1186 
1187  $min = new ilTextInputGUI('', 'subscription_min');
1188  $min->setSubmitFormOnEnter(true);
1189  $min->setSize(4);
1190  $min->setMaxLength(4);
1191  $min->setValue($this->object->getSubscriptionMinMembers() ?: '');
1192  $min->setTitle($this->lng->txt('crs_subscription_min_members'));
1193  $min->setInfo($this->lng->txt('crs_subscription_min_members_info'));
1194  $lim->addSubItem($min);
1195 
1196  $max = new ilTextInputGUI('', 'subscription_max');
1197  $max->setSubmitFormOnEnter(true);
1198  $max->setSize(4);
1199  $max->setMaxLength(4);
1200  $max->setValue($this->object->getSubscriptionMaxMembers() ?: '');
1201  $max->setTitle($this->lng->txt('crs_subscription_max_members'));
1202  $max->setInfo($this->lng->txt('crs_reg_max_info'));
1203 
1204  $lim->addSubItem($max);
1205 
1206  $wait = new ilRadioGroupInputGUI($this->lng->txt('crs_waiting_list'), 'waiting_list');
1207  $option = new ilRadioOption($this->lng->txt('none'), '0');
1208  $wait->addOption($option);
1209 
1210  $option = new ilRadioOption($this->lng->txt('crs_waiting_list_no_autofill'), '1');
1211  $option->setInfo($this->lng->txt('crs_wait_info'));
1212  $wait->addOption($option);
1213 
1214  $option = new ilRadioOption($this->lng->txt('crs_waiting_list_autofill'), '2');
1215  $option->setInfo($this->lng->txt('crs_waiting_list_autofill_info'));
1216  $wait->addOption($option);
1217 
1218  if ($this->object->hasWaitingListAutoFill()) {
1219  $wait->setValue('2');
1220  } elseif ($this->object->enabledWaitingList()) {
1221  $wait->setValue('1');
1222  } else {
1223  $wait->setValue('0');
1224  }
1225  $lim->addSubItem($wait);
1226  $form->addItem($lim);
1227  $pres = new ilFormSectionHeaderGUI();
1228  $pres->setTitle($this->lng->txt('crs_view_mode'));
1229 
1230  $form->addItem($pres);
1231 
1232  // title and icon visibility
1233  $form = $obj_service->commonSettings()->legacyForm($form, $this->object)->addTitleIconVisibility();
1234 
1235  // top actions visibility
1236  $form = $obj_service->commonSettings()->legacyForm($form, $this->object)->addTopActionsVisibility();
1237 
1238  // breadcrumbs
1239  if ($setting->get("rep_breadcr_crs") && $setting->get("rep_breadcr_crs_overwrite")) {
1240  $add = $setting->get("rep_breadcr_crs_default")
1241  ? " (" . $this->lng->txt("crs_breadcrumb_crs_only") . ")"
1242  : " (" . $this->lng->txt("crs_breadcrumb_full_path") . ")";
1243  $options = array(
1244  self::BREADCRUMB_DEFAULT => $this->lng->txt("crs_sys_default") . $add,
1245  self::BREADCRUMB_CRS_ONLY => $this->lng->txt("crs_breadcrumb_crs_only"),
1246  self::BREADCRUMB_FULL_PATH => $this->lng->txt("crs_breadcrumb_full_path")
1247  );
1248  $si = new ilSelectInputGUI($this->lng->txt("crs_shorten_breadcrumb"), "rep_breacrumb");
1249  $si->setValue((int) ilContainer::_lookupContainerSetting($this->object->getId(), "rep_breacrumb"));
1250  $si->setOptions($options);
1251  $form->addItem($si);
1252  }
1253 
1254  // custom icon
1255  $form = $obj_service->commonSettings()->legacyForm($form, $this->object)->addIcon();
1256 
1257  // tile image
1258  $form = $obj_service->commonSettings()->legacyForm($form, $this->object)->addTileImage();
1259 
1260  // list presentation
1262 
1263  // presentation type
1264  $view_type = new ilRadioGroupInputGUI($this->lng->txt('crs_presentation_type'), 'view_mode');
1265  $view_type->setValue($this->object->getViewMode());
1266 
1267  $opts = new ilRadioOption(
1268  $this->lng->txt('cntr_view_sessions'),
1270  );
1271  $opts->setInfo($this->lng->txt('cntr_view_info_sessions'));
1272  $view_type->addOption($opts);
1273 
1274  // Limited sessions
1275  $sess = new ilCheckboxInputGUI($this->lng->txt('sess_limit'), 'sl');
1276  $sess->setValue('1');
1277  $sess->setChecked($this->object->isSessionLimitEnabled());
1278  $sess->setInfo($this->lng->txt('sess_limit_info'));
1279 
1280  $prev = new ilNumberInputGUI($this->lng->txt('sess_num_prev'), 'sp');
1281  #$prev->setSubmitFormOnEnter(true);
1282  $prev->setMinValue(0);
1283  $prev->setValue(
1284  $this->object->getNumberOfPreviousSessions() == -1 ?
1285  '' :
1286  $this->object->getNumberOfPreviousSessions()
1287  );
1288  $prev->setSize(2);
1289  $prev->setMaxLength(3);
1290  $sess->addSubItem($prev);
1291 
1292  $next = new ilNumberInputGUI($this->lng->txt('sess_num_next'), 'sn');
1293  #$next->setSubmitFormOnEnter(true);
1294  $next->setMinValue(0);
1295  $next->setValue(
1296  $this->object->getNumberOfNextSessions() == -1 ?
1297  '' :
1298  $this->object->getNumberOfnextSessions()
1299  );
1300  $next->setSize(2);
1301  $next->setMaxLength(3);
1302  $sess->addSubItem($next);
1303 
1304  $opts->addSubItem($sess);
1305 
1306  $optsi = new ilRadioOption($this->lng->txt('cntr_view_simple'), (string) ilCourseConstants::IL_CRS_VIEW_SIMPLE);
1307  $optsi->setInfo($this->lng->txt('cntr_view_info_simple'));
1308  $view_type->addOption($optsi);
1309 
1310  $optbt = new ilRadioOption(
1311  $this->lng->txt('cntr_view_by_type'),
1313  );
1314  $optbt->setInfo($this->lng->txt('cntr_view_info_by_type'));
1315  $view_type->addOption($optbt);
1316 
1317  $opto = new ilRadioOption(
1318  $this->lng->txt('crs_view_objective'),
1320  );
1321  $opto->setInfo($this->lng->txt('crs_view_info_objective'));
1322  $view_type->addOption($opto);
1323 
1324  $optt = new ilRadioOption($this->lng->txt('crs_view_timing'), (string) ilCourseConstants::IL_CRS_VIEW_TIMING);
1325  $optt->setInfo($this->lng->txt('crs_view_info_timing'));
1326 
1327  // cognos-blu-patch: begin
1328  $timing = new ilRadioGroupInputGUI($this->lng->txt('crs_view_timings'), "timing_mode");
1329  $timing->setValue($this->object->getTimingMode());
1330 
1331  $absolute = new ilRadioOption(
1332  $this->lng->txt('crs_view_timing_absolute'),
1334  );
1335  $absolute->setInfo($this->lng->txt('crs_view_info_timing_absolute'));
1336  $timing->addOption($absolute);
1337 
1338  $relative = new ilRadioOption(
1339  $this->lng->txt('crs_view_timing_relative'),
1341  );
1342  $relative->setInfo($this->lng->txt('crs_view_info_timing_relative'));
1343  $timing->addOption($relative);
1344 
1345  $optt->addSubItem($timing);
1346  // cognos-blu-patch: end
1347 
1348  $view_type->addOption($optt);
1349 
1350  $form->addItem($view_type);
1351 
1352  $this->initSortingForm(
1353  $form,
1354  array(
1359  )
1360  );
1361 
1362  $tutorial_support_panel_checkbox = new ilCheckboxInputGUI(
1363  $this->lng->txt('tutorial_support_block_setting_title'),
1364  'tutorial_support_block_checkbox'
1365  );
1366  //$tutorial_support_panel_checkbox->setValue($this->object->getTutorialSupportBlockSettingValue());
1367  $tutorial_support_panel_checkbox->setChecked((bool) $this->object->getTutorialSupportBlockSettingValue());
1368  $tutorial_support_panel_checkbox->setInfo($this->lng->txt('tutorial_support_block_byline'));
1369  $form->addItem($tutorial_support_panel_checkbox);
1370 
1371  // lp vs. course status
1373  $olp = ilObjectLP::getInstance($this->object->getId());
1374  if ($olp->getCurrentMode()) {
1375  $lp_status = new ilFormSectionHeaderGUI();
1376  $lp_status->setTitle($this->lng->txt('crs_course_status_of_users'));
1377  $form->addItem($lp_status);
1378 
1379  $lp_status_options = new ilRadioGroupInputGUI($this->lng->txt('crs_status_determination'), "status_dt");
1380  // $lp_status_options->setRequired(true);
1381  $lp_status_options->setValue($this->object->getStatusDetermination());
1382 
1383  $lp_option = new ilRadioOption(
1384  $this->lng->txt('crs_status_determination_lp'),
1386  $this->lng->txt('crs_status_determination_lp_info')
1387  );
1388  $lp_status_options->addOption($lp_option);
1389  $lp_status_options->addOption(new ilRadioOption(
1390  $this->lng->txt('crs_status_determination_manual'),
1392  ));
1393 
1394  $form->addItem($lp_status_options);
1395  }
1396  }
1397 
1398  // additional features
1399  $feat = new ilFormSectionHeaderGUI();
1400  $feat->setTitle($this->lng->txt('obj_features'));
1401  $form->addItem($feat);
1402 
1404  $this->object->getId(),
1405  $form,
1406  $this->getSubServices()
1407  );
1408 
1409  $mem = new ilCheckboxInputGUI($this->lng->txt('crs_show_members'), 'show_members');
1410  $mem->setChecked($this->object->getShowMembers());
1411  $mem->setInfo($this->lng->txt('crs_show_members_info'));
1412  $form->addItem($mem);
1413 
1414  // check privacy
1415  if (\ilPrivacySettings::getInstance()->participantsListInCoursesEnabled()) {
1416  $part_list = new ilCheckboxInputGUI($this->lng->txt('crs_show_member_export'), 'show_members_export');
1417  $part_list->setChecked($this->object->getShowMembersExport());
1418  $part_list->setInfo($this->lng->txt('crs_show_member_export_info'));
1419  $mem->addSubItem($part_list);
1420  }
1421 
1422  // Show members type
1423  $mail_type = new ilRadioGroupInputGUI($this->lng->txt('crs_mail_type'), 'mail_type');
1424  $mail_type->setValue($this->object->getMailToMembersType());
1425 
1426  $mail_tutors = new ilRadioOption(
1427  $this->lng->txt('crs_mail_tutors_only'),
1429  $this->lng->txt('crs_mail_tutors_only_info')
1430  );
1431  $mail_type->addOption($mail_tutors);
1432 
1433  $mail_all = new ilRadioOption(
1434  $this->lng->txt('crs_mail_all'),
1436  $this->lng->txt('crs_mail_all_info')
1437  );
1438  $mail_type->addOption($mail_all);
1439  $form->addItem($mail_type);
1440 
1441  // Notification Settings
1442  /*$notification = new ilFormSectionHeaderGUI();
1443  $notification->setTitle($this->lng->txt('crs_notification'));
1444  $form->addItem($notification);*/
1445 
1446  // Self notification
1447  $not = new ilCheckboxInputGUI($this->lng->txt('crs_auto_notification'), 'auto_notification');
1448  $not->setValue('1');
1449  $not->setInfo($this->lng->txt('crs_auto_notification_info'));
1450  $not->setChecked($this->object->getAutoNotification());
1451  $form->addItem($not);
1452 
1453  $desk = new ilCheckboxInputGUI($this->lng->txt('crs_add_remove_from_desktop'), 'abo');
1454  $desk->setChecked($this->object->getAboStatus());
1455  $desk->setInfo($this->lng->txt('crs_add_remove_from_desktop_info'));
1456  $form->addItem($desk);
1457 
1458  // Edit ecs export settings
1459  $ecs = new ilECSCourseSettings($this->object);
1460  $ecs->addSettingsToForm($form, 'crs');
1461  return $form;
1462  }
1463 
1464  public function sendFileObject(): void
1465  {
1466  $file_id = 0;
1467  if ($this->http->wrapper()->query()->has('file_id')) {
1468  $file_id = $this->http->wrapper()->query()->retrieve(
1469  'file_id',
1470  $this->refinery->kindlyTo()->int()
1471  );
1472  }
1473  $file = new ilCourseFile($file_id);
1474  ilFileDelivery::deliverFileLegacy($file->getAbsolutePath(), $file->getFileName(), $file->getFileType());
1475  }
1476 
1477  public function setSubTabs(string $a_tab): void
1478  {
1479  switch ($a_tab) {
1480  case "properties":
1481  $this->tabs_gui->addSubTabTarget(
1482  "crs_settings",
1483  $this->ctrl->getLinkTarget($this, 'edit'),
1484  "edit",
1485  get_class($this)
1486  );
1487 
1488  $this->tabs_gui->addSubTabTarget(
1489  "crs_info_settings",
1490  $this->ctrl->getLinkTarget($this, 'editInfo'),
1491  "editInfo",
1492  get_class($this)
1493  );
1494 
1495  $this->tabs_gui->addSubTabTarget(
1496  "preconditions",
1497  $this->ctrl->getLinkTargetByClass('ilConditionHandlerGUI', 'listConditions'),
1498  "",
1499  "ilConditionHandlerGUI"
1500  );
1501 
1502  $this->tabs_gui->addSubTabTarget(
1503  "crs_start_objects",
1504  $this->ctrl->getLinkTargetByClass('ilContainerStartObjectsGUI', 'listStructure'),
1505  "listStructure",
1506  get_class($this)
1507  );
1508 
1509  $this->tabs_gui->addSubTabTarget(
1510  'groupings',
1511  $this->ctrl->getLinkTargetByClass('ilobjcoursegroupinggui', 'listGroupings'),
1512  'listGroupings',
1513  get_class($this)
1514  );
1515  $lti_settings = new ilLTIProviderObjectSettingGUI($this->object->getRefId());
1516  if ($lti_settings->hasSettingsAccess()) {
1517  $this->tabs_gui->addSubTabTarget(
1518  'lti_provider',
1519  $this->ctrl->getLinkTargetByClass(ilLTIProviderObjectSettingGUI::class)
1520  );
1521  }
1522 
1523  // map settings
1524  if (ilMapUtil::isActivated()) {
1525  $this->tabs_gui->addSubTabTarget(
1526  "crs_map_settings",
1527  $this->ctrl->getLinkTarget($this, 'editMapSettings'),
1528  "editMapSettings",
1529  get_class($this)
1530  );
1531  }
1532 
1533  // only show if export permission is granted
1534  if (ilPrivacySettings::getInstance()->checkExportAccess($this->object->getRefId()) || ilCourseDefinedFieldDefinition::_hasFields($this->object->getId())) {
1535  $this->tabs_gui->addSubTabTarget(
1536  'crs_custom_user_fields',
1537  $this->ctrl->getLinkTargetByClass('ilobjectcustomuserfieldsgui'),
1538  '',
1539  'ilobjectcustomuserfieldsgui'
1540  );
1541  }
1542 
1543  // certificates
1544  $validator = new ilCertificateActiveValidator();
1545  if (true === $validator->validate()) {
1546  $this->tabs_gui->addSubTabTarget(
1547  "certificate",
1548  $this->ctrl->getLinkTargetByClass("ilcertificategui", "certificateeditor"),
1549  "",
1550  "ilcertificategui"
1551  );
1552  }
1553  // news settings
1554  if ($this->object->getUseNews()) {
1555  $this->tabs_gui->addSubTab(
1556  'obj_news_settings',
1557  $this->lng->txt("cont_news_settings"),
1558  $this->ctrl->getLinkTargetByClass('ilcontainernewssettingsgui')
1559  );
1560  }
1561  if ($this->object->getShowMembersExport()) {
1562  $this->tabs_gui->addSubTab(
1563  'export_members',
1564  $this->lng->txt('crs_show_member_export_settings'),
1565  $this->ctrl->getLinkTargetByClass('ilmemberexportsettingsgui', '')
1566  );
1567  }
1568  $this->tabs_gui->addSubTabTarget(
1569  "obj_multilinguality",
1570  $this->ctrl->getLinkTargetByClass("ilobjecttranslationgui", ""),
1571  "",
1572  "ilobjecttranslationgui"
1573  );
1574  break;
1575  }
1576  }
1577 
1581  protected function showPossibleSubObjects(): void
1582  {
1583  if (
1584  $this->object->getViewMode() == ilContainer::VIEW_OBJECTIVE &&
1585  !$this->isActiveAdministrationPanel()) {
1586  return;
1587  }
1588  $this->renderAddNewItem();
1589  }
1590 
1591  public function renderAddNewItem(string ...$disabled_object_types): void
1592  {
1593  $createble_object_types = $this->getCreatableObjectTypes();
1594 
1595  foreach ($disabled_object_types as $type) {
1596  unset($createble_object_types[$type]);
1597  }
1598 
1600  $this->buildAddNewItemElements($createble_object_types)
1601  );
1602  $gui->render();
1603  }
1604 
1608  protected function afterSave(ilObject $new_object): void
1609  {
1610  $new_object->getMemberObject()->add($this->user->getId(), ilParticipants::IL_CRS_ADMIN);
1611  $new_object->getMemberObject()->updateNotification(
1612  $this->user->getId(),
1613  $this->settings->get('mail_crs_admin_notification', '1')
1614  );
1615  $new_object->getMemberObject()->updateContact($this->user->getId(), 1);
1616  $new_object->update();
1617 
1618  ilChangeEvent::_recordWriteEvent($new_object->getId(), $this->user->getId(), 'create');
1619  // END ChangeEvent: Record write event.
1620 
1621  // always send a message
1622  $this->tpl->setOnScreenMessage('success', $this->lng->txt("crs_added"), true);
1623  $this->ctrl->setParameter($this, "ref_id", $new_object->getRefId());
1625  "save",
1626  $this->ctrl->getLinkTarget($this, "edit", "")
1627  ));
1628  }
1629 
1630  public function readMemberData(array $ids, array $selected_columns = null, bool $skip_names = false): array
1631  {
1632  $show_tracking =
1633  (
1636  );
1637  if ($show_tracking) {
1638  $olp = ilObjectLP::getInstance($this->object->getId());
1639  $show_tracking = $olp->isActive();
1640  }
1641 
1642  if ($show_tracking) {
1643  $completed = ilLPStatusWrapper::_lookupCompletedForObject($this->object->getId());
1644  $in_progress = ilLPStatusWrapper::_lookupInProgressForObject($this->object->getId());
1645  $failed = ilLPStatusWrapper::_lookupFailedForObject($this->object->getId());
1646  }
1647  $privacy = ilPrivacySettings::getInstance();
1648 
1649  if ($privacy->enabledCourseAccessTimes()) {
1650  $progress = ilLearningProgress::_lookupProgressByObjId($this->object->getId());
1651  }
1652 
1653  $do_prtf = (is_array($selected_columns) &&
1654  in_array('prtf', $selected_columns) &&
1655  is_array($ids));
1656  if ($do_prtf) {
1658  $ids,
1659  $this->ctrl->getLinkTarget($this, "members")
1660  );
1661  }
1662 
1663  $members = [];
1664  foreach ($ids as $usr_id) {
1672  if (!$skip_names) {
1673  $name = ilObjUser::_lookupName($usr_id);
1674  $tmp_data['firstname'] = $name['firstname'];
1675  $tmp_data['lastname'] = $name['lastname'];
1676  $tmp_data['login'] = $name['login'];
1677  }
1678  $tmp_data['passed'] = $this->object->getMembersObject()->hasPassed($usr_id) ? 1 : 0;
1679  if ($this->object->getStatusDetermination() == ilObjCourse::STATUS_DETERMINATION_LP) {
1680  $tmp_data['passed_info'] = $this->object->getMembersObject()->getPassedInfo($usr_id);
1681  }
1682  $tmp_data['notification'] = $this->object->getMembersObject()->isNotificationEnabled($usr_id) ? 1 : 0;
1683  $tmp_data['blocked'] = $this->object->getMembersObject()->isBlocked($usr_id) ? 1 : 0;
1684  $tmp_data['contact'] = $this->object->getMembersObject()->isContact($usr_id) ? 1 : 0;
1685 
1686  $tmp_data['usr_id'] = $usr_id;
1687 
1688  if ($show_tracking) {
1689  if (in_array($usr_id, $completed)) {
1690  $tmp_data['progress'] = ilLPStatus::LP_STATUS_COMPLETED;
1691  } elseif (in_array($usr_id, $in_progress)) {
1692  $tmp_data['progress'] = ilLPStatus::LP_STATUS_IN_PROGRESS;
1693  } elseif (in_array($usr_id, $failed)) {
1694  $tmp_data['progress'] = ilLPStatus::LP_STATUS_FAILED;
1695  } else {
1696  $tmp_data['progress'] = ilLPStatus::LP_STATUS_NOT_ATTEMPTED;
1697  }
1698  }
1699 
1700  if ($privacy->enabledCourseAccessTimes()) {
1701  if (isset($progress[$usr_id]['ts']) && $progress[$usr_id]['ts']) {
1702  $tmp_data['access_ut'] = $progress[$usr_id]['ts'];
1703  $tmp_data['access_time'] = ilDatePresentation::formatDate(new ilDateTime(
1704  $progress[$usr_id]['ts'],
1705  IL_CAL_UNIX
1706  ));
1707  } else {
1708  $tmp_data['access_ut'] = 0;
1709  $tmp_data['access_time'] = $this->lng->txt('no_date');
1710  }
1711  }
1712 
1713  if ($do_prtf) {
1714  $tmp_data['prtf'] = $all_prtf[$usr_id] ?? null;
1715  }
1716 
1717  $members[$usr_id] = $tmp_data;
1718  }
1719  return $members;
1720  }
1721 
1725  public function updateLPFromStatus(int $a_member_id, bool $a_has_passed): void
1726  {
1728  $this->object->getStatusDetermination() == ilObjCourse::STATUS_DETERMINATION_LP) {
1729  $olp = ilObjectLP::getInstance($this->object->getId());
1730  if ($olp->getCurrentMode() == ilLPObjSettings::LP_MODE_MANUAL_BY_TUTOR) {
1731  $marks = new ilLPMarks($this->object->getId(), $a_member_id);
1732 
1733  // only if status has changed
1734  if ($marks->getCompleted() !== $a_has_passed) {
1735  $marks->setCompleted($a_has_passed);
1736  $marks->update();
1737 
1738  // as course is origin of LP status change, block syncing
1740  ilLPStatusWrapper::_updateStatus($this->object->getId(), $a_member_id);
1741  }
1742  }
1743  }
1744  }
1745 
1746  public function autoFillObject(): bool
1747  {
1748  $this->checkPermission('write');
1749  if (
1750  $this->object->isSubscriptionMembershipLimited() &&
1751  $this->object->getSubscriptionMaxMembers() &&
1752  $this->object->getSubscriptionMaxMembers() <= $this->object->getMembersObject()->getCountMembers()
1753  ) {
1754  $this->tpl->setOnScreenMessage('failure', $this->lng->txt("crs_max_members_reached"));
1755  $this->membersObject();
1756  return false;
1757  }
1758  if ($number = $this->object->getMembersObject()->autoFillSubscribers()) {
1759  $this->tpl->setOnScreenMessage('success', $this->lng->txt("crs_number_users_added") . " " . $number);
1760  } else {
1761  $this->tpl->setOnScreenMessage('failure', $this->lng->txt("crs_no_users_added"));
1762  }
1763  $this->membersObject();
1764  return true;
1765  }
1766 
1767  public function leaveObject(): void
1768  {
1769  $this->checkPermission('leave');
1770 
1771  if ($this->object->getMembersObject()->isLastAdmin($this->user->getId())) {
1772  $this->tpl->setOnScreenMessage('failure', $this->lng->txt('crs_min_one_admin'));
1773  $this->viewObject();
1774  return;
1775  }
1776 
1777  $this->tabs_gui->setTabActive('crs_unsubscribe');
1778  $cgui = new ilConfirmationGUI();
1779  $cgui->setHeaderText($this->lng->txt('crs_unsubscribe_sure'));
1780  $cgui->setFormAction($this->ctrl->getFormAction($this));
1781  $cgui->setCancel($this->lng->txt("cancel"), "cancel");
1782  $cgui->setConfirm($this->lng->txt("crs_unsubscribe"), "performUnsubscribe");
1783  $this->tpl->setContent($cgui->getHTML());
1784  }
1785 
1786  public function unsubscribeObject(): void
1787  {
1788  $this->leaveObject();
1789  }
1790 
1791  public function performUnsubscribeObject()
1792  {
1793  $this->checkPermission('leave');
1794  $this->getObject()->getMembersObject()->delete($this->user->getId());
1795  $this->getObject()->getMembersObject()->sendUnsubscribeNotificationToAdmins($this->user->getId());
1796  $this->getObject()->getMembersObject()->sendNotification(
1798  $this->user->getId()
1799  );
1800  $this->tpl->setOnScreenMessage('success', $this->lng->txt('crs_unsubscribed_from_crs'), true);
1801 
1802  $this->ctrl->setParameterByClass("ilrepositorygui", "ref_id", $this->tree->getParentId($this->ref_id));
1803  $this->ctrl->redirectByClass("ilrepositorygui", "");
1804  }
1805 
1806 
1807  protected function getAgreementTabs(): void
1808  {
1809  if ($this->access->checkAccess('visible', '', $this->ref_id)) {
1810  $this->tabs->addTarget(
1811  "info_short",
1812  $this->ctrl->getLinkTargetByClass(
1813  array("ilobjcoursegui", "ilinfoscreengui"),
1814  "showSummary"
1815  ),
1816  "infoScreen"
1817  );
1818  }
1819  if (
1820  $this->access->checkAccess('leave', '', $this->object->getRefId()) &&
1821  $this->object->getMemberObject()->isMember()
1822  ) {
1823  $this->tabs->addTarget(
1824  "crs_unsubscribe",
1825  $this->ctrl->getLinkTarget($this, "unsubscribe"),
1826  'leave',
1827  ""
1828  );
1829  }
1830  }
1831 
1832  public function addContentTab(): void
1833  {
1834  $this->tabs_gui->addTab(
1835  "view_content",
1836  $this->lng->txt("content"),
1837  $this->ctrl->getLinkTarget($this, "view")
1838  );
1839  }
1840 
1841  protected function getTabs(): void
1842  {
1843  $this->help->setScreenIdComponent("crs");
1844  $this->ctrl->setParameter($this, "ref_id", $this->ref_id);
1845 
1846  if ($this->access->checkAccess('read', '', $this->ref_id)) {
1847  // default activation
1848  $this->tabs_gui->activateTab('view_content');
1849  if ($this->object->isNewsTimelineEffective()) {
1850  if (!$this->object->isNewsTimelineLandingPageEffective()) {
1851  $this->addContentTab();
1852  }
1853  $this->tabs_gui->addTab(
1854  "news_timeline",
1855  $this->lng->txt("cont_news_timeline_tab"),
1856  $this->ctrl->getLinkTargetByClass("ilnewstimelinegui", "show")
1857  );
1858  if ($this->object->isNewsTimelineLandingPageEffective()) {
1859  $this->addContentTab();
1860  }
1861  } else {
1862  $this->addContentTab();
1863  }
1864  }
1865 
1866  if ($this->object->getViewMode() == ilCourseConstants::IL_CRS_VIEW_TIMING && $this->access->checkAccess('write', '', $this->ref_id)
1867  ) {
1868  $this->tabs->addTab(
1869  'timings_timings',
1870  $this->lng->txt('timings_timings'),
1871  $this->ctrl->getLinkTargetByClass('ilcoursecontentgui', 'manageTimings')
1872  );
1873  } elseif (
1874  $this->object->getViewMode() == ilCourseConstants::IL_CRS_VIEW_TIMING && $this->object->getMemberObject()->isParticipant() && $this->access->checkAccess('read', '', $this->ref_id)) {
1875  $this->tabs->addTab(
1876  'timings_timings',
1877  $this->lng->txt('timings_timings'),
1878  $this->ctrl->getLinkTargetByClass('ilcoursecontentgui', 'managePersonalTimings')
1879  );
1880  }
1881 
1882  // learning objectives
1883  if ($this->access->checkAccess('write', '', $this->ref_id)) {
1884  if ($this->object->getViewMode() == ilCourseConstants::IL_CRS_VIEW_OBJECTIVE or ilCourseObjective::_getCountObjectives($this->object->getId())) {
1885  $this->tabs_gui->addTarget(
1886  'crs_objectives',
1887  $this->ctrl->getLinkTargetByClass('illoeditorgui', ''),
1888  'illoeditorgui'
1889  );
1890  }
1891  }
1892 
1893  if (
1894  $this->access->checkAccess('visible', '', $this->ref_id) ||
1895  $this->access->checkAccess('join', '', $this->ref_id) ||
1896  $this->access->checkAccess('read', '', $this->ref_id)
1897  ) {
1898  $force_active =
1899  strcasecmp($this->ctrl->getCmdClass(), ilInfoScreenGUI::class) === 0 ||
1900  strcasecmp($this->ctrl->getCmdClass(), ilNoteGUI::class) === 0;
1901  $this->tabs_gui->addTarget(
1902  "info_short",
1903  $this->ctrl->getLinkTargetByClass(
1904  array("ilobjcoursegui", "ilinfoscreengui"),
1905  "showSummary"
1906  ),
1907  "infoScreen",
1908  "",
1909  "",
1910  $force_active
1911  );
1912  }
1913  if ($this->access->checkAccess('write', '', $this->ref_id)) {
1914  $force_active =
1915  strcasecmp($this->ctrl->getCmdClass(), ilConditionHandlerGUI::class) &&
1916  !$this->http->wrapper()->query()->has('item_id');
1917  $this->tabs_gui->addTarget(
1918  "settings",
1919  $this->ctrl->getLinkTarget($this, "edit"),
1920  array("edit", "editMapSettings", "editCourseIcons", "listStructure"),
1921  "",
1922  "",
1923  $force_active
1924  );
1925  }
1926 
1927  $is_participant = ilCourseParticipants::_isParticipant($this->ref_id, $this->user->getId());
1928  $mail = new ilMail($this->user->getId());
1929 
1930  $membership_gui = new ilCourseMembershipGUI($this, $this->object);
1931  $membership_gui->addMemberTab($this->tabs_gui, $is_participant);
1932 
1933  // badges
1934  if ($this->access->checkAccess('write', '', $this->ref_id)) {
1935  if (ilBadgeHandler::getInstance()->isObjectActive($this->object->getId())) {
1936  $this->tabs_gui->addTarget(
1937  "obj_tool_setting_badges",
1938  $this->ctrl->getLinkTargetByClass("ilbadgemanagementgui", ""),
1939  "",
1940  "ilbadgemanagementgui"
1941  );
1942  }
1943  }
1944 
1945  // skills
1946  if (ilContSkillPresentationGUI::isAccessible($this->ref_id)) {
1947  $this->tabs_gui->addTarget(
1948  "obj_tool_setting_skills",
1949  $this->ctrl->getLinkTargetByClass(array("ilcontainerskillgui", "ilcontskillpresentationgui"), ""),
1950  "",
1951  array("ilcontainerskillgui", "ilcontskillpresentationgui", "ilcontskilladmingui")
1952  );
1953  }
1954 
1955  // booking
1956  if ($this->access->checkAccess('write', '', $this->ref_id) && ilContainer::_lookupContainerSetting(
1957  $this->object->getId(),
1959  '0'
1960  )) {
1961  $this->tabs_gui->addTarget(
1962  "obj_tool_setting_booking",
1963  $this->ctrl->getLinkTargetByClass(array("ilbookinggatewaygui"), "")
1964  );
1965  }
1966 
1967  // learning progress
1968  if (ilLearningProgressAccess::checkAccess($this->object->getRefId(), $is_participant)) {
1969  $this->tabs_gui->addTarget(
1970  'learning_progress',
1971  $this->ctrl->getLinkTargetByClass(array('ilobjcoursegui', 'illearningprogressgui'), ''),
1972  '',
1973  array('illplistofobjectsgui', 'illplistofsettingsgui', 'illearningprogressgui', 'illplistofprogressgui')
1974  );
1975  }
1976 
1977  // meta data
1978  if ($this->access->checkAccess('write', '', $this->ref_id)) {
1979  $mdgui = new ilObjectMetaDataGUI($this->object);
1980  $mdtab = $mdgui->getTab();
1981  if ($mdtab) {
1982  $this->tabs_gui->addTarget(
1983  "meta_data",
1984  $mdtab,
1985  "",
1986  "ilobjectmetadatagui"
1987  );
1988  }
1989  }
1990 
1991  if ($this->access->checkAccess('write', '', $this->object->getRefId())) {
1992  $this->tabs_gui->addTarget(
1993  'export',
1994  $this->ctrl->getLinkTargetByClass('ilexportgui', ''),
1995  'export',
1996  'ilexportgui'
1997  );
1998  }
1999 
2000  if ($this->access->checkAccess('edit_permission', '', $this->ref_id)) {
2001  $this->tabs_gui->addTarget(
2002  "perm_settings",
2003  $this->ctrl->getLinkTargetByClass(array(get_class($this), 'ilpermissiongui'), "perm"),
2004  array("perm", "info", "owner"),
2005  'ilpermissiongui'
2006  );
2007  }
2008 
2009  // Join/Leave
2010  if ($this->access->checkAccess('join', '', $this->ref_id) && !$this->object->getMemberObject()->isAssigned()) {
2011  if (ilCourseWaitingList::_isOnList($this->user->getId(), $this->object->getId())) {
2012  $this->tabs_gui->addTab(
2013  'leave',
2014  $this->lng->txt('membership_leave'),
2015  $this->ctrl->getLinkTargetByClass('ilcourseregistrationgui', 'show', '')
2016  );
2017  } else {
2018  $this->tabs_gui->addTarget(
2019  "join",
2020  $this->ctrl->getLinkTargetByClass('ilcourseregistrationgui', "show"),
2021  'show',
2022  ""
2023  );
2024  }
2025  }
2026  if ($this->access->checkAccess('leave', '', $this->object->getRefId()) && $this->object->getMemberObject()->isMember()) {
2027  $this->tabs_gui->addTarget(
2028  "crs_unsubscribe",
2029  $this->ctrl->getLinkTarget($this, "unsubscribe"),
2030  'leave',
2031  ""
2032  );
2033  }
2034  }
2035 
2036  public function executeCommand(): void
2037  {
2038  $next_class = $this->ctrl->getNextClass($this);
2039  $cmd = $this->ctrl->getCmd();
2040 
2041  $this->prepareOutput();
2042 
2043  // add entry to navigation history
2044  if (!$this->getCreationMode() &&
2045  $this->access->checkAccess('read', '', $this->ref_id)) {
2046  $this->navigation_history->addItem(
2047  $this->ref_id,
2048  ilLink::_getLink($this->ref_id, "crs"),
2049  "crs"
2050  );
2051  }
2052  $header_action = true;
2053  switch ($next_class) {
2054  case strtolower(ilRepositoryTrashGUI::class):
2055  $ru = new \ilRepositoryTrashGUI($this);
2056  $this->ctrl->setReturn($this, 'trash');
2057  $this->ctrl->forwardCommand($ru);
2058  break;
2059 
2060  case 'illtiproviderobjectsettinggui':
2061 
2062  $this->setSubTabs('properties');
2063  $this->tabs_gui->activateTab('settings');
2064  $this->tabs_gui->activateSubTab('lti_provider');
2065  $lti_gui = new ilLTIProviderObjectSettingGUI($this->object->getRefId());
2066  $lti_gui->setCustomRolesForSelection($GLOBALS['DIC']->rbac()->review()->getLocalRoles($this->object->getRefId()));
2067  $lti_gui->offerLTIRolesForSelection(false);
2068  $this->ctrl->forwardCommand($lti_gui);
2069  break;
2070 
2071  case 'ilcoursemembershipgui':
2072 
2073  $this->tabs_gui->activateTab('members');
2074 
2075  $mem_gui = new ilCourseMembershipGUI($this, $this->object);
2076  $this->ctrl->forwardCommand($mem_gui);
2077  break;
2078 
2079  case "ilinfoscreengui":
2080  $this->infoScreen(); // forwards command
2081  break;
2082 
2083  case 'ilobjectmetadatagui':
2084  if (!$this->access->checkAccess('write', '', $this->object->getRefId())) {
2085  $this->error->raiseError($this->lng->txt('permission_denied'), $this->error->WARNING);
2086  }
2087  $this->tabs_gui->setTabActive('meta_data');
2088  $md_gui = new ilObjectMetaDataGUI($this->object);
2089  $this->ctrl->forwardCommand($md_gui);
2090  break;
2091 
2092  case 'ilcourseregistrationgui':
2093  $this->ctrl->setReturn($this, '');
2094  $this->tabs_gui->setTabActive('join');
2095  $registration = new ilCourseRegistrationGUI($this->object, $this);
2096  $this->ctrl->forwardCommand($registration);
2097  break;
2098 
2099  case 'ilobjectcustomuserfieldsgui':
2100  $cdf_gui = new ilObjectCustomUserFieldsGUI($this->object->getId());
2101  $this->setSubTabs('properties');
2102  $this->tabs_gui->activateTab('settings');
2103  $this->tabs_gui->activateSubTab('crs_custom_user_fields');
2104  $this->ctrl->forwardCommand($cdf_gui);
2105  break;
2106 
2107  case "ilcourseobjectivesgui":
2108 
2109  $this->ctrl->setReturn($this, "");
2110  $reg_gui = new ilCourseObjectivesGUI($this->object->getRefId());
2111  $this->ctrl->forwardCommand($reg_gui);
2112  break;
2113 
2114  case 'ilobjcoursegroupinggui':
2115 
2116  $this->ctrl->setReturn($this, 'edit');
2117  $this->setSubTabs('properties');
2118  $this->tabs_gui->activateTab('settings');
2119  $this->tabs_gui->activateSubTab('groupings');
2120 
2121  $grouping_id = 0;
2122  if ($this->http->wrapper()->query()->has('obj_id')) {
2123  $grouping_id = $this->http->wrapper()->query()->retrieve(
2124  'obj_id',
2125  $this->refinery->kindlyTo()->int()
2126  );
2127  }
2128  $crs_grp_gui = new ilObjCourseGroupingGUI($this->object, $grouping_id);
2129  $this->ctrl->forwardCommand($crs_grp_gui);
2130  break;
2131 
2132  case "ilpropertyformgui":
2133  // only case is currently adv metadata internal link in info settings, see #24497
2134  $form = $this->initInfoEditor();
2135  $this->ctrl->forwardCommand($form);
2136  break;
2137 
2138  case "ilcolumngui":
2139  $this->ctrl->setReturn($this, "");
2140  $this->tabs_gui->setTabActive('none');
2141  $this->checkPermission("read");
2142  //$this->prepareOutput();
2143  //$this->tpl->setVariable("LOCATION_CONTENT_STYLESHEET",
2144  // ilObjStyleSheet::getContentStylePath(0));
2145  //$this->renderObject();
2146  $this->viewObject();
2147  break;
2148 
2149  case "ilconditionhandlergui":
2150  // preconditions for whole course
2151  $this->setSubTabs("properties");
2152  $this->tabs_gui->activateTab('settings');
2153  $this->tabs_gui->activateSubTab('preconditions');
2154  $new_gui = new ilConditionHandlerGUI($this->object->getRefId());
2155  $this->ctrl->forwardCommand($new_gui);
2156  break;
2157 
2158  case "illearningprogressgui":
2159 
2160  $user_id = $this->user->getId();
2161  if ($this->http->wrapper()->query()->has('user_id')) {
2162  $user_id = $this->http->wrapper()->query()->retrieve(
2163  'user_id',
2164  $this->refinery->kindlyTo()->int()
2165  );
2166  }
2167  $new_gui = new ilLearningProgressGUI(
2169  $this->object->getRefId(),
2170  $user_id
2171  );
2172  $this->ctrl->forwardCommand($new_gui);
2173  $this->tabs_gui->setTabActive('learning_progress');
2174  break;
2175 
2176  case 'ilpermissiongui':
2177  $this->tabs_gui->setTabActive('perm_settings');
2178  $perm_gui = new ilPermissionGUI($this);
2179  $this->ctrl->forwardCommand($perm_gui);
2180  break;
2181 
2182  case 'ilcalendarpresentationgui':
2183  $cal = new ilCalendarPresentationGUI($this->object->getRefId());
2184  $ret = $this->ctrl->forwardCommand($cal);
2185  $header_action = false;
2186  break;
2187 
2188  case 'ilcoursecontentgui':
2189  $this->ctrl->setReturn($this, 'members');
2190  $course_content_obj = new ilCourseContentGUI($this);
2191  $this->ctrl->forwardCommand($course_content_obj);
2192  break;
2193 
2194  case 'ilpublicuserprofilegui':
2195  $this->tpl->enableDragDropFileUpload(null);
2196  $this->setSubTabs('members');
2197  $this->tabs_gui->setTabActive('members');
2198 
2199  $user_id = $this->user->getId();
2200  if ($this->http->wrapper()->query()->has('user_id')) {
2201  $user_id = $this->http->wrapper()->query()->retrieve(
2202  'user_id',
2203  $this->refinery->kindlyTo()->int()
2204  );
2205  }
2206  $profile_gui = new ilPublicUserProfileGUI($user_id);
2207  $profile_gui->setBackUrl($this->ctrl->getLinkTargetByClass(["ilCourseMembershipGUI",
2208  "ilUsersGalleryGUI"
2209  ], 'view'));
2210  $this->tabs_gui->setSubTabActive('crs_members_gallery');
2211  $html = $this->ctrl->forwardCommand($profile_gui);
2212  $this->tpl->setVariable("ADM_CONTENT", $html);
2213  break;
2214 
2215  case 'ilmemberagreementgui':
2216  $this->tabs_gui->clearTargets();
2217 
2218  $this->ctrl->setReturn($this, '');
2219  $agreement = new ilMemberAgreementGUI($this->object->getRefId());
2220  $this->ctrl->forwardCommand($agreement);
2221  break;
2222 
2223  // container page editing
2224  case "ilcontainerpagegui":
2225  $ret = $this->forwardToPageObject();
2226  if ($ret != "") {
2227  $this->tpl->setContent($ret);
2228  }
2229  $header_action = false;
2230  break;
2231 
2232  case "ilcontainerstartobjectspagegui":
2233  // file downloads, etc. (currently not active)
2234  $pgui = new ilContainerStartObjectsPageGUI($this->object->getId());
2235  $ret = $this->ctrl->forwardCommand($pgui);
2236  if ($ret) {
2237  $this->tpl->setContent($ret);
2238  }
2239  break;
2240 
2241  case 'ilobjectcopygui':
2242  $cp = new ilObjectCopyGUI($this);
2243  $cp->setType('crs');
2244  $this->ctrl->forwardCommand($cp);
2245  break;
2246 
2247  case "ilobjectcontentstylesettingsgui":
2248 
2249  global $DIC;
2250 
2251  $this->checkPermission("write");
2252  $this->setTitleAndDescription();
2253  $this->showContainerPageTabs();
2254  $settings_gui = $DIC->contentStyle()->gui()
2255  ->objectSettingsGUIForRefId(
2256  null,
2257  $this->object->getRefId()
2258  );
2259  $this->ctrl->forwardCommand($settings_gui);
2260  break;
2261 
2262  case 'ilexportgui':
2263  $this->tabs_gui->setTabActive('export');
2264  $exp = new ilExportGUI($this);
2265  $exp->addFormat('xml');
2266  $this->ctrl->forwardCommand($exp);
2267  break;
2268 
2269  case "ilcommonactiondispatchergui":
2271  $this->ctrl->forwardCommand($gui);
2272  break;
2273 
2274  case 'ildidactictemplategui':
2275  $this->ctrl->setReturn($this, 'edit');
2276  $did = new ilDidacticTemplateGUI($this);
2277  $this->ctrl->forwardCommand($did);
2278  break;
2279 
2280  case "ilcertificategui":
2281  $this->tabs_gui->activateTab("settings");
2282  $this->setSubTabs("properties");
2283  $this->tabs_gui->activateSubTab('certificate');
2284 
2285  $guiFactory = new ilCertificateGUIFactory();
2286  $output_gui = $guiFactory->create($this->object);
2287  $this->ctrl->forwardCommand($output_gui);
2288  break;
2289 
2290  case 'illoeditorgui':
2291  #$this->tabs_gui->clearTargets();
2292  #$this->tabs_gui->setBackTarget($this->lng->txt('back'),$this->ctrl->getLinkTarget($this,''));
2293  $this->tabs_gui->activateTab('crs_objectives');
2294 
2295  $editor = new ilLOEditorGUI($this);
2296  $this->ctrl->forwardCommand($editor);
2297  if (strtolower($this->ctrl->getCmdClass()) === "illopagegui") {
2298  $header_action = false;
2299  }
2300  break;
2301 
2302  case 'ilcontainerstartobjectsgui':
2303  $this->ctrl->setReturn($this, 'edit');
2304  $this->tabs_gui->clearTargets();
2305  $this->tabs_gui->setBackTarget(
2306  $this->lng->txt("back_to_crs_content"),
2307  $this->ctrl->getLinkTarget($this, "edit")
2308  );
2309  $this->tabs_gui->addTab(
2310  "start",
2311  $this->lng->txt("crs_start_objects"),
2312  $this->ctrl->getLinkTargetByClass("ilcontainerstartobjectsgui", "listStructure")
2313  );
2314  $this->tabs_gui->activateTab("start");
2315  if (strtolower($this->ctrl->getCmdClass()) ==
2316  "ilcontainerstartobjectspagegui") {
2317  $header_action = false;
2318  }
2319  global $DIC;
2320 
2321  $ilHelp = $DIC['ilHelp'];
2322  $this->help->setScreenIdComponent("crs");
2323  $stgui = new ilContainerStartObjectsGUI($this->object);
2324  $this->ctrl->forwardCommand($stgui);
2325  break;
2326 
2327  case 'illomembertestresultgui':
2328  $GLOBALS['DIC']['ilCtrl']->setReturn($this, 'members');
2329  $GLOBALS['DIC']['ilTabs']->clearTargets();
2330  $GLOBALS['DIC']['ilTabs']->setBackTarget(
2331  $GLOBALS['DIC']['lng']->txt('back'),
2332  $GLOBALS['DIC']['ilCtrl']->getLinkTarget($this, 'members')
2333  );
2334 
2335  $uid = 0;
2336  if ($this->http->wrapper()->query()->has('uid')) {
2337  $uid = $this->http->wrapper()->query()->retrieve(
2338  'uid',
2339  $this->refinery->kindlyTo()->int()
2340  );
2341  }
2342  $result_view = new ilLOMemberTestResultGUI($this, $this->object, $uid);
2343  $this->ctrl->forwardCommand($result_view);
2344  break;
2345 
2346  case 'ilmailmembersearchgui':
2347  $mail = new ilMail($this->user->getId());
2348 
2349  if (
2350  !($this->object->getMailToMembersType() == ilCourseConstants::MAIL_ALLOWED_ALL ||
2351  $this->access->checkAccess('manage_members', "", $this->object->getRefId())) &&
2352  $this->rbac_system->checkAccess('internal_mail', $mail->getMailObjectReferenceId())) {
2353  $this->error->raiseError($this->lng->txt("msg_no_perm_read"), $this->error->MESSAGE);
2354  }
2355 
2356  $this->tabs_gui->setTabActive('members');
2357 
2358  $mail_search = new ilMailMemberSearchGUI(
2359  $this,
2360  $this->object->getRefId(),
2362  );
2363  $mail_search->setObjParticipants(
2365  );
2366  $this->ctrl->forwardCommand($mail_search);
2367  break;
2368 
2369  case 'ilbadgemanagementgui':
2370  $this->tabs_gui->setTabActive('obj_tool_setting_badges');
2371  $bgui = new ilBadgeManagementGUI($this->object->getRefId(), $this->object->getId(), 'crs');
2372  $this->ctrl->forwardCommand($bgui);
2373  break;
2374 
2375  case "ilcontainernewssettingsgui":
2376  $this->setSubTabs("properties");
2377  $this->tabs_gui->activateTab('settings');
2378  $this->tabs_gui->activateSubTab('obj_news_settings');
2379  $news_set_gui = new ilContainerNewsSettingsGUI($this);
2380  $news_set_gui->setTimeline(true);
2381  $news_set_gui->setCronNotifications(true);
2382  $news_set_gui->setHideByDate(true);
2383  $this->ctrl->forwardCommand($news_set_gui);
2384  break;
2385 
2386  case "ilnewstimelinegui":
2387  if (!$this->__checkStartObjects()) { // see #37236
2388  $this->ctrl->redirectByClass(self::class, "view");
2389  }
2390  $this->tabs_gui->setTabActive('news_timeline');
2392  $this->object->getRefId(),
2393  $this->object->getNewsTimelineAutoEntries()
2394  );
2395  $t->setUserEditAll($this->access->checkAccess('write', '', $this->object->getRefId(), 'grp'));
2396  $this->showPermanentLink();
2397  $this->ctrl->forwardCommand($t);
2399  $this->user->getId(),
2400  $this->object->getId(),
2401  $this->object->getRefId(),
2402  'crs'
2403  );
2404  break;
2405 
2406  case 'ilmemberexportsettingsgui':
2407  $this->setSubTabs('properties');
2408  $this->tabs_gui->activateTab('properties');
2409  $this->tabs_gui->activateSubTab('export_members');
2410  $settings_gui = new ilMemberExportSettingsGUI($this->object->getType(), $this->object->getId());
2411  $this->ctrl->forwardCommand($settings_gui);
2412  break;
2413 
2414  case "ilcontainerskillgui":
2415  $this->tabs_gui->activateTab('obj_tool_setting_skills');
2416  $gui = new ilContainerSkillGUI($this);
2417  $this->ctrl->forwardCommand($gui);
2418  break;
2419 
2420  case 'ilobjecttranslationgui':
2421  $this->checkPermissionBool("write");
2422  $this->setSubTabs("properties");
2423  $this->tabs_gui->activateTab("settings");
2424  $this->tabs_gui->activateSubTab("obj_multilinguality");
2425  $transgui = new ilObjectTranslationGUI($this);
2426  $this->ctrl->forwardCommand($transgui);
2427  break;
2428 
2429  case "ilbookinggatewaygui":
2430  $this->tabs_gui->activateTab('obj_tool_setting_booking');
2431  $gui = new ilBookingGatewayGUI($this);
2432  $this->ctrl->forwardCommand($gui);
2433  break;
2434 
2435  default:
2436  // #9401 - see also ilStartupGUI::_checkGoto()
2437  if ($cmd == 'infoScreenGoto') {
2438  if (ilObjCourse::_isActivated($this->object->getId()) &&
2439  ilObjCourse::_registrationEnabled($this->object->getId())) {
2440  $cmd = 'join';
2441  } else {
2442  $cmd = 'infoScreen';
2443  }
2444  }
2445 
2446  if (!$this->creation_mode) {
2447  if ($cmd == "infoScreen") {
2448  $this->checkPermission("visible");
2449  } else {
2450  // $this->checkPermission("read");
2451  }
2452  }
2453 
2454  if (!$this->creation_mode
2455  && $cmd != 'infoScreen'
2456  && $cmd != 'sendfile'
2457  && $cmd != 'unsubscribe'
2458  && $cmd != 'deliverCertificate'
2459  && $cmd != 'performUnsubscribe'
2460  && $cmd != 'removeFromDesk'
2461  && $cmd !== 'leave'
2462  && !$this->access->checkAccess("read", '', $this->object->getRefId())
2463  || $cmd == 'join'
2464  || $cmd == 'subscribe'
2465  || $cmd === 'leaveWaitList') {
2466  if ($this->rbac_system->checkAccess('join', $this->object->getRefId()) &&
2467  !ilCourseParticipants::_isParticipant($this->object->getRefId(), $this->user->getId())) {
2468  $this->ctrl->redirectByClass("ilCourseRegistrationGUI");
2469  } else {
2470  $this->infoScreenObject();
2471  break;
2472  }
2473  }
2474 
2475  if ($cmd == 'listObjectives') {
2476  $this->ctrl->setReturn($this, "");
2477  $obj_gui = new ilCourseObjectivesGUI($this->object->getRefId());
2478  $this->ctrl->forwardCommand($obj_gui);
2479  break;
2480  }
2481  // if news timeline is landing page, redirect if necessary
2482  if ($cmd == "" && $this->object->isNewsTimelineLandingPageEffective()) {
2483  $this->ctrl->redirectByClass("ilnewstimelinegui");
2484  }
2485 
2486  if (!$cmd) {
2487  $cmd = 'view';
2488  }
2489  $cmd .= 'Object';
2490  $this->$cmd();
2491  break;
2492  }
2493 
2494  if ($header_action) {
2495  $this->addHeaderAction();
2496  }
2497  }
2498 
2499  private function checkAgreement(): bool
2500  {
2501  if ($this->access->checkAccess('write', '', $this->object->getRefId())) {
2502  return true;
2503  }
2504 
2505  // Disable aggrement if is not member of course
2506  if (!$this->object->getMemberObject()->isAssigned()) {
2507  return true;
2508  }
2509 
2510  if (ilMemberViewSettings::getInstance()->isActive()) {
2511  return true;
2512  }
2513 
2514  $privacy = ilPrivacySettings::getInstance();
2515 
2516  // Check agreement
2517  if (
2518  (
2519  $privacy->courseConfirmationRequired() || ilCourseDefinedFieldDefinition::_hasFields($this->object->getId())
2520  ) &&
2521  !ilMemberAgreement::_hasAccepted($this->user->getId(), $this->object->getId())
2522  ) {
2523  $this->logger->warning('Missing course confirmation.');
2524  return false;
2525  }
2526  // Check required fields
2527  if (!ilCourseUserData::_checkRequired($this->user->getId(), $this->object->getId())) {
2528  $this->logger->warning('Missing required fields');
2529  return false;
2530  }
2531  return true;
2532  }
2533 
2534  public static function _forwards(): array
2535  {
2536  return array("ilCourseRegisterGUI", 'ilConditionHandlerGUI');
2537  }
2538 
2539  protected function membersObject(): void
2540  {
2541  $this->ctrl->redirectByClass('ilcoursemembershipgui');
2542  }
2543 
2544  public static function _goto($a_target, string $a_add = ""): void
2545  {
2546  global $DIC;
2547  $main_tpl = $DIC->ui()->mainTemplate();
2548  $ilAccess = $DIC['ilAccess'];
2549  $ilErr = $DIC['ilErr'];
2550  $lng = $DIC['lng'];
2551  $ilUser = $DIC['ilUser'];
2552  $http = $DIC->http();
2553  $refinery = $DIC->refinery();
2554 
2555  $a_target = (int) $a_target;
2556 
2557  if (substr($a_add, 0, 5) == 'rcode') {
2558  if ($ilUser->getId() == ANONYMOUS_USER_ID) {
2559  $target = '';
2560  if ($http->wrapper()->query()->has('target')) {
2561  $target = $http->wrapper()->query()->retrieve(
2562  'target',
2563  $refinery->kindlyTo()->string()
2564  );
2565  }
2566  // Redirect to login for anonymous
2568  "login.php?target=" . $target . "&cmd=force_login&lang=" .
2569  $ilUser->getCurrentLanguage()
2570  );
2571  }
2572 
2573  // Redirects to target location after assigning user to course
2575  $a_target,
2577  substr($a_add, 5)
2578  );
2579  }
2580 
2581  if ($a_add == "mem" && $ilAccess->checkAccess("manage_members", "", $a_target)) {
2582  ilObjectGUI::_gotoRepositoryNode($a_target, "members");
2583  }
2584 
2585  if ($a_add == "comp" && ilContSkillPresentationGUI::isAccessible($a_target)) {
2586  ilObjectGUI::_gotoRepositoryNode($a_target, "competences");
2587  }
2588 
2589  if ($ilAccess->checkAccess("read", "", $a_target)) {
2591  } else {
2592  // to do: force flat view
2593  if ($ilAccess->checkAccess("visible", "", $a_target)) {
2594  ilObjectGUI::_gotoRepositoryNode($a_target, "infoScreenGoto");
2595  } else {
2596  if ($ilAccess->checkAccess("read", "", ROOT_FOLDER_ID)) {
2597  $main_tpl->setOnScreenMessage('failure', sprintf(
2598  $lng->txt("msg_no_perm_read_item"),
2600  ), true);
2602  }
2603  }
2604  }
2605  $ilErr->raiseError($lng->txt("msg_no_perm_read"), $ilErr->FATAL);
2606  }
2607 
2608  public function editMapSettingsObject(): void
2609  {
2610  $this->setSubTabs("properties");
2611  $this->tabs_gui->activateTab('settings');
2612  $this->tabs_gui->activateSubTab('crs_map_settings');
2613 
2614  if (!ilMapUtil::isActivated() ||
2615  !$this->access->checkAccess("write", "", $this->object->getRefId())) {
2616  return;
2617  }
2618 
2619  $latitude = $this->object->getLatitude();
2620  $longitude = $this->object->getLongitude();
2621  $zoom = $this->object->getLocationZoom();
2622 
2623  // Get Default settings, when nothing is set
2624  if ($latitude == 0 && $longitude == 0 && $zoom == 0) {
2626  $latitude = $def["latitude"];
2627  $longitude = $def["longitude"];
2628  $zoom = $def["zoom"];
2629  }
2630 
2631  $form = new ilPropertyFormGUI();
2632  $form->setFormAction($this->ctrl->getFormAction($this));
2633  $form->setTitle($this->lng->txt("crs_map_settings"));
2634 
2635  // enable map
2636  $public = new ilCheckboxInputGUI(
2637  $this->lng->txt("crs_enable_map"),
2638  "enable_map"
2639  );
2640  $public->setValue("1");
2641  $public->setChecked($this->object->getEnableCourseMap());
2642  $form->addItem($public);
2643 
2644  // map location
2645  $loc_prop = new ilLocationInputGUI(
2646  $this->lng->txt("crs_map_location"),
2647  "location"
2648  );
2649  $loc_prop->setLatitude((float) $latitude);
2650  $loc_prop->setLongitude((float) $longitude);
2651  $loc_prop->setZoom((int) $zoom);
2652  $form->addItem($loc_prop);
2653 
2654  $form->addCommandButton("saveMapSettings", $this->lng->txt("save"));
2655 
2656  $this->tpl->setVariable("ADM_CONTENT", $form->getHTML());
2657  //$this->tpl->show();
2658  }
2659 
2663  public function saveMapSettingsObject(): void
2664  {
2665  $location = [];
2666  if ($this->http->wrapper()->post()->has('location')) {
2667  $custom_transformer = $this->refinery->custom()->transformation(
2668  fn($array) => $array
2669  );
2670  $location = $this->http->wrapper()->post()->retrieve(
2671  'location',
2672  $custom_transformer
2673  );
2674  }
2675  $enable_map = false;
2676  if ($this->http->wrapper()->post()->has('enable_map')) {
2677  $enable_map = $this->http->wrapper()->post()->retrieve(
2678  'enable_map',
2679  $this->refinery->kindlyTo()->bool()
2680  );
2681  }
2682  $this->object->setLatitude($location['latitude']);
2683  $this->object->setLongitude($location['longitude']);
2684  $this->object->setLocationZoom($location['zoom']);
2685  $this->object->setEnableCourseMap($enable_map);
2686  $this->object->update();
2687  $this->ctrl->redirect($this, "editMapSettings");
2688  }
2689 
2693  public function modifyItemGUI(ilObjectListGUI $a_item_list_gui, array $a_item_data): void
2694  {
2696  $a_item_list_gui,
2697  'ilcoursecontentgui',
2698  $a_item_data,
2699  $this->object->getAboStatus(),
2700  $this->object->getRefId(),
2701  $this->object->getId()
2702  );
2703  }
2704 
2705  public static function _modifyItemGUI(
2706  ilObjectListGUI $a_item_list_gui,
2707  string $a_cmd_class,
2708  array $a_item_data,
2709  bool $a_abo_status,
2710  int $a_course_ref_id,
2711  int $a_course_obj_id,
2712  int $a_parent_ref_id = 0
2713  ): void {
2714  global $DIC;
2715  $lng = $DIC->language();
2716  $ilAccess = $DIC->access();
2717 
2718  // this is set for folders within the course
2719  if ($a_parent_ref_id == 0) {
2720  $a_parent_ref_id = $a_course_ref_id;
2721  }
2722 
2723  // Special handling for tests in courses with learning objectives
2724  if ($a_item_data['type'] == 'tst' && ilObjCourse::_lookupViewMode($a_course_obj_id) == ilContainer::VIEW_OBJECTIVE) {
2725  $a_item_list_gui->addCommandLinkParameter(array('crs_show_result' => $a_course_ref_id));
2726  }
2727 
2728  $a_item_list_gui->enableSubscribe($a_abo_status);
2729 
2730  $is_tutor = ($ilAccess->checkAccess(
2731  'write',
2732  '',
2733  $a_course_ref_id,
2734  'crs',
2735  $a_course_obj_id
2736  ));
2737  }
2738 
2742  public function setContentSubTabs(): void
2743  {
2744  global $DIC;
2745 
2746  $ilAccess = $DIC['ilAccess'];
2747  $lng = $DIC['lng'];
2748  $ilCtrl = $DIC['ilCtrl'];
2749 
2750  if ($this->object->getType() != 'crs') {
2751  return;
2752  }
2753  if (!$this->access->checkAccess(
2754  'write',
2755  '',
2756  $this->object->getRefId(),
2757  'crs',
2758  $this->object->getId()
2759  )) {
2760  $is_tutor = false;
2761  // No further tabs if objective view or archives
2762  if ($this->object->enabledObjectiveView()) {
2763  return;
2764  }
2765  } else {
2766  $is_tutor = true;
2767  }
2768 
2769  if (!$this->isActiveAdministrationPanel()) {
2770  $this->tabs_gui->addSubTab(
2771  "view_content",
2772  $lng->txt("view"),
2773  $this->ctrl->getLinkTargetByClass("ilobjcoursegui", "view")
2774  );
2775  } else {
2776  $this->tabs_gui->addSubTab(
2777  "view_content",
2778  $lng->txt("view"),
2779  $this->ctrl->getLinkTargetByClass("ilobjcoursegui", "disableAdministrationPanel")
2780  );
2781  }
2782  //}
2783 
2784  $this->addStandardContainerSubTabs(false);
2785  }
2786 
2787  public function askResetObject(): void
2788  {
2789  //$this->tpl->setOnScreenMessage('question', $this->lng->txt('crs_objectives_reset_sure'));
2790  $confirm = new ilConfirmationGUI();
2791  $confirm->setHeaderText($this->lng->txt('crs_objectives_reset_sure'));
2792  $confirm->setFormAction($this->ctrl->getFormAction($this));
2793  $confirm->setConfirm($this->lng->txt('reset'), 'reset');
2794  $confirm->setCancel($this->lng->txt('cancel'), 'cancel');
2795  $this->tpl->setContent($confirm->getHTML());
2796  }
2797 
2798  public function resetObject(): void
2799  {
2800  $usr_results = new ilLOUserResults($this->object->getId(), $GLOBALS['DIC']['ilUser']->getId());
2801  $usr_results->delete();
2803  $this->object->getId(),
2804  $GLOBALS['DIC']['ilUser']->getId()
2805  );
2806 
2807  $tmp_obj_res = new ilCourseObjectiveResult($this->user->getId());
2808  $tmp_obj_res->reset($this->object->getId());
2809 
2810  $this->user->deletePref('crs_objectives_force_details_' . $this->object->getId());
2811  $this->tpl->setOnScreenMessage('success', $this->lng->txt('crs_objectives_reseted'));
2812  $this->viewObject();
2813  }
2814 
2815  public function __checkStartObjects(): bool
2816  {
2817  if ($this->access->checkAccess('write', '', $this->object->getRefId())) {
2818  return true;
2819  }
2820  $this->start_obj = new ilContainerStartObjects(
2821  $this->object->getRefId(),
2822  $this->object->getId()
2823  );
2824  if (count($this->start_obj->getStartObjects()) &&
2825  !$this->start_obj->allFullfilled($this->user->getId())) {
2826  return false;
2827  }
2828  return true;
2829  }
2830 
2835  public function createMailSignature(): string
2836  {
2837  $link = chr(13) . chr(10) . chr(13) . chr(10);
2838  $link .= $this->lng->txt('crs_mail_permanent_link');
2839  $link .= chr(13) . chr(10) . chr(13) . chr(10);
2840  $link .= ilLink::_getLink($this->object->getRefId());
2841  return rawurlencode(base64_encode($link));
2842  }
2843 
2844  protected function initHeaderAction(?string $sub_type = null, ?int $sub_id = null): ?ilObjectListGUI
2845  {
2846  $lg = parent::initHeaderAction($sub_type, $sub_id);
2847 
2848  if ($lg && $this->ref_id && ilCourseParticipants::_isParticipant($this->ref_id, $this->user->getId())) {
2849  // certificate
2850 
2851  $validator = new ilCertificateDownloadValidator();
2852  if ($validator->isCertificateDownloadable($this->user->getId(), $this->object->getId())) {
2853  $cert_url = $this->ctrl->getLinkTarget($this, "deliverCertificate");
2854 
2855  $this->lng->loadLanguageModule("certificate");
2856  $lg->addCustomCommand($cert_url, "download_certificate");
2857 
2858  $lg->addHeaderIcon(
2859  "cert_icon",
2860  ilUtil::getImagePath("standard/icon_cert.svg"),
2861  $this->lng->txt("download_certificate"),
2862  null,
2863  null,
2864  $cert_url
2865  );
2866  }
2867 
2868  // notification
2869  if (ilMembershipNotifications::isActiveForRefId($this->ref_id)) {
2870  $noti = new ilMembershipNotifications($this->ref_id);
2871  if (!$noti->isCurrentUserActive()) {
2872  $lg->addHeaderIcon(
2873  "not_icon",
2874  ilUtil::getImagePath("object/notification_off.svg"),
2875  $this->lng->txt("crs_notification_deactivated")
2876  );
2877 
2878  $this->ctrl->setParameter($this, "crs_ntf", 1);
2879  $caption = "crs_activate_notification";
2880  } else {
2881  $lg->addHeaderIcon(
2882  "not_icon",
2883  ilUtil::getImagePath("object/notification_on.svg"),
2884  $this->lng->txt("crs_notification_activated")
2885  );
2886 
2887  $this->ctrl->setParameter($this, "crs_ntf", 0);
2888  $caption = "crs_deactivate_notification";
2889  }
2890 
2891  if ($noti->canCurrentUserEdit()) {
2892  $lg->addCustomCommand(
2893  $this->ctrl->getLinkTarget($this, "saveNotification"),
2894  $caption
2895  );
2896  }
2897 
2898  $this->ctrl->setParameter($this, "crs_ntf", "");
2899  }
2900  }
2901 
2902  return $lg;
2903  }
2904 
2908  public function deliverCertificateObject(): void
2909  {
2910  $user_id = null;
2911  if ($this->access->checkAccess('manage_members', '', $this->ref_id)) {
2912  $user_id = 0;
2913  if ($this->http->wrapper()->query()->has('member_id')) {
2914  $user_id = $this->http->wrapper()->query()->retrieve(
2915  'member_id',
2916  $this->refinery->kindlyTo()->int()
2917  );
2918  }
2919  }
2920  if (!$user_id) {
2921  $user_id = $this->user->getId();
2922  }
2923 
2924  $objId = $this->object->getId();
2925 
2926  $validator = new ilCertificateDownloadValidator();
2927 
2928  if (false === $validator->isCertificateDownloadable($user_id, $objId)) {
2929  $this->tpl->setOnScreenMessage('failure', $this->lng->txt("permission_denied"), true);
2930  $this->ctrl->redirect($this);
2931  }
2932 
2933  $repository = new ilUserCertificateRepository();
2934 
2935  $pdfGenerator = new ilPdfGenerator($repository);
2936 
2937  $pdfAction = new ilCertificatePdfAction(
2938  $pdfGenerator,
2940  $this->lng->txt('error_creating_certificate_pdf')
2941  );
2942  $pdfAction->downloadPdf((int) $user_id, $objId);
2943  }
2944 
2945  protected function afterSaveCallback(): void
2946  {
2947  $this->ctrl->redirectByClass(array('ilrepositorygui', 'ilobjcoursegui', 'illoeditorgui'), 'materials');
2948  }
2949 
2950  public function saveSortingObject(): void
2951  {
2952  $post_position = (array) ($this->http->request()->getParsedBody()['position'] ?? []);
2953  if (isset($post_position['lobj'])) {
2954  $lobj = $post_position['lobj'];
2955  $objective_order = array();
2956  foreach ($lobj as $objective_id => $materials) {
2957  $objective_order[$objective_id] = $materials[0];
2958  unset($lobj[$objective_id][0]);
2959  }
2960  // objective order
2961  asort($objective_order);
2962  $pos = 0;
2963  foreach (array_keys($objective_order) as $objective_id) {
2964  $obj = new ilCourseObjective($this->object, $objective_id);
2965  $obj->writePosition(++$pos);
2966  }
2967 
2968  // material order
2969  foreach ($lobj as $objective_id => $materials) {
2970  $objmat = new ilCourseObjectiveMaterials($objective_id);
2971 
2972  asort($materials);
2973  $pos = 0;
2974  foreach (array_keys($materials) as $ass_id) {
2975  $objmat->writePosition($ass_id, ++$pos);
2976  }
2977  }
2978  }
2979  parent::saveSortingObject();
2980  }
2981 
2982  protected function redirectLocToTestConfirmedObject(): void
2983  {
2984  $tid = 0;
2985  if ($this->http->wrapper()->query()->has('tid')) {
2986  $tid = $this->http->wrapper()->query()->retrieve(
2987  'tid',
2988  $this->refinery->kindlyTo()->int()
2989  );
2990  } elseif ($this->http->wrapper()->post()->has('tid')) {
2991  $tid = $this->http->wrapper()->post()->retrieve(
2992  'tid',
2993  $this->refinery->kindlyTo()->int()
2994  );
2995  }
2996  ilUtil::redirect(ilLink::_getLink($tid));
2997  }
2998 
2999  protected function redirectLocToTestObject($a_force_new_run = null): void
3000  {
3001  $tid = 0;
3002  if ($this->http->wrapper()->query()->has('tid')) {
3003  $tid = $this->http->wrapper()->query()->retrieve(
3004  'tid',
3005  $this->refinery->kindlyTo()->int()
3006  );
3007  }
3008  $objective_id = 0;
3009  if ($this->http->wrapper()->query()->has('objective_id')) {
3010  $objective_id = $this->http->wrapper()->query()->retrieve(
3011  'objective_id',
3012  $this->refinery->kindlyTo()->int()
3013  );
3014  }
3015 
3016  $res = new ilLOUserResults(
3017  $this->object->getId(),
3018  $this->user->getId()
3019  );
3020  $passed = $res->getCompletedObjectiveIds();
3021 
3022  $has_completed = false;
3023  if ($objective_id) {
3024  $objective_ids = array($objective_id);
3025  if (in_array($objective_id, $passed)) {
3026  $has_completed = true;
3027  $passed = array();
3028  }
3029  } else {
3030  $objective_ids = ilCourseObjective::_getObjectiveIds($this->object->getId(), true);
3031 
3032  // do not disable objective question if all are passed
3033  if (count($objective_ids) === count($passed)) {
3034  $has_completed = true;
3035  $passed = array();
3036  }
3037  }
3038 
3039  if ($has_completed) {
3040  // show confirmation
3041  $this->redirectLocToTestConfirmation($objective_id, $tid);
3042  return;
3043  }
3044  ilUtil::redirect(ilLink::_getLink($tid));
3045  }
3046 
3050  protected function redirectLocToTestConfirmation(int $a_objective_id, int $a_test_id): void
3051  {
3052  $confirm = new ilConfirmationGUI();
3053  $confirm->setFormAction($GLOBALS['DIC']['ilCtrl']->getFormAction($this));
3054 
3055  if ($a_objective_id) {
3056  $question = $this->lng->txt('crs_loc_objective_passed_confirmation');
3057  } else {
3058  $question = $this->lng->txt('crs_loc_objectives_passed_confirmation');
3059  }
3060 
3061  $confirm->setHeaderText($question);
3062  $confirm->addHiddenItem('objective_id', (string) $a_objective_id);
3063  $confirm->addHiddenItem('tid', (string) $a_test_id);
3064  $confirm->setConfirm($this->lng->txt('crs_loc_tst_start'), 'redirectLocToTestConfirmed');
3065  $confirm->setCancel($this->lng->txt('cancel'), 'view');
3066 
3067  //$this->tpl->setOnScreenMessage('question', $question);
3068  $this->tpl->setContent($confirm->getHTML());
3069  }
3070 
3076  public function getLocalRoles(array $a_exclude = array()): array
3077  {
3078  $crs_admin = $this->object->getDefaultAdminRole();
3079  $crs_member = $this->object->getDefaultMemberRole();
3080  $local_roles = $this->object->getLocalCourseRoles(false);
3081  $crs_roles = [];
3082 
3083  //put the course member role to the top of the crs_roles array
3084  if (in_array($crs_member, $local_roles)) {
3085  #$crs_roles[$crs_member] = ilObjRole::_getTranslation(array_search ($crs_member, $local_roles));
3086  #unset($local_roles[$crs_roles[$crs_member]]);
3087  }
3088 
3089  foreach ($local_roles as $title => $role_id) {
3090  if ($role_id == $crs_admin && !$this->hasAdminPermission()) {
3091  continue;
3092  }
3093 
3094  $crs_roles[$role_id] = ilObjRole::_getTranslation($title);
3095  }
3096 
3097  if ($a_exclude !== []) {
3098  foreach ($a_exclude as $excluded_role) {
3099  if (isset($crs_roles[$excluded_role])) {
3100  unset($crs_roles[$excluded_role]);
3101  }
3102  }
3103  }
3104  return $crs_roles;
3105  }
3106 
3107  protected function hasAdminPermission(): bool
3108  {
3109  return
3110  ilCourseParticipant::_getInstanceByObjId($this->object->getId(), $this->user->getId())->isAdmin() ||
3111  $this->checkPermissionBool('edit_permission');
3112  }
3113 
3114  protected function jump2UsersGalleryObject(): void
3115  {
3116  $this->ctrl->redirectByClass(ilUsersGalleryGUI::class);
3117  }
3118 
3122  public function setSideColumnReturn(): void
3123  {
3124  $this->ctrl->setReturn($this, "view");
3125  }
3126 } // END class.ilObjCourseGUI
static handleCode(int $a_ref_id, string $a_type, string $a_code)
setMultipart(bool $a_multipart)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
$res
Definition: ltiservices.php:69
static getInstance(int $a_ref_id, bool $a_include_auto_entries)
Class ilObjectMetaDataGUI.
setPropertyForm(ilPropertyFormGUI $form)
static formatDate(ilDateTime $date, bool $a_skip_day=false, bool $a_include_wd=false, bool $include_seconds=false, ilObjUser $user=null,)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
ilBadgeManagementGUI: ilPropertyFormGUI
setMessage(string $a_message)
const ANONYMOUS_USER_ID
Definition: constants.php:27
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
enableFileNameSelection(string $a_post_var)
saveSortingSettings(ilPropertyFormGUI $form)
This class represents a selection list property in a property form.
txt(string $a_topic, string $a_default_lang_fallback_mod="")
gets the text for a given topic if the topic is not in the list, the topic itself with "-" will be re...
getFormAction(string $cmd, string $default_form_action="")
Get form action for command (command is method name without "Object", e.g.
GUI class for the workflow of copying objects.
getItemByPostVar(string $a_post_var)
const ROOT_FOLDER_ID
Definition: constants.php:32
if($clientAssertionType !='urn:ietf:params:oauth:client-assertion-type:jwt-bearer'|| $grantType !='client_credentials') $parts
Definition: ltitoken.php:61
static _goto($a_target, string $a_add="")
$location
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Definition: buildRTE.php:22
static lookupRegistrationInfo(int $a_obj_id)
prepareOutput(bool $show_sub_objects=true)
static _isActivated(int $a_obj_id)
Is activated.
__construct($a_data, int $a_id, bool $a_call_by_reference=true, bool $a_prepare_output=true)
This class represents a file property in a property form.
const LP_STATUS_NOT_ATTEMPTED
static _lookupInProgressForObject(int $a_obj_id, ?array $a_user_ids=null)
Class ilLOEditorGUI.
static _getInstanceByObjId(int $a_obj_id, int $a_usr_id)
Help GUI class.
static getInstanceByObjId(int $a_obj_id)
Get instance by obj type.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
get(string $part=self::DEFAULT_BLOCK)
Renders the given block and returns the html string.
static _gotoRepositoryNode(int $ref_id, string $cmd="")
static _lookupName(int $a_user_id)
lookup user name
$objId
Definition: xapitoken.php:55
This class is used for integration of the booking manager as a service into other repository objects...
static getValidFilename(string $a_filename)
static getLinkTarget( $gui, string $cmd, array $gui_params=[], array $mail_params=[], array $context_params=[])
static _readFilesByCourse(int $a_course_id)
static _getObjectiveIds(int $course_id, bool $a_activated_only=false)
viewObject()
viewObject container presentation for "administration -> repository, trash, permissions" ...
Class ilObjCourseGUI.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
ilAdvancedMDRecordGUI $record_gui
enableSubscribe(bool $status)
setVariable(string $variable, $value='')
Sets the given variable to the given value.
afterSave(ilObject $new_object)
static updateServiceSettingsForm(int $obj_id, ilPropertyFormGUI $form, array $services)
static checkAccess(int $a_ref_id, bool $a_allow_only_read=true)
check access to learning progress
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
updateLPFromStatus(int $a_member_id, bool $a_has_passed)
sync course status and lp status
static _getFields(int $a_container_id, $a_sort=self::IL_CDF_SORT_NAME)
Get all fields of a container.
const IL_CAL_UNIX
$c
Definition: deliver.php:9
const STATUS_DETERMINATION_LP
getInput(string $a_post_var, bool $ensureValidation=true)
Returns the input of an item, if item provides getInput method and as fallback the value of the HTTP-...
$ilErr
Definition: raiseError.php:17
const LP_STATUS_IN_PROGRESS
static _lookupContainerSetting(int $a_id, string $a_keyword, string $a_default_value=null)
static _lookupViewMode(int $a_id)
editObject(ilPropertyFormGUI $form=null)
static _lookupCompletedForObject(int $a_obj_id, ?array $a_user_ids=null)
This class represents a date/time property in a property form.
static _lookupObjId(int $ref_id)
static deliverFileLegacy(string $a_file, ?string $a_filename=null, ?string $a_mime=null, ?bool $isInline=false, ?bool $removeAfterDelivery=false, ?bool $a_exit_after=true)
static _tracProgress(int $a_user_id, int $a_obj_id, int $a_ref_id, string $a_obj_type='')
GlobalHttpState $http
modifyItemGUI(ilObjectListGUI $a_item_list_gui, array $a_item_data)
deleteObject(bool $error=false)
ilLanguage $lng
static _checkRequired(int $a_usr_id, int $a_obj_id)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
class ilCourseObjectiveMaterials
GUI class for public user profile presentation.
ilContainerStartObjects $start_obj
Class ilMailMemberCourseRoles.
static http()
Fetches the global http state from ILIAS.
This class represents a property in a property form.
class ilobjcourseobjectivesgui
const LP_STATUS_FAILED
ilGlobalTemplateInterface $tpl
static _lookupTitle(int $obj_id)
static _getInstanceByObjId(int $a_obj_id)
$GLOBALS["DIC"]
Definition: wac.php:30
GUI class for LTI provider object settings.
createMailSignature()
Create a course mail signature.
static _getCountObjectives(int $a_obj_id, bool $a_activated_only=false)
setFormAction(string $a_formaction)
setValue($a_value)
Set Value.
addStandardContainerSubTabs(bool $a_include_view=true)
Add standard container subtabs for view, manage, oderdering and text/media editor link...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
$text
Definition: xapiexit.php:21
static _getTranslation(string $a_role_title)
initDidacticTemplate(ilPropertyFormGUI $form)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Validates if an active certificate is stored in the database and can be downloaded by the user...
static getDefaultSettings()
Get default longitude, latitude and zoom.
This class represents a location property in a property form.
global $DIC
Definition: shib_login.php:25
static getImagePath(string $image_name, string $module_path="", string $mode="output", bool $offline=false)
get image path (for images located in a template directory)
static _recordWriteEvent(int $obj_id, int $usr_id, string $action, ?int $parent_obj_id=null)
Records a write event.
redirectLocToTestConfirmation(int $a_objective_id, int $a_test_id)
Show confirmation whether user wants to start a new run or resume a previous run. ...
renderAddNewItem(string ... $disabled_object_types)
readMemberData(array $ids, array $selected_columns=null, bool $skip_names=false)
afterImport(ilObject $new_object)
static _modifyItemGUI(ilObjectListGUI $a_item_list_gui, string $a_cmd_class, array $a_item_data, bool $a_abo_status, int $a_course_ref_id, int $a_course_obj_id, int $a_parent_ref_id=0)
static initServiceSettingsForm(int $obj_id, ilPropertyFormGUI $form, array $services)
const STATUS_DETERMINATION_MANUAL
$txt
Definition: error.php:30
Last visited history for repository items.
ilNavigationHistory $navigation_history
addCommandButton(string $a_cmd, string $a_text, string $a_id="")
getEditFormValues()
values are already set in initEditForm Returning an empty array avoid overriding these values...
ilErrorHandling $error
setCustomRolesForSelection(array $a_roles)
Set custom roles for mapping to LTI roles.
Class ilObjCourseGroupingGUI.
saveListPresentation(ilPropertyFormGUI $form)
checkPermissionBool(string $perm, string $cmd="", string $type="", ?int $ref_id=null)
static _writeContainerSetting(int $a_id, string $a_keyword, string $a_value)
ilPropertyFormGUI $form
static redirect(string $a_script)
setCurrentBlock(string $part=self::DEFAULT_BLOCK)
Sets the template to the given block.
setObjParticipants(ilParticipants $objParticipants)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
buildAddNewItemElements(array $subtypes, string $create_target_class=ilRepositoryGUI::class, ?int $redirect_target_ref_id=null,)
static isActivated()
Checks whether Map feature is activated.
redirectLocToTestObject($a_force_new_run=null)
static _registrationEnabled(int $a_obj_id)
Registration enabled? Method is in Access class, since it is needed by Access/ListGUI.
static generateCode()
Generate new registration key.
Render add new item selector.
initListPresentationForm(ilPropertyFormGUI $form)
Add list presentation settings to form.
static _getInstanceByType(string $a_type)
Get Singleton Instance.
static setBlockedForLP(bool $a_status)
Toggle LP blocking property status.
initHeaderAction(?string $sub_type=null, ?int $sub_id=null)
setLatitude(?float $a_latitude)
initSortingForm(ilPropertyFormGUI $form, array $a_sorting_settings)
Append sorting settings to property form.
static formatPeriod(ilDateTime $start, ilDateTime $end, bool $a_skip_starting_day=false, ilObjUser $user=null)
Format a period of two dates Shows: 14.
__construct(Container $dic, ilPlugin $plugin)
getReturnLocation(string $cmd, string $default_location="")
Get return location for command (command is method name without "Object", e.g.
This class represents a text area property in a property form.
Class ilCourseContentGUI.
static _lookupProgressByObjId(int $a_obj_id)
lookup progress for a specific object
setInfoObject(ilInfoScreenGUI $info)
get info sections
ILIAS Container InternalGUIService $gui
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
setSubTabs(string $a_tab)
Class ilContainerGUI This is a base GUI class for all container objects in ILIAS: root folder...
static _isParticipant(int $a_ref_id, int $a_usr_id)
Static function to check if a user is a participant of the container object.
static getAvailablePortfolioLinksForUserIds(array $a_owner_ids, ?string $a_back_url=null)
static _lookupFailedForObject(int $a_obj_id, ?array $a_user_ids=null)
setCompleted(bool $a_status)
editInfoObject(ilPropertyFormGUI $a_form=null)
static _isOnList(int $a_usr_id, int $a_obj_id)
language()
description: > Example for rendring a language glyph.
Definition: language.php:25
static _hasAccepted(int $a_usr_id, int $a_obj_id)
Check if user has accepted agreement.
parseCurrentBlock(string $block_name=self::DEFAULT_BLOCK)
Parses the given block.
static _lookupType(int $id, bool $reference=false)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
infoScreenObject()
this one is called from the info button in the repository not very nice to set cmdClass/Cmd manually...
const LP_STATUS_COMPLETED
static _catchupWriteEvents(int $obj_id, int $usr_id, ?string $timestamp=null)
Catches up with all write events which occured before the specified timestamp.
addHeaderAction()
Add header action menu.
static getInstance(int $obj_id)
static makeClickable(string $a_text, bool $detectGotoLinks=false)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
kindlyTo()
Combined validations and transformations for primitive data types that establish a baseline for furth...
Definition: Factory.php:56
ilSetting $settings
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
checkPermission(string $perm, string $cmd="", string $type="", ?int $ref_id=null)
static _hasFields(int $a_container_id)
Check if there are any define fields.
static getInstanceFromAjaxCall()
(Re-)Build instance from ajax call
static deleteRuns(int $a_container_id, int $a_user_id)
Class ilContainerStartObjectsGUI.
GUI class for object translation handling.
Class ilECSCourseSettings.
static _gotoRepositoryRoot(bool $raise_error=false)
Goto repository root.
static _updateStatus(int $a_obj_id, int $a_usr_id, ?object $a_obj=null, bool $a_percentage=false, bool $a_force_raise=false)
getLocalRoles(array $a_exclude=array())
downloadPdf(int $userId, int $objectId)