ILIAS  release_7 Revision v7.30-3-g800a261c036
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
14{
18 protected $access;
19
23 protected $rbacsystem;
24
25
29 public function __construct($a_parent_obj, $a_parent_cmd, $a_lm)
30 {
31 global $DIC;
32
33 $this->ctrl = $DIC->ctrl();
34 $this->lng = $DIC->language();
35 $this->access = $DIC->access();
36 $this->rbacsystem = $DIC->rbac()->system();
37 $ilCtrl = $DIC->ctrl();
38 $lng = $DIC->language();
39 $ilAccess = $DIC->access();
40 $lng = $DIC->language();
41 $rbacsystem = $DIC->rbac()->system();
42
43 $this->lm = $a_lm;
44
45 $this->setId("lm_qst" . $this->lm->getId());
46
47 parent::__construct($a_parent_obj, $a_parent_cmd);
48 // $this->setTitle($this->lng->txt("users"));
49
50 //$this->addColumn("", "", "1", true);
51 $this->addColumn($this->lng->txt("pg"));
52 $this->addColumn($this->lng->txt("question"));
53 $this->addColumn($this->lng->txt("cont_users_answered"));
54 $this->addColumn($this->lng->txt("cont_correct_after_first"));
55 $this->addColumn($this->lng->txt("cont_second"));
56 $this->addColumn($this->lng->txt("cont_third_and_more"));
57 $this->addColumn($this->lng->txt("cont_never"));
58
59 $this->setExternalSorting(true);
60 $this->setExternalSegmentation(true);
61 $this->setEnableHeader(true);
62 //$this->setFormAction($ilCtrl->getFormAction($this->parent_obj, "applyFilter"));
63 $this->setFormAction($ilCtrl->getFormAction($this->parent_obj, $this->parent_cmd));
64 $this->setRowTemplate("tpl.lm_question_row.html", "Modules/LearningModule");
65 //$this->disable("footer");
66 $this->setEnableTitle(true);
67 // $this->initFilter();
68 // $this->setFilterCommand("applyFilter");
69 // $this->setDefaultOrderField("login");
70 // $this->setDefaultOrderDirection("asc");
71
72 // $this->setSelectAllCheckbox("id[]");
73
74 // $this->addMultiCommand("activateUsers", $lng->txt("activate"));
75
76 $this->getItems();
77 }
78
82 public function getItems()
83 {
85 //if ($GLOBALS["kk"]++ == 1) nj();
86
88
90 $this->lm->getId(),
91 ilUtil::stripSlashes($this->getOrderField()),
92 ilUtil::stripSlashes($this->getOrderDirection()),
93 ilUtil::stripSlashes($this->getOffset()),
94 ilUtil::stripSlashes($this->getLimit())
95 );
96
97 if (count($questions["set"]) == 0 && $this->getOffset() > 0) {
98 $this->resetOffset();
100 $this->lm->getId(),
101 ilUtil::stripSlashes($this->getOrderField()),
102 ilUtil::stripSlashes($this->getOrderDirection()),
103 ilUtil::stripSlashes($this->getOffset()),
104 ilUtil::stripSlashes($this->getLimit())
105 );
106 }
107
108 $this->setMaxCount($questions["cnt"]);
109 $this->setData($questions["set"]);
110 }
111
112
116 protected function fillRow($a_set)
117 {
118 $ilCtrl = $this->ctrl;
120
121 $this->tpl->setVariable(
122 "PAGE_TITLE",
123 ilLMObject::_lookupTitle($a_set["page_id"])
124 );
125 $this->tpl->setVariable(
126 "QUESTION",
127 assQuestion::_getQuestionText($a_set["question_id"])
128 );
129
130 $stats = ilPageQuestionProcessor::getQuestionStatistics($a_set["question_id"]);
131
132 $this->tpl->setVariable("VAL_ANSWERED", (int) $stats["all"]);
133 if ($stats["all"] == 0) {
134 $this->tpl->setVariable("VAL_CORRECT_FIRST", 0);
135 $this->tpl->setVariable("VAL_CORRECT_SECOND", 0);
136 $this->tpl->setVariable("VAL_CORRECT_THIRD_OR_MORE", 0);
137 $this->tpl->setVariable("VAL_NEVER", 0);
138 } else {
139 $this->tpl->setVariable("VAL_CORRECT_FIRST", $stats["first"] .
140 " (" . (100 / $stats["all"] * $stats["first"]) . " %)");
141 $this->tpl->setVariable("VAL_CORRECT_SECOND", $stats["second"] .
142 " (" . (100 / $stats["all"] * $stats["second"]) . " %)");
143 $this->tpl->setVariable("VAL_CORRECT_THIRD_AND_MORE", $stats["third_or_more"] .
144 " (" . (100 / $stats["all"] * $stats["third_or_more"]) . " %)");
145 $nev = $stats["all"] - $stats["first"] - $stats["second"] - $stats["third_or_more"];
146 $this->tpl->setVariable("VAL_NEVER", $nev .
147 " (" . (100 / $stats["all"] * $nev) . " %)");
148 }
149 }
150}
An exception for terminatinating execution or to throw for unit testing.
static _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.
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.
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.
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 $DIC
Definition: goto.php:24
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc