ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
class.ilSCORMVerificationTableGUI.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
26{
28
32 public function __construct(
33 ilObjSCORMVerificationGUI $a_parent_obj,
34 string $a_parent_cmd = '',
36 ) {
37 global $DIC;
38
39 $ilCtrl = $DIC->ctrl();
40 $database = $DIC->database();
41 $logger = $DIC->logger()->root();
42
43 if (null === $userCertificateRepository) {
45 }
46 $this->userCertificateRepository = $userCertificateRepository;
47
48 parent::__construct($a_parent_obj, $a_parent_cmd);
49
50 $this->addColumn($this->lng->txt('title'), 'title');
51 $this->addColumn($this->lng->txt('passed'), 'passed');
52 $this->addColumn($this->lng->txt('action'), '');
53
54 $this->setTitle($this->lng->txt('scov_create'));
55 $this->setDescription($this->lng->txt('scov_create_info'));
56
57 $this->setRowTemplate('tpl.sahs_verification_row.html', 'components/ILIAS/ScormAicc');
58 $this->setFormAction($ilCtrl->getFormAction($a_parent_obj, $a_parent_cmd));
59
60 $this->getItems();
61 }
62
63 protected function getItems(): void
64 {
65 global $DIC;
66
67 $ilUser = $DIC->user();
68
69 $userId = $ilUser->getId();
70
71 $certificateArray = $this->userCertificateRepository->fetchActiveCertificatesByTypeForPresentation(
72 $userId,
73 'sahs'
74 );
75
76 $data = [];
77 foreach ($certificateArray as $certificate) {
78 $user_cert = $certificate->getUserCertificate();
79 if ($user_cert !== null) {
80 $data[] = [
81 'id' => $user_cert->getObjId(),
82 'title' => $certificate->getObjectTitle(),
83 'passed' => true
84 ];
85 }
86 }
87
88 $this->setData($data);
89 }
90
94 protected function fillRow(array $a_set): void
95 {
96 global $DIC;
97 $ilCtrl = $DIC->ctrl();
98
99 $this->tpl->setVariable('TITLE', $a_set['title']);
100 $this->tpl->setVariable(
101 'PASSED',
102 ($a_set['passed']) ? $this->lng->txt('yes') : $this->lng->txt('no')
103 );
104
105 if ($a_set['passed']) {
106 $ilCtrl->setParameter($this->parent_obj, 'lm_id', $a_set['id']);
107 $action = $ilCtrl->getLinkTarget($this->parent_obj, 'save');
108 $this->tpl->setVariable('URL_SELECT', $action);
109 $this->tpl->setVariable('TXT_SELECT', $this->lng->txt('select'));
110 }
111 }
112}
return true
GUI class for scorm verification.
List all completed learning modules for current user.
ilUserCertificateRepository $userCertificateRepository
__construct(ilObjSCORMVerificationGUI $a_parent_obj, string $a_parent_cmd='', ?ilUserCertificateRepository $userCertificateRepository=null)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
setTitle(string $a_title, string $a_icon="", string $a_icon_alt="")
setDescription(string $a_val)
setFormAction(string $a_form_action, bool $a_multipart=false)
addColumn(string $a_text, string $a_sort_field="", string $a_width="", bool $a_is_checkbox_action_column=false, string $a_class="", string $a_tooltip="", bool $a_tooltip_with_html=false)
setRowTemplate(string $a_template, string $a_template_dir="")
Set row template.
setData(array $a_data)
Set table data.
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
global $DIC
Definition: shib_login.php:26