ILIAS  Release_4_4_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
class.ilTestAverageReachedPointsTableGUI.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 
5 include_once('./Services/Table/classes/class.ilTable2GUI.php');
6 
13 {
20  public function __construct($a_parent_obj, $a_parent_cmd)
21  {
22  $this->setId('tstAvgReachedPointsTbl');
23  $this->setPrefix('tstAvgReachedPointsTbl');
24 
25  parent::__construct($a_parent_obj, $a_parent_cmd);
26 
27  global $lng, $ilCtrl;
28 
29  $this->lng = $lng;
30  $this->ctrl = $ilCtrl;
31 
32  $this->setFormName('average_reached_points');
33  $this->setTitle($this->lng->txt('average_reached_points'));
34  $this->setStyle('table', 'fullwidth');
35  $this->addColumn($this->lng->txt("question_id"), 'qid', '');
36  $this->addColumn($this->lng->txt("question_title"), 'title', '');
37  $this->addColumn($this->lng->txt("points"), 'points', '');
38  $this->addColumn($this->lng->txt("percentage"), 'percentage', '');
39  $this->addColumn($this->lng->txt("number_of_answers"), 'answers', '');
40 
41  $this->setRowTemplate("tpl.il_as_tst_average_reached_points_row.html", "Modules/Test");
42 
43  $this->setFormAction($this->ctrl->getFormAction($a_parent_obj, $a_parent_cmd));
44 
45  $this->setDefaultOrderField("title");
46  $this->setDefaultOrderDirection("asc");
47  $this->enable('sort');
48  $this->enable('header');
49  $this->disable('select_all');
50  }
51 
56  function numericOrdering($a_field)
57  {
58  switch($a_field)
59  {
60  case 'qid':
61  return true;
62 
63  case 'percentage':
64  return true;
65 
66  default:
67  return false;
68  }
69  }
70 
77  public function fillRow($data)
78  {
79  $this->tpl->setVariable("ID", $data["qid"]);
80  $this->tpl->setVariable("TITLE", $data["title"]);
81  $this->tpl->setVariable("POINTS", $data["points"]);
82  $this->tpl->setVariable("PERCENTAGE", sprintf("%.2f", $data["percentage"]) . "%");
83  $this->tpl->setVariable("ANSWERS", $data["answers"]);
84  }
85 }