ILIAS  release_9 Revision v9.13-25-g2c18ec4c24f
class.ilObjLearningSequenceGUI.php
Go to the documentation of this file.
1 <?php
2 
19 declare(strict_types=1);
20 
21 use 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;
119  protected Data\Factory $data_factory;
124 
125  public static function _goto(string $target): void
126  {
127  global $DIC;
128  $main_tpl = $DIC->ui()->mainTemplate();
129 
130  $request = $DIC->http()->request();
131  $lng = $DIC->language();
132  $err = $DIC['ilErr'];
133 
134  $targetParameters = explode('_', $target);
135  $id = (int) $targetParameters[0];
136 
137  if (!self::isAccessible($id)) {
138  $err->raiseError($lng->txt('msg_no_perm_read'), $err->FATAL);
139  }
140 
141  if (self::hasAccess(self::ACCESS_READ, $id)) {
142  $params = ['ref_id' => $id];
143 
144  if (isset($request->getQueryParams()['gotolp'])) {
145  $params['gotolp'] = 1;
146  }
147 
148  self::forwardByClass(
149  ilRepositoryGUI::class,
150  [ilObjLearningSequenceGUI::class],
151  $params
152  );
153  }
154 
155  if (self::hasAccess(self::ACCESS_VISIBLE, $id)) {
156  ilObjectGUI::_gotoRepositoryNode($id, 'infoScreen');
157  }
158 
159  if (self::hasAccess(self::ACCESS_READ, ROOT_FOLDER_ID)) {
160  $main_tpl->setOnScreenMessage('info', sprintf(
161  $lng->txt('msg_no_perm_read_item'),
163  ), true);
164 
165  self::forwardByClass(ilRepositoryGUI::class, [ilRepositoryGUI::class], ['ref_id' => ROOT_FOLDER_ID]);
166  }
167  }
168 
169  protected static function isAccessible(int $id): bool
170  {
171  return $id > 0 && (
172  self::hasAccess(self::ACCESS_READ, $id) ||
173  self::hasAccess(self::ACCESS_VISIBLE, $id) ||
174  self::hasAccess(self::ACCESS_READ, ROOT_FOLDER_ID)
175  );
176  }
177 
178  protected static function hasAccess(string $mode, int $id): bool
179  {
180  global $DIC;
181  return $DIC->access()->checkAccess($mode, '', $id);
182  }
183 
184  protected static function forwardByClass(string $base_class, array $classes, array $params, string $cmd = ''): void
185  {
186  global $DIC;
187  $ctrl = $DIC->ctrl();
188  $target_class = end($classes);
189 
190  $ctrl->setTargetScript('ilias.php');
191  foreach ($params as $key => $value) {
192  $ctrl->setParameterByClass($target_class, $key, $value);
193  }
194 
195  // insert the baseclass to the first position.
196  array_splice($classes, 0, 0, $base_class);
197  $ctrl->redirectByClass($classes, $cmd);
198  }
199 
200  public function __construct()
201  {
202  $this->obj_type = ilObjLearningSequence::OBJ_TYPE;
203 
204  global $DIC;
205  $this->ctrl = $DIC['ilCtrl'];
206  $this->lng = $DIC['lng'];
207  $this->user = $DIC['ilUser'];
208  $this->tabs = $DIC['ilTabs'];
209  $this->toolbar = $DIC['ilToolbar'];
210  $this->help = $DIC['ilHelp'];
211  $this->settings = $DIC['ilSetting'];
212  $this->access = $DIC['ilAccess'];
213  $this->rbac_review = $DIC['rbacreview'];
214  $this->ui_factory = $DIC['ui.factory'];
215  $this->ui_renderer = $DIC['ui.renderer'];
216  $this->request = $DIC->http()->request();
217 
218  $this->log = $DIC["ilLoggerFactory"]->getRootLogger();
219  $this->app_event_handler = $DIC['ilAppEventHandler'];
220  $this->navigation_history = $DIC['ilNavigationHistory'];
221  $this->obj_definition = $DIC['objDefinition'];
222  $this->tpl = $DIC["tpl"];
223  $this->obj_service = $DIC->object();
224  $this->toolbar = $DIC['ilToolbar'];
225  $this->request_wrapper = $DIC->http()->wrapper()->query();
226  $this->post_wrapper = $DIC->http()->wrapper()->post();
227  $this->refinery = $DIC->refinery();
228  $this->content_style = $DIC->contentStyle();
229 
230  $this->help->setScreenIdComponent($this->obj_type);
231  $this->lng->loadLanguageModule($this->obj_type);
232 
233  $this->data_factory = new Data\Factory();
234 
235  $this->ref_id = $this->request_wrapper->retrieve("ref_id", $this->refinery->kindlyTo()->int());
236  parent::__construct([], $this->ref_id, true, false);
237  }
238 
239  protected function recordLearningSequenceRead(): void
240  {
242  $this->object->getType(),
243  $this->object->getRefId(),
244  $this->object->getId(),
245  $this->user->getId()
246  );
247  }
248 
249  public function executeCommand(): void
250  {
251  $next_class = $this->ctrl->getNextClass($this);
252  $cmd = $this->ctrl->getCmd();
253  $tpl = $this->tpl;
254 
255  parent::prepareOutput();
256  $this->addToNavigationHistory();
257  //showRepTree is from containerGUI;
258  //LSO will attach allowed subitems to ok-list
259  //see: $this::getAdditionalOKTypes
260 
261  $in_player = (
262  $next_class === 'ilobjlearningsequencelearnergui'
263  && $cmd === 'view'
264  );
265 
266  $tpl->setPermanentLink("lso", $this->ref_id);
267 
268  switch ($next_class) {
269  case "ilcommonactiondispatchergui":
271  $this->ctrl->forwardCommand($gui);
272  break;
273  case "ilinfoscreengui":
274  $this->info($cmd);
275  break;
276  case "ilpermissiongui":
277  $this->permissions($cmd);
278  break;
279  case "ilobjlearningsequencesettingsgui":
281  $this->settings($cmd);
282  break;
283  case "ilobjlearningsequencecontentgui":
285  $this->manageContent($cmd);
286  break;
287  case "ilobjlearningsequencelearnergui":
288  $this->learnerView($cmd);
289  break;
290  case "illearningsequencemembershipgui":
291  $this->manage_members($cmd);
292  break;
293  case 'illearningprogressgui':
294  $this->learningProgress();
295  break;
296  case 'ilexportgui':
297  $this->export();
298  break;
299  case 'ilobjectcopygui':
300  $cp = new ilObjectCopyGUI($this);
301  $cp->setType('lso');
302  $this->ctrl->forwardCommand($cp);
303  break;
304  case 'ilobjindividualassessmentgui':
305  $struct = ['ilrepositorygui', 'ilobjindividualassessmentgui'];
306  if ($cmd === 'edit') {
307  $struct[] = 'ilindividualassessmentsettingsgui';
308  }
309  $this->ctrl->redirectByClass($struct, $cmd);
310  break;
311  case 'ilobjtestgui':
312  $struct = ['ilrepositorygui', 'ilobjtestgui'];
313  $this->ctrl->redirectByClass($struct, $cmd);
314  break;
315  case 'ilobjlearningsequencelppollinggui':
316  $gui = $this->object->getLocalDI()["gui.learner.lp"];
317  $this->ctrl->setCmd($cmd);
318  $this->ctrl->forwardCommand($gui);
319  break;
320 
321  case "ilobjlearningsequenceeditintrogui":
322  $which_page = LSOPageType::INTRO;
323  $which_tab = self::TAB_EDIT_INTRO;
324  $gui_class = 'ilObjLearningSequenceEditIntroGUI';
325  // no break
326  case "ilobjlearningsequenceeditextrogui":
328  if (!isset($which_page)) {
329  $which_page = LSOPageType::EXTRO;
330  $which_tab = self::TAB_EDIT_EXTRO;
331  $gui_class = 'ilObjLearningSequenceEditExtroGUI';
332  }
333 
334  $this->addContentStyleCss();
335  $this->addSubTabsForContent($which_tab);
336 
337  if (!$this->object->hasContentPage($which_page)) {
338  $this->object->createContentPage($which_page);
339  }
340 
341  $gui = new $gui_class(
342  $which_page->value,
343  $this->object->getContentPageId()
344  );
345  $this->ctrl->setCmd($cmd);
346  $out = $this->ctrl->forwardCommand($gui);
347 
348  //editor's guis will write to template, but not return
349  //e.g. see ilPCTabsGUI::insert
350  if (!is_null($out)) {
351  $tpl->setContent($out);
352  }
353  break;
354 
355  case false:
356  if ($cmd === '') {
357  if ($this->checkAccess("write")) {
358  $cmd = self::CMD_CONTENT;
359  } else {
360  $cmd = self::CMD_VIEW;
361  }
362  }
363 
364  switch ($cmd) {
365  case self::CMD_IMPORT:
366  $this->importFileObject();
367  break;
368  case self::CMD_INFO:
369  case self::CMD_INFO_SCREEN:
370  $this->info();
371  break;
372  case self::CMD_VIEW:
373  case self::CMD_LEARNER_VIEW:
374  case self::CMD_CONTENT:
375  case self::CMD_MEMBERS:
376  case self::CMD_SETTINGS:
377  case self::CMD_SAVE:
378  case self::CMD_CREATE:
379  case self::CMD_UNPARTICIPATE:
380  if (!$this->checkAccess("read")) {
381  $this->tpl->setOnScreenMessage('info', sprintf(
382  $this->lng->txt('msg_no_perm_read_item'),
383  $this->object->getTitle()
384  ), true);
385  break;
386  }
387  $this->$cmd();
388  break;
389  case self::CMD_CANCEL:
390  if ($this->getCreationMode()) {
391  $this->cancelCreation();
392  }
393  break;
394  case self::CMD_REMOVE_FROM_DESK:
395  $this->removeFromDeskObject();
396  $this->view();
397  break;
398  case self::CMD_ADD_TO_DESK:
399  $this->addToDeskObject();
400  $this->view();
401  break;
402  case self::CMD_CUT:
403  $this->cutObject();
404  break;
405  case self::CMD_CUT_SHOWTREE:
406  $this->showPasteTreeObject();
407  break;
408  case self::CMD_CUT_CLIPBOARD:
410  break;
411  case self::CMD_LINK:
412  $this->linkObject();
413  break;
414  case self::CMD_DELETE:
415  $this->deleteObject();
416  break;
417  case self::CMD_DELETE_CONFIRMED:
418  $this->confirmedDeleteObject();
419  break;
420  case self::CMD_PERFORM_PASTE:
422  break;
423  case self::CMD_SHOW_TRASH:
424  $this->trashObject();
425  break;
426  case self::CMD_UNDELETE:
427  $this->undeleteObject();
428  break;
429 
430  case self::CMD_CANCEL_CUT:
431  case self::CMD_CANCEL_DELETE:
432  case self::CMD_CANCEL_LINK:
433  $cmd = self::CMD_CONTENT;
434  $this->$cmd();
435  break;
436 
437  case self::CMD_REDRAW_HEADER:
438  $this->redrawHeaderActionObject();
439  break;
440 
441  // This is a temporary implementation (Mantis Ticket 36631)
442  case self::CMD_ENABLE_ADMINISTRATION_PANEL:
443  $tpl->setOnScreenMessage("failure", $this->lng->txt('lso_multidownload_not_available'), false);
444  $this->manageContent();
445  break;
446 
447  default:
448  throw new ilException("ilObjLearningSequenceGUI: Invalid command '$cmd'");
449  }
450  break;
451  default:
452  throw new ilException("ilObjLearningSequenceGUI: Can't forward to next class $next_class");
453  }
454 
455  if (!$in_player) {
456  $this->addHeaderAction();
457  }
458 
459  // This is the base class for the call, so we ought to print.
460  // TODO: This is super fishy and most probably hints on the fact, that
461  // something regarding that base class usage needs to change.
462  if (strtolower($this->request_wrapper->retrieve("baseClass", $this->refinery->kindlyTo()->string())) === strtolower(self::class)) {
463  $tpl->printToStdOut();
464  }
465  }
466 
467  public function addContentStyleCss(): void
468  {
469  $this->content_style->gui()->addCss(
470  $this->tpl,
471  $this->object->getRefId()
472  );
473  }
474 
475  public function addToNavigationHistory(): void
476  {
477  if (
478  !$this->getCreationMode() &&
479  $this->access->checkAccess('read', '', $this->ref_id)
480  ) {
481  $link = ilLink::_getLink($this->ref_id, $this->obj_type);
482  $this->navigation_history->addItem($this->ref_id, $link, $this->obj_type);
483  }
484  }
485 
486  protected function info(string $cmd = self::CMD_INFO): void
487  {
488  $this->tabs->setTabActive(self::TAB_INFO);
489  $this->ctrl->setCmdClass('ilinfoscreengui');
490  $this->ctrl->setCmd($cmd);
491  $info = new ilInfoScreenGUI($this);
492  $this->ctrl->forwardCommand($info);
493  }
494 
495  protected function permissions(string $cmd = self::CMD_PERMISSIONS): void
496  {
497  $this->tabs->setTabActive(self::TAB_PERMISSIONS);
498  $perm_gui = new ilPermissionGUI($this);
499  $this->ctrl->setCmd($cmd);
500  $this->ctrl->forwardCommand($perm_gui);
501  }
502 
503  protected function settings(string $cmd = self::CMD_SETTINGS): void
504  {
505  $this->tabs->activateTab(self::TAB_SETTINGS);
507  $this->getObject(),
508  $this->ctrl,
509  $this->lng,
510  $this->tpl,
511  $this->refinery,
512  $this->ui_factory,
513  $this->ui_renderer,
514  $this->request
515  );
516  $this->ctrl->setCmd($cmd);
517  $this->ctrl->forwardCommand($gui);
518  }
519 
520  protected function view(): void
521  {
523  $this->tabs->clearSubTabs();
524  if ($this->checkAccess("write")) {
525  $this->manageContent(self::CMD_CONTENT);
526  return;
527  } elseif ($this->checkAccess("read")) {
528  $this->learnerView(self::CMD_LEARNER_VIEW);
529  return;
530  } else {
531  $this->info(self::CMD_INFO);
532  }
533  }
534 
535  protected function manageContent(string $cmd = self::CMD_CONTENT): void
536  {
537  $this->tabs->activateTab(self::TAB_CONTENT_MAIN);
538  $this->addSubTabsForContent(self::TAB_MANAGE);
539 
541  $this,
542  $this->ctrl,
543  $this->tpl,
544  $this->lng,
545  $this->access,
546  new ilConfirmationGUI(),
547  new LSItemOnlineStatus(),
548  $this->post_wrapper,
549  $this->refinery,
550  $this->ui_factory,
551  $this->ui_renderer
552  );
553  $this->ctrl->setCmd($cmd);
554  $this->ctrl->forwardCommand($gui);
555  }
556 
557  protected function learnerView(string $cmd = self::CMD_LEARNER_VIEW): void
558  {
559  $this->addContentStyleCss();
560  $this->tabs->activateTab(self::TAB_CONTENT_MAIN);
561  $this->addSubTabsForContent(self::TAB_VIEW_CONTENT);
562 
563  $gui = $this->object->getLocalDI()["gui.learner"];
564 
565  $this->ctrl->setCmd($cmd);
566  $this->ctrl->forwardCommand($gui);
567  }
568 
569  protected function members(): void
570  {
571  $may_manage_members = $this->checkAccess("edit_members");
572  $this->ctrl->setCmdClass('ilLearningSequenceMembershipGUI');
573  if ($may_manage_members) {
574  $this->manage_members();
575  } else {
576  $this->manage_members(self::CMD_MEMBERS_GALLERY);
577  }
578  }
579 
580  protected function manage_members(string $cmd = self::CMD_MANAGE_MEMBERS): void
581  {
582  $this->tabs->setTabActive(self::TAB_MEMBERS);
583 
584  $ms_gui = new ilLearningSequenceMembershipGUI(
585  $this,
586  $this->getObject(),
587  $this->getTrackingObject(),
589  $this->rbac_review,
590  $this->settings,
591  $this->toolbar,
592  $this->request_wrapper,
593  $this->post_wrapper,
594  $this->refinery,
595  $this->ui_factory
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,
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());
660  $settings->setSortMode(ilContainer::SORT_MANUAL);
661  $settings->setSortDirection(ilContainer::SORT_DIRECTION_ASC);
663  $settings->setSortNewItemsPosition(ilContainer::SORT_NEW_ITEMS_POSITION_BOTTOM);
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 
755  public function renderObject(): void
756  {
757  $this->manageContent();
758  }
759 
760 
761  protected function addSubTabsForContent(string $active): void
762  {
763  $this->tabs->addSubTab(
764  self::TAB_VIEW_CONTENT,
765  $this->lng->txt(self::TAB_VIEW_CONTENT),
766  $this->getLinkTarget(self::CMD_LEARNER_VIEW)
767  );
768 
769  if ($this->checkAccess("write")) {
770  $this->tabs->addSubTab(
771  self::TAB_MANAGE,
772  $this->lng->txt(self::TAB_MANAGE),
773  $this->getLinkTarget(self::CMD_CONTENT)
774  );
775 
776  $this->tabs->addSubTab(
777  self::TAB_EDIT_INTRO,
778  $this->lng->txt("lso_settings_intro"),
779  $this->ctrl->getLinkTargetByClass(
780  strtolower('ilObjLearningSequenceEditIntroGUI'),
781  'preview'
782  )
783  );
784  $this->tabs->addSubTab(
785  self::TAB_EDIT_EXTRO,
786  $this->lng->txt("lso_settings_extro"),
787  $this->ctrl->getLinkTargetByClass(
788  strtolower('ilObjLearningSequenceEditExtroGUI'),
789  'preview'
790  )
791  );
792  }
793  $this->tabs->activateSubTab($active);
794  }
795 
796  protected function checkAccess(string $which): bool
797  {
798  return $this->access->checkAccess($which, "", $this->ref_id);
799  }
800 
801  protected function checkLPAccess(): bool
802  {
803  if (ilObject::_lookupType($this->ref_id, true) !== "lso") {
804  return false;
805  }
806 
807  $ref_id = $this->getObject()->getRefId();
808  $is_participant = ilLearningSequenceParticipants::_isParticipant($ref_id, $this->user->getId());
809 
810  return ilLearningProgressAccess::checkAccess($ref_id, $is_participant);
811  }
812 
813  protected function getLinkTarget(string $cmd): string
814  {
815  $class = $this->getClassForTabs($cmd);
816  $class_path = [
817  strtolower('ilObjLearningSequenceGUI'),
818  $class
819  ];
820  return $this->ctrl->getLinkTargetByClass($class_path, $cmd);
821  }
822 
823  protected function getClassForTabs(string $cmd): string
824  {
825  switch ($cmd) {
826  case self::CMD_CONTENT:
827  return 'ilObjLearningSequenceContentGUI';
828  case self::CMD_LEARNER_VIEW:
829  return 'ilObjLearningSequenceLearnerGUI';
830  case self::CMD_SETTINGS:
831  return 'ilObjLearningSequenceSettingsGUI';
832  case self::CMD_INFO:
833  return 'ilInfoScreenGUI';
834  case self::CMD_PERMISSIONS:
835  return 'ilPermissionGUI';
836  }
837 
838  throw new InvalidArgumentException('cannot resolve class for command: ' . $cmd);
839  }
840 
841  public function createMailSignature(): string
842  {
843  $link = chr(13) . chr(10) . chr(13) . chr(10);
844  $link .= $this->lng->txt('lso_mail_permanent_link');
845  $link .= chr(13) . chr(10) . chr(13) . chr(10);
846  $link .= ilLink::_getLink($this->object->getRefId());
847 
848  return rawurlencode(base64_encode($link));
849  }
850 
851  protected function getTrackingObject(): ilObjUserTracking
852  {
853  return new ilObjUserTracking();
854  }
855 
859  public function getLocalRoles(): array
860  {
861  $local_roles = $this->object->getLocalLearningSequenceRoles();
862  $lso_member = $this->object->getDefaultMemberRole();
863  $lso_roles = array();
864 
865  if (in_array($lso_member, $local_roles)) {
866  $lso_roles[$lso_member] = ilObjRole::_getTranslation(array_search($lso_member, $local_roles));
867  unset($local_roles[$lso_roles[$lso_member]]);
868  }
869 
870  foreach ($local_roles as $title => $role_id) {
871  $lso_roles[$role_id] = ilObjRole::_getTranslation($title);
872  }
873 
874  return $lso_roles;
875  }
876 
881  protected function getAdditionalOKTypes(): array
882  {
883  return array_filter(
884  array_keys($this->obj_definition->getSubObjects('lso', false)),
885  fn($type) => $type !== 'rolf'
886  );
887  }
888 
892  public function addCustomData(array $a_data): array
893  {
894  $res_data = array();
895  foreach ($a_data as $usr_id => $user_data) {
896  $res_data[$usr_id] = $user_data;
897  $udf_data = new ilUserDefinedData($usr_id);
898 
899  foreach ($udf_data->getAll() as $field => $value) {
900  list(, $field_id) = explode('_', $field);
901  $res_data[$usr_id]['udf_' . $field_id] = (string) $value;
902  }
903  }
904 
905  return $res_data;
906  }
907 
908  public function showPossibleSubObjects(): void
909  {
910  $gui = new ilObjectAddNewItemGUI($this->object->getRefId());
911  $gui->render();
912  }
913 
914  protected function enableDragDropFileUpload(): void
915  {
916  }
917 
918  private function denyAccessIfNotWritePermission(): void
919  {
920  if (!$this->checkAccess("write")) {
921  $this->tpl->setOnScreenMessage('info', sprintf(
922  $this->lng->txt('msg_no_perm_read_item'),
923  $this->object->getTitle()
924  ), true);
925  $this->ctrl->redirect($this, self::CMD_VIEW);
926  }
927  }
928 }
redrawHeaderActionObject()
Ajax call: redraw action header only.
renderObject()
Redirects to Manage Content to make deletion screen work.
static hasAccess(string $mode, int $id)
Class ilInfoScreenGUI.
redirectByClass( $a_class, string $a_cmd=null, string $a_anchor=null, bool $is_async=false)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
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...
cancelCreation()
cancel create action and go back to repository parent
Psr Http Message ServerRequestInterface $request
GUI class for the workflow of copying objects.
const ROOT_FOLDER_ID
Definition: constants.php:32
setOnScreenMessage(string $type, string $a_txt, bool $a_keep=false)
Set a message to be displayed to the user.
if(! $DIC->user() ->getId()||!ilLTIConsumerAccess::hasCustomProviderCreationAccess()) $params
Definition: ltiregstart.php:33
Help GUI class.
trashObject()
Show trash content of object.
static _gotoRepositoryNode(int $ref_id, string $cmd="")
setParameterByClass(string $a_class, string $a_parameter, $a_value)
confirmedDeleteObject()
confirmed deletion of object -> objects are moved to trash or deleted immediately, if trash is disabled
deleteObject(bool $error=false)
Display deletion confirmation screen.
static checkAccess(int $a_ref_id, bool $a_allow_only_read=true)
check access to learning progress
static _lookupObjId(int $ref_id)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
importFileObject(int $parent_id=null)
static _isParticipant(int $a_ref_id, int $a_usr_id)
Interface ilCtrlBaseClassInterface describes ilCtrl base classes.
global $DIC
Definition: feed.php:28
Export User Interface Class.
ilLanguage $lng
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
const SORT_NEW_ITEMS_POSITION_BOTTOM
__construct(VocabulariesInterface $vocabularies)
ilGlobalTemplateInterface $tpl
static _lookupTitle(int $obj_id)
setContent(string $a_html)
Sets content for standard template.
initDidacticTemplate(ilPropertyFormGUI $form)
undeleteObject()
Get objects back from trash.
linkObject()
create an new reference of an object in tree it&#39;s like a hard link of unix
manage_members(string $cmd=self::CMD_MANAGE_MEMBERS)
ILIAS HTTP Wrapper RequestWrapper $request_wrapper
const SORT_NEW_ITEMS_ORDER_CREATION
manageContent(string $cmd=self::CMD_CONTENT)
static _getTranslation(string $a_role_title)
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)
settings(string $cmd=self::CMD_SETTINGS)
$out
Definition: buildRTE.php:24
static forwardByClass(string $base_class, array $classes, array $params, string $cmd='')
string $key
Consumer key/client ID value.
Definition: System.php:193
learnerView(string $cmd=self::CMD_LEARNER_VIEW)
Last visited history for repository items.
ilPropertyFormGUI $form
static redirect(string $a_script)
ILIAS Style Content Service $content_style
setPermanentLink(string $a_type, ?int $a_id, string $a_append="", string $a_target="", string $a_title="")
Generates and sets a permanent ilias link.
setTargetScript(string $a_target_script)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
getReturnLocation(string $cmd, string $default_location="")
Get return location for command (command is method name without "Object", e.g.
cutObject()
cut object(s) out from a container and write the information to clipboard public ...
ilAppEventHandler $app_event_handler
ILIAS Container InternalGUIService $gui
Class ilContainerGUI This is a base GUI class for all container objects in ILIAS: root folder...
New PermissionGUI (extends from old ilPermission2GUI) RBAC related output.
Class ilObjLearningSequenceGUI ilObjLearningSequenceGUI: ilRepositoryGUI ilObjLearningSequenceGUI: ...
getAdditionalOKTypes()
append additional types to ilRepositoryExplorerGUI&#39;s positive list
permissions(string $cmd=self::CMD_PERMISSIONS)
const SORT_DIRECTION_ASC
static _lookupType(int $id, bool $reference=false)
addHeaderAction()
Add header action menu.
ilSetting $settings
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.
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...