ILIAS  release_8 Revision v8.24
class.ilCertificateGUIFactory.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
22
27{
28 private Container $dic;
29
30 public function __construct(?Container $dic = null)
31 {
32 if (null === $dic) {
33 global $DIC;
34 $dic = $DIC;
35 }
36 $this->dic = $dic;
37 }
38
44 public function create(ilObject $object): ilCertificateGUI
45 {
46 global $DIC;
47
48 $type = $object->getType();
49 $objectId = $object->getId();
50
51 $logger = $DIC->logger()->cert();
52
53 $templateRepository = new ilCertificateTemplateDatabaseRepository($this->dic->database(), $logger);
54 $deleteAction = new ilCertificateTemplateDeleteAction($templateRepository);
55 $pathFactory = new ilCertificatePathFactory();
56
57 $certificatePath = $pathFactory->create($object);
58
59 switch ($type) {
60 case 'tst':
61 $placeholderDescriptionObject = new ilTestPlaceholderDescription();
62 $placeholderValuesObject = new ilTestPlaceholderValues();
63
65 $objectId,
66 $certificatePath,
67 false,
68 $object,
69 $DIC->language(),
70 $DIC->ctrl(),
71 $DIC->access(),
72 $DIC->toolbar(),
73 $placeholderDescriptionObject
74 );
75
76 $deleteAction = new ilCertificateTestTemplateDeleteAction(
77 $deleteAction,
79 );
80
81 break;
82 case 'crs':
83 $hasAdditionalElements = true;
84
85 $placeholderDescriptionObject = new ilCoursePlaceholderDescription($objectId);
86 $placeholderValuesObject = new ilCoursePlaceholderValues();
87
89 $object,
90 $certificatePath,
91 false,
92 $DIC->language(),
93 $DIC->ctrl(),
94 $DIC->access(),
95 $DIC->toolbar(),
96 $placeholderDescriptionObject
97 );
98
99 break;
100 case 'exc':
101 $placeholderDescriptionObject = new ilExercisePlaceholderDescription();
102 $placeholderValuesObject = new ilExercisePlaceholderValues();
103
105 $object,
106 $certificatePath,
107 false,
108 $DIC->language(),
109 $DIC->ctrl(),
110 $DIC->access(),
111 $DIC->toolbar(),
112 $placeholderDescriptionObject
113 );
114
115 break;
116 case 'sahs':
117 $placeholderDescriptionObject = new ilScormPlaceholderDescription($object);
118 $placeholderValuesObject = new ilScormPlaceholderValues();
119
121 $object,
122 $certificatePath,
123 true,
124 $DIC->language(),
125 $DIC->ctrl(),
126 $DIC->access(),
127 $DIC->toolbar(),
128 $placeholderDescriptionObject
129 );
130 break;
131 case 'lti':
132 $placeholderDescriptionObject = new ilLTIConsumerPlaceholderDescription();
133 $placeholderValuesObject = new ilLTIConsumerPlaceholderValues();
134
136 $object,
137 $certificatePath,
138 true,
139 $DIC->language(),
140 $DIC->ctrl(),
141 $DIC->access(),
142 $DIC->toolbar(),
143 $placeholderDescriptionObject
144 );
145 break;
146 case 'cmix':
147 $placeholderDescriptionObject = new ilCmiXapiPlaceholderDescription();
148 $placeholderValuesObject = new ilCmiXapiPlaceholderValues();
149
151 $object,
152 $certificatePath,
153 true,
154 $DIC->language(),
155 $DIC->ctrl(),
156 $DIC->access(),
157 $DIC->toolbar(),
158 $placeholderDescriptionObject
159 );
160 break;
161 case 'prg':
162 $placeholderDescriptionObject =
164 $placeholderValuesObject =
167 $object,
168 $certificatePath,
169 false,
170 $DIC->language(),
171 $DIC->ctrl(),
172 $DIC->access(),
173 $DIC->toolbar(),
174 $placeholderDescriptionObject
175 );
176 break;
177 default:
178 throw new ilException(sprintf('The type "%s" is currently not defined for certificates', $type));
179 }
180
181 return new ilCertificateGUI(
182 $placeholderDescriptionObject,
183 $placeholderValuesObject,
184 $objectId,
185 $certificatePath,
186 $formFactory,
187 $deleteAction
188 );
189 }
190}
Customizing of pimple-DIC for ILIAS.
Definition: Container.php:32
GUI class to create PDF certificates.
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
$type