ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
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 );
542 }
543
544 protected function view(): void
545 {
547 $this->tabs->clearSubTabs();
548
549 $cmd = self::CMD_INFO;
550 if ($this->checkAccess("write")) {
551 $cmd = self::CMD_CONTENT;
552 $this->ctrl->redirectByClass(ilObjLearningSequenceContentGUI::class, $cmd);
553 } elseif ($this->checkAccess("read")) {
555 $this->ctrl->redirectByClass(ilObjLearningSequenceLearnerGUI::class, $cmd);
556 }
557 }
558
560 {
562 $this,
563 $this->ctrl,
564 $this->tpl,
565 $this->lng,
566 $this->access,
567 new ilConfirmationGUI(),
568 new LSItemOnlineStatus(),
569 $this->post_wrapper,
570 $this->refinery,
571 $this->ui_factory,
572 $this->ui_renderer
573 );
574 }
575
577 {
578 return $this->object->getLocalDI()["gui.learner"];
579 }
580
582 {
584 $this,
585 $this->getObject(),
586 $this->getTrackingObject(),
588 $this->rbac_review,
589 $this->settings,
590 $this->toolbar,
591 $this->request_wrapper,
592 $this->post_wrapper,
593 $this->refinery,
594 $this->ui_factory
595 );
596 }
597
599 {
600 $for_user = $this->user->getId();
601 if ($this->request_wrapper->has("user_id")) {
602 $for_user = $this->request_wrapper->retrieve("user_id", $this->refinery->kindlyTo()->int());
603 }
604 return new ilLearningProgressGUI(
606 $this->getObject()->getRefId(),
607 $for_user
608 );
609 }
610
612 {
613 return $form;
614 }
615
616 protected function create(): void
617 {
618 parent::createObject();
619 }
620
621 protected function save(): void
622 {
623 parent::saveObject();
624 }
625
626 protected function afterSave(ilObject $new_object): void
627 {
628 $participant = new ilLearningSequenceParticipants(
629 $new_object->getId(),
630 $this->log,
631 $this->app_event_handler,
632 $this->settings
633 );
634
635 $participant->add($this->user->getId(), ilParticipants::IL_LSO_ADMIN);
636 $participant->updateNotification(
637 $this->user->getId(),
638 (bool) $this->settings->get('mail_lso_admin_notification', "1")
639 );
640
641 $settings = new ilContainerSortingSettings($new_object->getId());
646 $settings->save();
647
648 $this->tpl->setOnScreenMessage('success', $this->lng->txt('object_added'), true);
649 $this->ctrl->setParameter($this, "ref_id", $new_object->getRefId());
651 $this->getReturnLocation(
652 "save",
653 $this->ctrl->getLinkTarget($this, self::CMD_SETTINGS, "", false, false)
654 )
655 );
656 }
657
658 public function unparticipate(): void
659 {
660 if ($this->checkAccess('unparticipate')) {
661 $usr_id = $this->user->getId();
662 $this->getObject()->getLSRoles()->leave($usr_id);
663 }
664 $this->ctrl->redirectByClass('ilObjLearningSequenceLearnerGUI', self::CMD_LEARNER_VIEW);
665 }
666
667 protected function getTabs(): void
668 {
669 if ($this->checkAccess("read")) {
670 $cmd = $this->checkAccess("write") ? self::CMD_CONTENT : self::CMD_VIEW;
671 $this->tabs->addTab(
672 self::TAB_CONTENT_MAIN,
673 $this->lng->txt(self::TAB_CONTENT_MAIN),
674 $this->ctrl->getLinkTarget($this, $cmd, "", false, false)
675 );
676 }
677
678 if ($this->checkAccess("read") || $this->checkAccess("visible")) {
679 $this->tabs->addTab(
680 self::TAB_INFO,
681 $this->lng->txt(self::TAB_INFO),
682 $this->getLinkTarget(self::CMD_INFO)
683 );
684 }
685
686 if ($this->checkAccess("write")) {
687 $this->tabs->addTab(
688 self::TAB_SETTINGS,
689 $this->lng->txt(self::TAB_SETTINGS),
690 $this->getLinkTarget(self::CMD_SETTINGS)
691 );
692 }
693
694 if ($this->checkAccess("read")) {
695 $cmd = null;
696 if ($this->checkAccess("manage_members")) {
697 $cmd = self::CMD_MEMBERS;
698 } elseif (
699 $this->getObject()->getLSSettings()->getMembersGallery()
700 && $this->getObject()->getLSRoles()->isMember($this->user->getId())
701 ) {
703 }
704
705 if ($cmd) {
706 $this->tabs->addTab(
707 self::TAB_MEMBERS,
708 $this->lng->txt(self::TAB_MEMBERS),
709 $this->ctrl->getLinkTarget($this, $cmd, "", false, false)
710 );
711 }
712 }
713
715 $this->tabs->addTab(
716 self::TAB_LP,
717 $this->lng->txt(self::TAB_LP),
718 $this->ctrl->getLinkTargetByClass(array('ilobjlearningsequencegui', 'illearningprogressgui'), '')
719 );
720 }
721
722 if ($this->checkAccess("write")) {
723 $this->tabs->addTab(
724 self::TAB_EXPORT,
725 $this->lng->txt(self::TAB_EXPORT),
726 $this->ctrl->getLinkTargetByClass("ilexportgui", "")
727 );
728 }
729
730 if ($this->checkAccess("edit_permission")) {
731 $this->tabs->addTab(
732 self::TAB_PERMISSIONS,
733 $this->lng->txt(self::TAB_PERMISSIONS),
734 $this->getLinkTarget(self::CMD_PERMISSIONS)
735 );
736 }
737 }
738
739 protected function addSubTabsForContent(string $active): void
740 {
741 $this->tabs->addSubTab(
742 self::TAB_VIEW_CONTENT,
743 $this->lng->txt(self::TAB_VIEW_CONTENT),
744 $this->getLinkTarget(self::CMD_LEARNER_VIEW)
745 );
746
747 if ($this->checkAccess("write")) {
748 $this->tabs->addSubTab(
749 self::TAB_MANAGE,
750 $this->lng->txt(self::TAB_MANAGE),
751 $this->getLinkTarget(self::CMD_CONTENT)
752 );
753
754 $this->tabs->addSubTab(
755 self::TAB_EDIT_INTRO,
756 $this->lng->txt("lso_settings_intro"),
757 $this->ctrl->getLinkTargetByClass(
758 strtolower('ilObjLearningSequenceEditIntroGUI'),
759 'preview'
760 )
761 );
762 $this->tabs->addSubTab(
763 self::TAB_EDIT_EXTRO,
764 $this->lng->txt("lso_settings_extro"),
765 $this->ctrl->getLinkTargetByClass(
766 strtolower('ilObjLearningSequenceEditExtroGUI'),
767 'preview'
768 )
769 );
770 }
771 $this->tabs->activateSubTab($active);
772 }
773
774 protected function checkAccess(string $which): bool
775 {
776 return $this->access->checkAccess($which, "", $this->ref_id);
777 }
778
779 protected function checkLPAccess(): bool
780 {
781 if (ilObject::_lookupType($this->ref_id, true) !== "lso") {
782 return false;
783 }
784
785 $ref_id = $this->getObject()->getRefId();
786 $is_participant = ilLearningSequenceParticipants::_isParticipant($ref_id, $this->user->getId());
787
788 return ilLearningProgressAccess::checkAccess($ref_id, $is_participant);
789 }
790
791 protected function getLinkTarget(string $cmd): string
792 {
793 $class = $this->getClassForTabs($cmd);
794 $class_path = [
795 strtolower('ilObjLearningSequenceGUI'),
796 $class
797 ];
798 return $this->ctrl->getLinkTargetByClass($class_path, $cmd);
799 }
800
801 protected function getClassForTabs(string $cmd): string
802 {
803 switch ($cmd) {
805 return 'ilObjLearningSequenceContentGUI';
807 return 'ilObjLearningSequenceLearnerGUI';
809 return 'ilObjLearningSequenceSettingsGUI';
810 case self::CMD_INFO:
811 return 'ilInfoScreenGUI';
813 return 'ilPermissionGUI';
814 }
815
816 throw new InvalidArgumentException('cannot resolve class for command: ' . $cmd);
817 }
818
819 public function createMailSignature(): string
820 {
821 $link = chr(13) . chr(10) . chr(13) . chr(10);
822 $link .= $this->lng->txt('lso_mail_permanent_link');
823 $link .= chr(13) . chr(10) . chr(13) . chr(10);
824 $link .= ilLink::_getLink($this->object->getRefId());
825
826 return rawurlencode(base64_encode($link));
827 }
828
830 {
831 return new ilObjUserTracking();
832 }
833
837 public function getLocalRoles(): array
838 {
839 $local_roles = $this->object->getLocalLearningSequenceRoles();
840 $lso_member = $this->object->getDefaultMemberRole();
841 $lso_roles = array();
842
843 if (in_array($lso_member, $local_roles)) {
844 $lso_roles[$lso_member] = ilObjRole::_getTranslation(array_search($lso_member, $local_roles));
845 unset($local_roles[$lso_roles[$lso_member]]);
846 }
847
848 foreach ($local_roles as $title => $role_id) {
849 $lso_roles[$role_id] = ilObjRole::_getTranslation($title);
850 }
851
852 return $lso_roles;
853 }
854
859 protected function getAdditionalOKTypes(): array
860 {
861 return array_filter(
862 array_keys($this->obj_definition->getSubObjects('lso', false)),
863 fn($type) => $type !== 'rolf'
864 );
865 }
866
870 public function addCustomData(array $a_data): array
871 {
872 $udfs = $this->profile->getAllUserDefinedFields();
873 return array_reduce(
874 $this->profile->getDataForMultiple(array_keys($a_data)),
875 function (array $c, ProfileData $v) use ($a_data, $udfs): array {
876 $c[$v->getId()] = $a_data[$v->getId()];
877 foreach ($udfs as $field) {
878 $field_id = $field->getIdentifier();
879 $c[$v->getId()]['udf_' . $field_id] = (string) $v->getAdditionalFieldByIdentifier($field_id);
880 }
881 },
882 []
883 );
884 }
885
886 public function showPossibleSubObjects(): void
887 {
888 $this->ctrl->setParameterByClass(ilRepositoryGUI::class, 'ref_id', $this->ref_id);
892 ilRepositoryGUI::class,
893 $this->ref_id
894 )
895 );
896 $gui->render();
897 $this->ctrl->clearParametersByClass(ilRepositoryGUI::class);
898 }
899
900 public function afterSaveCallback(): void
901 {
902 }
903
904 protected function enableDragDropFileUpload(): void
905 {
906 }
907
908}
@ 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, bool $isCatchupWriteEvents=true, $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