ILIAS  release_9 Revision v9.13-25-g2c18ec4c24f
class.ilObjStudyProgrammeGUI.php
Go to the documentation of this file.
1 <?php
2 
19 declare(strict_types=1);
20 
22 use ILIAS\Refinery;
24 
48 {
49  private const TAB_VIEW_CONTENT = "view_content";
50  private const SUBTAB_VIEW_TREE = "view_tree";
51  private const TAB_INFO = "info_short";
52  private const TAB_SETTINGS = "settings";
53  private const TAB_MEMBERS = "members";
54  private const TAB_METADATA = "edit_advanced_settings";
55  private const SUBTAB_PAGE_EDIT = "page";
56 
59  protected ilHelpGUI $help;
68  protected Refinery\Factory $refinery;
71 
75  public ?ilObject $object;
76 
79 
80  public function __construct()
81  {
82  global $DIC;
83  $this->tpl = $DIC['tpl'];
84  $this->ctrl = $DIC['ilCtrl'];
85  $this->ilLocator = $DIC['ilLocator'];
86  $this->tree = $DIC['tree'];
87  $this->toolbar = $DIC['ilToolbar'];
88  $this->ilLog = $DIC['ilLog'];
89  $this->ilias = $DIC['ilias'];
90  $this->type = "prg";
91  $this->help = $DIC['ilHelp'];
92  $this->user = $DIC['ilUser'];
93  $this->refinery = $DIC->refinery();
94  $this->request_wrapper = $DIC->http()->wrapper()->query();
95 
96  $ref_id = $this->request_wrapper->retrieve("ref_id", $this->refinery->kindlyTo()->int());
97  parent::__construct(array(), $ref_id, true, false);
98 
99  $lng = $DIC['lng'];
100  $lng->loadLanguageModule("prg");
101 
103  $this->settings_gui = $dic['ilObjStudyProgrammeSettingsGUI'];
104  $this->members_gui = $dic['ilObjStudyProgrammeMembersGUI'];
105  $this->memberships_gui = $dic['ilObjStudyProgrammeAutoMembershipsGUI'];
106  $this->tree_gui = $dic['ilObjStudyProgrammeTreeGUI'];
107  $this->type_gui = $dic['ilStudyProgrammeTypeGUI'];
108  $this->autocategories_gui = $dic['ilObjStudyProgrammeAutoCategoriesGUI'];
109  $this->type_repository = $dic['model.Type.ilStudyProgrammeTypeRepository'];
110  $this->ui_factory = $dic['ui.factory'];
111 
112  $this->internal_domain_service = $DIC->container()->internal()->domain()->content();
113  $this->container_view_manager = $this->internal_domain_service->view($this->object);
114  }
115 
116  public function executeCommand(): void
117  {
118  $cmd = $this->ctrl->getCmd();
119  $next_class = $this->ctrl->getNextClass($this);
120 
121  if ($cmd == "" || $cmd === null) {
122  $cmd = "view";
123  }
124  $this->addToNavigationHistory();
125 
126  parent::prepareOutput();
127 
128  $this->addHeaderAction();
129 
130  switch ($next_class) {
131  case "ilinfoscreengui":
132  $this->tabs_gui->activateTab(self::TAB_INFO);
133  $this->denyAccessIfNotAnyOf([
136  ]);
137  $info = new ilInfoScreenGUI($this);
138  $this->fillInfoScreen($info);
139  $this->ctrl->forwardCommand($info);
140 
141  // I guess this is how it was supposed to work,
142  // but it doesn't... it won't respect our sub-id and sub-type when creating the objects!
143  // So we reimplemented the stuff in the method parseInfoScreen()
144  // $info = new ilInfoScreenGUI($this);
145  // $amd_gui = new ilAdvancedMDRecordGUI(
146  // ilAdvancedMDRecordGUI::MODE_INFO,
147  // 'orgu',
148  // $this->object->getId(),
149  // 'orgu_type',
150  // $this->object->getOrgUnitTypeId()
151  // );
152  // $amd_gui->setInfoObject($info);
153  // $amd_gui->setSelectedOnly(true);
154  // $amd_gui->parse();
155  // $this->ctrl->forwardCommand($info);
156  break;
157  case 'ilpermissiongui':
158  $this->tabs_gui->activateTab('perm_settings');
159  $ilPermissionGUI = new ilPermissionGUI($this);
160  $this->ctrl->forwardCommand($ilPermissionGUI);
161  break;
162  case "ilcommonactiondispatchergui":
164  $this->ctrl->forwardCommand($gui);
165  break;
166  case "ilobjstudyprogrammesettingsgui":
168  $this->getSubTabs('settings');
169  $this->tabs_gui->activateTab(self::TAB_SETTINGS);
170  $this->tabs_gui->activateSubTab('settings');
171  $this->settings_gui->setRefId($this->ref_id);
172  $this->ctrl->forwardCommand($this->settings_gui);
173  break;
174  case "ilobjstudyprogrammeautocategoriesgui":
176  $this->getSubTabs('settings');
177  $this->tabs_gui->activateTab(self::TAB_SETTINGS);
178  $this->tabs_gui->activateSubTab('auto_content');
179  $this->autocategories_gui->setRefId($this->ref_id);
180  $this->initTreeJS();
181  $this->ctrl->forwardCommand($this->autocategories_gui);
182  break;
183  case "ilobjstudyprogrammemembersgui":
185  $this->getSubTabs('members');
186  $this->tabs_gui->activateTab(self::TAB_MEMBERS);
187  $this->tabs_gui->activateSubTab('edit_participants');
188  $this->members_gui->setParentGUI($this);
189  $this->members_gui->setRefId($this->ref_id);
190  $this->ctrl->forwardCommand($this->members_gui);
191  break;
192  case 'ilprgmembersexportgui':
194  $this->getSubTabs('members');
195  $this->tabs_gui->activateTab(self::TAB_MEMBERS);
196  $this->tabs_gui->activateSubTab('export_memberships');
197 
198  $specific_dic = ilStudyProgrammeDIC::specificDicFor($this->object);
199  $export_gui = new ilPRGMembersExportGUI(
200  $this->ref_id,
201  $specific_dic['ilStudyProgrammeUserTable'],
202  $specific_dic['DataFactory']
203  );
204  $this->ctrl->forwardCommand($export_gui);
205  break;
206 
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 "ilobjstudyprogrammetreegui":
218  $this->getSubTabs($cmd);
219  $this->setContentSubTabs();
220  $this->tabs_gui->activateTab(self::TAB_VIEW_CONTENT);
221  $this->tabs_gui->activateSubTab(self::SUBTAB_VIEW_TREE);
222  $this->tree_gui->setRefId($this->id);
223  $this->ctrl->forwardCommand($this->tree_gui);
224  break;
225  case 'ilstudyprogrammetypegui':
226  $this->tabs_gui->activateTab('subtypes');
227  $this->type_gui->setParentGUI($this);
228  $this->ctrl->forwardCommand($this->type_gui);
229  break;
230  case 'ilobjectcopygui':
231  $gui = new ilobjectcopygui($this);
232  $this->ctrl->forwardCommand($gui);
233  break;
234  case 'ilobjecttranslationgui':
236  $this->getSubTabs('settings');
237  $this->tabs_gui->activateTab(self::TAB_SETTINGS);
238  $this->tabs_gui->activateSubTab('settings_trans');
239  $transgui = new ilObjectTranslationGUI($this);
240  $this->ctrl->forwardCommand($transgui);
241  break;
242  case "ilcertificategui":
243  $this->getSubTabs('settings');
245  $this->tabs_gui->activateTab(self::TAB_SETTINGS);
246  $this->tabs_gui->activateSubTab('certificate');
247  $guiFactory = new ilCertificateGUIFactory();
248  $output_gui = $guiFactory->create($this->object);
249  $this->ctrl->forwardCommand($output_gui);
250  break;
251  case "ilprgpageobjectgui":
253  if (!$this->object->hasContentPage()) {
254  $this->object->createContentPage();
255  }
256  $gui = new ilPRGPageObjectGUI($this->object->getId());
257  $gui->setItemPresentationManager(
258  $this->internal_domain_service
259  ->itemPresentation(
260  $this->object,
261  null,
262  false
263  )
264  );
265  $this->content_style_gui->addCss($this->tpl, $this->object->getRefId());
266  $this->ctrl->setCmd($cmd);
267  $out = $this->ctrl->forwardCommand($gui);
268  if (!is_null($out)) {
269  $this->tpl->setContent($out);
270  }
271  break;
272  case "ilobjstylesheetgui":
273  $this->forwardToStyleSheet();
274  break;
275  case "ilobjectcontentstylesettingsgui":
276  $this->tabs_gui->activateTab(self::TAB_VIEW_CONTENT);
277  $settings_gui = $this->content_style_gui
278  ->objectSettingsGUIForRefId(null, $this->object->getRefId());
279  $this->ctrl->forwardCommand($settings_gui);
280  break;
281  case strtolower(ilPropertyFormGUI::class):
282  /*
283  * Only used for async loading of the repository tree in custom md
284  * internal links (see #28060, #37974). This is necessary since StudyProgrammes don't
285  * use ilObjectMetaDataGUI.
286  */
287  $form = $this->initAdvancedSettingsForm();
290  'prg',
291  $this->object->getId(),
292  'prg_type',
293  $this->object->getSettings()->getTypeSettings()->getTypeId()
294  );
295  $gui->setPropertyForm($form);
296  $gui->parse();
297  $this->ctrl->forwardCommand($form);
298  break;
299  case false:
300  $this->getSubTabs($cmd);
301  switch ($cmd) {
302  case "cancelDelete":
303  $cmd = "view";
304  // no break
305  case "create":
306  case "save":
307  case "cancel":
308  case "edit":
309  $this->$cmd();
310  break;
311  case "view":
312  $this->getModeManager()->setContentMode();
313  $this->view();
314  break;
315  case "delete":
316  $this->tabs_gui->clearTargets();
317  $this->tabs_gui->setBackTarget($this->lng->txt("back"), $this->ctrl->getLinkTarget($this));
318  parent::deleteObject();
319  break;
320  case 'confirmedDelete':
321  parent::confirmedDeleteObject();
322  break;
323  case 'editAdvancedSettings':
324  $this->tabs_gui->activateTab('edit_advanced_settings');
325  $this->editAdvancedSettings();
326  break;
327  case 'updateAdvancedSettings':
328  $this->tabs_gui->activateTab('edit_advanced_settings');
329  $this->updateAdvancedSettings();
330  break;
331  case "infoScreen":
332  $this->ctrl->redirectByClass("ilInfoScreenGUI", "showSummary");
333  break;
334  case 'getAsynchItemList':
335  parent::getAsynchItemListObject();
336  break;
337 
338  case 'editPageFrame':
339  $this->ctrl->redirectToURL($this->getLinkTarget('edit_page'));
340  break;
341  case 'editStyleProperties':
342  $this->editStylePropertiesObject();
343  break;
344 
345  case 'trash':
346  case 'undelete':
347  case 'confirmRemoveFromSystem':
348  case 'removeFromSystem':
349  case 'deliverCertificate':
350  case 'addToDesk':
351  case 'removeFromDesk':
352  case 'cut':
353  case 'paste':
354  case 'clear':
355  case 'render':
356  case 'performPasteIntoMultipleObjects':
357  case 'cancelMoveLink':
358  case 'keepObjectsInClipboard':
359 
360  $cmd .= "Object";
361  $this->$cmd();
362  break;
363  default:
364  throw new ilException("ilObjStudyProgrammeGUI: Command not supported: $cmd");
365  }
366  break;
367  default:
368  throw new ilException("ilObjStudyProgrammeGUI: Can't forward to next class $next_class");
369  }
370  }
371 
372  protected function create(): void
373  {
374  parent::createObject();
375  }
376 
377  protected function save(): void
378  {
379  parent::saveObject();
380 
381  if ($this->ctrl->isAsynch()) {
382  $form = $this->getAsyncCreationForm();
385  "cmd" => $this->ctrl->getCmd(),
386  "success" => false,
387  "errors" => $form->getErrors()
388  ]);
389  exit();
390  }
391  }
392 
393  protected function cancel(): void
394  {
395  $async_response = ilAsyncOutputHandler::encodeAsyncResponse(array("cmd" => "cancel", "success" => false));
396 
397  ilAsyncOutputHandler::handleAsyncOutput("", $async_response, false);
398 
399  parent::cancelCreation();
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 
416  "cmd" => "cancel",
417  "success" => true,
418  "message" => $this->lng->txt("object_added")
419  ]);
420 
421  ilAsyncOutputHandler::handleAsyncOutput("", $async_response, false);
422 
423  $this->tpl->setOnScreenMessage("success", $this->lng->txt("object_added"), true);
424 
425  $this->ctrl->setParameter($this, "ref_id", $new_object->getRefId());
426  $this->ctrl->redirectToURL($this->getReturnLocation(
427  "save",
428  $this->ctrl->getLinkTarget($this, "edit", "", false, false)
429  ));
430  }
431 
433  {
434  if (!$this->permissions) {
435  if (!$this->object || !$this->object->getRefId()) {
436  throw new LogicException('Cannot ask for permission when not in tree!');
437  }
438 
439  $this->permissions = ilStudyProgrammeDIC::specificDicFor($this->object)['permissionhelper'];
440  }
441  return $this->permissions;
442  }
443 
444  protected function view(): void
445  {
447  $this->tabs_gui->activateTab(self::TAB_VIEW_CONTENT);
448  parent::renderObject();
449  }
450 
451  public function isActiveAdministrationPanel(): bool
452  {
453  return false;
454  }
455 
457  {
458  $form = new ilPropertyFormGUI();
459  $form->setFormAction($this->ctrl->getFormAction($this));
460  $form->addCommandButton('updateAdvancedSettings', $this->lng->txt('save'));
461  $form->addCommandButton('editAdvancedSettings', $this->lng->txt('cancel'));
462 
463  return $form;
464  }
465 
466  protected function editAdvancedSettings(): void
467  {
469  $this->tpl->setOnScreenMessage("failure", $this->lng->txt("permission_denied"), true);
470  $this->ctrl->redirect($this);
471  }
472  $form = $this->initAdvancedSettingsForm();
475  'prg',
476  $this->object->getId(),
477  'prg_type',
478  $this->object->getSettings()->getTypeSettings()->getTypeId()
479  );
480  $gui->setPropertyForm($form);
481  $gui->parse();
482  $this->tpl->setContent($form->getHTML());
483  }
484 
485  protected function updateAdvancedSettings(): void
486  {
488  $this->tpl->setOnScreenMessage("failure", $this->lng->txt("permission_denied"), true);
489  $this->ctrl->redirect($this);
490  }
491  $form = $this->initAdvancedSettingsForm();
494  'prg',
495  $this->object->getId(),
496  'prg_type',
497  $this->object->getSettings()->getTypeSettings()->getTypeId()
498  );
499  $gui->setPropertyForm($form);
500  $gui->parse();
501  $form->checkInput();
502 
503  if ($gui->importEditFormPostValues()) {
504  $gui->writeEditForm();
505  $this->tpl->setOnScreenMessage("success", $this->lng->txt('settings_saved'), true);
506  $this->ctrl->redirect($this, 'editAdvancedSettings');
507  } else {
508  $this->tpl->setContent($form->getHTML());
509  }
510  }
511 
515  protected function initCreationForms($new_type): array
516  {
517  return array(self::CFORM_NEW => $this->initCreateForm($new_type));
518  }
519 
525  {
526  $asyncForm = new ilAsyncPropertyFormGUI($this->request_wrapper);
527 
528  $tmp_forms = $this->initCreationForms('prg');
529  $asyncForm->cloneForm($tmp_forms[self::CFORM_NEW]);
530  $asyncForm->setAsync(true);
531 
532  return $asyncForm;
533  }
534 
536  // HELPERS
538 
539  protected function checkAccess(string $permission): bool
540  {
541  return $this->getPermissionsHelper()->may($permission);
542  }
543 
544  protected function denyAccessIfNot(string $permission): void
545  {
546  $this->denyAccessIfNotAnyOf([$permission]);
547  }
548 
549  protected function denyAccessIfNotAnyOf(array $permissions): void
550  {
551  if (!$this->getPermissionsHelper()->mayAnyOf($permissions)) {
553  $this->tpl->setOnScreenMessage('failure', $this->lng->txt("msg_no_perm_write"));
554  $this->ctrl->redirectByClass('ilinfoscreengui', '');
555  } else {
556  $this->ilias->raiseError($this->lng->txt("msg_no_perm_read"), $this->ilias->error_obj->WARNING);
557  }
558  }
559  }
560 
561  protected function getTabs(): void
562  {
563  $this->help->setScreenIdComponent("prg");
565  $this->tabs_gui->addTab(self::TAB_VIEW_CONTENT, $this->lng->txt("content"), $this->getLinkTarget("view"));
566  }
567 
569  $this->tabs_gui->addTab(
570  self::TAB_INFO,
571  $this->lng->txt("info_short"),
572  $this->getLinkTarget("info_short")
573  );
574  }
575 
577  $this->tabs_gui->addTab(
578  self::TAB_SETTINGS,
579  $this->lng->txt("settings"),
580  $this->getLinkTarget("settings")
581  );
582  }
583 
585  $this->tabs_gui->addTab(
586  self::TAB_MEMBERS,
587  $this->lng->txt("assignments"),
588  $this->getLinkTarget("members")
589  );
590  }
591 
592  if ($this->object->hasAdvancedMetadata()
594  ) {
595  $this->tabs_gui->addTab(
596  self::TAB_METADATA,
597  $this->lng->txt('meta_data'),
598  $this->ctrl->getLinkTarget($this, 'editAdvancedSettings')
599  );
600  }
601 
602  parent::getTabs();
603  }
604 
609  public function getSubTabs(string $parent_tab): void
610  {
611  switch ($parent_tab) {
612  case self::TAB_VIEW_CONTENT:
613  case self::SUBTAB_VIEW_TREE:
614  case 'view':
616  $this->tabs_gui->addSubTab(
617  self::TAB_VIEW_CONTENT,
618  $this->lng->txt("view"),
619  $this->getLinkTarget("view")
620  );
621  }
622 
624  $this->tabs_gui->addSubTab(
625  self::SUBTAB_VIEW_TREE,
626  $this->lng->txt("cntr_manage"),
627  $this->getLinkTarget(self::SUBTAB_VIEW_TREE)
628  );
629  }
630  break;
631  case 'settings':
632  $this->tabs_gui->addSubTab(
633  'settings',
634  $this->lng->txt('settings'),
635  $this->getLinkTarget('settings')
636  );
637 
638  if ($this->object->isAutoContentApplicable()) {
639  $this->tabs_gui->addSubTab(
640  "auto_content",
641  $this->lng->txt("content_automation"),
642  $this->getLinkTarget("auto_content")
643  );
644  }
645 
646  $this->tabs_gui->addSubTab(
647  "settings_trans",
648  $this->lng->txt("obj_multilinguality"),
649  $this->ctrl->getLinkTargetByClass("ilobjecttranslationgui", "")
650  );
651 
652  $validator = new ilCertificateActiveValidator();
653  if (true === $validator->validate()) {
654  $this->tabs_gui->addSubTabTarget(
655  "certificate",
656  $this->ctrl->getLinkTargetByClass("ilcertificategui", "certificateeditor"),
657  "",
658  "ilcertificategui"
659  );
660  }
661 
662  if ($this->permissions->isOrguAccessEnabledGlobally()) {
663  $this->tabs_gui->addSubTab(
664  'commonSettings',
665  $this->lng->txt("obj_features"),
666  $this->getLinkTarget("commonSettings")
667  );
668  }
669 
670  break;
671 
672  case 'members':
673  $this->tabs_gui->addSubTab(
674  'edit_participants',
675  $this->lng->txt('edit_participants'),
676  $this->getLinkTarget('members')
677  );
678 
680  $this->tabs_gui->addSubTab(
681  'auto_memberships',
682  $this->lng->txt('auto_memberships'),
683  $this->getLinkTarget('memberships')
684  );
685  }
686 
688  $this->tabs_gui->addSubTab(
689  'export_memberships',
690  $this->lng->txt('export_memberships'),
691  $this->getLinkTarget('export_memberships')
692  );
693  }
694  break;
695  }
696  }
697 
701  public function setContentSubTabs(): void
702  {
703  }
704 
708  protected function getLinkTarget(string $cmd): string
709  {
710  if ($cmd === "info_short") {
711  return $this->ctrl->getLinkTargetByClass("ilinfoscreengui", "showSummary");
712  }
713  if ($cmd === "settings") {
714  return $this->ctrl->getLinkTargetByClass("ilobjstudyprogrammesettingsgui", "view");
715  }
716  if ($cmd === "auto_content") {
717  return $this->ctrl->getLinkTargetByClass("ilObjStudyProgrammeAutoCategoriesGUI", "view");
718  }
719  if ($cmd === self::SUBTAB_VIEW_TREE) {
720  return $this->ctrl->getLinkTargetByClass("ilobjstudyprogrammetreegui", "view");
721  }
722  if ($cmd === "members") {
723  return $this->ctrl->getLinkTargetByClass("ilobjstudyprogrammemembersgui", "view");
724  }
725  if ($cmd === "memberships") {
726  return $this->ctrl->getLinkTargetByClass("ilobjstudyprogrammeautomembershipsgui", "view");
727  }
728  if ($cmd == "export_memberships") {
729  return $this->ctrl->getLinkTargetByClass('ilprgmembersexportgui', 'show');
730  }
731  if ($cmd === "subtypes") {
732  return $this->ctrl->getLinkTargetByClass("ilstudyprogrammetypegui", "listTypes");
733  }
734  if ($cmd === "commonSettings") {
735  return $this->ctrl->getLinkTargetByClass(
736  [
737  "ilobjstudyprogrammesettingsgui",
738  "ilStudyProgrammeCommonSettingsGUI"
739  ],
740  "editSettings"
741  );
742  }
743  if ($cmd == "edit_page") {
744  return $this->ctrl->getLinkTargetByClass(
745  ["ilObjStudyProgrammeGUI", "ilPRGPageObjectGUI"],
746  'edit'
747  );
748  }
749 
750  return $this->ctrl->getLinkTarget($this, $cmd);
751  }
752 
756  protected function fillInfoScreen($info_screen): void
757  {
758  if (!$this->object->getSettings()->getTypeSettings()->getTypeId() ||
759  !ilStudyProgrammeDIC::dic()['model.Type.ilStudyProgrammeTypeRepository']
760  ->getType($this->object->getSettings()->getTypeSettings()->getTypeId())
761  ) {
762  return;
763  }
764 
765  $record_gui = new ilAdvancedMDRecordGUI(
767  'prg',
768  $this->object->getId(),
769  'prg_type',
770  $this->object->getSettings()->getTypeSettings()->getTypeId()
771  );
772  $record_gui->setInfoObject($info_screen);
773  $record_gui->parse();
774  }
775 
776  protected function edit(): void
777  {
779  $link = $this->ctrl->getLinkTargetByClass(ilObjStudyProgrammeSettingsGUI::class, 'view');
780  $this->ctrl->redirectToURL($link);
781  }
782 
783  public static function _goto(string $target): void
784  {
785  global $DIC;
786  $ilCtrl = $DIC['ilCtrl'];
787  $id = explode("_", $target);
788  $ilCtrl->setTargetScript('ilias.php');
789  $ilCtrl->setParameterByClass("ilobjstudyprogrammegui", "ref_id", $id[0]);
790  $ilCtrl->redirectByClass(array("ilRepositoryGUI", "ilobjstudyprogrammegui"), "view");
791  }
792 
793  public function addToNavigationHistory(): void
794  {
795  global $DIC;
796  $ilNavigationHistory = $DIC['ilNavigationHistory'];
797 
799  $ref_id = $this->request_wrapper->retrieve("ref_id", $this->refinery->kindlyTo()->int());
800  $link = ilLink::_getLink($ref_id, "prg");
801  $ilNavigationHistory->addItem($ref_id, $link, 'prg');
802  }
803  }
804 
805  protected function initHeaderAction(?string $sub_type = null, ?int $sub_id = null): ?ilObjectListGUI
806  {
807  $lg = parent::initHeaderAction($sub_type, $sub_id);
808  $validator = new ilCertificateDownloadValidator();
809  if ($lg && true === $validator->isCertificateDownloadable($this->user->getId(), $this->object->getId())) {
810  $cert_url = $this->ctrl->getLinkTarget($this, "deliverCertificate");
811  $this->lng->loadLanguageModule("certificate");
812  $lg->addCustomCommand($cert_url, "download_certificate");
813  $lg->addHeaderIcon(
814  "cert_icon",
815  ilUtil::getImagePath("standard/icon_cert.svg"),
816  $this->lng->txt("download_certificate"),
817  null,
818  null,
819  $cert_url
820  );
821  }
822  return $lg;
823  }
824 
825  protected function deliverCertificateObject(): void
826  {
827  $this->lng->loadLanguageModule('cert');
828 
829  $user_id = (int) $this->user->getId();
830  $obj_id = $this->object->getId();
831 
832  $validator = new ilCertificateDownloadValidator();
833  if (false === $validator->isCertificateDownloadable($user_id, $obj_id)) {
834  $this->tpl->setOnScreenMessage('failure', $this->lng->txt("permission_denied"), true);
835  $this->ctrl->redirect($this);
836  }
837  $repository = new ilUserCertificateRepository();
838  $pdf_action = new ilCertificatePdfAction(
839  new ilPdfGenerator($repository),
841  $this->lng->txt('error_creating_certificate_pdf')
842  );
843  $pdf_action->downloadPdf($user_id, $obj_id);
844  }
845 
846  protected function initTreeJS(): void
847  {
849  }
850 
851  protected function supportsPageEditor(): bool
852  {
853  return true;
854  }
855 }
ilObjStudyProgrammeMembersGUI $members_gui
exit
Definition: login.php:29
ilStudyProgrammeTypeGUI $type_gui
Class ilInfoScreenGUI.
Class ilObjStudyProgrammeGUI class ilObjStudyProgrammeGUI: ilPermissionGUI ilObjStudyProgrammeGUI: ...
PageObjectGUI for StudyProgrammes.
ilObjStudyProgrammeAutoMembershipsGUI $memberships_gui
afterSave(ilObject $new_object)
Sets the sorting of the container correctly.
static handleAsyncOutput(string $normal_content, string $async_content=null, bool $apply_to_tpl=true)
Handles async output.
ilStudyProgrammeTypeRepository $type_repository
static getImagePath(string $img, string $module_path="", string $mode="output", bool $offline=false)
get image path (for images located in a template directory)
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
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...
global $DIC
Definition: feed.php:28
ilObjStudyProgrammeTreeGUI $tree_gui
ilLanguage $lng
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
initCreationForms($new_type)
Overwritten from ilObjectGUI since copy and import are not implemented.
const SORT_NEW_ITEMS_POSITION_BOTTOM
__construct(VocabulariesInterface $vocabularies)
static encodeAsyncResponse(array $data=array())
Encode data as json for async output.
initHeaderAction(?string $sub_type=null, ?int $sub_id=null)
setFormAction(string $a_formaction)
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...
Interface RequestWrapper.
$out
Definition: buildRTE.php:24
header include for all ilias files.
static specificDicFor(ilObjStudyProgramme $prg)
ilObjStudyProgrammeMembersGUI: ilStudyProgrammeRepositorySearchGUI ilObjStudyProgrammeMembersGUI: il...
addCommandButton(string $a_cmd, string $a_text, string $a_id="")
ilPropertyFormGUI $form
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Just a wrapper class to create Unit Test for other classes.
getLinkTarget(string $cmd)
Generates a link based on a cmd.
setContentSubTabs()
Disable default content subtabs.
ilPRGPermissionsHelper $permissions
ilObjStudyProgrammeAutoCategoriesGUI $autocategories_gui
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
Class ilContainerGUI This is a base GUI class for all container objects in ILIAS: root folder...
$dic
Definition: result.php:32
Class ilAsyncPropertyFormGUI.
static init(ilGlobalTemplateInterface $a_main_tpl=null)
New PermissionGUI (extends from old ilPermission2GUI) RBAC related output.
const SORT_DIRECTION_ASC
export assignments of PRG
addHeaderAction()
Add header action menu.
ilSetting $settings
static getInstanceFromAjaxCall()
(Re-)Build instance from ajax call
GUI class for object translation handling.
ilObjStudyProgrammeSettingsGUI: ilStudyProgrammeCommonSettingsGUI
Class ilObjStudyProgrammeTreeGUI Generates the manage view for ilTrainingProgramme-Repository objects...
downloadPdf(int $userId, int $objectId)