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