ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
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
5require_once("./Services/Container/classes/class.ilContainerGUI.php");
6require_once("./Services/AccessControl/classes/class.ilObjRole.php");
7require_once("./Services/Form/classes/class.ilPropertyFormGUI.php");
8require_once("./Services/AccessControl/classes/class.ilPermissionGUI.php");
9require_once("./Services/InfoScreen/classes/class.ilInfoScreenGUI.php");
10require_once("./Services/Object/classes/class.ilObjectAddNewItemGUI.php");
11require_once("./Modules/StudyProgramme/classes/class.ilObjStudyProgrammeTreeGUI.php");
12require_once('./Services/Container/classes/class.ilContainerSortingSettings.php');
13require_once("./Modules/StudyProgramme/classes/types/class.ilStudyProgrammeTypeGUI.php");
14require_once("./Services/AdvancedMetaData/classes/class.ilAdvancedMDRecordGUI.php");
15require_once("./Services/Object/classes/class.ilObjectCopyGUI.php");
16require_once("./Services/Repository/classes/class.ilRepUtil.php");
17
38{
42 public $ctrl;
43
47 public $tpl;
48
52 public $tabs_gui;
53
57 protected $ilAccess;
58
62 protected $toolbar;
63
67 protected $ilLocator;
68
72 public $tree;
73
77 public $object;
78
82 protected $ilLog;
83
87 public $ilias;
88
92 protected $help;
93
97 protected $settings_gui;
98
102 protected $members_gui;
103
108
112 protected $tree_gui;
113
117 protected $type_gui;
118
123
128
129
130 public function __construct()
131 {
132 global $DIC;
133 $tpl = $DIC['tpl'];
134 $ilCtrl = $DIC['ilCtrl'];
135 $ilAccess = $DIC['ilAccess'];
136 $ilToolbar = $DIC['ilToolbar'];
137 $ilLocator = $DIC['ilLocator'];
138 $tree = $DIC['tree'];
139 $lng = $DIC['lng'];
140 $ilLog = $DIC['ilLog'];
141 $ilias = $DIC['ilias'];
142 $ilHelp = $DIC['ilHelp'];
143 $ilUser = $DIC['ilUser'];
144
145 parent::__construct(array(), (int) $_GET['ref_id'], true, false);
146
147 $this->tpl = $tpl;
148 $this->ctrl = $ilCtrl;
149 $this->ilAccess = $ilAccess;
150 $this->ilLocator = $ilLocator;
151 $this->tree = $tree;
152 $this->toolbar = $ilToolbar;
153 $this->ilLog = $ilLog;
154 $this->ilias = $ilias;
155 $this->type = "prg";
156 $this->help = $ilHelp;
157 $this->user = $ilUser;
158
159 $lng->loadLanguageModule("prg");
160
161 $this->settings_gui = ilStudyProgrammeDIC::dic()['ilObjStudyProgrammeSettingsGUI'];
162 $this->members_gui = ilStudyProgrammeDIC::dic()['ilObjStudyProgrammeMembersGUI'];
163 $this->memberships_gui = ilStudyProgrammeDIC::dic()['ilObjStudyProgrammeAutoMembershipsGUI'];
164 $this->tree_gui = ilStudyProgrammeDIC::dic()['ilObjStudyProgrammeTreeGUI'];
165 $this->type_gui = ilStudyProgrammeDIC::dic()['ilStudyProgrammeTypeGUI'];
166 $this->autocategories_gui = ilStudyProgrammeDIC::dic()['ilObjStudyProgrammeAutoCategoriesGUI'];
167
168 $this->type_repository = ilStudyProgrammeDIC::dic()['model.Type.ilStudyProgrammeTypeRepository'];
169 }
170
171
172 public function executeCommand()
173 {
174 $cmd = $this->ctrl->getCmd();
175 $next_class = $this->ctrl->getNextClass($this);
176
177 if ($cmd == "") {
178 $cmd = "view";
179 }
180
181 $this->addToNavigationHistory();
182
183 parent::prepareOutput();
184
185 $this->addHeaderAction();
186
187 switch ($next_class) {
188 case "ilinfoscreengui":
189 $this->tabs_gui->activateTab(self::TAB_INFO);
190 $this->denyAccessIfNotAnyOf(array("read", "visible"));
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":
215 $this->denyAccessIfNot("write");
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":
224 $this->denyAccessIfNot("write");
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":
247 $this->denyAccessIfNot("manage_members");
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":
261 $this->denyAccessIfNot("write");
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':
285 $this->denyAccessIfNot("write");
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');
294 $this->denyAccessIfNot("write");
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 false:
302 $this->getSubTabs($cmd);
303 switch ($cmd) {
304 case "cancelDelete":
305 $cmd = "view";
306 // no break
307 case "create":
308 case "save":
309 case "view":
310 case "cancel":
311 case "edit":
312 $this->$cmd();
313 break;
314 case "delete":
315 $this->tabs_gui->clearTargets();
316 $this->tabs_gui->setBackTarget($this->lng->txt("back"), $this->ctrl->getLinkTarget($this));
317 parent::deleteObject();
318 break;
319 case 'confirmedDelete':
320 parent::confirmedDeleteObject();
321 break;
322 case 'editAdvancedSettings':
323 $this->tabs_gui->activateTab("settings");
324 $this->tabs_gui->activateSubTab('edit_advanced_settings');
325 $this->editAdvancedSettings();
326 break;
327 case 'updateAdvancedSettings':
328 $this->tabs_gui->activateTab("settings");
329 $this->tabs_gui->activateSubTab('edit_advanced_settings');
330 $this->updateAdvancedSettings();
331 break;
332 case "infoScreen":
333 $this->ctrl->redirectByClass("ilInfoScreenGUI", "showSummary");
334 break;
335 case 'getAsynchItemList':
336 parent::getAsynchItemListObject();
337 break;
338 case 'trash':
339 case 'undelete':
340 case 'confirmRemoveFromSystem':
341 case 'removeFromSystem':
342 case 'deliverCertificate':
343 case 'addToDesk':
344 case 'removeFromDesk':
345 $cmd .= "Object";
346 $this->$cmd();
347 break;
348 default:
349 throw new ilException("ilObjStudyProgrammeGUI: Command not supported: $cmd");
350 }
351 break;
352
353 default:
354 throw new ilException("ilObjStudyProgrammeGUI: Can't forward to next class $next_class");
355 }
356 }
357
358
362 protected function create()
363 {
364 parent::createObject();
365 }
366
367
373 protected function save()
374 {
375 parent::saveObject();
376
377 if ($this->ctrl->isAsynch()) {
378 $form = $this->getAsyncCreationForm();
379 $form->setValuesByPost();
380 echo ilAsyncOutputHandler::encodeAsyncResponse(array("cmd" => $this->ctrl->getCmd(), "success" => false, "errors" => $form->getErrors()));
381 exit();
382 }
383 }
384
385
391 protected function cancel()
392 {
393 $async_response = ilAsyncOutputHandler::encodeAsyncResponse(array("cmd" => "cancel", "success" => false));
394
395 ilAsyncOutputHandler::handleAsyncOutput("", $async_response, false);
396
397 parent::cancelCreation();
398 }
399
400
407 protected function afterSave(ilObject $a_new_object)
408 {
409 // set default sort to manual
410 $settings = new ilContainerSortingSettings($a_new_object->getId());
415 $settings->save();
416
417 $async_response = ilAsyncOutputHandler::encodeAsyncResponse(array("cmd" => "cancel", "success" => true, "message" => $this->lng->txt("object_added")));
418
419 ilAsyncOutputHandler::handleAsyncOutput("", $async_response, false);
420
421 ilUtil::sendSuccess($this->lng->txt("object_added"), true);
422
423 $this->ctrl->setParameter($this, "ref_id", $a_new_object->getRefId());
425 "save",
426 $this->ctrl->getLinkTarget($this, "edit", "", false, false)
427 ));
428 }
429
430
434 protected function view()
435 {
436 $this->denyAccessIfNot("read");
437 $this->tabs_gui->activateTab(self::TAB_VIEW_CONTENT);
438 parent::renderObject();
439 }
441 {
442 return false;
443 }
444
445
451 protected function initAdvancedSettingsForm()
452 {
453 $form = new ilPropertyFormGUI();
454 $form->setFormAction($this->ctrl->getFormAction($this));
455 $form->addCommandButton('updateAdvancedSettings', $this->lng->txt('save'));
456 $form->addCommandButton('editAdvancedSettings', $this->lng->txt('cancel'));
457
458 return $form;
459 }
460
464 protected function editAdvancedSettings()
465 {
466 if (!$this->ilAccess->checkAccess("write", "", $this->ref_id)) {
467 ilUtil::sendFailure($this->lng->txt("permission_denied"), true);
468 $this->ctrl->redirect($this);
469 }
470 $form = $this->initAdvancedSettingsForm();
471 $gui = new ilAdvancedMDRecordGUI(
473 'prg',
474 $this->object->getId(),
475 'prg_type',
476 $this->object->getTypeSettings()->getTypeId()
477 );
478 $gui->setPropertyForm($form);
479 $gui->parse();
480 $this->tpl->setContent($form->getHTML());
481 }
482
486 protected function updateAdvancedSettings()
487 {
488 if (!$this->ilAccess->checkAccess("write", "", $this->ref_id)) {
489 ilUtil::sendFailure($this->lng->txt("permission_denied"), true);
490 $this->ctrl->redirect($this);
491 }
492
493 $form = $this->initAdvancedSettingsForm();
494 $gui = new ilAdvancedMDRecordGUI(
496 'prg',
497 $this->object->getId(),
498 'prg_type',
499 $this->object->getTypeSettings()->getTypeId()
500 );
501 $gui->setPropertyForm($form);
502 $form->checkInput();
503 $gui->parse();
504 if ($gui->importEditFormPostValues()) {
505 $gui->writeEditForm();
506 ilUtil::sendSuccess($this->lng->txt('settings_saved'), true);
507 $this->ctrl->redirect($this, 'editAdvancedSettings');
508 } else {
509 $this->tpl->setContent($form->getHTML());
510 }
511 }
512
513
521 protected function initCreationForms($a_new_type)
522 {
523 return array( self::CFORM_NEW => $this->initCreateForm($a_new_type));
524 }
525
526
533 public function getAsyncCreationForm()
534 {
535 $asyncForm = new ilAsyncPropertyFormGUI();
536
537 $tmp_forms = $this->initCreationForms('prg');
538 $asyncForm->cloneForm($tmp_forms[self::CFORM_NEW]);
539 $asyncForm->setAsync(true);
540
541 return $asyncForm;
542 }
543
545 // HELPERS
547
548 protected function checkAccess($a_which)
549 {
550 return $this->ilAccess->checkAccess($a_which, "", $this->ref_id);
551 }
552
553 protected function denyAccessIfNot($a_perm, $position_permission = null)
554 {
555 $perm = array($a_perm);
556 if (!is_null($position_permission)) {
557 $position_permission = array($position_permission);
558 }
559
560 return $this->denyAccessIfNotAnyOf($perm, $position_permission);
561 }
562
563 protected function denyAccessIfNotAnyOf($a_perms, $position_permissions = null)
564 {
565 foreach ($a_perms as $perm) {
566 if ($this->checkAccess($perm)) {
567 return;
568 }
569 }
570 if (!is_null($position_permissions)) {
571 $ref_id = (int) $this->object->getRefId();
572 foreach ($position_permissions as $perm) {
573 if ($this->ilAccess->checkPositionAccess($perm, $ref_id)) {
574 return true;
575 }
576 }
577 }
578
579 if ($this->checkAccess("visible")) {
580 ilUtil::sendFailure($this->lng->txt("msg_no_perm_write"));
581 $this->ctrl->redirectByClass('ilinfoscreengui', '');
582 }
583
584 $this->ilias->raiseError($this->lng->txt("msg_no_perm_read"), $this->ilias->error_obj->WARNING);
585 }
586
587 const TAB_VIEW_CONTENT = "view_content";
588 const SUBTAB_VIEW_TREE = "view_tree";
589 const TAB_INFO = "info_short";
590 const TAB_SETTINGS = "settings";
591 const TAB_MEMBERS = "members";
592 const TAB_SUBTYPES = "subtypes";
593
597 public function getTabs()
598 {
599 $this->help->setScreenIdComponent("prg");
600 if ($this->checkAccess("read")) {
601 $this->tabs_gui->addTab(self::TAB_VIEW_CONTENT, $this->lng->txt("content"), $this->getLinkTarget("view"));
602 }
603
604 if ($this->checkAccess("read")) {
605 $this->tabs_gui->addTab(
606 self::TAB_INFO,
607 $this->lng->txt("info_short"),
608 $this->getLinkTarget("info_short")
609 );
610 }
611
612 if ($this->checkAccess("write")) {
613 $this->tabs_gui->addTab(
614 self::TAB_SETTINGS,
615 $this->lng->txt("settings"),
616 $this->getLinkTarget("settings")
617 );
618 }
619
620 if (
621 $this->checkAccess("manage_members") ||
624 (int) $this->object->getRefId()
625 )
626 ) {
627 $this->tabs_gui->addTab(
628 self::TAB_MEMBERS,
629 $this->lng->txt("members"),
630 $this->getLinkTarget("members")
631 );
632 }
633 parent::getTabs();
634 }
635
641 public function getSubTabs($a_parent_tab)
642 {
643 switch ($a_parent_tab) {
646 case 'view':
647 if ($this->checkAccess("read")) {
648 $this->tabs_gui->addSubTab(self::TAB_VIEW_CONTENT, $this->lng->txt("view"), $this->getLinkTarget("view"));
649 }
650
651 if ($this->checkAccess("write")) {
652 $this->tabs_gui->addSubTab(self::SUBTAB_VIEW_TREE, $this->lng->txt("cntr_manage"), $this->getLinkTarget(self::SUBTAB_VIEW_TREE));
653 }
654 break;
655 case 'settings':
656 case 'editAdvancedSettings':
657 $this->tabs_gui->addSubTab('settings', $this->lng->txt('settings'), $this->getLinkTarget('settings'));
658
659 if ($this->object->isAutoContentApplicable()) {
660 $this->tabs_gui->addSubTab("auto_content", $this->lng->txt("content_automation"), $this->getLinkTarget("auto_content"));
661 }
662
663 $this->tabs_gui->addSubTab("settings_trans", $this->lng->txt("obj_multilinguality"), $this->ctrl->getLinkTargetByClass("ilobjecttranslationgui", ""));
664 //$this->tabs_gui->addSubTab("edit_translations", $this->lng->txt("obj_multilinguality"), $this->ctrl->getLinkTargetByClass("iltranslationgui", "editTranslations"));
665
666 $sub_type_id = $this->object->getTypeSettings()->getTypeId();
667 if ($sub_type_id) {
668 $type = $this->type_repository->readType($sub_type_id);
669 }
670 if (
671 !is_null($type) &&
672 count(
673 $this->type_repository->readAssignedAMDRecordIdsByType(
674 $type->getId(),
675 true
676 )
677 ) > 0
678 ) {
679 $this->tabs_gui->addSubTab('edit_advanced_settings', $this->lng->txt('meta_data'), $this->ctrl->getLinkTarget($this, 'editAdvancedSettings'));
680 }
681 $validator = new ilCertificateActiveValidator();
682 if (true === $validator->validate()) {
683 $this->tabs_gui->addSubTabTarget(
684 "certificate",
685 $this->ctrl->getLinkTargetByClass("ilcertificategui", "certificateeditor"),
686 "",
687 "ilcertificategui"
688 );
689 }
690
691 $this->tabs_gui->addSubTab(
692 'commonSettings',
693 $this->lng->txt("obj_features"),
694 $this->getLinkTarget("commonSettings")
695 );
696 break;
697
698 case 'members':
699 $this->tabs_gui->addSubTab('edit_participants', $this->lng->txt('edit_participants'), $this->getLinkTarget('members'));
700 $this->tabs_gui->addSubTab('auto_memberships', $this->lng->txt('auto_memberships'), $this->getLinkTarget('memberships'));
701 break;
702 }
703 }
704
705
709 public function setContentSubTabs()
710 {
711 return;
712 }
713
714
722 protected function getLinkTarget($a_cmd)
723 {
724 if ($a_cmd == "info_short") {
725 return $this->ctrl->getLinkTargetByClass("ilinfoscreengui", "showSummary");
726 }
727 if ($a_cmd == "settings") {
728 return $this->ctrl->getLinkTargetByClass("ilobjstudyprogrammesettingsgui", "view");
729 }
730 if ($a_cmd == "auto_content") {
731 return $this->ctrl->getLinkTargetByClass("ilObjStudyProgrammeAutoCategoriesGUI", "view");
732 }
733
734 if ($a_cmd == self::SUBTAB_VIEW_TREE) {
735 return $this->ctrl->getLinkTargetByClass("ilobjstudyprogrammetreegui", "view");
736 }
737 if ($a_cmd == "members") {
738 return $this->ctrl->getLinkTargetByClass("ilobjstudyprogrammemembersgui", "view");
739 }
740 if ($a_cmd == "memberships") {
741 return $this->ctrl->getLinkTargetByClass("ilobjstudyprogrammeautomembershipsgui", "view");
742 }
743 if ($a_cmd == "subtypes") {
744 return $this->ctrl->getLinkTargetByClass("ilstudyprogrammetypegui", "listTypes");
745 }
746 if ($a_cmd == "commonSettings") {
747 return $this->ctrl->getLinkTargetByClass(
748 [
749 "ilobjstudyprogrammesettingsgui",
750 "ilStudyProgrammeCommonSettingsGUI"
751 ],
752 "editSettings"
753 );
754 }
755
756 return $this->ctrl->getLinkTarget($this, $a_cmd);
757 }
758
759
765 protected function fillInfoScreen($a_info_screen)
766 {
767 if (!$this->object->getTypeSettings()->getTypeId() ||
768 !ilStudyProgrammeDIC::dic()['model.Type.ilStudyProgrammeTypeRepository']
769 ->readType($this->object->getTypeSettings()->getTypeId())
770 ) {
771 return;
772 }
773 $record_gui = new ilAdvancedMDRecordGUI(
775 'prg',
776 $this->object->getId(),
777 'prg_type',
778 $this->object->getTypeSettings()->getTypeId()
779 );
780 $record_gui->setInfoObject($a_info_screen);
781 $record_gui->parse();
782 }
783
784 protected function edit()
785 {
786 $this->denyAccessIfNot("write");
787
788 $link = $this->ctrl->getLinkTargetByClass(ilObjStudyProgrammeSettingsGUI::class, 'view');
789 $this->ctrl->redirectToURL($link);
790 }
791
798 public static function _goto($a_target)
799 {
800 global $DIC;
801 $ilAccess = $DIC['ilAccess'];
802 $ilErr = $DIC['ilErr'];
803 $ilCtrl = $DIC['ilCtrl'];
804 $id = explode("_", $a_target);
805 $ilCtrl->initBaseClass("ilRepositoryGUI");
806 $ilCtrl->setParameterByClass("ilobjstudyprogrammegui", "ref_id", $id[0]);
807
808 $ilCtrl->redirectByClass(array( "ilRepositoryGUI", "ilobjstudyprogrammegui" ), "view");
809 }
810
811 public function addToNavigationHistory()
812 {
813 global $DIC;
814 $ilNavigationHistory = $DIC['ilNavigationHistory'];
815
816 if (!$this->getCreationMode() &&
817 $this->ilAccess->checkAccess('read', '', $_GET['ref_id'])) {
818 $link = ilLink::_getLink($_GET["ref_id"], "iass");
819
820 $ilNavigationHistory->addItem(
821 $_GET['ref_id'],
822 $link,
823 'prg'
824 );
825 }
826 }
827
828 protected function initHeaderAction($a_sub_type = null, $a_sub_id = null)
829 {
830 $lg = parent::initHeaderAction($a_sub_type, $a_sub_id);
831 $validator = new ilCertificateDownloadValidator();
832 if (true === $validator->isCertificateDownloadable($this->user->getId(), $this->object->getId()) && $lg) {
833 $cert_url = $this->ctrl->getLinkTarget($this, "deliverCertificate");
834 $this->lng->loadLanguageModule("certificate");
835 $lg->addCustomCommand($cert_url, "download_certificate");
836 $lg->addHeaderIcon(
837 "cert_icon",
838 ilUtil::getImagePath("icon_cert.svg"),
839 $this->lng->txt("download_certificate"),
840 null,
841 null,
842 $cert_url
843 );
844 }
845 return $lg;
846 }
847
848
849 protected function deliverCertificateObject()
850 {
851 global $DIC;
852
853 $user_id = (int) $this->user->getId();
854 $obj_id = (int) $this->object->getId();
855
856 $validator = new ilCertificateDownloadValidator();
857 if (false === $validator->isCertificateDownloadable($user_id, $obj_id)) {
858 ilUtil::sendFailure($this->lng->txt("permission_denied"), true);
859 $this->ctrl->redirect($this);
860 }
861 $repository = new ilUserCertificateRepository();
862 $cert_logger = $DIC->logger()->cert();
863 $pdf_action = new ilCertificatePdfAction(
864 $cert_logger,
865 new ilPdfGenerator($repository, $cert_logger),
867 $this->lng->txt('error_creating_certificate_pdf')
868 );
869 $pdf_action->downloadPdf($user_id, $obj_id);
870 }
871
872 protected function initTreeJS() : void
873 {
875 }
876}
user()
Definition: user.php:4
$_GET["client_id"]
$_SESSION["AccountId"]
An exception for terminatinating execution or to throw for unit testing.
Class ilAccessHandler.
checkPositionAccess($pos_perm, $ref_id)
getAvailablePositionRelatedPermissions for available permissionsbool
checkAccess($a_permission, $a_cmd, $a_ref_id, $a_type="", $a_obj_id="", $a_tree_id="")
check access for an object (provide $a_type and $a_obj_id if available for better performance)
static handleAsyncOutput($normal_content, $async_content=null, $apply_to_tpl=true)
Handles async output.
static encodeAsyncResponse(array $data=array())
Encode data as json for async output.
Class ilAsyncPropertyFormGUI.
Validates if an active certificate is stored in the database and can be downloaded by the user.
Just a wrapper class to create Unit Test for other classes.
static getInstanceFromAjaxCall()
(Re-)Build instance from ajax call
Class ilContainerGUI.
const SORT_NEW_ITEMS_ORDER_CREATION
const SORT_NEW_ITEMS_POSITION_BOTTOM
Base class for ILIAS Exception handling.
static init($a_main_tpl=null)
Init JS.
Class ilInfoScreenGUI.
logging
Definition: class.ilLog.php:19
Class ilObjStudyProgrammeGUI class.
initAdvancedSettingsForm()
Initialize the form for editing advanced meta data.
getSubTabs($a_parent_tab)
Adds subtabs based on the parent tab.
cancel()
Cancel the object generation.
updateAdvancedSettings()
Update Advanced Metadata.
executeCommand()
execute command note: this method is overwritten in all container objects
fillInfoScreen($a_info_screen)
Adding meta-data to the info-screen.
getLinkTarget($a_cmd)
Generates a link based on a cmd.
editAdvancedSettings()
Edit Advanced Metadata.
getAsyncCreationForm()
Method for implementing async windows-output Should be moved into core to enable async requests on cr...
getTabs()
Adds the default tabs to the gui.
static _goto($a_target)
_goto Deep link
denyAccessIfNot($a_perm, $position_permission=null)
initHeaderAction($a_sub_type=null, $a_sub_id=null)
Add file manager link.
denyAccessIfNotAnyOf($a_perms, $position_permissions=null)
setContentSubTabs()
Disable default content subtabs.
initCreationForms($a_new_type)
Overwritten from ilObjectGUI since copy and import are not implemented.
afterSave(ilObject $a_new_object)
After save hook Sets the sorting of the container correctly.
initCreateForm($a_new_type)
Init object creation form.
getReturnLocation($a_cmd, $a_location="")
get return location for command (command is method name without "Object", e.g.
getCreationMode()
get creation mode
addHeaderAction()
Add header action menu.
GUI class for object translation handling.
Class ilObject Basic functions for all objects.
getRefId()
get reference id @access public
getId()
get object id @access public
New PermissionGUI (extends from old ilPermission2GUI) RBAC related output.
This class represents a property form user interface.
static redirect($a_script)
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
help()
Definition: help.php:2
global $ilCtrl
Definition: ilias.php:18
exit
Definition: login.php:29
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
Class ilPdfGeneratorConstantsTest.
redirection script todo: (a better solution should control the processing via a xml file)
$type
$ilUser
Definition: imgupload.php:18
$DIC
Definition: xapitoken.php:46