ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
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 
4 include_once './Services/Table/classes/class.ilTable2GUI.php';
5 
13 {
20  public function __construct($a_parent_obj, $a_parent_cmd = "")
21  {
22  global $ilCtrl;
23 
24  parent::__construct($a_parent_obj, $a_parent_cmd);
25 
26  $this->addColumn($this->lng->txt("title"), "title");
27  $this->addColumn($this->lng->txt("passed"), "passed");
28  $this->addColumn($this->lng->txt("action"), "");
29 
30  $this->setTitle($this->lng->txt("tstv_create"));
31  $this->setDescription($this->lng->txt("tstv_create_info"));
32 
33  $this->setRowTemplate("tpl.il_test_verification_row.html", "Modules/Test");
34  $this->setFormAction($ilCtrl->getFormAction($a_parent_obj, $a_parent_cmd));
35 
36  $this->getItems();
37  }
38 
42  protected function getItems()
43  {
44  global $ilUser;
45 
46  include_once "Modules/Test/classes/class.ilObjTest.php";
47  include_once "Modules/Test/classes/class.ilTestSessionFactory.php";
48 
49  $data = array();
50  foreach (ilObjTest::getTestObjIdsWithActiveForUserId($ilUser->getId()) as $test_id) {
51  // #11210 - only available certificates!
52  $test = new ilObjTest($test_id, false);
54  $session = $session->getSession(null);
55  if ($test->canShowCertificate($session, $session->getUserId(), $session->getActiveId())) {
56  $data[] = array("id" => $test_id,
57  "title" => $test->getTitle(),
58  "passed" => $test->getPassed($session->getActiveId()));
59  }
60  }
61 
62  $this->setData($data);
63  }
64 
70  protected function fillRow($a_set)
71  {
72  global $ilCtrl;
73 
74  $this->tpl->setVariable("TITLE", $a_set["title"]);
75  $this->tpl->setVariable("PASSED", ($a_set["passed"]) ? $this->lng->txt("yes") :
76  $this->lng->txt("no"));
77 
78  if ($a_set["passed"]) {
79  $ilCtrl->setParameter($this->parent_obj, "tst_id", $a_set["id"]);
80  $action = $ilCtrl->getLinkTarget($this->parent_obj, "save");
81  $this->tpl->setVariable("URL_SELECT", $action);
82  $this->tpl->setVariable("TXT_SELECT", $this->lng->txt("select"));
83  }
84  }
85 }
setDescription($a_val)
Set description.
$action
$session
global $ilCtrl
Definition: ilias.php:18
setTitle($a_title, $a_icon=0, $a_icon_alt=0)
Set title and title icon.
Class ilTable2GUI.
__construct($a_parent_obj, $a_parent_cmd="")
Constructor.
$ilUser
Definition: imgupload.php:18
setRowTemplate($a_template, $a_template_dir="")
Set row template.
Create styles array
The data for the language used.
setFormAction($a_form_action, $a_multipart=false)
Set Form action parameter.
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.
static getTestObjIdsWithActiveForUserId($userId)
List all completed tests for current user.
$test
Definition: Utf8Test.php:84