ILIAS  release_7 Revision v7.30-3-g800a261c036
class.ilTestVerificationTableGUI.php
Go to the documentation of this file.
1<?php
2/* Copyright (c) 1998-2013 ILIAS open source, Extended GPL, see docs/LICENSE */
3
4include_once './Services/Table/classes/class.ilTable2GUI.php';
5
13{
18
24 public function __construct(
25 $a_parent_obj,
26 $a_parent_cmd = "",
28 ) {
29 global $DIC;
30
31 $ilCtrl = $DIC->ctrl();
32 $database = $DIC->database();
33 $logger = $DIC->logger()->root();
34
35 if (null === $userCertificateRepository) {
37 }
38 $this->userCertificateRepository = $userCertificateRepository;
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("tstv_create"));
47 $this->setDescription($this->lng->txt("tstv_create_info"));
48
49 $this->setRowTemplate("tpl.il_test_verification_row.html", "Modules/Test");
50 $this->setFormAction($ilCtrl->getFormAction($a_parent_obj, $a_parent_cmd));
51
52 $this->getItems();
53 }
54
58 protected function getItems()
59 {
60 global $DIC;
61
62 $ilUser = $DIC->user();
63
64 $userId = $ilUser->getId();
65
66 $certificateArray = $this->userCertificateRepository->fetchActiveCertificatesByTypeForPresentation($userId, 'tst');
67
68 $data = array();
69 foreach ($certificateArray as $certificate) {
70 $data[] = array(
71 'id' => $certificate->getUserCertificate()->getObjId(),
72 'title' => $certificate->getObjectTitle(),
73 'passed' => true
74 );
75 }
76
77 $this->setData($data);
78 }
79
85 protected function fillRow($a_set)
86 {
87 global $DIC;
88 $ilCtrl = $DIC['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, "tst_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}
An exception for terminatinating execution or to throw for unit testing.
Class ilTable2GUI.
setTitle($a_title, $a_icon=0, $a_icon_alt=0)
Set title and title icon.
setData($a_data)
set table data @access public
setRowTemplate($a_template, $a_template_dir="")
Set row template.
addColumn( $a_text, $a_sort_field="", $a_width="", $a_is_checkbox_action_column=false, $a_class="", $a_tooltip="", $a_tooltip_with_html=false)
Add a column to the header.
setDescription($a_val)
Set description.
setFormAction($a_form_action, $a_multipart=false)
Set Form action parameter.
List all completed tests for current user.
__construct( $a_parent_obj, $a_parent_cmd="", ilUserCertificateRepository $userCertificateRepository=null)
global $DIC
Definition: goto.php:24
$ilUser
Definition: imgupload.php:18
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc