ILIAS  release_7 Revision v7.30-3-g800a261c036
class.ilObjStudyProgrammeGUI.php
Go to the documentation of this file.
1 <?php
2 
3 /* Copyright (c) 2015 Richard Klees <richard.klees@concepts-and-training.de> Extended GPL, see docs/LICENSE */
4 
5 require_once("./Services/Container/classes/class.ilContainerGUI.php");
6 require_once("./Services/AccessControl/classes/class.ilObjRole.php");
7 require_once("./Services/Form/classes/class.ilPropertyFormGUI.php");
8 require_once("./Services/AccessControl/classes/class.ilPermissionGUI.php");
9 require_once("./Services/InfoScreen/classes/class.ilInfoScreenGUI.php");
10 require_once("./Services/Object/classes/class.ilObjectAddNewItemGUI.php");
11 require_once("./Modules/StudyProgramme/classes/class.ilObjStudyProgrammeTreeGUI.php");
12 require_once('./Services/Container/classes/class.ilContainerSortingSettings.php');
13 require_once("./Modules/StudyProgramme/classes/types/class.ilStudyProgrammeTypeGUI.php");
14 require_once("./Services/AdvancedMetaData/classes/class.ilAdvancedMDRecordGUI.php");
15 require_once("./Services/Object/classes/class.ilObjectCopyGUI.php");
16 require_once("./Services/Repository/classes/class.ilRepUtil.php");
17 
39 {
43  public $ctrl;
44 
48  public $tpl;
49 
53  public $tabs_gui;
54 
58  protected $toolbar;
59 
63  protected $ilLocator;
64 
68  public $tree;
69 
73  public $object;
74 
78  protected $ilLog;
79 
83  public $ilias;
84 
88  protected $help;
89 
93  protected $settings_gui;
94 
98  protected $members_gui;
99 
103  protected $memberships_gui;
104 
108  protected $tree_gui;
109 
113  protected $type_gui;
114 
118  protected $type_repository;
119 
124 
128  protected $permissions;
129 
130  public function __construct()
131  {
132  global $DIC;
133  $tpl = $DIC['tpl'];
134  $ilCtrl = $DIC['ilCtrl'];
135  $ilToolbar = $DIC['ilToolbar'];
136  $ilLocator = $DIC['ilLocator'];
137  $tree = $DIC['tree'];
138  $lng = $DIC['lng'];
139  $ilLog = $DIC['ilLog'];
140  $ilias = $DIC['ilias'];
141  $ilHelp = $DIC['ilHelp'];
142  $ilUser = $DIC['ilUser'];
143 
144  parent::__construct(array(), (int) $_GET['ref_id'], true, false);
145 
146  $this->tpl = $tpl;
147  $this->ctrl = $ilCtrl;
148  $this->ilLocator = $ilLocator;
149  $this->tree = $tree;
150  $this->toolbar = $ilToolbar;
151  $this->ilLog = $ilLog;
152  $this->ilias = $ilias;
153  $this->type = "prg";
154  $this->help = $ilHelp;
155  $this->user = $ilUser;
156 
157  $lng->loadLanguageModule("prg");
158 
159  $this->settings_gui = ilStudyProgrammeDIC::dic()['ilObjStudyProgrammeSettingsGUI'];
160  $this->members_gui = ilStudyProgrammeDIC::dic()['ilObjStudyProgrammeMembersGUI'];
161  $this->memberships_gui = ilStudyProgrammeDIC::dic()['ilObjStudyProgrammeAutoMembershipsGUI'];
162  $this->tree_gui = ilStudyProgrammeDIC::dic()['ilObjStudyProgrammeTreeGUI'];
163  $this->type_gui = ilStudyProgrammeDIC::dic()['ilStudyProgrammeTypeGUI'];
164  $this->autocategories_gui = ilStudyProgrammeDIC::dic()['ilObjStudyProgrammeAutoCategoriesGUI'];
165  $this->type_repository = ilStudyProgrammeDIC::dic()['model.Type.ilStudyProgrammeTypeRepository'];
166  }
167 
168 
169  public function executeCommand()
170  {
171  $cmd = $this->ctrl->getCmd();
172  $next_class = $this->ctrl->getNextClass($this);
173 
174  if ($cmd == "") {
175  $cmd = "view";
176  }
177 
178  $this->addToNavigationHistory();
179 
180  parent::prepareOutput();
181 
182  $this->addHeaderAction();
183 
184  switch ($next_class) {
185  case "ilinfoscreengui":
186  $this->tabs_gui->activateTab(self::TAB_INFO);
187  $this->denyAccessIfNotAnyOf([
190  ]);
191  $info = new ilInfoScreenGUI($this);
192  $this->fillInfoScreen($info);
193  $this->ctrl->forwardCommand($info);
194 
195  // I guess this is how it was supposed to work, but it doesn't... it won't respect our sub-id and sub-type when creating the objects!
196  // So we reimplemented the stuff in the method parseInfoScreen()
197  // $info = new ilInfoScreenGUI($this);
198  // $amd_gui = new ilAdvancedMDRecordGUI(ilAdvancedMDRecordGUI::MODE_INFO, 'orgu', $this->object->getId(), 'orgu_type', $this->object->getOrgUnitTypeId());
199  // $amd_gui->setInfoObject($info);
200  // $amd_gui->setSelectedOnly(true);
201  // $amd_gui->parse();
202  // $this->ctrl->forwardCommand($info);
203  break;
204  case 'ilpermissiongui':
205  $this->tabs_gui->activateTab('perm_settings');
206  $ilPermissionGUI = new ilPermissionGUI($this);
207  $this->ctrl->forwardCommand($ilPermissionGUI);
208  break;
209  case "ilcommonactiondispatchergui":
210  require_once("Services/Object/classes/class.ilCommonActionDispatcherGUI.php");
212  $this->ctrl->forwardCommand($gui);
213  break;
214  case "ilobjstudyprogrammesettingsgui":
216  $this->getSubTabs('settings');
217  $this->tabs_gui->activateTab(self::TAB_SETTINGS);
218  $this->tabs_gui->activateSubTab('settings');
219  $this->settings_gui->setRefId($this->ref_id);
220  $this->ctrl->forwardCommand($this->settings_gui);
221  break;
222 
223  case "ilobjstudyprogrammeautocategoriesgui":
225  $this->getSubTabs('settings');
226  $this->tabs_gui->activateTab(self::TAB_SETTINGS);
227  $this->tabs_gui->activateSubTab('auto_content');
228  $this->autocategories_gui->setRefId($this->ref_id);
229  $this->initTreeJS();
230  $this->ctrl->forwardCommand($this->autocategories_gui);
231  break;
232 
233  case "ilobjstudyprogrammemembersgui":
235  $this->getSubTabs('members');
236 
237  $this->tabs_gui->activateTab(self::TAB_MEMBERS);
238  $this->tabs_gui->activateSubTab('edit_participants');
239 
240  $this->members_gui->setParentGUI($this);
241  $this->members_gui->setRefId($this->ref_id);
242  $this->ctrl->forwardCommand($this->members_gui);
243 
244  break;
245 
246  case "ilobjstudyprogrammeautomembershipsgui":
248  $this->getSubTabs('members');
249 
250  $this->tabs_gui->activateTab(self::TAB_MEMBERS);
251  $this->tabs_gui->activateSubTab('auto_memberships');
252 
253  $this->memberships_gui->setParentGUI($this);
254  $this->memberships_gui->setRefId($this->ref_id);
255  $this->ctrl->forwardCommand($this->memberships_gui);
256 
257  break;
258 
259 
260  case "ilobjstudyprogrammetreegui":
262 
263  $this->getSubTabs($cmd);
264  $this->setContentSubTabs();
265  $this->tabs_gui->activateTab(self::TAB_VIEW_CONTENT);
266  $this->tabs_gui->activateSubTab(self::SUBTAB_VIEW_TREE);
267 
268  // disable admin panel
269  $_SESSION["il_cont_admin_panel"] = false;
270 
271  $this->tree_gui->setRefId($this->id);
272  $this->ctrl->forwardCommand($this->tree_gui);
273  break;
274  case 'ilstudyprogrammetypegui':
275  $this->tabs_gui->activateTab('subtypes');
276 
277  $this->type_gui->setParentGUI($this);
278  $this->ctrl->forwardCommand($this->type_gui);
279  break;
280  case 'ilobjectcopygui':
281  $gui = new ilobjectcopygui($this);
282  $this->ctrl->forwardCommand($gui);
283  break;
284  case 'ilobjecttranslationgui':
286  $this->getSubTabs('settings');
287  $this->tabs_gui->activateTab(self::TAB_SETTINGS);
288  $this->tabs_gui->activateSubTab('settings_trans');
289  $transgui = new ilObjectTranslationGUI($this);
290  $this->ctrl->forwardCommand($transgui);
291  break;
292  case "ilcertificategui":
293  $this->getSubTabs('settings');
295  $this->tabs_gui->activateTab(self::TAB_SETTINGS);
296  $this->tabs_gui->activateSubTab('certificate');
297  $guiFactory = new ilCertificateGUIFactory();
298  $output_gui = $guiFactory->create($this->object);
299  $this->ctrl->forwardCommand($output_gui);
300  break;
301  case strtolower(ilPropertyFormGUI::class):
302  /*
303  * Only used for async loading of the repository tree in custom md
304  * internal links (see #28060, #37974). This is necessary since StudyProgrammes don't
305  * use ilObjectMetaDataGUI.
306  */
307  $form = $this->initAdvancedSettingsForm();
308  $gui = new ilAdvancedMDRecordGUI(
310  'prg',
311  $this->object->getId(),
312  'prg_type',
313  $this->object->getSettings()->getTypeSettings()->getTypeId()
314  );
315  $gui->setPropertyForm($form);
316  $gui->parse();
317  $this->ctrl->forwardCommand($form);
318  break;
319  case false:
320  $this->getSubTabs($cmd);
321  switch ($cmd) {
322  case "cancelDelete":
323  $cmd = "view";
324  // no break
325  case "create":
326  case "save":
327  case "view":
328  case "cancel":
329  case "edit":
330  $this->$cmd();
331  break;
332  case "delete":
333  $this->tabs_gui->clearTargets();
334  $this->tabs_gui->setBackTarget($this->lng->txt("back"), $this->ctrl->getLinkTarget($this));
335  parent::deleteObject();
336  break;
337  case 'confirmedDelete':
338  parent::confirmedDeleteObject();
339  break;
340  case 'editAdvancedSettings':
341  $this->tabs_gui->activateTab('edit_advanced_settings');
342  $this->editAdvancedSettings();
343  break;
344  case 'updateAdvancedSettings':
345  $this->tabs_gui->activateTab('edit_advanced_settings');
346  $this->updateAdvancedSettings();
347  break;
348  case "infoScreen":
349  $this->ctrl->redirectByClass("ilInfoScreenGUI", "showSummary");
350  break;
351  case 'getAsynchItemList':
352  parent::getAsynchItemListObject();
353  break;
354  case 'trash':
355  case 'undelete':
356  case 'confirmRemoveFromSystem':
357  case 'removeFromSystem':
358  case 'deliverCertificate':
359  case 'addToDesk':
360  case 'removeFromDesk':
361  $cmd .= "Object";
362  $this->$cmd();
363  break;
364  default:
365  throw new ilException("ilObjStudyProgrammeGUI: Command not supported: $cmd");
366  }
367  break;
368 
369  default:
370  throw new ilException("ilObjStudyProgrammeGUI: Can't forward to next class $next_class");
371  }
372  }
373 
374 
375  protected function create()
376  {
377  parent::createObject();
378  }
379 
380  protected function save()
381  {
382  parent::saveObject();
383 
384  if ($this->ctrl->isAsynch()) {
385  $form = $this->getAsyncCreationForm();
386  $form->setValuesByPost();
387  echo ilAsyncOutputHandler::encodeAsyncResponse(array("cmd" => $this->ctrl->getCmd(), "success" => false, "errors" => $form->getErrors()));
388  exit();
389  }
390  }
391 
392  protected function cancel()
393  {
394  $async_response = ilAsyncOutputHandler::encodeAsyncResponse(array("cmd" => "cancel", "success" => false));
395 
396  ilAsyncOutputHandler::handleAsyncOutput("", $async_response, false);
397 
398  parent::cancelCreation();
399  }
400 
401 
405  protected function afterSave(ilObject $a_new_object)
406  {
407  // set default sort to manual
408  $settings = new ilContainerSortingSettings($a_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  $async_response = ilAsyncOutputHandler::encodeAsyncResponse(array("cmd" => "cancel", "success" => true, "message" => $this->lng->txt("object_added")));
416 
417  ilAsyncOutputHandler::handleAsyncOutput("", $async_response, false);
418 
419  ilUtil::sendSuccess($this->lng->txt("object_added"), true);
420 
421  $this->ctrl->setParameter($this, "ref_id", $a_new_object->getRefId());
423  "save",
424  $this->ctrl->getLinkTarget($this, "edit", "", false, false)
425  ));
426  }
427 
429  {
430  if (!$this->permisssions) {
431  if (!$this->object || !$this->object->getRefId()) {
432  throw new LogicException('Cannot ask for permission when not in tree!');
433  }
434 
435  $this->permissions = ilStudyProgrammeDIC::specificDicFor($this->object)['permissionhelper'];
436  }
437  return $this->permissions;
438  }
439 
440  protected function view()
441  {
443  $this->tabs_gui->activateTab(self::TAB_VIEW_CONTENT);
444  parent::renderObject();
445  }
446 
447  public function isActiveAdministrationPanel() : bool
448  {
449  return false;
450  }
451 
453  {
454  $form = new ilPropertyFormGUI();
455  $form->setFormAction($this->ctrl->getFormAction($this));
456  $form->addCommandButton('updateAdvancedSettings', $this->lng->txt('save'));
457  $form->addCommandButton('editAdvancedSettings', $this->lng->txt('cancel'));
458 
459  return $form;
460  }
461 
462  protected function editAdvancedSettings() : void
463  {
465  ilUtil::sendFailure($this->lng->txt("permission_denied"), true);
466  $this->ctrl->redirect($this);
467  }
468  $form = $this->initAdvancedSettingsForm();
469  $gui = new ilAdvancedMDRecordGUI(
471  'prg',
472  $this->object->getId(),
473  'prg_type',
474  $this->object->getSettings()->getTypeSettings()->getTypeId()
475  );
476  $gui->setPropertyForm($form);
477  $gui->parse();
478  $this->tpl->setContent($form->getHTML());
479  }
480 
481  protected function updateAdvancedSettings() : void
482  {
484  ilUtil::sendFailure($this->lng->txt("permission_denied"), true);
485  $this->ctrl->redirect($this);
486  }
487 
488  $form = $this->initAdvancedSettingsForm();
489  $gui = new ilAdvancedMDRecordGUI(
491  'prg',
492  $this->object->getId(),
493  'prg_type',
494  $this->object->getSettings()->getTypeSettings()->getTypeId()
495  );
496  $gui->setPropertyForm($form);
497  $form->checkInput();
498  $gui->parse();
499  if ($gui->importEditFormPostValues()) {
500  $gui->writeEditForm();
501  ilUtil::sendSuccess($this->lng->txt('settings_saved'), true);
502  $this->ctrl->redirect($this, 'editAdvancedSettings');
503  } else {
504  $this->tpl->setContent($form->getHTML());
505  }
506  }
507 
508 
512  protected function initCreationForms($a_new_type) : array
513  {
514  return array( self::CFORM_NEW => $this->initCreateForm($a_new_type));
515  }
516 
517 
523  {
524  $asyncForm = new ilAsyncPropertyFormGUI();
525 
526  $tmp_forms = $this->initCreationForms('prg');
527  $asyncForm->cloneForm($tmp_forms[self::CFORM_NEW]);
528  $asyncForm->setAsync(true);
529 
530  return $asyncForm;
531  }
532 
534  // HELPERS
536 
537  protected function checkAccess(string $permission) : bool
538  {
539  return $this->getPermissionsHelper()->may($permission);
540  }
541 
542  protected function denyAccessIfNot(string $permission) : void
543  {
544  $this->denyAccessIfNotAnyOf([$permission]);
545  }
546 
547  protected function denyAccessIfNotAnyOf(array $permissions) : void
548  {
549  if (!$this->getPermissionsHelper()->mayAnyOf($permissions)) {
551  ilUtil::sendFailure($this->lng->txt("msg_no_perm_write"));
552  $this->ctrl->redirectByClass('ilinfoscreengui', '');
553  } else {
554  $this->ilias->raiseError($this->lng->txt("msg_no_perm_read"), $this->ilias->error_obj->WARNING);
555  }
556  }
557  }
558 
559  const TAB_VIEW_CONTENT = "view_content";
560  const SUBTAB_VIEW_TREE = "view_tree";
561  const TAB_INFO = "info_short";
562  const TAB_SETTINGS = "settings";
563  const TAB_MEMBERS = "members";
564  const TAB_METADATA = "edit_advanced_settings";
565  const TAB_SUBTYPES = "subtypes";
566 
567  public function getTabs()
568  {
569  $this->help->setScreenIdComponent("prg");
571  $this->tabs_gui->addTab(self::TAB_VIEW_CONTENT, $this->lng->txt("content"), $this->getLinkTarget("view"));
572  }
573 
575  $this->tabs_gui->addTab(
576  self::TAB_INFO,
577  $this->lng->txt("info_short"),
578  $this->getLinkTarget("info_short")
579  );
580  }
581 
583  $this->tabs_gui->addTab(
584  self::TAB_SETTINGS,
585  $this->lng->txt("settings"),
586  $this->getLinkTarget("settings")
587  );
588  }
589 
591  $this->tabs_gui->addTab(
592  self::TAB_MEMBERS,
593  $this->lng->txt("assignments"),
594  $this->getLinkTarget("members")
595  );
596  }
597 
598  if ($this->object->hasAdvancedMetadata()
600  ) {
601  $this->tabs_gui->addTab(
602  self::TAB_METADATA,
603  $this->lng->txt('meta_data'),
604  $this->ctrl->getLinkTarget($this, 'editAdvancedSettings')
605  );
606  }
607 
608  parent::getTabs();
609  }
610 
616  public function getSubTabs($a_parent_tab)
617  {
618  switch ($a_parent_tab) {
619  case self::TAB_VIEW_CONTENT:
620  case self::SUBTAB_VIEW_TREE:
621  case 'view':
623  $this->tabs_gui->addSubTab(self::TAB_VIEW_CONTENT, $this->lng->txt("view"), $this->getLinkTarget("view"));
624  }
625 
627  $this->tabs_gui->addSubTab(self::SUBTAB_VIEW_TREE, $this->lng->txt("cntr_manage"), $this->getLinkTarget(self::SUBTAB_VIEW_TREE));
628  }
629  break;
630  case 'settings':
631  $this->tabs_gui->addSubTab('settings', $this->lng->txt('settings'), $this->getLinkTarget('settings'));
632 
633  if ($this->object->isAutoContentApplicable()) {
634  $this->tabs_gui->addSubTab("auto_content", $this->lng->txt("content_automation"), $this->getLinkTarget("auto_content"));
635  }
636 
637  $this->tabs_gui->addSubTab("settings_trans", $this->lng->txt("obj_multilinguality"), $this->ctrl->getLinkTargetByClass("ilobjecttranslationgui", ""));
638  //$this->tabs_gui->addSubTab("edit_translations", $this->lng->txt("obj_multilinguality"), $this->ctrl->getLinkTargetByClass("iltranslationgui", "editTranslations"));
639 
640  $validator = new ilCertificateActiveValidator();
641  if (true === $validator->validate()) {
642  $this->tabs_gui->addSubTabTarget(
643  "certificate",
644  $this->ctrl->getLinkTargetByClass("ilcertificategui", "certificateeditor"),
645  "",
646  "ilcertificategui"
647  );
648  }
649 
650  $this->tabs_gui->addSubTab(
651  'commonSettings',
652  $this->lng->txt("obj_features"),
653  $this->getLinkTarget("commonSettings")
654  );
655  break;
656 
657  case 'members':
658  $this->tabs_gui->addSubTab('edit_participants', $this->lng->txt('edit_participants'), $this->getLinkTarget('members'));
660  $this->tabs_gui->addSubTab('auto_memberships', $this->lng->txt('auto_memberships'), $this->getLinkTarget('memberships'));
661  }
662  break;
663  }
664  }
665 
666 
670  public function setContentSubTabs()
671  {
672  return;
673  }
674 
675 
683  protected function getLinkTarget($a_cmd)
684  {
685  if ($a_cmd == "info_short") {
686  return $this->ctrl->getLinkTargetByClass("ilinfoscreengui", "showSummary");
687  }
688  if ($a_cmd == "settings") {
689  return $this->ctrl->getLinkTargetByClass("ilobjstudyprogrammesettingsgui", "view");
690  }
691  if ($a_cmd == "auto_content") {
692  return $this->ctrl->getLinkTargetByClass("ilObjStudyProgrammeAutoCategoriesGUI", "view");
693  }
694 
695  if ($a_cmd == self::SUBTAB_VIEW_TREE) {
696  return $this->ctrl->getLinkTargetByClass("ilobjstudyprogrammetreegui", "view");
697  }
698  if ($a_cmd == "members") {
699  return $this->ctrl->getLinkTargetByClass("ilobjstudyprogrammemembersgui", "view");
700  }
701  if ($a_cmd == "memberships") {
702  return $this->ctrl->getLinkTargetByClass("ilobjstudyprogrammeautomembershipsgui", "view");
703  }
704  if ($a_cmd == "subtypes") {
705  return $this->ctrl->getLinkTargetByClass("ilstudyprogrammetypegui", "listTypes");
706  }
707  if ($a_cmd == "commonSettings") {
708  return $this->ctrl->getLinkTargetByClass(
709  [
710  "ilobjstudyprogrammesettingsgui",
711  "ilStudyProgrammeCommonSettingsGUI"
712  ],
713  "editSettings"
714  );
715  }
716 
717  return $this->ctrl->getLinkTarget($this, $a_cmd);
718  }
719 
720 
726  protected function fillInfoScreen($a_info_screen)
727  {
728  if (!$this->object->getSettings()->getTypeSettings()->getTypeId() ||
729  !ilStudyProgrammeDIC::dic()['model.Type.ilStudyProgrammeTypeRepository']
730  ->getType($this->object->getSettings()->getTypeSettings()->getTypeId())
731  ) {
732  return;
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($a_info_screen);
742  $record_gui->parse();
743  }
744 
745  protected function edit()
746  {
748 
749  $link = $this->ctrl->getLinkTargetByClass(ilObjStudyProgrammeSettingsGUI::class, 'view');
750  $this->ctrl->redirectToURL($link);
751  }
752 
759  public static function _goto($a_target)
760  {
761  global $DIC;
762  $ilAccess = $DIC['ilAccess'];
763  $ilErr = $DIC['ilErr'];
764  $ilCtrl = $DIC['ilCtrl'];
765  $id = explode("_", $a_target);
766  $ilCtrl->initBaseClass("ilRepositoryGUI");
767  $ilCtrl->setParameterByClass("ilobjstudyprogrammegui", "ref_id", $id[0]);
768 
769  $ilCtrl->redirectByClass(array( "ilRepositoryGUI", "ilobjstudyprogrammegui" ), "view");
770  }
771 
772  public function addToNavigationHistory()
773  {
774  global $DIC;
775  $ilNavigationHistory = $DIC['ilNavigationHistory'];
776 
777  if (!$this->getCreationMode()
779  ) {
780  $link = ilLink::_getLink($_GET["ref_id"], "iass");
781  $ilNavigationHistory->addItem(
782  $_GET['ref_id'],
783  $link,
784  'prg'
785  );
786  }
787  }
788 
789  protected function initHeaderAction($a_sub_type = null, $a_sub_id = null)
790  {
791  $lg = parent::initHeaderAction($a_sub_type, $a_sub_id);
792  $validator = new ilCertificateDownloadValidator();
793  if (true === $validator->isCertificateDownloadable($this->user->getId(), $this->object->getId()) && $lg) {
794  $cert_url = $this->ctrl->getLinkTarget($this, "deliverCertificate");
795  $this->lng->loadLanguageModule("certificate");
796  $lg->addCustomCommand($cert_url, "download_certificate");
797  $lg->addHeaderIcon(
798  "cert_icon",
799  ilUtil::getImagePath("icon_cert.svg"),
800  $this->lng->txt("download_certificate"),
801  null,
802  null,
803  $cert_url
804  );
805  }
806  return $lg;
807  }
808 
809 
810  protected function deliverCertificateObject()
811  {
812  global $DIC;
813 
814  $this->lng->loadLanguageModule('cert');
815 
816  $user_id = (int) $this->user->getId();
817  $obj_id = (int) $this->object->getId();
818 
819  $validator = new ilCertificateDownloadValidator();
820  if (false === $validator->isCertificateDownloadable($user_id, $obj_id)) {
821  ilUtil::sendFailure($this->lng->txt("permission_denied"), true);
822  $this->ctrl->redirect($this);
823  }
824  $repository = new ilUserCertificateRepository();
825  $cert_logger = $DIC->logger()->cert();
826  $pdf_action = new ilCertificatePdfAction(
827  $cert_logger,
828  new ilPdfGenerator($repository, $cert_logger),
830  $this->lng->txt('error_creating_certificate_pdf')
831  );
832  $pdf_action->downloadPdf($user_id, $obj_id);
833  }
834 
835  protected function initTreeJS() : void
836  {
838  }
839 
840  protected function supportsPageEditor() : bool
841  {
842  return false;
843  }
844 }
Class ilPdfGeneratorConstantsTest.
exit
Definition: login.php:29
Class ilInfoScreenGUI.
Class ilObjStudyProgrammeGUI class.
$_SESSION["AccountId"]
This class represents a property form user interface.
setPropertyForm($form)
set property form object
$_GET["client_id"]
static init($a_main_tpl=null)
Init JS.
logging
Definition: class.ilLog.php:18
user()
Definition: user.php:4
help()
Definition: help.php:2
static _goto($a_target)
_goto Deep link
getSubTabs($a_parent_tab)
Adds subtabs based on the parent tab.
const SORT_NEW_ITEMS_POSITION_BOTTOM
static encodeAsyncResponse(array $data=array())
Encode data as json for async output.
setInfoObject($info)
get info sections
getId()
get object id public
getLinkTarget($a_cmd)
Generates a link based on a cmd.
getAsyncCreationForm()
Method for implementing async windows-output Should be moved into core to enable async requests on cr...
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
const SORT_NEW_ITEMS_ORDER_CREATION
Validates if an active certificate is stored in the database and can be downloaded by the user...
global $DIC
Definition: goto.php:24
initHeaderAction($a_sub_type=null, $a_sub_id=null)
redirection script todo: (a better solution should control the processing via a xml file) ...
initCreateForm($a_new_type)
Init object creation form.
static specificDicFor(\ilObjStudyProgramme $prg)
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
Both role and OrgU-based permissions are relevant in many places of the PRG.
Just a wrapper class to create Unit Test for other classes.
setContentSubTabs()
Disable default content subtabs.
fillInfoScreen($a_info_screen)
Adding meta-data to the info-screen.
__construct(Container $dic, ilPlugin $plugin)
getCreationMode()
get creation mode
getRefId()
get reference id public
afterSave(ilObject $a_new_object)
Sets the sorting of the container correctly.
Class ilContainerGUI.
initCreationForms($a_new_type)
Overwritten from ilObjectGUI since copy and import are not implemented.
Class ilAsyncPropertyFormGUI.
New PermissionGUI (extends from old ilPermission2GUI) RBAC related output.
$ilUser
Definition: imgupload.php:18
static redirect($a_script)
addHeaderAction()
Add header action menu.
getReturnLocation($a_cmd, $a_location="")
get return location for command (command is method name without "Object", e.g.
static getInstanceFromAjaxCall()
(Re-)Build instance from ajax call
GUI class for object translation handling.
static handleAsyncOutput($normal_content, $async_content=null, $apply_to_tpl=true)
Handles async output.
downloadPdf(int $userId, int $objectId)