ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
class.ilLMQuestionListTableGUI.php
Go to the documentation of this file.
1 <?php
2 
3 /* Copyright (c) 1998-2009 ILIAS open source, Extended GPL, see docs/LICENSE */
4 
5 include_once("./Services/Table/classes/class.ilTable2GUI.php");
6 include_once("./Modules/TestQuestionPool/classes/class.assQuestion.php");
7 include_once("./Modules/LearningModule/classes/class.ilLMObject.php");
8 
18 {
22  protected $access;
23 
27  protected $rbacsystem;
28 
29 
33  public function __construct($a_parent_obj, $a_parent_cmd, $a_lm)
34  {
35  global $DIC;
36 
37  $this->ctrl = $DIC->ctrl();
38  $this->lng = $DIC->language();
39  $this->access = $DIC->access();
40  $this->rbacsystem = $DIC->rbac()->system();
41  $ilCtrl = $DIC->ctrl();
42  $lng = $DIC->language();
43  $ilAccess = $DIC->access();
44  $lng = $DIC->language();
45  $rbacsystem = $DIC->rbac()->system();
46 
47  $this->lm = $a_lm;
48 
49  $this->setId("lm_qst" . $this->lm->getId());
50 
51  parent::__construct($a_parent_obj, $a_parent_cmd);
52  // $this->setTitle($this->lng->txt("users"));
53 
54  //$this->addColumn("", "", "1", true);
55  $this->addColumn($this->lng->txt("pg"));
56  $this->addColumn($this->lng->txt("question"));
57  $this->addColumn($this->lng->txt("cont_users_answered"));
58  $this->addColumn($this->lng->txt("cont_correct_after_first"));
59  $this->addColumn($this->lng->txt("cont_second"));
60  $this->addColumn($this->lng->txt("cont_third_and_more"));
61  $this->addColumn($this->lng->txt("cont_never"));
62 
63  $this->setExternalSorting(true);
64  $this->setExternalSegmentation(true);
65  $this->setEnableHeader(true);
66  //$this->setFormAction($ilCtrl->getFormAction($this->parent_obj, "applyFilter"));
67  $this->setFormAction($ilCtrl->getFormAction($this->parent_obj, $this->parent_cmd));
68  $this->setRowTemplate("tpl.lm_question_row.html", "Modules/LearningModule");
69  //$this->disable("footer");
70  $this->setEnableTitle(true);
71  // $this->initFilter();
72  // $this->setFilterCommand("applyFilter");
73  // $this->setDefaultOrderField("login");
74  // $this->setDefaultOrderDirection("asc");
75 
76  // $this->setSelectAllCheckbox("id[]");
77 
78  // $this->addMultiCommand("activateUsers", $lng->txt("activate"));
79 
80  $this->getItems();
81  }
82 
86  public function getItems()
87  {
88  $lng = $this->lng;
89  //if ($GLOBALS["kk"]++ == 1) nj();
90 
91  $this->determineOffsetAndOrder();
92 
93  include_once("./Modules/LearningModule/classes/class.ilLMPageObject.php");
94 
96  $this->lm->getId(),
101  );
102 
103  if (count($questions["set"]) == 0 && $this->getOffset() > 0) {
104  $this->resetOffset();
106  $this->lm->getId(),
111  );
112  }
113 
114  $this->setMaxCount($questions["cnt"]);
115  $this->setData($questions["set"]);
116  }
117 
118 
122  protected function fillRow($a_set)
123  {
125  $lng = $this->lng;
126 
127  $this->tpl->setVariable(
128  "PAGE_TITLE",
129  ilLMObject::_lookupTitle($a_set["page_id"])
130  );
131  $this->tpl->setVariable(
132  "QUESTION",
133  assQuestion::_getQuestionText($a_set["question_id"])
134  );
135 
136  include_once("./Services/COPage/classes/class.ilPageQuestionProcessor.php");
138 
139  $this->tpl->setVariable("VAL_ANSWERED", (int) $stats["all"]);
140  if ($stats["all"] == 0) {
141  $this->tpl->setVariable("VAL_CORRECT_FIRST", 0);
142  $this->tpl->setVariable("VAL_CORRECT_SECOND", 0);
143  $this->tpl->setVariable("VAL_CORRECT_THIRD_OR_MORE", 0);
144  $this->tpl->setVariable("VAL_NEVER", 0);
145  } else {
146  $this->tpl->setVariable("VAL_CORRECT_FIRST", $stats["first"] .
147  " (" . (100 / $stats["all"] * $stats["first"]) . " %)");
148  $this->tpl->setVariable("VAL_CORRECT_SECOND", $stats["second"] .
149  " (" . (100 / $stats["all"] * $stats["second"]) . " %)");
150  $this->tpl->setVariable("VAL_CORRECT_THIRD_AND_MORE", $stats["third_or_more"] .
151  " (" . (100 / $stats["all"] * $stats["third_or_more"]) . " %)");
152  $nev = $stats["all"] - $stats["first"] - $stats["second"] - $stats["third_or_more"];
153  $this->tpl->setVariable("VAL_NEVER", $nev .
154  " (" . (100 / $stats["all"] * $nev) . " %)");
155  }
156  }
157 }
static _getQuestionText($a_q_id)
Returns question text.
setExternalSorting($a_val)
Set external sorting.
global $DIC
Definition: saml.php:7
setExternalSegmentation($a_val)
Set external segmentation.
resetOffset($a_in_determination=false)
Reset offset.
static _lookupTitle($a_obj_id)
Lookup title.
getOrderDirection()
Get order direction.
setId($a_val)
Set id.
static getQuestionStatistics($a_q_id)
Get statistics for question.
global $ilCtrl
Definition: ilias.php:18
Class ilTable2GUI.
getOffset()
Get offset.
static queryQuestionsOfLearningModule( $a_lm_id, $a_order_field, $a_order_dir, $a_offset, $a_limit)
Get questions of learning module.
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
__construct($a_parent_obj, $a_parent_cmd, $a_lm)
Constructor.
setRowTemplate($a_template, $a_template_dir="")
Set row template.
determineOffsetAndOrder($a_omit_offset=false)
Determine offset and order.
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.
setEnableHeader($a_enableheader)
Set Enable Header.
getLimit()
Get limit.
setMaxCount($a_max_count)
set max.
setEnableTitle($a_enabletitle)
Set Enable Title.