ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
class.ilCmiXapiVerificationTableGUI.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
30{
34 public function __construct(ilObjCmiXapiVerificationGUI $a_parent_obj, string $a_parent_cmd = "")
35 {
36 global $ilCtrl;
37
38 parent::__construct($a_parent_obj, $a_parent_cmd);
39
40 $this->addColumn($this->lng->txt("title"), "title");
41 $this->addColumn($this->lng->txt("passed"), "passed");
42 $this->addColumn($this->lng->txt("action"), "");
43
44 $this->setTitle($this->lng->txt("cmxv_create"));
45 $this->setDescription($this->lng->txt("cmxv_create_info"));
46
47 $this->setRowTemplate("tpl.cmix_verification_row.html", "components/ILIAS/CmiXapi");
48 $this->setFormAction($ilCtrl->getFormAction($a_parent_obj, $a_parent_cmd));
49
50 $this->getItems();
51 }
52
56 protected function getItems(): void
57 {
58 global $DIC; /* @var \ILIAS\DI\Container $DIC */
59
60 $userCertificateRepository = new ilUserCertificateRepository(
61 $DIC->database(),
62 $DIC->logger()->root()
63 );
64
65 $certificateArray = $userCertificateRepository->fetchActiveCertificatesByTypeForPresentation(
66 $DIC->user()->getId(),
67 'cmix'
68 );
69
70 $data = array();
71
72 foreach ($certificateArray as $certificate) {
73 $data[] = array(
74 'id' => $certificate->getUserCertificate()->getObjId(),
75 'title' => $certificate->getObjectTitle(),
76 'passed' => true
77 );
78 }
79
80 $this->setData($data);
81 }
82
86 protected function fillRow(array $a_set): void
87 {
88 global $ilCtrl;
89
90 $this->tpl->setVariable("TITLE", $a_set["title"]);
91 $this->tpl->setVariable("PASSED", ($a_set["passed"]) ? $this->lng->txt("yes") :
92 $this->lng->txt("no"));
93
94 if ($a_set["passed"]) {
95 $ilCtrl->setParameter($this->parent_obj, "cmix_id", $a_set["id"]);
96 $action = $ilCtrl->getLinkTarget($this->parent_obj, "save");
97 $this->tpl->setVariable("URL_SELECT", $action);
98 $this->tpl->setVariable("TXT_SELECT", $this->lng->txt("select"));
99 }
100 }
101}
__construct(ilObjCmiXapiVerificationGUI $a_parent_obj, string $a_parent_cmd="")
Constructor.
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