ILIAS  release_8 Revision v8.24
class.ilObjLearningSequenceGUI.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
21use ILIAS\Data;
23
54{
55 public const CMD_VIEW = "view";
56 public const CMD_LEARNER_VIEW = "learnerView";
57 public const CMD_CONTENT = "manageContent";
58
59 public const CMD_MEMBERS = "members";
60 public const CMD_MANAGE_MEMBERS = "participants";
61 public const CMD_MEMBERS_GALLERY = "jump2UsersGallery";
62
63 public const CMD_INFO = "showSummary";
64 public const CMD_INFO_SCREEN = "infoScreen";
65 public const CMD_SETTINGS = "settings";
66 public const CMD_PERMISSIONS = "perm";
67 public const CMD_EXPORT = "export";
68 public const CMD_IMPORT = "importFile";
69 public const CMD_CREATE = "create";
70 public const CMD_SAVE = "save";
71 public const CMD_CANCEL = "cancel";
72 public const CMD_UNPARTICIPATE = "unparticipate";
73 public const CMD_ADD_TO_DESK = "addToDesk";
74 public const CMD_REMOVE_FROM_DESK = "removeFromDesk";
75 public const CMD_LINK = "link";
76 public const CMD_CANCEL_LINK = "cancelMoveLink";
77 public const CMD_CUT = "cut";
78 public const CMD_CANCEL_CUT = "cancelCut";
79 public const CMD_CUT_SHOWTREE = "showPasteTree";
80 public const CMD_CUT_CLIPBOARD = "keepObjectsInClipboard";
81 public const CMD_DELETE = "delete";
82 public const CMD_CANCEL_DELETE = "cancelDelete";
83 public const CMD_DELETE_CONFIRMED = "confirmedDelete";
84 public const CMD_PERFORM_PASTE = 'performPasteIntoMultipleObjects';
85 public const CMD_SHOW_TRASH = 'trash';
86 public const CMD_UNDELETE = 'undelete';
87 public const CMD_REDRAW_HEADER = 'redrawHeaderAction';
88 public const CMD_ENABLE_ADMINISTRATION_PANEL = "enableAdministrationPanel";
89
90 public const TAB_VIEW_CONTENT = "view";
91 public const TAB_MANAGE = "manage";
92 public const TAB_CONTENT_MAIN = "manage_content_maintab";
93 public const TAB_INFO = "show_summary";
94 public const TAB_SETTINGS = "settings";
95 public const TAB_PERMISSIONS = "perm_settings";
96 public const TAB_MEMBERS = "members";
97 public const TAB_LP = "learning_progress";
98 public const TAB_EXPORT = "export";
99
100 public const TAB_EDIT_INTRO = "edit_intropage";
101 public const TAB_EDIT_EXTRO = "edit_extropage";
102
103
104 public const MAIL_ALLOWED_ALL = 1;
105 public const MAIL_ALLOWED_TUTORS = 2;
106
107 public const ACCESS_READ = 'read';
108 public const ACCESS_VISIBLE = 'visible';
109 protected \ILIAS\Style\Content\Service $content_style;
110
111 protected string $obj_type;
116 protected ilHelpGUI $help;
123
124 public static function _goto(string $target): void
125 {
126 global $DIC;
127 $main_tpl = $DIC->ui()->mainTemplate();
128
129 $request = $DIC->http()->request();
130 $lng = $DIC->language();
131 $err = $DIC['ilErr'];
132
133 $targetParameters = explode('_', $target);
134 $id = (int) $targetParameters[0];
135
136 if (!self::isAccessible($id)) {
137 $err->raiseError($lng->txt('msg_no_perm_read'), $err->FATAL);
138 }
139
140 if (self::hasAccess(self::ACCESS_READ, $id)) {
141 $params = ['ref_id' => $id];
142
143 if (isset($request->getQueryParams()['gotolp'])) {
144 $params['gotolp'] = 1;
145 }
146
148 ilRepositoryGUI::class,
149 [ilObjLearningSequenceGUI::class],
150 $params
151 );
152 }
153
154 if (self::hasAccess(self::ACCESS_VISIBLE, $id)) {
156 }
157
158 if (self::hasAccess(self::ACCESS_READ, ROOT_FOLDER_ID)) {
159 $main_tpl->setOnScreenMessage('info', sprintf(
160 $lng->txt('msg_no_perm_read_item'),
162 ), true);
163
164 self::forwardByClass(ilRepositoryGUI::class, [ilRepositoryGUI::class], ['ref_id' => ROOT_FOLDER_ID]);
165 }
166 }
167
168 protected static function isAccessible(int $id): bool
169 {
170 return $id > 0 && (
171 self::hasAccess(self::ACCESS_READ, $id) ||
172 self::hasAccess(self::ACCESS_VISIBLE, $id) ||
173 self::hasAccess(self::ACCESS_READ, ROOT_FOLDER_ID)
174 );
175 }
176
177 protected static function hasAccess(string $mode, int $id): bool
178 {
179 global $DIC;
180 return $DIC->access()->checkAccess($mode, '', $id);
181 }
182
183 protected static function forwardByClass(string $base_class, array $classes, array $params, string $cmd = ''): void
184 {
185 global $DIC;
186 $ctrl = $DIC->ctrl();
187 $target_class = end($classes);
188
189 $ctrl->setTargetScript('ilias.php');
190 foreach ($params as $key => $value) {
191 $ctrl->setParameterByClass($target_class, $key, $value);
192 }
193
194 // insert the baseclass to the first position.
195 array_splice($classes, 0, 0, $base_class);
196 $ctrl->redirectByClass($classes, $cmd);
197 }
198
199 public function __construct()
200 {
201 $this->obj_type = ilObjLearningSequence::OBJ_TYPE;
202
203 global $DIC;
204 $this->ctrl = $DIC['ilCtrl'];
205 $this->lng = $DIC['lng'];
206 $this->user = $DIC['ilUser'];
207 $this->tabs = $DIC['ilTabs'];
208 $this->toolbar = $DIC['ilToolbar'];
209 $this->help = $DIC['ilHelp'];
210 $this->settings = $DIC['ilSetting'];
211 $this->access = $DIC['ilAccess'];
212 $this->rbac_review = $DIC['rbacreview'];
213 $this->ui_factory = $DIC['ui.factory'];
214 $this->ui_renderer = $DIC['ui.renderer'];
215
216 $this->log = $DIC["ilLoggerFactory"]->getRootLogger();
217 $this->app_event_handler = $DIC['ilAppEventHandler'];
218 $this->navigation_history = $DIC['ilNavigationHistory'];
219 $this->obj_definition = $DIC['objDefinition'];
220 $this->tpl = $DIC["tpl"];
221 $this->obj_service = $DIC->object();
222 $this->toolbar = $DIC['ilToolbar'];
223 $this->request_wrapper = $DIC->http()->wrapper()->query();
224 $this->post_wrapper = $DIC->http()->wrapper()->post();
225 $this->refinery = $DIC->refinery();
226 $this->content_style = $DIC->contentStyle();
227
228 $this->help->setScreenIdComponent($this->obj_type);
229 $this->lng->loadLanguageModule($this->obj_type);
230
231 $this->data_factory = new Data\Factory();
232
233 $this->ref_id = $this->request_wrapper->retrieve("ref_id", $this->refinery->kindlyTo()->int());
234 parent::__construct([], $this->ref_id, true, false);
235 }
236
237 protected function recordLearningSequenceRead(): void
238 {
240 $this->object->getType(),
241 $this->object->getRefId(),
242 $this->object->getId(),
243 $this->user->getId()
244 );
245 }
246
247 public function executeCommand(): void
248 {
249 $next_class = $this->ctrl->getNextClass($this);
250 $cmd = $this->ctrl->getCmd();
252
253 parent::prepareOutput();
254 $this->addToNavigationHistory();
255 //showRepTree is from containerGUI;
256 //LSO will attach allowed subitems to whitelist
257 //see: $this::getAdditionalWhitelistTypes
258
259 $in_player = (
260 $next_class === 'ilobjlearningsequencelearnergui'
261 && $cmd === 'view'
262 );
263
264 $tpl->setPermanentLink("lso", $this->ref_id);
265
266 switch ($next_class) {
267 case "ilcommonactiondispatchergui":
269 $this->ctrl->forwardCommand($gui);
270 break;
271 case "ilinfoscreengui":
272 $this->info($cmd);
273 break;
274 case "ilpermissiongui":
275 $this->permissions($cmd);
276 break;
277 case "ilobjlearningsequencesettingsgui":
279 $this->settings($cmd);
280 break;
281 case "ilobjlearningsequencecontentgui":
283 $this->manageContent($cmd);
284 break;
285 case "ilobjlearningsequencelearnergui":
286 $this->learnerView($cmd);
287 break;
288 case "illearningsequencemembershipgui":
289 $this->manage_members($cmd);
290 break;
291 case 'illearningprogressgui':
292 $this->learningProgress();
293 break;
294 case 'ilexportgui':
295 $this->export();
296 break;
297 case 'ilobjectcopygui':
298 $cp = new ilObjectCopyGUI($this);
299 $cp->setType('lso');
300 $this->ctrl->forwardCommand($cp);
301 break;
302 case 'ilobjindividualassessmentgui':
303 $struct = ['ilrepositorygui', 'ilobjindividualassessmentgui'];
304 if ($cmd === 'edit') {
305 $struct[] = 'ilindividualassessmentsettingsgui';
306 }
307 $this->ctrl->redirectByClass($struct, $cmd);
308 break;
309 case 'ilobjtestgui':
310 $struct = ['ilrepositorygui', 'ilobjtestgui'];
311 $this->ctrl->redirectByClass($struct, $cmd);
312 break;
313 case 'ilobjlearningsequencelppollinggui':
314 $gui = $this->object->getLocalDI()["gui.learner.lp"];
315 $this->ctrl->setCmd($cmd);
316 $this->ctrl->forwardCommand($gui);
317 break;
318
319 case "ilobjlearningsequenceeditintrogui":
320 $which_page = $this->object::CP_INTRO;
321 $which_tab = self::TAB_EDIT_INTRO;
322 $gui_class = 'ilObjLearningSequenceEditIntroGUI';
323 // no break
324 case "ilobjlearningsequenceeditextrogui":
326
327 if (!isset($which_page)) {
328 $which_page = $this->object::CP_EXTRO;
329 $which_tab = self::TAB_EDIT_EXTRO;
330
331 $gui_class = 'ilObjLearningSequenceEditExtroGUI';
332 }
333
334 $this->addContentStyleCss();
335 $this->addSubTabsForContent($which_tab);
336
337 $page_id = $this->object->getContentPageId($which_page);
338 if (!$this->object->hasContentPage($which_page)) {
339 $this->object->createContentPage($which_page);
340 }
341
342 $gui = new $gui_class(
343 $this->object::CP_TYPE,
344 $page_id
345 );
346 $this->ctrl->setCmd($cmd);
347 $out = $this->ctrl->forwardCommand($gui);
348
349 //editor's guis will write to template, but not return
350 //e.g. see ilPCTabsGUI::insert
351 if (!is_null($out)) {
353 }
354 break;
355
356 case false:
357 if ($cmd === '') {
358 if ($this->checkAccess("write")) {
359 $cmd = self::CMD_CONTENT;
360 } else {
361 $cmd = self::CMD_VIEW;
362 }
363 }
364
365 switch ($cmd) {
366 case self::CMD_IMPORT:
367 $this->importFileObject();
368 break;
369 case self::CMD_INFO:
371 $this->info();
372 break;
373 case self::CMD_VIEW:
378 case self::CMD_SAVE:
379 case self::CMD_CREATE:
381 if (!$this->checkAccess("read")) {
382 $this->tpl->setOnScreenMessage('info', sprintf(
383 $this->lng->txt('msg_no_perm_read_item'),
384 $this->object->getTitle()
385 ), true);
386 break;
387 }
388 $this->$cmd();
389 break;
390 case self::CMD_CANCEL:
391 if ($this->getCreationMode()) {
392 $this->cancelCreation();
393 }
394 break;
396 $this->removeFromDeskObject();
397 $this->view();
398 break;
400 $this->addToDeskObject();
401 $this->view();
402 break;
403 case self::CMD_CUT:
404 $this->cutObject();
405 break;
407 $this->showPasteTreeObject();
408 break;
411 break;
412 case self::CMD_LINK:
413 $this->linkObject();
414 break;
415 case self::CMD_DELETE:
416 $this->deleteObject();
417 break;
419 $this->confirmedDeleteObject();
420 break;
423 break;
425 $this->trashObject();
426 break;
428 $this->undeleteObject();
429 break;
430
434 $cmd = self::CMD_CONTENT;
435 $this->$cmd();
436 break;
437
440 break;
441
442 // This is a temporary implementation (Mantis Ticket 36631)
444 $tpl->setOnScreenMessage("failure", $this->lng->txt('lso_multidownload_not_available'), false);
445 $this->manageContent();
446 break;
447
448 default:
449 throw new ilException("ilObjLearningSequenceGUI: Invalid command '$cmd'");
450 }
451 break;
452 default:
453 throw new ilException("ilObjLearningSequenceGUI: Can't forward to next class $next_class");
454 }
455
456 if (!$in_player) {
457 $this->addHeaderAction();
458 }
459
460 // This is the base class for the call, so we ought to print.
461 // TODO: This is super fishy and most probably hints on the fact, that
462 // something regarding that base class usage needs to change.
463 if (strtolower($this->request_wrapper->retrieve("baseClass", $this->refinery->kindlyTo()->string())) === strtolower(self::class)) {
464 $tpl->printToStdOut();
465 }
466 }
467
468 public function addContentStyleCss(): void
469 {
470 $this->content_style->gui()->addCss(
471 $this->tpl,
472 $this->object->getRefId()
473 );
474 }
475
476 public function addToNavigationHistory(): void
477 {
478 if (
479 !$this->getCreationMode() &&
480 $this->access->checkAccess('read', '', $this->ref_id)
481 ) {
482 $link = ilLink::_getLink($this->ref_id, $this->obj_type);
483 $this->navigation_history->addItem($this->ref_id, $link, $this->obj_type);
484 }
485 }
486
487 protected function info(string $cmd = self::CMD_INFO): void
488 {
489 $this->tabs->setTabActive(self::TAB_INFO);
490 $this->ctrl->setCmdClass('ilinfoscreengui');
491 $this->ctrl->setCmd($cmd);
492 $info = new ilInfoScreenGUI($this);
493 $this->ctrl->forwardCommand($info);
494 }
495
496 protected function permissions(string $cmd = self::CMD_PERMISSIONS): void
497 {
498 $this->tabs->setTabActive(self::TAB_PERMISSIONS);
499 $perm_gui = new ilPermissionGUI($this);
500 $this->ctrl->setCmd($cmd);
501 $this->ctrl->forwardCommand($perm_gui);
502 }
503
504 protected function settings(string $cmd = self::CMD_SETTINGS): void
505 {
506 $this->tabs->activateTab(self::TAB_SETTINGS);
508 $this->getObject(),
509 $this->ctrl,
510 $this->lng,
511 $this->tpl,
512 $this->obj_service,
513 $this->post_wrapper,
514 $this->refinery,
515 $this->toolbar
516 );
517 $this->ctrl->setCmd($cmd);
518 $this->ctrl->forwardCommand($gui);
519 }
520
521 protected function view(): void
522 {
524 $this->tabs->clearSubTabs();
525 if ($this->checkAccess("write")) {
526 $this->manageContent(self::CMD_CONTENT);
527 return;
528 } elseif ($this->checkAccess("read")) {
529 $this->learnerView(self::CMD_LEARNER_VIEW);
530 return;
531 } else {
532 $this->info(self::CMD_INFO);
533 }
534 }
535
536 protected function manageContent(string $cmd = self::CMD_CONTENT): void
537 {
538 $this->tabs->activateTab(self::TAB_CONTENT_MAIN);
539 $this->addSubTabsForContent(self::TAB_MANAGE);
540
542 $this,
543 $this->ctrl,
544 $this->tpl,
545 $this->lng,
546 $this->access,
547 new ilConfirmationGUI(),
548 new LSItemOnlineStatus(),
549 $this->post_wrapper,
550 $this->refinery,
551 $this->ui_factory,
552 $this->ui_renderer,
553 );
554 $this->ctrl->setCmd($cmd);
555 $this->ctrl->forwardCommand($gui);
556 }
557
558 protected function learnerView(string $cmd = self::CMD_LEARNER_VIEW): void
559 {
560 $this->addContentStyleCss();
561 $this->tabs->activateTab(self::TAB_CONTENT_MAIN);
562 $this->addSubTabsForContent(self::TAB_VIEW_CONTENT);
563
564 $gui = $this->object->getLocalDI()["gui.learner"];
565
566 $this->ctrl->setCmd($cmd);
567 $this->ctrl->forwardCommand($gui);
568 }
569
570 protected function members(): void
571 {
572 $may_manage_members = $this->checkAccess("edit_members");
573 $this->ctrl->setCmdClass('ilLearningSequenceMembershipGUI');
574 if ($may_manage_members) {
575 $this->manage_members();
576 } else {
577 $this->manage_members(self::CMD_MEMBERS_GALLERY);
578 }
579 }
580
581 protected function manage_members(string $cmd = self::CMD_MANAGE_MEMBERS): void
582 {
583 $this->tabs->setTabActive(self::TAB_MEMBERS);
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 );
597
598 $this->ctrl->setCmd($cmd);
599 $this->ctrl->forwardCommand($ms_gui);
600 }
601
602 protected function learningProgress(): void
603 {
604 $this->tabs->setTabActive(self::TAB_LP);
605
606 $for_user = $this->user->getId();
607
608 if ($this->request_wrapper->has("user_id")) {
609 $for_user = $this->request_wrapper->retrieve("user_id", $this->refinery->kindlyTo()->int());
610 }
611
612 $lp_gui = new ilLearningProgressGUI(
614 $this->getObject()->getRefId(),
615 $for_user
616 );
617 $this->ctrl->forwardCommand($lp_gui);
618 }
619
620 protected function export(): void
621 {
622 $this->tabs->setTabActive(self::TAB_EXPORT);
623 $gui = new ilExportGUI($this);
624 $gui->addFormat("xml");
625
626 $this->ctrl->forwardCommand($gui);
627 }
628
630 {
631 return $form;
632 }
633
634 protected function create(): void
635 {
636 parent::createObject();
637 }
638
639 protected function save(): void
640 {
641 parent::saveObject();
642 }
643
644 protected function afterSave(ilObject $new_object): void
645 {
646 $participant = new ilLearningSequenceParticipants(
647 $new_object->getId(),
648 $this->log,
649 $this->app_event_handler,
650 $this->settings
651 );
652
653 $participant->add($this->user->getId(), ilParticipants::IL_LSO_ADMIN);
654 $participant->updateNotification(
655 $this->user->getId(),
656 (bool) $this->settings->get('mail_lso_admin_notification', "1")
657 );
658
659 $settings = new ilContainerSortingSettings($new_object->getId());
664 $settings->save();
665
666 $this->tpl->setOnScreenMessage('success', $this->lng->txt('object_added'), true);
667 $this->ctrl->setParameter($this, "ref_id", $new_object->getRefId());
669 $this->getReturnLocation(
670 "save",
671 $this->ctrl->getLinkTarget($this, self::CMD_SETTINGS, "", false, false)
672 )
673 );
674 }
675
676 public function unparticipate(): void
677 {
678 if ($this->checkAccess('unparticipate')) {
679 $usr_id = $this->user->getId();
680 $this->getObject()->getLSRoles()->leave($usr_id);
681 $this->learnerView();
682 }
683 }
684
685 protected function getTabs(): void
686 {
687 if ($this->checkAccess("read")) {
688 $this->tabs->addTab(
689 self::TAB_CONTENT_MAIN,
690 $this->lng->txt(self::TAB_CONTENT_MAIN),
691 $this->ctrl->getLinkTarget($this, self::CMD_VIEW, "", false, false)
692 );
693 }
694
695 if ($this->checkAccess("read") || $this->checkAccess("visible")) {
696 $this->tabs->addTab(
697 self::TAB_INFO,
698 $this->lng->txt(self::TAB_INFO),
699 $this->getLinkTarget(self::CMD_INFO)
700 );
701 }
702
703 if ($this->checkAccess("write")) {
704 $this->tabs->addTab(
705 self::TAB_SETTINGS,
706 $this->lng->txt(self::TAB_SETTINGS),
707 $this->getLinkTarget(self::CMD_SETTINGS)
708 );
709 }
710
711 if ($this->checkAccess("read")) {
712 if ($this->checkAccess("manage_members")
713 || (
714 $this->getObject()->getLSSettings()->getMembersGallery()
715 &&
716 $this->getObject()->getLSRoles()->isMember($this->user->getId())
717 )
718 ) {
719 $this->tabs->addTab(
720 self::TAB_MEMBERS,
721 $this->lng->txt(self::TAB_MEMBERS),
722 $this->ctrl->getLinkTarget($this, self::CMD_MEMBERS, "", false, false)
723 );
724 }
725 }
726
728 $this->tabs->addTab(
729 self::TAB_LP,
730 $this->lng->txt(self::TAB_LP),
731 $this->ctrl->getLinkTargetByClass(array('ilobjlearningsequencegui', 'illearningprogressgui'), '')
732 );
733 }
734
735 if ($this->checkAccess("write")) {
736 $this->tabs->addTab(
737 self::TAB_EXPORT,
738 $this->lng->txt(self::TAB_EXPORT),
739 $this->ctrl->getLinkTargetByClass("ilexportgui", "")
740 );
741 }
742
743 if ($this->checkAccess("edit_permission")) {
744 $this->tabs->addTab(
745 self::TAB_PERMISSIONS,
746 $this->lng->txt(self::TAB_PERMISSIONS),
747 $this->getLinkTarget(self::CMD_PERMISSIONS)
748 );
749 }
750 }
751
752 public function renderObject(): void
753 {
754 // disables this method in ilContainerGUI
755 }
756
757
758 protected function addSubTabsForContent(string $active): void
759 {
760 $this->tabs->addSubTab(
761 self::TAB_VIEW_CONTENT,
762 $this->lng->txt(self::TAB_VIEW_CONTENT),
763 $this->getLinkTarget(self::CMD_LEARNER_VIEW)
764 );
765
766 if ($this->checkAccess("write")) {
767 $this->tabs->addSubTab(
768 self::TAB_MANAGE,
769 $this->lng->txt(self::TAB_MANAGE),
770 $this->getLinkTarget(self::CMD_CONTENT)
771 );
772
773 $this->tabs->addSubTab(
774 self::TAB_EDIT_INTRO,
775 $this->lng->txt("lso_settings_intro"),
776 $this->ctrl->getLinkTargetByClass(
777 strtolower('ilObjLearningSequenceEditIntroGUI'),
778 'preview'
779 )
780 );
781 $this->tabs->addSubTab(
782 self::TAB_EDIT_EXTRO,
783 $this->lng->txt("lso_settings_extro"),
784 $this->ctrl->getLinkTargetByClass(
785 strtolower('ilObjLearningSequenceEditExtroGUI'),
786 'preview'
787 )
788 );
789 }
790 $this->tabs->activateSubTab($active);
791 }
792
793 protected function checkAccess(string $which): bool
794 {
795 return $this->access->checkAccess($which, "", $this->ref_id);
796 }
797
798 protected function checkLPAccess(): bool
799 {
800 if (ilObject::_lookupType($this->ref_id, true) !== "lso") {
801 return false;
802 }
803
804 $ref_id = $this->getObject()->getRefId();
805 $is_participant = ilLearningSequenceParticipants::_isParticipant($ref_id, $this->user->getId());
806
807 return ilLearningProgressAccess::checkAccess($ref_id, $is_participant);
808 }
809
810 protected function getLinkTarget(string $cmd): string
811 {
812 $class = $this->getClassForTabs($cmd);
813 $class_path = [
814 strtolower('ilObjLearningSequenceGUI'),
815 $class
816 ];
817 return $this->ctrl->getLinkTargetByClass($class_path, $cmd);
818 }
819
820 protected function getClassForTabs(string $cmd): string
821 {
822 switch ($cmd) {
824 return 'ilObjLearningSequenceContentGUI';
826 return 'ilObjLearningSequenceLearnerGUI';
828 return 'ilObjLearningSequenceSettingsGUI';
829 case self::CMD_INFO:
830 return 'ilInfoScreenGUI';
832 return 'ilPermissionGUI';
833 }
834
835 throw new InvalidArgumentException('cannot resolve class for command: ' . $cmd);
836 }
837
838 public function createMailSignature(): string
839 {
840 $link = chr(13) . chr(10) . chr(13) . chr(10);
841 $link .= $this->lng->txt('lso_mail_permanent_link');
842 $link .= chr(13) . chr(10) . chr(13) . chr(10);
843 $link .= ilLink::_getLink($this->object->getRefId());
844
845 return rawurlencode(base64_encode($link));
846 }
847
848 public function getObject(): ilObjLearningSequence
849 {
850 if ($this->object === null) {
852 $obj = ilObjLearningSequence::getInstanceByRefId($this->ref_id);
853 $this->object = $obj;
854 }
855
856 return $this->object;
857 }
858
860 {
861 return new ilObjUserTracking();
862 }
863
867 public function getLocalRoles(): array
868 {
869 $local_roles = $this->object->getLocalLearningSequenceRoles();
870 $lso_member = $this->object->getDefaultMemberRole();
871 $lso_roles = array();
872
873 if (in_array($lso_member, $local_roles)) {
874 $lso_roles[$lso_member] = ilObjRole::_getTranslation(array_search($lso_member, $local_roles));
875 unset($local_roles[$lso_roles[$lso_member]]);
876 }
877
878 foreach ($local_roles as $title => $role_id) {
879 $lso_roles[$role_id] = ilObjRole::_getTranslation($title);
880 }
881
882 return $lso_roles;
883 }
884
889 protected function getAdditionalWhitelistTypes(): array
890 {
891 return array_filter(
892 array_keys($this->obj_definition->getSubObjects('lso', false)),
893 fn ($type) => $type !== 'rolf'
894 );
895 }
896
900 public function addCustomData(array $a_data): array
901 {
902 $res_data = array();
903 foreach ($a_data as $usr_id => $user_data) {
904 $res_data[$usr_id] = $user_data;
905 $udf_data = new ilUserDefinedData($usr_id);
906
907 foreach ($udf_data->getAll() as $field => $value) {
908 list(, $field_id) = explode('_', $field);
909 $res_data[$usr_id]['udf_' . $field_id] = (string) $value;
910 }
911 }
912
913 return $res_data;
914 }
915
916 public function showPossibleSubObjects(): void
917 {
918 $gui = new ilObjectAddNewItemGUI($this->object->getRefId());
919 $gui->render();
920 }
921
926 public function confirmedDeleteObject(): void
927 {
928 if ($this->post_wrapper->has("mref_id")) {
929 $mref_id = $this->post_wrapper->retrieve(
930 "mref_id",
931 $this->refinery->kindlyTo()->listOf($this->refinery->kindlyTo()->int())
932 );
933 $_SESSION["saved_post"] = array_unique(array_merge($_SESSION["saved_post"], $mref_id));
934 }
935
936 $ru = new ilRepositoryTrashGUI($this);
937 $ru->deleteObjects($this->requested_ref_id, ilSession::get("saved_post") ?? []);
938 ilSession::clear("saved_post");
939 $this->ctrl->redirect($this, self::CMD_CONTENT);
940 }
941
942 protected function enableDragDropFileUpload(): void
943 {
944 }
945
946 private function denyAccessIfNotWritePermission(): void
947 {
948 if (!$this->checkAccess("write")) {
949 $this->tpl->setOnScreenMessage('info', sprintf(
950 $this->lng->txt('msg_no_perm_read_item'),
951 $this->object->getTitle()
952 ), true);
953 $this->ctrl->redirect($this, self::CMD_VIEW);
954 }
955 }
956}
$out
Definition: buildRTE.php:24
Builds data types.
Definition: Factory.php:21
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
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,...
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
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
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
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
GUI class for learning sequence membership features.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static _isParticipant(int $a_ref_id, int $a_usr_id)
Static function to check if a user is a participant of the container object.
Navigation History of Repository Items.
Class ilObjLearningSequenceGUI @ilCtrl_isCalledBy ilObjLearningSequenceGUI: ilRepositoryGUI @ilCtrl_i...
settings(string $cmd=self::CMD_SETTINGS)
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)
confirmedDeleteObject()
ATTENTION: This mostly is a copy of ilObjectGUI::confirmDeleteObject, but does not redirect to parent...
getTabs()
@abstract overwrite in derived GUI class of your object type
afterSave(ilObject $new_object)
Post (successful) object creation hook.
manageContent(string $cmd=self::CMD_CONTENT)
static hasAccess(string $mode, int $id)
ILIAS HTTP Wrapper RequestWrapper $request_wrapper
manage_members(string $cmd=self::CMD_MANAGE_MEMBERS)
permissions(string $cmd=self::CMD_PERMISSIONS)
initDidacticTemplate(ilPropertyFormGUI $form)
static forwardByClass(string $base_class, array $classes, array $params, string $cmd='')
getAdditionalWhitelistTypes()
append additional types to ilRepositoryExplorerGUI's whitelist
learnerView(string $cmd=self::CMD_LEARNER_VIEW)
static getInstanceByRefId(int $ref_id)
static _getTranslation(string $a_role_title)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
GUI class for the workflow of copying objects.
cancelCreation()
cancel create action and go back to repository parent
importFileObject(int $parent_id=null)
ilGlobalTemplateInterface $tpl
deleteObject(bool $error=false)
Display deletion confirmation screen.
ilSetting $settings
addHeaderAction()
Add header action menu.
static _gotoRepositoryNode(int $ref_id, string $cmd="")
ServerRequestInterface $request
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.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static _lookupType(int $id, bool $reference=false)
static _lookupObjId(int $ref_id)
static _lookupTitle(int $obj_id)
New PermissionGUI (extends from old ilPermission2GUI) RBAC related output.
This class represents a property form user interface.
class ilRbacReview Contains Review functions of core Rbac.
Repository GUI Utilities.
static get(string $a_var)
static clear(string $a_var)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static redirect(string $a_script)
const ROOT_FOLDER_ID
Definition: constants.php:32
global $DIC
Definition: feed.php:28
Interface RequestWrapper.
This is how the factory for UI elements looks.
Definition: Factory.php:38
An entity that renders components to a string output.
Definition: Renderer.php:31
Interface ilCtrlBaseClassInterface describes ilCtrl base classes.
removeFromDeskObject()
Remove from desktop @access public.
addToDeskObject()
Add desktop item @access public.
setContent(string $a_html)
Sets content for standard template.
setOnScreenMessage(string $type, string $a_txt, bool $a_keep=false)
Set a message to be displayed to the user.
setPermanentLink(string $a_type, ?int $a_id, string $a_append="", string $a_target="", string $a_title="")
Generates and sets a permanent ilias link.
if(! $DIC->user() ->getId()||!ilLTIConsumerAccess::hasCustomProviderCreationAccess()) $params
Definition: ltiregstart.php:33
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
string $key
Consumer key/client ID value.
Definition: System.php:193