ILIAS  trunk Revision v11.0_alpha-2638-g80c1d007f79
class.ilObjStudyProgrammeGUI.php
Go to the documentation of this file.
1 <?php
2 
19 declare(strict_types=1);
20 
22 use ILIAS\Refinery;
25 
49 {
50  private const TAB_VIEW_CONTENT = "view_content";
51  private const SUBTAB_VIEW_MANAGE = "manage";
52  private const TAB_INFO = "info_short";
53  private const TAB_SETTINGS = "settings";
54  private const TAB_MEMBERS = "members";
55  private const TAB_METADATA = "edit_advanced_settings";
56  private const SUBTAB_PAGE_EDIT = "page";
57  private const ASYNC_CALLS = [
61  ];
62 
65  protected ilHelpGUI $help;
73  protected Refinery\Factory $refinery;
76 
80  public ?ilObject $object;
81 
84 
85  public function __construct()
86  {
87  global $DIC;
88  $this->tpl = $DIC['tpl'];
89  $this->ctrl = $DIC['ilCtrl'];
90  $this->ilLocator = $DIC['ilLocator'];
91  $this->tree = $DIC['tree'];
92  $this->toolbar = $DIC['ilToolbar'];
93  $this->ilLog = $DIC['ilLog'];
94  $this->ilias = $DIC['ilias'];
95  $this->type = "prg";
96  $this->help = $DIC['ilHelp'];
97  $this->user = $DIC['ilUser'];
98  $this->refinery = $DIC->refinery();
99  $this->request_wrapper = $DIC->http()->wrapper()->query();
100 
101  $ref_id = $this->request_wrapper->retrieve("ref_id", $this->refinery->kindlyTo()->int());
102  parent::__construct([], $ref_id, true, false);
103 
104  $lng = $DIC['lng'];
105  $lng->loadLanguageModule("prg");
106 
108  $this->settings_gui = $dic['ilObjStudyProgrammeSettingsGUI'];
109  $this->members_gui = $dic['ilObjStudyProgrammeMembersGUI'];
110  $this->memberships_gui = $dic['ilObjStudyProgrammeAutoMembershipsGUI'];
111  $this->type_gui = $dic['ilStudyProgrammeTypeGUI'];
112  $this->autocategories_gui = $dic['ilObjStudyProgrammeAutoCategoriesGUI'];
113  $this->type_repository = $dic['model.Type.ilStudyProgrammeTypeRepository'];
114  $this->ui_factory = $dic['ui.factory'];
115 
116  $this->internal_domain_service = $DIC->container()->internal()->domain()->content();
117  $this->container_view_manager = $this->internal_domain_service->view($this->object);
118  }
119 
120  public function executeCommand(): void
121  {
122  $cmd = $this->ctrl->getCmd(self::SUBTAB_VIEW_MANAGE);
123  $next_class = $this->ctrl->getNextClass($this);
124 
125  if (!in_array($cmd, self::ASYNC_CALLS)) {
126  $this->addToNavigationHistory();
127  parent::prepareOutput();
128  $this->addHeaderAction();
129  }
130 
131  switch ($next_class) {
132  case "ilinfoscreengui":
133  $this->tabs_gui->activateTab(self::TAB_INFO);
134  $this->denyAccessIfNotAnyOf([
137  ]);
138  $info = new ilInfoScreenGUI($this);
139  $this->fillInfoScreen($info);
140  $this->ctrl->forwardCommand($info);
141 
142  // I guess this is how it was supposed to work,
143  // but it doesn't... it won't respect our sub-id and sub-type when creating the objects!
144  // So we reimplemented the stuff in the method parseInfoScreen()
145  // $info = new ilInfoScreenGUI($this);
146  // $amd_gui = new ilAdvancedMDRecordGUI(
147  // ilAdvancedMDRecordGUI::MODE_INFO,
148  // 'orgu',
149  // $this->object->getId(),
150  // 'orgu_type',
151  // $this->object->getOrgUnitTypeId()
152  // );
153  // $amd_gui->setInfoObject($info);
154  // $amd_gui->setSelectedOnly(true);
155  // $amd_gui->parse();
156  // $this->ctrl->forwardCommand($info);
157  break;
158  case 'ilpermissiongui':
159  $this->tabs_gui->activateTab('perm_settings');
160  $ilPermissionGUI = new ilPermissionGUI($this);
161  $this->ctrl->forwardCommand($ilPermissionGUI);
162  break;
163  case "ilcommonactiondispatchergui":
165  $this->ctrl->forwardCommand($gui);
166  break;
167  case "ilobjstudyprogrammesettingsgui":
169  $this->getSubTabs('settings');
170  $this->tabs_gui->activateTab(self::TAB_SETTINGS);
171  $this->tabs_gui->activateSubTab('settings');
172  $this->settings_gui->setRefId($this->ref_id);
173  $this->ctrl->forwardCommand($this->settings_gui);
174  break;
175  case "ilobjstudyprogrammeautocategoriesgui":
177  $this->getSubTabs('settings');
178  $this->tabs_gui->activateTab(self::TAB_SETTINGS);
179  $this->tabs_gui->activateSubTab('auto_content');
180  $this->autocategories_gui->setRefId($this->ref_id);
181  $this->initTreeJS();
182  $this->ctrl->forwardCommand($this->autocategories_gui);
183  break;
184  case "ilobjstudyprogrammemembersgui":
186  $this->getSubTabs('members');
187  $this->tabs_gui->activateTab(self::TAB_MEMBERS);
188  $this->tabs_gui->activateSubTab('edit_participants');
189  $this->members_gui->setParentGUI($this);
190  $this->members_gui->setRefId($this->ref_id);
191  $this->ctrl->forwardCommand($this->members_gui);
192  break;
193  case 'ilprgmembersexportgui':
195  $this->getSubTabs('members');
196  $this->tabs_gui->activateTab(self::TAB_MEMBERS);
197  $this->tabs_gui->activateSubTab('export_memberships');
198 
199  $specific_dic = ilStudyProgrammeDIC::specificDicFor($this->object);
200  $export_gui = new ilPRGMembersExportGUI(
201  $this->ref_id,
202  $specific_dic['ilStudyProgrammeUserTable'],
203  $specific_dic['DataFactory']
204  );
205  $this->ctrl->forwardCommand($export_gui);
206  break;
207  case "ilobjstudyprogrammeautomembershipsgui":
209  $this->getSubTabs('members');
210  $this->tabs_gui->activateTab(self::TAB_MEMBERS);
211  $this->tabs_gui->activateSubTab('auto_memberships');
212  $this->memberships_gui->setParentGUI($this);
213  $this->memberships_gui->setRefId($this->ref_id);
214  $this->ctrl->forwardCommand($this->memberships_gui);
215  break;
216  case 'ilstudyprogrammetypegui':
217  $this->tabs_gui->activateTab('subtypes');
218  $this->type_gui->setParentGUI($this);
219  $this->ctrl->forwardCommand($this->type_gui);
220  break;
221  case 'ilobjectcopygui':
222  $gui = new ilobjectcopygui($this);
223  $this->ctrl->forwardCommand($gui);
224  break;
225  case strtolower(TranslationGUI::class):
227  $this->getSubTabs('settings');
228  $this->tabs_gui->activateTab(self::TAB_SETTINGS);
229  $this->tabs_gui->activateSubTab('settings_trans');
230  $transgui = new TranslationGUI(
231  $this->getObject(),
232  $this->lng,
233  $this->access,
234  $this->user,
235  $this->ctrl,
236  $this->tpl,
237  $this->ui_factory,
238  $this->ui_renderer,
239  $this->http,
240  $this->refinery,
241  $this->toolbar
242  );
243  $this->ctrl->forwardCommand($transgui);
244  break;
245  case "ilcertificategui":
246  $this->getSubTabs('settings');
248  $this->tabs_gui->activateTab(self::TAB_SETTINGS);
249  $this->tabs_gui->activateSubTab('certificate');
250  $guiFactory = new ilCertificateGUIFactory();
251  $output_gui = $guiFactory->create($this->object);
252  $this->ctrl->forwardCommand($output_gui);
253  break;
254  case "ilprgpageobjectgui":
256  if (!$this->object->hasContentPage()) {
257  $this->object->createContentPage();
258  }
259  $gui = new ilPRGPageObjectGUI($this->object->getId());
260  $gui->setItemPresentationManager(
261  $this->internal_domain_service
262  ->itemPresentation(
263  $this->object,
264  null,
265  false
266  )
267  );
268  $this->content_style_gui->addCss($this->tpl, $this->object->getRefId());
269  $out = $this->ctrl->forwardCommand($gui);
270  if (!is_null($out)) {
271  $this->tpl->setContent($out);
272  }
273  break;
274  case "ilobjstylesheetgui":
275  $this->forwardToStyleSheet();
276  break;
277  case "ilobjectcontentstylesettingsgui":
278  $this->tabs_gui->activateTab(self::TAB_VIEW_CONTENT);
279  $settings_gui = $this->content_style_gui
280  ->objectSettingsGUIForRefId(null, $this->object->getRefId());
281  $this->ctrl->forwardCommand($settings_gui);
282  break;
283  case strtolower(ilPropertyFormGUI::class):
284  /*
285  * Only used for async loading of the repository tree in custom md
286  * internal links (see #28060, #37974). This is necessary since StudyProgrammes don't
287  * use ilObjectMetaDataGUI.
288  */
289  $form = $this->initAdvancedSettingsForm();
292  'prg',
293  $this->object->getId(),
294  'prg_type',
295  $this->object->getSettings()->getTypeSettings()->getTypeId()
296  );
297  $gui->setPropertyForm($form);
298  $gui->parse();
299  $this->ctrl->forwardCommand($form);
300  break;
301  case false:
302  $this->getSubTabs($cmd);
303  switch ($cmd) {
304  case "cancelDelete":
305  case "cancel":
306  $cmd = "view";
307  // no break
308  case "create":
309  case "save":
310  case "edit":
311  $this->$cmd();
312  break;
313  case "view":
314  $this->getModeManager()->setContentMode();
315  $this->view();
316  break;
317  case self::SUBTAB_VIEW_MANAGE: //manage
318  $this->getModeManager()->setAdminMode();
319  $this->view();
320  break;
321  case "delete":
322  parent::deleteObject();
323  break;
324  case 'confirmedDelete':
325  parent::confirmedDeleteObject();
326  break;
327  case 'editAdvancedSettings':
328  $this->tabs_gui->activateTab('edit_advanced_settings');
329  $this->editAdvancedSettings();
330  break;
331  case 'updateAdvancedSettings':
332  $this->tabs_gui->activateTab('edit_advanced_settings');
333  $this->updateAdvancedSettings();
334  break;
335  case "infoScreen":
336  $this->ctrl->redirectByClass("ilInfoScreenGUI", "showSummary");
337  break;
338  case 'editPageFrame':
339  $this->ctrl->redirectToURL($this->getLinkTarget('edit_page'));
340  break;
341  case 'editStyleProperties':
342  $this->editStylePropertiesObject();
343  break;
344 
345  case 'render':
346  case 'disableAdministrationPanel':
347  case 'enableAdministrationPanel':
348  case 'saveSorting':
349  case 'editOrder':
350  case 'trash':
351  case 'undelete':
352  case 'confirmRemoveFromSystem':
353  case 'removeFromSystem':
354  case 'deliverCertificate':
355  case 'addToDesk':
356  case 'removeFromDesk':
357  case 'paste':
358  case 'clear':
359  case 'performPasteIntoMultipleObjects':
360  case 'cancelMoveLink':
361  case 'keepObjectsInClipboard':
362  case 'link':
363  case 'copy':
364  $this->getSubTabs(self::TAB_VIEW_CONTENT);
365  $cmd .= "Object";
366  $this->$cmd();
367  break;
368 
369  case 'editAvailabilityPeriod':
370  case 'saveAvailabilityPeriod':
371  $this->tpl->setOnScreenMessage('failure', $this->lng->txt('prg_availability_action_not_allowed'));
372  $this->view();
373  break;
374  case 'cut':
375  $this->tpl->setOnScreenMessage('failure', $this->lng->txt('prg_cut_action_not_allowed'));
376  $this->view();
377  break;
378  case 'routeImportCmd':
379  $this->tpl->setOnScreenMessage('failure', $this->lng->txt('prg_import_action_not_allowed'));
380  $this->view();
381  break;
382 
383  default:
384  throw new ilException("ilObjStudyProgrammeGUI: Command not supported: $cmd");
385  }
386  break;
387  default:
388  throw new ilException("ilObjStudyProgrammeGUI: Can't forward to next class $next_class");
389  }
390  }
391 
392  protected function create(): void
393  {
394  parent::createObject();
395  }
396 
397  protected function save(): void
398  {
399  parent::saveObject();
400  }
401 
405  protected function afterSave(ilObject $new_object): void
406  {
407  // set default sort to manual
408  $settings = new ilContainerSortingSettings($new_object->getId());
409  $settings->setSortMode(ilContainer::SORT_MANUAL);
410  $settings->setSortDirection(ilContainer::SORT_DIRECTION_ASC);
412  $settings->setSortNewItemsPosition(ilContainer::SORT_NEW_ITEMS_POSITION_BOTTOM);
413  $settings->save();
414 
415  $this->tpl->setOnScreenMessage("success", $this->lng->txt("object_added"), true);
416 
417  $this->ctrl->setParameter($this, "ref_id", $new_object->getRefId());
418  $this->ctrl->redirectToURL($this->getReturnLocation(
419  "save",
420  $this->ctrl->getLinkTarget($this, "edit", "", false, false)
421  ));
422  }
423 
425  {
426  if (!$this->permissions) {
427  if (!$this->object || !$this->object->getRefId()) {
428  throw new LogicException('Cannot ask for permission when not in tree!');
429  }
430 
431  $this->permissions = ilStudyProgrammeDIC::specificDicFor($this->object)['permissionhelper'];
432  }
433  return $this->permissions;
434  }
435 
436  protected function view(): void
437  {
439  $this->tabs_gui->activateTab(self::TAB_VIEW_CONTENT);
440  parent::renderObject();
441  }
442 
444  {
445  $form = new ilPropertyFormGUI();
446  $form->setFormAction($this->ctrl->getFormAction($this));
447  $form->addCommandButton('updateAdvancedSettings', $this->lng->txt('save'));
448  $form->addCommandButton('editAdvancedSettings', $this->lng->txt('cancel'));
449 
450  return $form;
451  }
452 
453  protected function editAdvancedSettings(): void
454  {
456  $this->tpl->setOnScreenMessage("failure", $this->lng->txt("permission_denied"), true);
457  $this->ctrl->redirect($this);
458  }
459  $form = $this->initAdvancedSettingsForm();
462  'prg',
463  $this->object->getId(),
464  'prg_type',
465  $this->object->getSettings()->getTypeSettings()->getTypeId()
466  );
467  $gui->setPropertyForm($form);
468  $gui->parse();
469  $this->tpl->setContent($form->getHTML());
470  }
471 
472  protected function updateAdvancedSettings(): void
473  {
475  $this->tpl->setOnScreenMessage("failure", $this->lng->txt("permission_denied"), true);
476  $this->ctrl->redirect($this);
477  }
478  $form = $this->initAdvancedSettingsForm();
481  'prg',
482  $this->object->getId(),
483  'prg_type',
484  $this->object->getSettings()->getTypeSettings()->getTypeId()
485  );
486  $gui->setPropertyForm($form);
487  $gui->parse();
488  $form->checkInput();
489 
490  if ($gui->importEditFormPostValues()) {
491  $gui->writeEditForm();
492  $this->tpl->setOnScreenMessage("success", $this->lng->txt('settings_saved'), true);
493  $this->ctrl->redirect($this, 'editAdvancedSettings');
494  } else {
495  $this->tpl->setContent($form->getHTML());
496  }
497  }
498 
503  public function getAsyncCreationForm(): ilAsyncPropertyFormGUI
504  {
505  $asyncForm = new ilAsyncPropertyFormGUI($this->request_wrapper);
506 
507  $asyncForm->cloneForm(
508  $this->initCreateForm('prg')
509  );
510  $asyncForm->setAsync(true);
511 
512  return $asyncForm;
513  }
514 
516  // HELPERS
518 
519  protected function checkAccess(string $permission): bool
520  {
521  return $this->getPermissionsHelper()->may($permission);
522  }
523 
524  protected function denyAccessIfNot(string $permission): void
525  {
526  $this->denyAccessIfNotAnyOf([$permission]);
527  }
528 
529  protected function denyAccessIfNotAnyOf(array $permissions): void
530  {
531  if (!$this->getPermissionsHelper()->mayAnyOf($permissions)) {
533  $this->tpl->setOnScreenMessage('failure', $this->lng->txt("msg_no_perm_write"));
534  $this->ctrl->redirectByClass('ilinfoscreengui', '');
535  } else {
536  $this->ilias->raiseError($this->lng->txt("msg_no_perm_read"), $this->ilias->error_obj->WARNING);
537  }
538  }
539  }
540 
541  protected function getTabs(): void
542  {
543  $this->help->setScreenIdComponent("prg");
545  $this->tabs_gui->addTab(self::TAB_VIEW_CONTENT, $this->lng->txt("content"), $this->getLinkTarget("view"));
546  }
547 
549  $this->tabs_gui->addTab(
550  self::TAB_INFO,
551  $this->lng->txt("info_short"),
552  $this->getLinkTarget("info_short")
553  );
554  }
555 
557  $this->tabs_gui->addTab(
558  self::TAB_SETTINGS,
559  $this->lng->txt("settings"),
560  $this->getLinkTarget("settings")
561  );
562  }
563 
565  $this->tabs_gui->addTab(
566  self::TAB_MEMBERS,
567  $this->lng->txt("assignments"),
568  $this->getLinkTarget("members")
569  );
570  }
571 
572  if ($this->object->hasAdvancedMetadata()
574  ) {
575  $this->tabs_gui->addTab(
576  self::TAB_METADATA,
577  $this->lng->txt('meta_data'),
578  $this->ctrl->getLinkTarget($this, 'editAdvancedSettings')
579  );
580  }
581 
582  parent::getTabs();
583  }
584 
589  public function getSubTabs(string $parent_tab): void
590  {
591  switch ($parent_tab) {
592  case self::TAB_VIEW_CONTENT:
593  case self::SUBTAB_VIEW_MANAGE:
594  case 'view':
595  case 'delete':
596  $this->addStandardContainerSubTabs(true);
597  break;
598 
599  case 'settings':
600  $this->tabs_gui->addSubTab(
601  'settings',
602  $this->lng->txt('general'),
603  $this->getLinkTarget('settings')
604  );
605 
606  if ($this->object->isAutoContentApplicable()) {
607  $this->tabs_gui->addSubTab(
608  "auto_content",
609  $this->lng->txt("content_automation"),
610  $this->getLinkTarget("auto_content")
611  );
612  }
613 
614  $this->tabs_gui->addSubTab(
615  "settings_trans",
616  $this->lng->txt("obj_multilinguality"),
617  $this->ctrl->getLinkTargetByClass(TranslationGUI::class, "")
618  );
619 
620  $validator = new ilCertificateActiveValidator();
621  if (true === $validator->validate()) {
622  $this->tabs_gui->addSubTabTarget(
623  "certificate",
624  $this->ctrl->getLinkTargetByClass("ilcertificategui", "certificateeditor"),
625  "",
626  "ilcertificategui"
627  );
628  }
629 
630  if ($this->permissions->isOrguAccessEnabledGlobally()) {
631  $this->tabs_gui->addSubTab(
632  'commonSettings',
633  $this->lng->txt("obj_features"),
634  $this->getLinkTarget("commonSettings")
635  );
636  }
637 
638  break;
639 
640  case 'members':
641  $this->tabs_gui->addSubTab(
642  'edit_participants',
643  $this->lng->txt('edit_participants'),
644  $this->getLinkTarget('members')
645  );
646 
648  $this->tabs_gui->addSubTab(
649  'auto_memberships',
650  $this->lng->txt('auto_memberships'),
651  $this->getLinkTarget('memberships')
652  );
653  }
654 
656  $this->tabs_gui->addSubTab(
657  'export_memberships',
658  $this->lng->txt('export_memberships'),
659  $this->getLinkTarget('export_memberships')
660  );
661  }
662  break;
663  }
664  }
665 
669  public function setContentSubTabs(): void
670  {
671  }
672 
676  protected function getLinkTarget(string $cmd): string
677  {
678  if ($cmd === "info_short") {
679  return $this->ctrl->getLinkTargetByClass("ilinfoscreengui", "showSummary");
680  }
681  if ($cmd === "settings") {
682  return $this->ctrl->getLinkTargetByClass("ilobjstudyprogrammesettingsgui", "view");
683  }
684  if ($cmd === "auto_content") {
685  return $this->ctrl->getLinkTargetByClass("ilObjStudyProgrammeAutoCategoriesGUI", "view");
686  }
687  if ($cmd === self::SUBTAB_VIEW_MANAGE) {
688  return $this->ctrl->getLinkTarget($this, self::SUBTAB_VIEW_MANAGE);
689  }
690 
691  if ($cmd === "members") {
692  return $this->ctrl->getLinkTargetByClass("ilobjstudyprogrammemembersgui", "view");
693  }
694  if ($cmd === "memberships") {
695  return $this->ctrl->getLinkTargetByClass("ilobjstudyprogrammeautomembershipsgui", "view");
696  }
697  if ($cmd == "export_memberships") {
698  return $this->ctrl->getLinkTargetByClass('ilprgmembersexportgui', 'show');
699  }
700  if ($cmd === "subtypes") {
701  return $this->ctrl->getLinkTargetByClass("ilstudyprogrammetypegui", "listTypes");
702  }
703  if ($cmd === "commonSettings") {
704  return $this->ctrl->getLinkTargetByClass(
705  [
706  "ilobjstudyprogrammesettingsgui",
707  "ilStudyProgrammeCommonSettingsGUI"
708  ],
709  "editSettings"
710  );
711  }
712  if ($cmd == "edit_page") {
713  return $this->ctrl->getLinkTargetByClass(
714  ["ilObjStudyProgrammeGUI", "ilPRGPageObjectGUI"],
715  'edit'
716  );
717  }
718 
719  return $this->ctrl->getLinkTarget($this, $cmd);
720  }
721 
725  protected function fillInfoScreen($info_screen): void
726  {
727  if (!$this->object->getSettings()->getTypeSettings()->getTypeId() ||
728  !ilStudyProgrammeDIC::dic()['model.Type.ilStudyProgrammeTypeRepository']
729  ->getType($this->object->getSettings()->getTypeSettings()->getTypeId())
730  ) {
731  return;
732  }
733 
734  $record_gui = new ilAdvancedMDRecordGUI(
736  'prg',
737  $this->object->getId(),
738  'prg_type',
739  $this->object->getSettings()->getTypeSettings()->getTypeId()
740  );
741  $record_gui->setInfoObject($info_screen);
742  $record_gui->parse();
743  }
744 
745  protected function edit(): void
746  {
748  $link = $this->ctrl->getLinkTargetByClass(ilObjStudyProgrammeSettingsGUI::class, 'view');
749  $this->ctrl->redirectToURL($link);
750  }
751 
752  public static function _goto(string $target): void
753  {
754  global $DIC;
755  $ilCtrl = $DIC['ilCtrl'];
756  $ilCtrl->setTargetScript('ilias.php');
757  $ilCtrl->setParameterByClass("ilobjstudyprogrammegui", "ref_id", $target);
758  $ilCtrl->redirectByClass(array("ilRepositoryGUI", "ilobjstudyprogrammegui"), "view");
759  }
760 
761  public function addToNavigationHistory(): void
762  {
763  global $DIC;
764  $ilNavigationHistory = $DIC['ilNavigationHistory'];
765 
767  $ref_id = $this->request_wrapper->retrieve("ref_id", $this->refinery->kindlyTo()->int());
768  $link = ilLink::_getLink($ref_id, "prg");
769  $ilNavigationHistory->addItem($ref_id, $link, 'prg');
770  }
771  }
772 
773  protected function initHeaderAction(?string $sub_type = null, ?int $sub_id = null): ?ilObjectListGUI
774  {
775  $lg = parent::initHeaderAction($sub_type, $sub_id);
776  $validator = new ilCertificateDownloadValidator();
777  if ($lg && true === $validator->isCertificateDownloadable($this->user->getId(), $this->object->getId())) {
778  $cert_url = $this->ctrl->getLinkTarget($this, "deliverCertificate");
779  $this->lng->loadLanguageModule("certificate");
780  $lg->addCustomCommand($cert_url, "download_certificate");
781  $lg->addHeaderIcon(
782  "cert_icon",
783  ilUtil::getImagePath("standard/icon_cert.svg"),
784  $this->lng->txt("download_certificate"),
785  null,
786  null,
787  $cert_url
788  );
789  }
790  return $lg;
791  }
792 
793  protected function deliverCertificateObject(): void
794  {
795  $this->lng->loadLanguageModule('cert');
796 
797  $user_id = (int) $this->user->getId();
798  $obj_id = $this->object->getId();
799 
800  $validator = new ilCertificateDownloadValidator();
801  if (false === $validator->isCertificateDownloadable($user_id, $obj_id)) {
802  $this->tpl->setOnScreenMessage('failure', $this->lng->txt("permission_denied"), true);
803  $this->ctrl->redirect($this);
804  }
805  $repository = new ilUserCertificateRepository();
806  $pdf_action = new ilCertificatePdfAction(
807  new ilPdfGenerator($repository),
809  $this->lng->txt('error_creating_certificate_pdf')
810  );
811  $pdf_action->downloadPdf($user_id, $obj_id);
812  }
813 
814  protected function initTreeJS(): void
815  {
817  }
818 
819  protected function supportsPageEditor(): bool
820  {
821  return true;
822  }
823 }
ilObjStudyProgrammeMembersGUI $members_gui
ilStudyProgrammeTypeGUI $type_gui
Class ilObjStudyProgrammeGUI class ilObjStudyProgrammeGUI: ilPermissionGUI ilObjStudyProgrammeGUI: ...
PageObjectGUI for StudyProgrammes.
ilObjStudyProgrammeAutoMembershipsGUI $memberships_gui
afterSave(ilObject $new_object)
Sets the sorting of the container correctly.
ilStudyProgrammeTypeRepository $type_repository
Help GUI class.
ILIAS Container Content DomainService $internal_domain_service
getSubTabs(string $parent_tab)
Adds subtabs based on the parent tab.
Component logger with individual log levels by component id.
fillInfoScreen($info_screen)
Adding meta-data to the info-screen.
loadLanguageModule(string $a_module)
Load language module.
ilObjStudyProgrammeSettingsGUI $settings_gui
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Definition: class.ilLog.php:30
Covers the persistence of sp-type related information.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
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
static http()
Fetches the global http state from ILIAS.
initHeaderAction(?string $sub_type=null, ?int $sub_id=null)
setFormAction(string $a_formaction)
addStandardContainerSubTabs(bool $a_include_view=true)
Add standard container subtabs for view, manage, oderdering and text/media editor link...
getAsyncCreationForm()
Method for implementing async windows-output Should be moved into core to enable async requests on cr...
const SORT_NEW_ITEMS_ORDER_CREATION
Validates if an active certificate is stored in the database and can be downloaded by the user...
$out
Definition: buildRTE.php:24
global $DIC
Definition: shib_login.php:26
static getImagePath(string $image_name, string $module_path="", string $mode="output", bool $offline=false)
get image path (for images located in a template directory)
Class ilObjForumAdministration.
static specificDicFor(ilObjStudyProgramme $prg)
ilObjStudyProgrammeMembersGUI: ilStudyProgrammeRepositorySearchGUI ilObjStudyProgrammeMembersGUI: il...
addCommandButton(string $a_cmd, string $a_text, string $a_id="")
ilPropertyFormGUI $form
Both role and OrgU-based permissions are relevant in many places of the PRG.
getLinkTarget(string $cmd)
Generates a link based on a cmd.
setContentSubTabs()
Disable default content subtabs.
ilPRGPermissionsHelper $permissions
ilObjStudyProgrammeAutoCategoriesGUI $autocategories_gui
__construct(Container $dic, ilPlugin $plugin)
getReturnLocation(string $cmd, string $default_location="")
Get return location for command (command is method name without "Object", e.g.
initCreateForm(string $new_type)
setInfoObject(ilInfoScreenGUI $info)
get info sections
ILIAS Container InternalGUIService $gui
$dic
Definition: result.php:31
$info
Definition: entry_point.php:21
const SORT_DIRECTION_ASC
export assignments of PRG
addHeaderAction()
Add header action menu.
ilSetting $settings
static init(?ilGlobalTemplateInterface $a_main_tpl=null)
static getInstanceFromAjaxCall()
(Re-)Build instance from ajax call
ilObjStudyProgrammeSettingsGUI: ilStudyProgrammeCommonSettingsGUI
downloadPdf(int $userId, int $objectId)