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