ILIAS  release_8 Revision v8.25-1-g13de6a5eca6
class.ilTestVerificationTableGUI.php
Go to the documentation of this file.
1<?php
2
3declare(strict_types=1);
4
27{
29
30 public function __construct(
31 ilObjTestVerificationGUI $a_parent_obj,
32 string $a_parent_cmd = "",
34 ) {
35 global $DIC;
36
37 $ilCtrl = $DIC->ctrl();
38 $database = $DIC->database();
39 $logger = $DIC->logger()->root();
40
41 if (null === $userCertificateRepository) {
43 }
44 $this->userCertificateRepository = $userCertificateRepository;
45
46 parent::__construct($a_parent_obj, $a_parent_cmd);
47
48 $this->addColumn($this->lng->txt('title'), 'title');
49 $this->addColumn($this->lng->txt('passed'), 'passed');
50 $this->addColumn($this->lng->txt('action'), '');
51
52 $this->setTitle($this->lng->txt('tstv_create'));
53 $this->setDescription($this->lng->txt('tstv_create_info'));
54
55 $this->setRowTemplate('tpl.il_test_verification_row.html', 'Modules/Test');
56 $this->setFormAction($ilCtrl->getFormAction($a_parent_obj, $a_parent_cmd));
57
58 $this->getItems();
59 }
60
61 protected function getItems(): void
62 {
63 global $DIC;
64
65 $ilUser = $DIC->user();
66
67 $userId = $ilUser->getId();
68
69 $certificateArray = $this->userCertificateRepository->fetchActiveCertificatesByTypeForPresentation(
70 $userId,
71 'tst'
72 );
73
74 $data = [];
75 foreach ($certificateArray as $certificate) {
76 $data[] = [
77 'id' => $certificate->getUserCertificate()->getObjId(),
78 'title' => $certificate->getObjectTitle(),
79 'passed' => true
80 ];
81 }
82
83 $this->setData($data);
84 }
85
86 protected function fillRow(array $a_set): void
87 {
88 global $DIC;
89 $ilCtrl = $DIC['ilCtrl'];
90
91 $this->tpl->setVariable('TITLE', $a_set['title']);
92 $this->tpl->setVariable(
93 'PASSED',
94 ($a_set['passed']) ? $this->lng->txt('yes') : $this->lng->txt('no')
95 );
96
97 if ($a_set['passed']) {
98 $ilCtrl->setParameter($this->parent_obj, 'tst_id', $a_set['id']);
99 $action = $ilCtrl->getLinkTarget($this->parent_obj, 'save');
100 $this->tpl->setVariable('URL_SELECT', $action);
101 $this->tpl->setVariable('TXT_SELECT', $this->lng->txt('select'));
102 }
103 }
104}
return true
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...
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.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
__construct(ilObjTestVerificationGUI $a_parent_obj, string $a_parent_cmd="", ?ilUserCertificateRepository $userCertificateRepository=null)
fillRow(array $a_set)
Standard Version of Fill Row.
ilUserCertificateRepository $userCertificateRepository
global $DIC
Definition: feed.php:28
$ilUser
Definition: imgupload.php:34
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc