ILIAS  trunk Revision v12.0_alpha-1540-g00f839d5fa1
class.ilObjLearningSequenceGUI.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
21use ILIAS\Data;
24use ILIAS\User\Profile\Data as ProfileData;
25
56{
57 public const CMD_VIEW = "view";
58 public const CMD_LEARNER_VIEW = "learnerView";
59 public const CMD_CONTENT = "manageContent";
60
61 public const CMD_MEMBERS = "members";
62 public const CMD_MANAGE_MEMBERS = "participants";
63 public const CMD_MEMBERS_GALLERY = "jump2UsersGallery";
64
65 public const CMD_INFO = "showSummary";
66 public const CMD_INFO_SCREEN = "infoScreen";
67 public const CMD_SETTINGS = "settings";
68 public const CMD_PERMISSIONS = "perm";
69 public const CMD_EXPORT = "export";
70 public const CMD_IMPORT = "routeImportCmd";
71 public const CMD_CREATE = "create";
72 public const CMD_SAVE = "save";
73 public const CMD_CANCEL = "cancel";
74 public const CMD_UNPARTICIPATE = "unparticipate";
75 public const CMD_ADD_TO_DESK = "addToDesk";
76 public const CMD_REMOVE_FROM_DESK = "removeFromDesk";
77 public const CMD_LINK = "link";
78 public const CMD_CANCEL_LINK = "cancelMoveLink";
79 public const CMD_CUT = "cut";
80 public const CMD_CANCEL_CUT = "cancelCut";
81 public const CMD_CUT_SHOWTREE = "showPasteTree";
82 public const CMD_CUT_CLIPBOARD = "keepObjectsInClipboard";
83 public const CMD_DELETE = "delete";
84 public const CMD_CANCEL_DELETE = "cancelDelete";
85 public const CMD_DELETE_CONFIRMED = "confirmedDelete";
86 public const CMD_PERFORM_PASTE = 'performPasteIntoMultipleObjects';
87 public const CMD_SHOW_TRASH = 'trash';
88 public const CMD_UNDELETE = 'undelete';
89 public const CMD_REDRAW_HEADER = 'redrawHeaderAction';
90 public const CMD_ENABLE_ADMINISTRATION_PANEL = "enableAdministrationPanel";
91
92 public const TAB_VIEW_CONTENT = "view";
93 public const TAB_MANAGE = "manage";
94 public const TAB_CONTENT_MAIN = "manage_content_maintab";
95 public const TAB_INFO = "show_summary";
96 public const TAB_SETTINGS = "settings";
97 public const TAB_PERMISSIONS = "perm_settings";
98 public const TAB_MEMBERS = "members";
99 public const TAB_LP = "learning_progress";
100 public const TAB_EXPORT = "export";
101
102 public const TAB_EDIT_INTRO = "edit_intropage";
103 public const TAB_EDIT_EXTRO = "edit_extropage";
104
105
106 public const MAIL_ALLOWED_ALL = 1;
107 public const MAIL_ALLOWED_TUTORS = 2;
108
109 public const ACCESS_READ = 'read';
110 public const ACCESS_VISIBLE = 'visible';
111 protected \ILIAS\Style\Content\Service $content_style;
112
116 protected ilHelpGUI $help;
119 protected Data\Factory $data_factory;
123 protected Psr\Http\Message\ServerRequestInterface $request;
124 protected Profile $profile;
125
126 public static function _goto(string $target): void
127 {
128 global $DIC;
129 $main_tpl = $DIC->ui()->mainTemplate();
130
131 $request = $DIC->http()->request();
132 $lng = $DIC->language();
133 $err = $DIC['ilErr'];
134
135 $targetParameters = explode('_', $target);
136 $id = (int) $targetParameters[0];
137
138 if (!self::isAccessible($id)) {
139 $err->raiseError($lng->txt('msg_no_perm_read'), $err->FATAL);
140 }
141
142 if (self::hasAccess(self::ACCESS_READ, $id)) {
143 $params = ['ref_id' => $id];
144
145 if (isset($request->getQueryParams()['gotolp'])) {
146 $params['gotolp'] = 1;
147 }
148
150 ilRepositoryGUI::class,
151 [ilObjLearningSequenceGUI::class],
152 $params
153 );
154 }
155
156 if (self::hasAccess(self::ACCESS_VISIBLE, $id)) {
158 }
159
160 if (self::hasAccess(self::ACCESS_READ, ROOT_FOLDER_ID)) {
161 $main_tpl->setOnScreenMessage('info', sprintf(
162 $lng->txt('msg_no_perm_read_item'),
164 ), true);
165
166 self::forwardByClass(ilRepositoryGUI::class, [ilRepositoryGUI::class], ['ref_id' => ROOT_FOLDER_ID]);
167 }
168 }
169
170 protected static function isAccessible(int $id): bool
171 {
172 return $id > 0 && (
173 self::hasAccess(self::ACCESS_READ, $id) ||
174 self::hasAccess(self::ACCESS_VISIBLE, $id) ||
175 self::hasAccess(self::ACCESS_READ, ROOT_FOLDER_ID)
176 );
177 }
178
179 protected static function hasAccess(string $mode, int $id): bool
180 {
181 global $DIC;
182 return $DIC->access()->checkAccess($mode, '', $id);
183 }
184
185 protected static function forwardByClass(string $base_class, array $classes, array $params, string $cmd = ''): void
186 {
187 global $DIC;
188 $ctrl = $DIC->ctrl();
189 $target_class = end($classes);
190
191 $ctrl->setTargetScript('ilias.php');
192 foreach ($params as $key => $value) {
193 $ctrl->setParameterByClass($target_class, $key, $value);
194 }
195
196 // insert the baseclass to the first position.
197 array_splice($classes, 0, 0, $base_class);
198 $ctrl->redirectByClass($classes, $cmd);
199 }
200
201 public function __construct()
202 {
204
205 global $DIC;
206 $this->ctrl = $DIC['ilCtrl'];
207 $this->lng = $DIC['lng'];
208 $this->user = $DIC['ilUser'];
209 $this->profile = $DIC['user']->getProfile();
210 $this->tabs = $DIC['ilTabs'];
211 $this->toolbar = $DIC['ilToolbar'];
212 $this->help = $DIC['ilHelp'];
213 $this->settings = $DIC['ilSetting'];
214 $this->access = $DIC['ilAccess'];
215 $this->rbac_review = $DIC['rbacreview'];
216 $this->ui_factory = $DIC['ui.factory'];
217 $this->ui_renderer = $DIC['ui.renderer'];
218 $this->request = $DIC->http()->request();
219
220 $this->log = $DIC["ilLoggerFactory"]->getRootLogger();
221 $this->app_event_handler = $DIC['ilAppEventHandler'];
222 $this->navigation_history = $DIC['ilNavigationHistory'];
223 $this->obj_definition = $DIC['objDefinition'];
224 $this->tpl = $DIC["tpl"];
225 $this->obj_service = $DIC->object();
226 $this->toolbar = $DIC['ilToolbar'];
227 $this->request_wrapper = $DIC->http()->wrapper()->query();
228 $this->post_wrapper = $DIC->http()->wrapper()->post();
229 $this->refinery = $DIC->refinery();
230 $this->content_style = $DIC->contentStyle();
231
232 $this->help->setScreenIdComponent($this->type);
233 $this->lng->loadLanguageModule($this->type);
234
235 $this->data_factory = new Data\Factory();
236
237 $this->ref_id = $this->request_wrapper->retrieve("ref_id", $this->refinery->kindlyTo()->int());
238 parent::__construct([], $this->ref_id, true, false);
239 }
240
241 protected function recordLearningSequenceRead(): void
242 {
244 $this->object->getType(),
245 $this->object->getRefId(),
246 $this->object->getId(),
247 $this->user->getId()
248 );
249 }
250
251 public function executeCommand(): void
252 {
253 $next_class = $this->ctrl->getNextClass($this);
254 $cmd = $this->ctrl->getCmd();
256
257 parent::prepareOutput();
258 $this->addToNavigationHistory();
259 //showRepTree is from containerGUI;
260 //LSO will attach allowed subitems to ok-list
261 //see: $this::getAdditionalOKTypes
262
263 $in_player = (
264 $next_class === 'ilobjlearningsequencelearnergui'
265 && $cmd === 'view'
266 );
267
268 $tpl->setPermanentLink("lso", $this->ref_id);
269
270 switch ($next_class) {
271 case "ilcommonactiondispatchergui":
273 $this->ctrl->forwardCommand($gui);
274 break;
275 case "ilinfoscreengui":
276 $this->tabs->setTabActive(self::TAB_INFO);
277 $this->ctrl->forwardCommand($this->getGUIInfo());
278 break;
279 case "ilpermissiongui":
280 $this->tabs->setTabActive(self::TAB_PERMISSIONS);
281 $this->ctrl->forwardCommand($this->getGUIPermissions());
282 break;
283 case "ilobjlearningsequencesettingsgui":
284
285 if (!$this->checkAccess("write", '', $this->ref_id)) {
286 $this->tpl->setOnScreenMessage('failure', sprintf(
287 $this->lng->txt('msg_no_perm_read_item'),
288 $this->object->getTitle()
289 ), true);
290
291 $this->ctrl->redirect($this, 'view');
292 }
293
294 $this->tabs->activateTab(self::TAB_SETTINGS);
295 $this->ctrl->forwardCommand($this->getGUISettings());
296 break;
297 case "ilobjlearningsequencecontentgui":
298
299 if (!$this->checkAccess("read", '', $this->ref_id)) {
300 $this->tpl->setOnScreenMessage('failure', sprintf(
301 $this->lng->txt('msg_no_perm_read_item'),
302 $this->object->getTitle()
303 ), true);
304
305 $this->ctrl->redirect($this, 'view');
306 }
307
308
309 $this->tabs->activateTab(self::TAB_CONTENT_MAIN);
310 $this->addSubTabsForContent(self::TAB_MANAGE);
311 $this->ctrl->forwardCommand($this->getGUIManageContent());
312 break;
313 case "ilobjlearningsequencelearnergui":
314 $this->addContentStyleCss();
315 $this->tabs->activateTab(self::TAB_CONTENT_MAIN);
316 $this->addSubTabsForContent(self::TAB_VIEW_CONTENT);
317 $this->ctrl->forwardCommand($this->getGUILearnerView());
318 break;
319 case "illearningsequencemembershipgui":
320 $this->tabs->setTabActive(self::TAB_MEMBERS);
321 $this->ctrl->forwardCommand($this->getGUIMembers());
322 break;
323 case 'illearningprogressgui':
324 $this->tabs->setTabActive(self::TAB_LP);
325 $this->ctrl->forwardCommand($this->getGUILearningProgress());
326 break;
327 case 'ilexportgui':
328 $gui = new ilExportGUI($this);
329 $gui->addFormat("xml");
330 $this->tabs->setTabActive(self::TAB_EXPORT);
331 $this->ctrl->forwardCommand($gui);
332 break;
333 case 'ilobjectcopygui':
334 $gui = new ilObjectCopyGUI($this);
335 $gui->setType('lso');
336 $this->ctrl->forwardCommand($gui);
337 break;
338 case 'ilobjindividualassessmentgui':
339 $struct = ['ilrepositorygui', 'ilobjindividualassessmentgui'];
340 if ($cmd === 'edit') {
341 $struct[] = 'ilindividualassessmentsettingsgui';
342 }
343 $this->ctrl->redirectByClass($struct, $cmd);
344 // no break
345 case 'ilobjtestgui':
346 $struct = ['ilrepositorygui', 'ilobjtestgui'];
347 $this->ctrl->redirectByClass($struct, $cmd);
348 // no break
349 case 'ilobjlearningsequencelppollinggui':
350 $gui = $this->object->getLocalDI()["gui.learner.lp"];
351 $this->ctrl->forwardCommand($gui);
352 break;
353 case "ilobjlearningsequenceeditintrogui":
354 $which_page = LSOPageType::INTRO;
355 $which_tab = self::TAB_EDIT_INTRO;
356 $gui_class = 'ilObjLearningSequenceEditIntroGUI';
357 // no break
358 case "ilobjlearningsequenceeditextrogui":
359 if (!isset($which_page)) {
360 $which_page = LSOPageType::EXTRO;
361 $which_tab = self::TAB_EDIT_EXTRO;
362 $gui_class = 'ilObjLearningSequenceEditExtroGUI';
363 }
364
365 $this->addContentStyleCss();
366 $this->addSubTabsForContent($which_tab);
367
368 if (!$this->object->hasContentPage($which_page)) {
369 $this->object->createContentPage($which_page);
370 }
371
372 $gui = new $gui_class(
373 $which_page->value,
374 $this->object->getContentPageId()
375 );
376 $out = $this->ctrl->forwardCommand($gui);
377
378 //editor's guis will write to template, but not return
379 //e.g. see ilPCTabsGUI::insert
380 if (!is_null($out)) {
382 }
383 break;
384
385 case false:
386 if ($cmd === '') {
387 if ($this->checkAccess("write")) {
388 $cmd = self::CMD_CONTENT;
389 } else {
390 $cmd = self::CMD_VIEW;
391 }
392 }
393
394 switch ($cmd) {
395 case self::CMD_IMPORT:
396 $this->routeImportCmdObject();
397 break;
398 case self::CMD_VIEW:
400 $this->view();
401 // no break
402 case self::CMD_INFO:
404 $this->ctrl->redirectByClass(ilInfoScreenGUI::class, 'showSummary');
405 // no break
407 $this->ctrl->redirectByClass(ilObjLearningSequenceSettingsGUI::class, $cmd);
408 // no break
410 $this->ctrl->redirectByClass(ilObjLearningSequenceContentGUI::class, $cmd);
411 // no break
414 $this->ctrl->redirectByClass(ilLearningSequenceMembershipGUI::class, $cmd);
415 // no break
417 $this->unparticipate();
418 // no break
419 case self::CMD_CANCEL:
420 if ($this->getCreationMode()) {
421 $this->cancelCreation();
422 }
423 break;
425 $this->removeFromDeskObject();
426 $this->view();
427 break;
429 $this->addToDeskObject();
430 $this->view();
431 break;
432 case self::CMD_CUT:
433 $this->cutObject();
434 break;
436 $this->showPasteTreeObject();
437 break;
440 break;
441 case self::CMD_LINK:
442 $this->linkObject();
443 break;
444 case self::CMD_DELETE:
445 $this->deleteObject();
446 break;
448 $this->confirmedDeleteObject();
449 break;
452 break;
454 $this->trashObject();
455 break;
457 $this->undeleteObject();
458 break;
459
463 $this->view();
464 break;
465
466 case self::CMD_SAVE:
467 case self::CMD_CREATE:
468 $this->$cmd();
469 break;
470
473 break;
474
475 // This is a temporary implementation (Mantis Ticket 36631)
477 $tpl->setOnScreenMessage("failure", $this->lng->txt('lso_multidownload_not_available'), false);
478 $this->manageContent();
479 break;
480
481 default:
482 throw new ilException("ilObjLearningSequenceGUI: Invalid command '$cmd'");
483 }
484 break;
485 default:
486 throw new ilException("ilObjLearningSequenceGUI: Can't forward to next class $next_class");
487 }
488
489 if (!$in_player) {
490 $this->addHeaderAction();
491 }
492
493 // This is the base class for the call, so we ought to print.
494 // TODO: This is super fishy and most probably hints on the fact, that
495 // something regarding that base class usage needs to change.
496 if (strtolower($this->request_wrapper->retrieve("baseClass", $this->refinery->kindlyTo()->string())) === strtolower(self::class)) {
497 $tpl->printToStdOut();
498 }
499 }
500
501 public function addContentStyleCss(): void
502 {
503 $this->content_style->gui()->addCss(
504 $this->tpl,
505 $this->object->getRefId()
506 );
507 }
508
509 public function addToNavigationHistory(): void
510 {
511 if (
512 !$this->getCreationMode() &&
513 $this->access->checkAccess('read', '', $this->ref_id)
514 ) {
515 $link = ilLink::_getLink($this->ref_id, $this->type);
516 $this->navigation_history->addItem($this->ref_id, $link, $this->type);
517 }
518 }
519
520 protected function getGUIInfo(): ilInfoScreenGUI
521 {
522 return new ilInfoScreenGUI($this);
523 }
524
525 protected function getGUIPermissions(): ilPermissionGUI
526 {
527 return new ilPermissionGUI($this);
528 }
529
531 {
533 $this->getObject(),
534 $this->ctrl,
535 $this->lng,
536 $this->tpl,
537 $this->refinery,
538 $this->ui_factory,
539 $this->ui_renderer,
540 $this->request,
541 $this->user,
542 $this->data_factory
543 );
544 }
545
546 protected function view(): void
547 {
549 $this->tabs->clearSubTabs();
550
551 $cmd = self::CMD_INFO;
552 if ($this->checkAccess("write")) {
553 $cmd = self::CMD_CONTENT;
554 $this->ctrl->redirectByClass(ilObjLearningSequenceContentGUI::class, $cmd);
555 } elseif ($this->checkAccess("read")) {
557 $this->ctrl->redirectByClass(ilObjLearningSequenceLearnerGUI::class, $cmd);
558 }
559 }
560
562 {
564 $this,
565 $this->ctrl,
566 $this->tpl,
567 $this->lng,
568 $this->access,
569 new ilConfirmationGUI(),
570 new LSItemOnlineStatus(),
571 $this->post_wrapper,
572 $this->refinery,
573 $this->ui_factory,
574 $this->ui_renderer
575 );
576 }
577
579 {
580 return $this->object->getLocalDI()["gui.learner"];
581 }
582
584 {
586 $this,
587 $this->getObject(),
588 $this->getTrackingObject(),
590 $this->rbac_review,
591 $this->settings,
592 $this->toolbar,
593 $this->request_wrapper,
594 $this->post_wrapper,
595 $this->refinery,
596 $this->ui_factory
597 );
598 }
599
601 {
602 $for_user = $this->user->getId();
603 if ($this->request_wrapper->has("user_id")) {
604 $for_user = $this->request_wrapper->retrieve("user_id", $this->refinery->kindlyTo()->int());
605 }
606 return new ilLearningProgressGUI(
608 $this->getObject()->getRefId(),
609 $for_user
610 );
611 }
612
614 {
615 return $form;
616 }
617
618 protected function create(): void
619 {
620 parent::createObject();
621 }
622
623 protected function save(): void
624 {
625 parent::saveObject();
626 }
627
628 protected function afterSave(ilObject $new_object): void
629 {
630 $participant = new ilLearningSequenceParticipants(
631 $new_object->getId(),
632 $this->log,
633 $this->app_event_handler,
634 $this->settings
635 );
636
637 $participant->add($this->user->getId(), ilParticipants::IL_LSO_ADMIN);
638 $participant->updateNotification(
639 $this->user->getId(),
640 (bool) $this->settings->get('mail_lso_admin_notification', "1")
641 );
642
643 $settings = new ilContainerSortingSettings($new_object->getId());
648 $settings->save();
649
650 $this->tpl->setOnScreenMessage('success', $this->lng->txt('object_added'), true);
651 $this->ctrl->setParameter($this, "ref_id", $new_object->getRefId());
653 $this->getReturnLocation(
654 "save",
655 $this->ctrl->getLinkTarget($this, self::CMD_SETTINGS, "", false, false)
656 )
657 );
658 }
659
660 public function unparticipate(): void
661 {
662 if ($this->checkAccess('unparticipate')) {
663 $usr_id = $this->user->getId();
664 $this->getObject()->getLSRoles()->leave($usr_id);
665 }
666 $this->ctrl->redirectByClass('ilObjLearningSequenceLearnerGUI', self::CMD_LEARNER_VIEW);
667 }
668
669 protected function getTabs(): void
670 {
671 if ($this->checkAccess("read")) {
672 $cmd = $this->checkAccess("write") ? self::CMD_CONTENT : self::CMD_VIEW;
673 $this->tabs->addTab(
674 self::TAB_CONTENT_MAIN,
675 $this->lng->txt(self::TAB_CONTENT_MAIN),
676 $this->ctrl->getLinkTarget($this, $cmd, "", false, false)
677 );
678 }
679
680 if ($this->checkAccess("read") || $this->checkAccess("visible")) {
681 $this->tabs->addTab(
682 self::TAB_INFO,
683 $this->lng->txt(self::TAB_INFO),
684 $this->getLinkTarget(self::CMD_INFO)
685 );
686 }
687
688 if ($this->checkAccess("write")) {
689 $this->tabs->addTab(
690 self::TAB_SETTINGS,
691 $this->lng->txt(self::TAB_SETTINGS),
692 $this->getLinkTarget(self::CMD_SETTINGS)
693 );
694 }
695
696 if ($this->checkAccess("read")) {
697 $cmd = null;
698 if ($this->checkAccess("manage_members")) {
699 $cmd = self::CMD_MEMBERS;
700 } elseif (
701 $this->getObject()->getLSSettings()->getMembersGallery()
702 && $this->getObject()->getLSRoles()->isMember($this->user->getId())
703 ) {
705 }
706
707 if ($cmd) {
708 $this->tabs->addTab(
709 self::TAB_MEMBERS,
710 $this->lng->txt(self::TAB_MEMBERS),
711 $this->ctrl->getLinkTarget($this, $cmd, "", false, false)
712 );
713 }
714 }
715
717 $this->tabs->addTab(
718 self::TAB_LP,
719 $this->lng->txt(self::TAB_LP),
720 $this->ctrl->getLinkTargetByClass(array('ilobjlearningsequencegui', 'illearningprogressgui'), '')
721 );
722 }
723
724 if ($this->checkAccess("write")) {
725 $this->tabs->addTab(
726 self::TAB_EXPORT,
727 $this->lng->txt(self::TAB_EXPORT),
728 $this->ctrl->getLinkTargetByClass("ilexportgui", "")
729 );
730 }
731
732 if ($this->checkAccess("edit_permission")) {
733 $this->tabs->addTab(
734 self::TAB_PERMISSIONS,
735 $this->lng->txt(self::TAB_PERMISSIONS),
736 $this->getLinkTarget(self::CMD_PERMISSIONS)
737 );
738 }
739 }
740
741 protected function addSubTabsForContent(string $active): void
742 {
743 $this->tabs->addSubTab(
744 self::TAB_VIEW_CONTENT,
745 $this->lng->txt(self::TAB_VIEW_CONTENT),
746 $this->getLinkTarget(self::CMD_LEARNER_VIEW)
747 );
748
749 if ($this->checkAccess("write")) {
750 $this->tabs->addSubTab(
751 self::TAB_MANAGE,
752 $this->lng->txt(self::TAB_MANAGE),
753 $this->getLinkTarget(self::CMD_CONTENT)
754 );
755
756 $this->tabs->addSubTab(
757 self::TAB_EDIT_INTRO,
758 $this->lng->txt("lso_settings_intro"),
759 $this->ctrl->getLinkTargetByClass(
760 strtolower('ilObjLearningSequenceEditIntroGUI'),
761 'preview'
762 )
763 );
764 $this->tabs->addSubTab(
765 self::TAB_EDIT_EXTRO,
766 $this->lng->txt("lso_settings_extro"),
767 $this->ctrl->getLinkTargetByClass(
768 strtolower('ilObjLearningSequenceEditExtroGUI'),
769 'preview'
770 )
771 );
772 }
773 $this->tabs->activateSubTab($active);
774 }
775
776 protected function checkAccess(string $which): bool
777 {
778 return $this->access->checkAccess($which, "", $this->ref_id);
779 }
780
781 protected function checkLPAccess(): bool
782 {
783 if (ilObject::_lookupType($this->ref_id, true) !== "lso") {
784 return false;
785 }
786
787 $ref_id = $this->getObject()->getRefId();
788 $is_participant = ilLearningSequenceParticipants::_isParticipant($ref_id, $this->user->getId());
789
790 return ilLearningProgressAccess::checkAccess($ref_id, $is_participant);
791 }
792
793 protected function getLinkTarget(string $cmd): string
794 {
795 $class = $this->getClassForTabs($cmd);
796 $class_path = [
797 strtolower('ilObjLearningSequenceGUI'),
798 $class
799 ];
800 return $this->ctrl->getLinkTargetByClass($class_path, $cmd);
801 }
802
803 protected function getClassForTabs(string $cmd): string
804 {
805 switch ($cmd) {
807 return 'ilObjLearningSequenceContentGUI';
809 return 'ilObjLearningSequenceLearnerGUI';
811 return 'ilObjLearningSequenceSettingsGUI';
812 case self::CMD_INFO:
813 return 'ilInfoScreenGUI';
815 return 'ilPermissionGUI';
816 }
817
818 throw new InvalidArgumentException('cannot resolve class for command: ' . $cmd);
819 }
820
821 public function createMailSignature(): string
822 {
823 $link = chr(13) . chr(10) . chr(13) . chr(10);
824 $link .= $this->lng->txt('lso_mail_permanent_link');
825 $link .= chr(13) . chr(10) . chr(13) . chr(10);
826 $link .= ilLink::_getLink($this->object->getRefId());
827
828 return rawurlencode(base64_encode($link));
829 }
830
832 {
833 return new ilObjUserTracking();
834 }
835
839 public function getLocalRoles(): array
840 {
841 $local_roles = $this->object->getLocalLearningSequenceRoles();
842 $lso_member = $this->object->getDefaultMemberRole();
843 $lso_roles = array();
844
845 if (in_array($lso_member, $local_roles)) {
846 $lso_roles[$lso_member] = ilObjRole::_getTranslation(array_search($lso_member, $local_roles));
847 unset($local_roles[$lso_roles[$lso_member]]);
848 }
849
850 foreach ($local_roles as $title => $role_id) {
851 $lso_roles[$role_id] = ilObjRole::_getTranslation($title);
852 }
853
854 return $lso_roles;
855 }
856
861 protected function getAdditionalOKTypes(): array
862 {
863 return array_filter(
864 array_keys($this->obj_definition->getSubObjects('lso', false)),
865 fn($type) => $type !== 'rolf'
866 );
867 }
868
872 public function addCustomData(array $a_data): array
873 {
874 $udfs = $this->profile->getAllUserDefinedFields();
875 return array_reduce(
876 $this->profile->getDataForMultiple(array_keys($a_data)),
877 function (array $c, ProfileData $v) use ($a_data, $udfs): array {
878 $c[$v->getId()] = $a_data[$v->getId()];
879 foreach ($udfs as $field) {
880 $field_id = $field->getIdentifier();
881 $c[$v->getId()]['udf_' . $field_id] = (string) $v->getAdditionalFieldByIdentifier($field_id);
882 }
883 },
884 []
885 );
886 }
887
888 public function showPossibleSubObjects(): void
889 {
890 $this->ctrl->setParameterByClass(ilRepositoryGUI::class, 'ref_id', $this->ref_id);
894 ilRepositoryGUI::class,
895 $this->ref_id
896 )
897 );
898 $gui->render();
899 $this->ctrl->clearParametersByClass(ilRepositoryGUI::class);
900 }
901
902 public function afterSaveCallback(): void
903 {
904 }
905
906 protected function enableDragDropFileUpload(): void
907 {
908 }
909
910}
@ EXTRO
Definition: LSOPageType.php:24
$out
Definition: buildRTE.php:24
Builds a Color from either hex- or rgb values.
Definition: Factory.php:31
Builds data types.
Definition: Factory.php:36
Render add new item selector.
static _recordReadEvent(string $a_type, int $a_ref_id, int $obj_id, int $usr_id, $a_ext_rc=null, $a_ext_time=null)
static getInstanceFromAjaxCall()
(Re-)Build instance from ajax call
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Class ilContainerGUI This is a base GUI class for all container objects in ILIAS: root folder,...
ILIAS Container InternalGUIService $gui
trashObject()
Show trash content of object.
cutObject()
cut object(s) out from a container and write the information to clipboard @access public
ilPropertyFormGUI $form
undeleteObject()
Get objects back from trash.
linkObject()
create an new reference of an object in tree it's like a hard link of unix
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
const SORT_NEW_ITEMS_ORDER_CREATION
const SORT_NEW_ITEMS_POSITION_BOTTOM
const SORT_DIRECTION_ASC
redirectByClass( $a_class, ?string $a_cmd=null, ?string $a_anchor=null, bool $is_async=false)
@inheritDoc
setTargetScript(string $a_target_script)
@inheritDoc
setParameterByClass(string $a_class, string $a_parameter, $a_value)
@inheritDoc
Base class for ILIAS Exception handling.
Export User Interface Class.
Help GUI class.
Class ilInfoScreenGUI.
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...
static checkAccess(int $a_ref_id, bool $a_allow_only_read=true)
check access to learning progress
Class ilObjUserTrackingGUI.
GUI class for learning sequence membership features.
static _isParticipant(int $a_ref_id, int $a_usr_id)
Static function to check if a user is a participant of the container object.
Last visited history for repository items.
Class ilObjLearningSequenceGUI @ilCtrl_isCalledBy ilObjLearningSequenceGUI: ilRepositoryGUI @ilCtrl_i...
ILIAS Style Content Service $content_style
enableDragDropFileUpload()
Enables the file upload into this object by dropping files.
showPossibleSubObjects()
show possible sub objects (pull down menu)
getAdditionalOKTypes()
append additional types to ilRepositoryExplorerGUI's positive list
getTabs()
@abstract overwrite in derived GUI class of your object type
afterSave(ilObject $new_object)
Post (successful) object creation hook.
Psr Http Message ServerRequestInterface $request
static hasAccess(string $mode, int $id)
ILIAS HTTP Wrapper RequestWrapper $request_wrapper
initDidacticTemplate(ilPropertyFormGUI $form)
static forwardByClass(string $base_class, array $classes, array $params, string $cmd='')
static _getTranslation(string $a_role_title)
GUI class for the workflow of copying objects.
confirmedDeleteObject()
confirmed deletion of object -> objects are moved to trash or deleted immediately,...
buildAddNewItemElements(array $subtypes, string $create_target_class=ilRepositoryGUI::class, ?int $redirect_target_ref_id=null,)
cancelCreation()
cancel create action and go back to repository parent
ilGlobalTemplateInterface $tpl
deleteObject(bool $error=false)
Display deletion confirmation screen.
ilSetting $settings
addHeaderAction()
Add header action menu.
static _gotoRepositoryNode(int $ref_id, string $cmd="")
getReturnLocation(string $cmd, string $default_location="")
Get return location for command (command is method name without "Object", e.g.
ilLanguage $lng
redrawHeaderActionObject()
Ajax call: redraw action header only.
Class ilObject Basic functions for all objects.
static _lookupType(int $id, bool $reference=false)
static _lookupObjId(int $ref_id)
static _lookupTitle(int $obj_id)
This class represents a property form user interface.
class ilRbacReview Contains Review functions of core Rbac.
static redirect(string $a_script)
const ROOT_FOLDER_ID
Definition: constants.php:32
$c
Definition: deliver.php:25
Interface RequestWrapper.
setPermanentLink(string $a_type, ?int $a_id, string $a_append="", string $a_target="", string $a_title="")
Generates and sets a permanent ilias link.
setOnScreenMessage(string $type, string $a_txt, bool $a_keep=false)
Set a message to be displayed to the user.
setContent(string $a_html)
Sets content for standard template.
An entity that renders components to a string output.
Definition: Renderer.php:31
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
if(! $DIC->user() ->getId()||!ilLTIConsumerAccess::hasCustomProviderCreationAccess()) $params
Definition: ltiregstart.php:31
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
global $DIC
Definition: shib_login.php:26