ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
class.ilCertificateGUIFactory.php
Go to the documentation of this file.
1<?php
2/* Copyright (c) 1998-2018 ILIAS open source, Extended GPL, see docs/LICENSE */
3
8{
12 private $dic;
13
17 public function __construct(\ILIAS\DI\Container $dic = null)
18 {
19 if (null === $dic) {
20 global $DIC;
21 $dic = $DIC;
22 }
23 $this->dic = $dic;
24 }
25
31 public function create(\ilObject $object) : ilCertificateGUI
32 {
33 global $DIC;
34
35 $type = $object->getType();
36 $objectId = $object->getId();
37
38 $logger = $DIC->logger()->cert();
39
40 $templateRepository = new ilCertificateTemplateRepository($this->dic->database(), $logger);
41 $deleteAction = new ilCertificateTemplateDeleteAction($templateRepository);
42
43 switch ($type) {
44 case 'tst':
45 $placeholderDescriptionObject = new ilTestPlaceholderDescription();
46 $placeholderValuesObject = new ilTestPlaceholderValues();
47 $adapter = new ilTestCertificateAdapter($object);
48
49 $certificatePath = ilCertificatePathConstants::TEST_PATH . $objectId . '/';
50
52 $objectId,
53 $certificatePath,
54 $object,
55 $DIC->language(),
56 $DIC->ui()->mainTemplate(),
57 $DIC->ctrl(),
58 $DIC->access(),
59 $DIC->toolbar(),
60 $placeholderDescriptionObject
61 );
62
63 $certificatePath = ilCertificatePathConstants::TEST_PATH . $objectId . '/';
64
65 $deleteAction = new ilCertificateTestTemplateDeleteAction(
66 $deleteAction,
68 );
69
70 break;
71 case 'crs':
72 $adapter = new ilCourseCertificateAdapter($object);
73 $placeholderDescriptionObject = new ilCoursePlaceholderDescription();
74 $placeholderValuesObject = new ilCoursePlaceholderValues();
75
76 $certificatePath = ilCertificatePathConstants::COURSE_PATH . $objectId . '/';
77
79 $object,
80 $certificatePath,
81 $DIC->language(),
82 $DIC->ui()->mainTemplate(),
83 $DIC->ctrl(),
84 $DIC->access(),
85 $DIC->toolbar(),
86 $placeholderDescriptionObject
87 );
88
89 $certificatePath = ilCertificatePathConstants::COURSE_PATH . $objectId . '/';
90 break;
91 case 'exc':
92 $adapter = new ilExerciseCertificateAdapter($object);
93 $placeholderDescriptionObject = new ilExercisePlaceholderDescription();
94 $placeholderValuesObject = new ilExercisePlaceholderValues();
95
96 $certificatePath = ilCertificatePathConstants::EXERCISE_PATH . $objectId . '/';
97
99 $object,
100 $certificatePath,
101 $DIC->language(),
102 $DIC->ui()->mainTemplate(),
103 $DIC->ctrl(),
104 $DIC->access(),
105 $DIC->toolbar(),
106 $placeholderDescriptionObject
107 );
108
109 $certificatePath = ilCertificatePathConstants::EXERCISE_PATH . $objectId . '/';
110 break;
111 case 'sahs':
112 $adapter = new ilSCORMCertificateAdapter($object);
113 $placeholderDescriptionObject = new ilScormPlaceholderDescription($object);
114 $placeholderValuesObject = new ilScormPlaceholderValues();
115
116 $certificatePath = ilCertificatePathConstants::SCORM_PATH . $objectId . '/';
117
119 $object,
120 $certificatePath,
121 $DIC->language(),
122 $DIC->ui()->mainTemplate(),
123 $DIC->ctrl(),
124 $DIC->access(),
125 $DIC->toolbar(),
126 $placeholderDescriptionObject
127 );
128
129 $certificatePath = ilCertificatePathConstants::SCORM_PATH . $objectId . '/';
130
131 break;
132 default:
133 throw new ilException(sprintf('The type "%s" is currently not defined for certificates', $type));
134 break;
135 }
136
137 $gui = new ilCertificateGUI(
138 $adapter,
139 $placeholderDescriptionObject,
140 $placeholderValuesObject,
141 $objectId,
142 $certificatePath,
143 $formFactory,
144 $deleteAction
145 );
146
147 return $gui;
148 }
149}
An exception for terminatinating execution or to throw for unit testing.
__construct(\ILIAS\DI\Container $dic=null)
GUI class to create PDF certificates.
Base class for ILIAS Exception handling.
Class ilObject Basic functions for all objects.
getType()
get object type @access public
getId()
get object id @access public
Class HTTPServicesTest.
Class BaseForm.
$type
global $DIC
Definition: saml.php:7