ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
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
5include_once("./Services/Table/classes/class.ilTable2GUI.php");
6include_once("./Modules/TestQuestionPool/classes/class.assQuestion.php");
7include_once("./Modules/LearningModule/classes/class.ilLMObject.php");
8
18{
19
23 function __construct($a_parent_obj, $a_parent_cmd, $a_lm)
24 {
25 global $ilCtrl, $lng, $ilAccess, $lng, $rbacsystem;
26
27 $this->lm = $a_lm;
28
29 $this->setId("lm_qst".$this->lm->getId());
30
31 parent::__construct($a_parent_obj, $a_parent_cmd);
32// $this->setTitle($this->lng->txt("users"));
33
34 //$this->addColumn("", "", "1", true);
35 $this->addColumn($this->lng->txt("pg"));
36 $this->addColumn($this->lng->txt("question"));
37 $this->addColumn($this->lng->txt("cont_users_answered"));
38 $this->addColumn($this->lng->txt("cont_correct_after_first"));
39 $this->addColumn($this->lng->txt("cont_second"));
40 $this->addColumn($this->lng->txt("cont_third_and_more"));
41 $this->addColumn($this->lng->txt("cont_never"));
42
43 $this->setExternalSorting(true);
44 $this->setExternalSegmentation(true);
45 $this->setEnableHeader(true);
46 //$this->setFormAction($ilCtrl->getFormAction($this->parent_obj, "applyFilter"));
47 $this->setFormAction($ilCtrl->getFormAction($this->parent_obj, $this->parent_cmd));
48 $this->setRowTemplate("tpl.lm_question_row.html", "Modules/LearningModule");
49 //$this->disable("footer");
50 $this->setEnableTitle(true);
51// $this->initFilter();
52// $this->setFilterCommand("applyFilter");
53// $this->setDefaultOrderField("login");
54// $this->setDefaultOrderDirection("asc");
55
56// $this->setSelectAllCheckbox("id[]");
57
58// $this->addMultiCommand("activateUsers", $lng->txt("activate"));
59
60 $this->getItems();
61 }
62
66 function getItems()
67 {
68 global $lng;
69//if ($GLOBALS["kk"]++ == 1) nj();
70
72
73 include_once("./Modules/LearningModule/classes/class.ilLMPageObject.php");
74
76 $this->lm->getId(),
77 ilUtil::stripSlashes($this->getOrderField()),
78 ilUtil::stripSlashes($this->getOrderDirection()),
79 ilUtil::stripSlashes($this->getOffset()),
80 ilUtil::stripSlashes($this->getLimit())
81 );
82
83 if (count($questions["set"]) == 0 && $this->getOffset() > 0)
84 {
85 $this->resetOffset();
87 $this->lm->getId(),
88 ilUtil::stripSlashes($this->getOrderField()),
89 ilUtil::stripSlashes($this->getOrderDirection()),
90 ilUtil::stripSlashes($this->getOffset()),
91 ilUtil::stripSlashes($this->getLimit())
92 );
93 }
94
95 $this->setMaxCount($questions["cnt"]);
96 $this->setData($questions["set"]);
97 }
98
99
103 protected function fillRow($a_set)
104 {
105 global $ilCtrl, $lng;
106
107 $this->tpl->setVariable("PAGE_TITLE",
108 ilLMObject::_lookupTitle($a_set["page_id"]));
109 $this->tpl->setVariable("QUESTION",
110 assQuestion::_getQuestionText($a_set["question_id"]));
111
112 include_once("./Services/COPage/classes/class.ilPageQuestionProcessor.php");
113 $stats = ilPageQuestionProcessor::getQuestionStatistics($a_set["question_id"]);
114
115 $this->tpl->setVariable("VAL_ANSWERED", (int) $stats["all"]);
116 if ($stats["all"] == 0)
117 {
118 $this->tpl->setVariable("VAL_CORRECT_FIRST", 0);
119 $this->tpl->setVariable("VAL_CORRECT_SECOND", 0);
120 $this->tpl->setVariable("VAL_CORRECT_THIRD_OR_MORE", 0);
121 $this->tpl->setVariable("VAL_NEVER", 0);
122 }
123 else
124 {
125 $this->tpl->setVariable("VAL_CORRECT_FIRST", $stats["first"].
126 " (".(100/$stats["all"] * $stats["first"])." %)");
127 $this->tpl->setVariable("VAL_CORRECT_SECOND", $stats["second"].
128 " (".(100/$stats["all"] * $stats["second"])." %)");
129 $this->tpl->setVariable("VAL_CORRECT_THIRD_AND_MORE", $stats["third_or_more"].
130 " (".(100/$stats["all"] * $stats["third_or_more"])." %)");
131 $nev = $stats["all"] - $stats["first"] - $stats["second"] - $stats["third_or_more"];
132 $this->tpl->setVariable("VAL_NEVER", $nev.
133 " (".(100/$stats["all"] * $nev)." %)");
134 }
135 }
136}
137
138?>
_getQuestionText($a_q_id)
Returns question text.
static _lookupTitle($a_obj_id)
Lookup title.
static queryQuestionsOfLearningModule($a_lm_id, $a_order_field, $a_order_dir, $a_offset, $a_limit)
Get questions of learning module.
__construct($a_parent_obj, $a_parent_cmd, $a_lm)
Constructor.
static getQuestionStatistics($a_q_id)
Get statistics for question.
Class ilTable2GUI.
setEnableHeader($a_enableheader)
Set Enable Header.
setExternalSorting($a_val)
Set external sorting.
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.
determineOffsetAndOrder($a_omit_offset=false)
Determine offset and order.
setData($a_data)
set table data @access public
setEnableTitle($a_enabletitle)
Set Enable Title.
setRowTemplate($a_template, $a_template_dir="")
Set row template.
resetOffset($a_in_determination=false)
Reset offset.
getOffset()
Get offset.
setExternalSegmentation($a_val)
Set external segmentation.
setId($a_val)
Set id.
setFormAction($a_form_action, $a_multipart=false)
Set Form action parameter.
setMaxCount($a_max_count)
set max.
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
global $ilCtrl
Definition: ilias.php:18
global $lng
Definition: privfeed.php:40