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