ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
class.ilExerciseVerificationTableGUI.php
Go to the documentation of this file.
1<?php
2/* Copyright (c) 1998-2009 ILIAS open source, Extended GPL, see docs/LICENSE */
3
11{
12
17
21 protected $user;
22
28 public function __construct(
29 $a_parent_obj,
30 $a_parent_cmd = "",
32 ) {
33 global $DIC;
34
35 $this->ctrl = $DIC->ctrl();
36 $this->user = $DIC->user();
37 $database = $DIC->database();
38 $logger = $DIC->logger()->root();
39 $ilCtrl = $DIC->ctrl();
40
41 if (null === $userCertificateRepository) {
43 }
44 $this->userCertificateRepository = $userCertificateRepository;
45
46 parent::__construct($a_parent_obj, $a_parent_cmd);
47
48 $this->addColumn($this->lng->txt("title"), "title");
49 $this->addColumn($this->lng->txt("passed"), "passed");
50 $this->addColumn($this->lng->txt("action"), "");
51
52 $this->setTitle($this->lng->txt("excv_create"));
53 $this->setDescription($this->lng->txt("excv_create_info"));
54
55 $this->setRowTemplate("tpl.exc_verification_row.html", "Modules/Exercise");
56 $this->setFormAction($ilCtrl->getFormAction($a_parent_obj, $a_parent_cmd));
57
58 $this->getItems();
59 }
60
64 protected function getItems()
65 {
67 $userId = $ilUser->getId();
68
69 $certificateArray = $this->userCertificateRepository
70 ->fetchActiveCertificatesByTypeForPresentation($userId, 'exc');
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
90 protected function fillRow($a_set)
91 {
93
94 $this->tpl->setVariable("TITLE", $a_set["title"]);
95 $this->tpl->setVariable("PASSED", ($a_set["passed"]) ? $this->lng->txt("yes") :
96 $this->lng->txt("no"));
97
98 if ($a_set["passed"]) {
99 $ilCtrl->setParameter($this->parent_obj, "exc_id", $a_set["id"]);
100 $action = $ilCtrl->getLinkTarget($this->parent_obj, "save");
101 $this->tpl->setVariable("URL_SELECT", $action);
102 $this->tpl->setVariable("TXT_SELECT", $this->lng->txt("select"));
103 }
104 }
105}
user()
Definition: user.php:4
An exception for terminatinating execution or to throw for unit testing.
List all completed exercises for current user.
getItems()
Get all achieved test certificates for the current user.
__construct( $a_parent_obj, $a_parent_cmd="", ilUserCertificateRepository $userCertificateRepository=null)
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.
global $ilCtrl
Definition: ilias.php:18
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
$ilUser
Definition: imgupload.php:18
$DIC
Definition: xapitoken.php:46