ILIAS  release_10 Revision v10.1-43-ga1241a92c2f
class.ilLTIConsumerVerificationTableGUI.php
Go to the documentation of this file.
1 <?php
2 
19 declare(strict_types=1);
20 
31 {
36  public function __construct(?ilObjLTIConsumerVerificationGUI $a_parent_obj, ?string $a_parent_cmd = "")
37  {
38  global $DIC; /* @var \ILIAS\DI\Container $DIC */
39 
40  parent::__construct($a_parent_obj, $a_parent_cmd);
41 
42  $this->addColumn($this->lng->txt("title"), "title");
43  $this->addColumn($this->lng->txt("passed"), "passed");
44  $this->addColumn($this->lng->txt("action"), "");
45 
46  $this->setTitle($this->lng->txt("ltiv_create"));
47  $this->setDescription($this->lng->txt("ltiv_create_info"));
48 
49  $this->setRowTemplate("tpl.lti_verification_row.html", "components/ILIAS/LTIConsumer");
50  $this->setFormAction($DIC->ctrl()->getFormAction($a_parent_obj, $a_parent_cmd));
51 
52  $this->getItems();
53  }
54 
58  protected function getItems(): void
59  {
60  global $DIC; /* @var \ILIAS\DI\Container $DIC */
61 
62  $userCertificateRepository = new ilUserCertificateRepository(
63  $DIC->database(),
64  $DIC->logger()->root()
65  );
66 
67  $certificateArray = $userCertificateRepository->fetchActiveCertificatesByTypeForPresentation(
68  $DIC->user()->getId(),
69  'lti'
70  );
71 
72  $data = array();
73 
74  foreach ($certificateArray as $certificate) {
75  $data[] = array(
76  'id' => $certificate->getUserCertificate()->getObjId(),
77  'title' => $certificate->getObjectTitle(),
78  'passed' => true
79  );
80  }
81 
82  $this->setData($data);
83  }
84 
88  protected function fillRow(array $a_set): void
89  {
90  global $DIC; /* @var \ILIAS\DI\Container $DIC */
91 
92  $this->tpl->setVariable("TITLE", $a_set["title"]);
93  $this->tpl->setVariable("PASSED", ($a_set["passed"]) ? $this->lng->txt("yes") :
94  $this->lng->txt("no"));
95 
96  if ($a_set["passed"]) {
97  $DIC->ctrl()->setParameter($this->parent_obj, "lti_id", $a_set["id"]);
98  $action = $DIC->ctrl()->getLinkTarget($this->parent_obj, "save");
99  $this->tpl->setVariable("URL_SELECT", $action);
100  $this->tpl->setVariable("TXT_SELECT", $this->lng->txt("select"));
101  }
102  }
103 }
setData(array $a_data)
setFormAction(string $a_form_action, bool $a_multipart=false)
setDescription(string $a_val)
setRowTemplate(string $a_template, string $a_template_dir="")
Set row template.
global $DIC
Definition: shib_login.php:25
setTitle(string $a_title, string $a_icon="", string $a_icon_alt="")
__construct(?ilObjLTIConsumerVerificationGUI $a_parent_obj, ?string $a_parent_cmd="")
Constructor.
__construct(Container $dic, ilPlugin $plugin)
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)