3 declare(strict_types=1);
34 string $a_hier_id =
'0',
39 $this->
user = $DIC->user();
45 $cmd = $this->
ctrl->getCmd();
56 $this->tpl->setContent($a_form->getHTML());
66 $this->tpl->setContent($a_form->getHTML());
80 foreach ($tree->getSubTree($root) as $node) {
81 if (in_array($node[
'type'], self::SUPPORTED_TYPES,
true)) {
82 $nodes[$node[
'obj_id']] = $node;
99 $activeCertificates = $repository->fetchActiveCertificates($this->
user->getId());
100 foreach ($activeCertificates as $certificate) {
101 $certificates[$certificate->getObjId()] = $certificate;
104 return $certificates;
109 $this->
lng->loadLanguageModule(
'wsp');
112 $form->setFormAction($this->
ctrl->getFormAction($this));
116 $form->setTitle($this->
lng->txt(
'cont_insert_verification'));
117 $form->addCommandButton(
'create_verification', $this->
lng->txt(
'save'));
118 $form->addCommandButton(
'cancelCreate', $this->
lng->txt(
'cancel'));
120 $form->setTitle($this->
lng->txt(
'cont_update_verification'));
121 $form->addCommandButton(
'update', $this->
lng->txt(
'save'));
122 $form->addCommandButton(
'cancelUpdate', $this->
lng->txt(
'cancel'));
123 $data = $this->content_obj->getData();
126 $certificateOptions = [];
128 $userCertificate = $certificate->getUserCertificate();
130 $userCertificate->getAcquiredTimestamp(),
134 $type = $this->
lng->txt(
'wsp_type_' . $userCertificate->getObjType() .
'v');
135 if (
'sahs' === $userCertificate->getObjType()) {
136 $type = $this->
lng->txt(
'wsp_type_scov');
138 $additionalInformation =
' (' .
$type .
' / ' . $dateTime .
')';
139 $certificateOptions[$userCertificate->getObjId()] = $certificate->getObjectTitle() . $additionalInformation;
142 if ($a_insert || (isset(
$data[
'type']) &&
'crta' ===
$data[
'type'])) {
144 $certificate->setRequired(
true);
145 $certificate->setOptions($certificateOptions);
146 $form->addItem($certificate);
147 if (isset(
$data[
'id'])) {
148 $certificate->setValue(
$data[
'id']);
155 $this->
lng->txt(
'certificate_selection'),
156 'certificate_selection' 160 $this->
lng->txt(
'certificate_workspace_option'),
161 'certificate_workspace_option' 164 $this->
lng->txt(
'certificate_persistent_option'),
165 'certificate_persistent_option' 168 $workspaceCertificates =
new ilSelectInputGUI($this->
lng->txt(
'cont_verification_object'),
'object');
169 $workspaceCertificates->setRequired(
true);
170 $workspaceOptions = [];
172 $workspaceOptions[$node[
'obj_id']] = $node[
'title'] .
' (' . $this->
lng->txt(
'wsp_type_' . $node[
'type']) .
')';
174 asort($workspaceOptions);
175 $workspaceCertificates->setOptions($workspaceOptions);
177 $certificate =
new ilSelectInputGUI($this->
lng->txt(
'cont_verification_object'),
'persistent_object');
178 $certificate->setRequired(
true);
179 $certificate->setOptions($certificateOptions);
180 $persistentRadioButton->
addSubItem($certificate);
181 $workspaceRadioButton->
addSubItem($workspaceCertificates);
183 $certificateSource->addOption($persistentRadioButton);
184 $certificateSource->addOption($workspaceRadioButton);
186 $form->addItem($certificateSource);
188 $certificateSource->setValue(
'certificate_workspace_option');
197 if ($form->checkInput()) {
198 $objectId = (
int) $form->getInput(
'persistent_object');
199 $userId = $this->
user->getId();
203 $certificateFileService->createCertificateFile($userId, $objectId);
205 $this->tpl->setOnScreenMessage(
'info', $this->
lng->txt(
'certificate_file_not_found_error'),
true);
206 $this->log->warning($e->getMessage());
208 $this->tpl->setOnScreenMessage(
'info', $this->
lng->txt(
'certificate_file_input_output_error'),
true);
209 $this->log->error($e->getMessage());
210 $this->
ctrl->redirect($this,
'initForm');
212 $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
'error_creating_certificate_pdf'),
true);
213 $this->log->error($e->getMessage());
214 $this->
ctrl->redirect($this,
'initForm');
218 $this->content_obj->create($this->pg_obj, $this->hier_id, $this->pc_id);
219 $this->content_obj->setData(
'crta', $objectId);
221 $this->updated = $this->pg_obj->update();
222 if ($this->updated ===
true) {
223 $this->
ctrl->returnToParent($this,
'jump' . $this->hier_id);
226 $this->log->info(
'File could not be created');
239 if ($form->checkInput()) {
240 $option =
'certificate_persistent_option';
241 if ($form->getItemByPostVar(
'certificate_selection')) {
242 $option = $form->getInput(
'certificate_selection');
245 $oldContentData = $this->content_obj->getData();
247 if (
'certificate_workspace_option' === $option) {
248 $objectId = (
int) $form->getInput(
'object');
251 if (isset($validWorkSpaceCertificates[$objectId])) {
252 $this->content_obj->setData($validWorkSpaceCertificates[$objectId][
'type'], $objectId);
254 } elseif (
'certificate_persistent_option' === $option) {
256 $objectId = (
int) $form->getInput(
'persistent_object');
259 if (isset($validCertificates[$objectId])) {
261 $certificateFileService->createCertificateFile(
262 $this->
user->getId(),
265 $this->content_obj->setData(
'crta', $objectId);
268 $this->tpl->setOnScreenMessage(
'info', $this->
lng->txt(
'certificate_file_not_found_error'),
true);
269 $this->log->warning($e->getMessage());
271 $this->tpl->setOnScreenMessage(
'info', $this->
lng->txt(
'certificate_file_input_output_error'),
true);
272 $this->log->warning($e->getMessage());
274 $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
'error_creating_certificate_pdf'),
true);
275 $this->log->error($e->getMessage());
276 $this->
ctrl->redirect($this,
'initForm');
280 if (
'crta' === $oldContentData[
'type']) {
283 $certificateFileService->deleteCertificateFile(
284 $this->
user->getId(),
285 (
int) $oldContentData[
'id']
288 $this->tpl->setOnScreenMessage(
'info', $this->
lng->txt(
'certificate_file_not_found_error'));
289 $this->log->warning($e->getMessage());
291 $this->tpl->setOnScreenMessage(
'info', $this->
lng->txt(
'certificate_file_input_output_error'));
292 $this->log->warning($e->getMessage());
296 $this->updated = $this->pg_obj->update();
297 if ($this->updated ===
true) {
298 $this->
ctrl->returnToParent($this,
'jump' . $this->hier_id);
302 $this->pg_obj->addHierIDs();
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
getNodeData(int $a_node_id, ?int $a_tree_pk=null)
get all information of a node.
getValidWorkspaceCertificateNodeByIdMap()
Class ChatMainBarProvider .
static formatDate(ilDateTime $date, bool $a_skip_day=false, bool $a_include_wd=false, bool $include_seconds=false)
getValidCertificateByIdMap()
__construct(ilPageObject $a_pg_obj, ?ilPCVerification $a_content_obj, string $a_hier_id='0', string $a_pc_id="")
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...
initForm(bool $a_insert=false)
User Interface for Editing of Page Content Objects (Paragraphs, Tables, ...)
insert(?ilPropertyFormGUI $a_form=null)
edit(?ilPropertyFormGUI $a_form=null)
setValue(string $a_value)
Class ilPageObject Handles PageObjects of ILIAS Learning Modules (see ILIAS DTD)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
__construct(Container $dic, ilPlugin $plugin)
Class FlySystemFileAccessTest disabled disabled disabled.