ILIAS  release_4-3 Revision
 All Data Structures Namespaces Files Functions Variables Groups Pages
class.ilTestPassOverwiewTableGUI.php
Go to the documentation of this file.
1 <?php
2 
3 /* Copyright (c) 1998-2010 ILIAS open source, Extended GPL, see docs/LICENSE */
4 
5 include_once('./Services/Table/classes/class.ilTable2GUI.php');
6 
16 {
23  public function __construct($parentObj, $parentCmd)
24  {
25  parent::__construct($parentObj, $parentCmd);
26 
27  global $ilCtrl;
28 
29  $this->setPrefix('manScorePassesTable');
30 
31  $this->setFormName('manScorePassesTable');
32  $this->setStyle('table', 'fullwidth');
33 
34  $this->enable('header');
35 
36  $this->setFormAction($ilCtrl->getFormAction($parentObj, $parentCmd));
37 
38  $this->setRowTemplate("tpl.il_as_tst_pass_overview_tblrow.html", "Modules/Test");
39 
40  $this->initColumns();
41  $this->initOrdering();
42  }
43 
44  private function initColumns()
45  {
46  global $lng;
47 
48  $this->addColumn($lng->txt("scored_pass"),'', '150');
49  $this->addColumn($lng->txt("pass"),'pass', '');
50  $this->addColumn($lng->txt("date"),'finishdate', '');
51  $this->addColumn($lng->txt("tst_answered_questions"),'answered_questions', '');
52  $this->addColumn($lng->txt("tst_reached_points"),'reached_points', '');
53  $this->addColumn($lng->txt("tst_percent_solved"),'percentage', '');
54  $this->addColumn('','', '1%');
55  }
56 
57  private function initOrdering()
58  {
59  $this->disable('sort');
60 
61  $this->setDefaultOrderField("pass");
62  $this->setDefaultOrderDirection("asc");
63  }
64 
70  public function fillRow($row)
71  {
72  //vd($row);
73 
74  global $ilCtrl, $lng;
75 
76  $ilCtrl->setParameter($this->parent_obj, 'active_id', $row['active_id']);
77  $ilCtrl->setParameter($this->parent_obj, 'pass', $row['pass']);
78 
79  if( $row['is_scored_pass'] )
80  {
81  $this->tpl->setCurrentBlock('selected_pass');
82  $this->tpl->touchBlock('selected_pass');
83  $this->tpl->parseCurrentBlock();
84  $this->tpl->setVariable('CSS_ROW', 'tblrowmarked');
85  }
86 
87  $this->tpl->setVariable("PASS_NR", $row['pass'] + 1);
88  $this->tpl->setVariable("PASS_DATE", ilDatePresentation::formatDate(new ilDate($row['finishdate'],IL_CAL_UNIX)));
89  $this->tpl->setVariable("PASS_ANSWERED_QUESTIONS", $row['answered_questions']." ".strtolower($this->lng->txt("of"))." ".$row['total_questions']);
90  $this->tpl->setVariable("PASS_REACHED_POINTS", $row['reached_points']." ".strtolower($this->lng->txt("of"))." ".$row['max_points']);
91  $this->tpl->setVariable("PASS_REACHED_PERCENTAGE", sprintf("%.2f%%", $row['percentage']));
92 
93  $this->tpl->setVariable("TXT_SHOW_PASS", $lng->txt('tst_edit_scoring'));
94  $this->tpl->setVariable("HREF_SHOW_PASS", $ilCtrl->getLinkTarget($this->parent_obj, $this->parent_cmd));
95  }
96 }