ILIAS  release_5-0 Revision 5.0.0-1144-gc4397b1f87
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  {
52  // #11210 - only available certificates!
53  $test = new ilObjTest($test_id, false);
54  $session = new ilTestSessionFactory($test);
55  $session = $session->getSession(null);
56  if($test->canShowCertificate($session, $session->getUserId(), $session->getActiveId()))
57  {
58  $data[] = array("id" => $test_id,
59  "title" => $test->getTitle(),
60  "passed" => $test->getPassed($session->getActiveId()));
61  }
62  }
63 
64  $this->setData($data);
65  }
66 
72  protected function fillRow($a_set)
73  {
74  global $ilCtrl;
75 
76  $this->tpl->setVariable("TITLE", $a_set["title"]);
77  $this->tpl->setVariable("PASSED", ($a_set["passed"]) ? $this->lng->txt("yes") :
78  $this->lng->txt("no"));
79 
80  if($a_set["passed"])
81  {
82  $ilCtrl->setParameter($this->parent_obj, "tst_id", $a_set["id"]);
83  $action = $ilCtrl->getLinkTarget($this->parent_obj, "save");
84  $this->tpl->setVariable("URL_SELECT", $action);
85  $this->tpl->setVariable("TXT_SELECT", $this->lng->txt("select"));
86  }
87  }
88 }
89 
90 ?>
setDescription($a_val)
Set description.
global $ilCtrl
Definition: ilias.php:18
setTitle($a_title, $a_icon=0, $a_icon_alt=0)
Set title and title icon.
Class ilTable2GUI.
addColumn($a_text, $a_sort_field="", $a_width="", $a_is_checkbox_action_column=false, $a_class="", $a_tooltip="")
Add a column to the header.
__construct($a_parent_obj, $a_parent_cmd="")
Constructor.
setRowTemplate($a_template, $a_template_dir="")
Set row template.
setFormAction($a_form_action, $a_multipart=false)
Set Form action parameter.
global $ilUser
Definition: imgupload.php:15
static getTestObjIdsWithActiveForUserId($userId)
List all completed tests for current user.
$test
Definition: Utf8Test.php:85