ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
class.ilCourseVerificationTableGUI.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=0);
20
22
29{
31 private Container $dic;
32
33 public function __construct(
34 ilObjCourseVerificationGUI $a_parent_obj,
35 string $a_parent_cmd = '',
37 ) {
38 global $DIC;
39
40 $this->dic = $DIC;
41 $database = $DIC->database();
42 $logger = $DIC->logger()->root();
43
44 if (null === $userCertificateRepository) {
46 }
47 $this->userCertificateRepository = $userCertificateRepository;
48
49 parent::__construct($a_parent_obj, $a_parent_cmd);
50
51 $this->addColumn($this->lng->txt('title'), 'title');
52 $this->addColumn($this->lng->txt('passed'), 'passed');
53 $this->addColumn($this->lng->txt('action'), '');
54
55 $this->setTitle($this->lng->txt('crsv_create'));
56 $this->setDescription($this->lng->txt('crsv_create_info'));
57
58 $this->setRowTemplate('tpl.crs_verification_row.html', 'components/ILIAS/Course');
59 $this->setFormAction($this->ctrl->getFormAction($a_parent_obj, $a_parent_cmd));
60
61 $this->getItems();
62 }
63
64 protected function getItems(): void
65 {
66 $certificateArray = $this->userCertificateRepository->fetchActiveCertificatesByTypeForPresentation(
67 $this->dic->user()->getId(),
68 'crs'
69 );
70
71 $data = [];
72 foreach ($certificateArray as $certificate) {
73 $data[] = [
74 'id' => $certificate->getUserCertificate()->getObjId(),
75 'title' => $certificate->getObjectTitle(),
76 'passed' => true
77 ];
78 }
79
80 $this->setData($data);
81 }
82
83 protected function fillRow(array $a_set): void
84 {
85 $this->dic->ctrl();
86
87 $this->tpl->setVariable('TITLE', $a_set['title']);
88 $this->tpl->setVariable(
89 'PASSED',
90 ($a_set['passed']) ? $this->lng->txt('yes') : $this->lng->txt('no')
91 );
92
93 if ($a_set['passed']) {
94 $this->ctrl->setParameter($this->parent_obj, 'crs_id', $a_set['id']);
95 $action = $this->ctrl->getLinkTarget($this->parent_obj, 'save');
96 $this->tpl->setVariable('URL_SELECT', $action);
97 $this->tpl->setVariable('TXT_SELECT', $this->lng->txt('select'));
98 }
99 }
100}
Customizing of pimple-DIC for ILIAS.
Definition: Container.php:36
return true
List all completed course for current user.
ilUserCertificateRepository $userCertificateRepository
fillRow(array $a_set)
Standard Version of Fill Row.
__construct(ilObjCourseVerificationGUI $a_parent_obj, string $a_parent_cmd='', ?ilUserCertificateRepository $userCertificateRepository=null)
GUI class for course verification.
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