18 public function __construct($a_parent_obj, $a_parent_cmd, array $a_results)
22 $lng = $DIC->language();
25 $this->
setId(
"svy_cum");
31 $this->
addColumn($this->lng->txt(
"title"));
33 if (strcmp(
$c,
'question') == 0) {
34 $this->
addColumn($this->lng->txt(
"question"));
36 if (strcmp(
$c,
'question_type') == 0) {
37 $this->
addColumn($this->lng->txt(
"question_type"));
39 if (strcmp(
$c,
'users_answered') == 0) {
40 $this->
addColumn($this->lng->txt(
"users_answered"));
42 if (strcmp(
$c,
'users_skipped') == 0) {
43 $this->
addColumn($this->lng->txt(
"users_skipped"));
45 if (strcmp(
$c,
'mode') == 0) {
46 $this->
addColumn($this->lng->txt(
"mode"));
48 if (strcmp(
$c,
'mode_nr_of_selections') == 0) {
49 $this->
addColumn($this->lng->txt(
"mode_nr_of_selections"));
51 if (strcmp(
$c,
'median') == 0) {
52 $this->
addColumn($this->lng->txt(
"median"));
54 if (strcmp(
$c,
'arithmetic_mean') == 0) {
55 $this->
addColumn($this->lng->txt(
"arithmetic_mean"));
59 $this->
setRowTemplate(
"tpl.il_svy_svy_results_cumulated_row.html",
"Modules/Survey");
60 $this->
setFormAction($this->ctrl->getFormAction($a_parent_obj, $a_parent_cmd));
69 $cols[
"question"] = array(
70 "txt" =>
$lng->txt(
"question"),
73 $cols[
"question_type"] = array(
74 "txt" =>
$lng->txt(
"question_type"),
77 $cols[
"users_answered"] = array(
78 "txt" =>
$lng->txt(
"users_answered"),
81 $cols[
"users_skipped"] = array(
82 "txt" =>
$lng->txt(
"users_skipped"),
85 $cols[
"mode"] = array(
86 "txt" =>
$lng->txt(
"mode"),
89 $cols[
"mode_nr_of_selections"] = array(
90 "txt" =>
$lng->txt(
"mode_nr_of_selections"),
93 $cols[
"median"] = array(
94 "txt" =>
$lng->txt(
"median"),
97 $cols[
"arithmetic_mean"] = array(
98 "txt" =>
$lng->txt(
"arithmetic_mean"),
108 foreach ($a_results as $question_res) {
109 if (!is_array($question_res)) {
110 $question = $question_res->getQuestion();
113 "title" => $question->getTitle(),
114 "question" => strip_tags($question->getQuestiontext()),
116 "users_answered" => $question_res->getUsersAnswered(),
117 "users_skipped" => $question_res->getUsersSkipped(),
118 "mode" => $question_res->getModeValueAsText(),
119 "mode_nr_of_selections" => $question_res->getModeNrOfSelections(),
120 "median" => $question_res->getMedianAsText(),
121 "arithmetic_mean" => $question_res->getMean()
129 foreach ($question_res as $idx => $item) {
130 $row_title = $item[0];
132 $question = $row_res->getQuestion();
135 "title" => $question->getTitle(),
136 "question" => $row_title,
138 "users_answered" => $row_res->getUsersAnswered(),
139 "users_skipped" => $row_res->getUsersSkipped(),
140 "mode" => $row_res->getModeValueAsText(),
141 "mode_nr_of_selections" => $row_res->getModeNrOfSelections(),
142 "median" => $row_res->getMedianAsText(),
143 "arithmetic_mean" => $row_res->getMean()
154 return !in_array($a_field, array(
"question",
"question_type"));
166 $this->tpl->setVariable(
"TITLE",
$data[
'title']);
169 if (strcmp($c,
'question') == 0) {
170 $this->tpl->setCurrentBlock(
'question');
171 $this->tpl->setVariable(
"QUESTION",
$data[
'question']);
172 $this->tpl->parseCurrentBlock();
174 if (strcmp($c,
'question_type') == 0) {
175 $this->tpl->setCurrentBlock(
'question_type');
176 $this->tpl->setVariable(
"QUESTION_TYPE", trim(
$data[
'question_type']));
177 $this->tpl->parseCurrentBlock();
179 if (strcmp($c,
'users_answered') == 0) {
180 $this->tpl->setCurrentBlock(
'users_answered');
181 $this->tpl->setVariable(
"USERS_ANSWERED", trim(
$data[
'users_answered']));
182 $this->tpl->parseCurrentBlock();
184 if (strcmp($c,
'users_skipped') == 0) {
185 $this->tpl->setCurrentBlock(
'users_skipped');
186 $this->tpl->setVariable(
"USERS_SKIPPED", trim(
$data[
'users_skipped']));
187 $this->tpl->parseCurrentBlock();
189 if (strcmp($c,
'mode') == 0) {
190 $this->tpl->setCurrentBlock(
'mode');
191 $this->tpl->setVariable(
"MODE", trim(
$data[
'mode']));
193 $this->tpl->parseCurrentBlock();
195 if (strcmp($c,
'mode_nr_of_selections') == 0) {
196 $this->tpl->setCurrentBlock(
'mode_nr_of_selections');
197 $this->tpl->setVariable(
"MODE_NR_OF_SELECTIONS", trim(
$data[
'mode_nr_of_selections']));
199 $this->tpl->parseCurrentBlock();
201 if (strcmp($c,
'median') == 0) {
202 $this->tpl->setCurrentBlock(
'median');
203 $this->tpl->setVariable(
"MEDIAN", trim(
$data[
'median']));
205 $this->tpl->parseCurrentBlock();
207 if (strcmp($c,
'arithmetic_mean') == 0) {
208 $this->tpl->setCurrentBlock(
'arithmetic_mean');
209 $this->tpl->setVariable(
"ARITHMETIC_MEAN", trim(
$data[
'arithmetic_mean']));
211 $this->tpl->parseCurrentBlock();
numericOrdering($a_field)
getItems(array $a_results)
static _getQuestionTypeName($type_tag)
Return the translation for a given question type tag.
getSelectedColumns()
Get selected columns.
setRowTemplate($a_template, $a_template_dir="")
Set row template.
setFormAction($a_form_action, $a_multipart=false)
Set Form action parameter.
__construct(Container $dic, ilPlugin $plugin)
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.
setShowRowsSelector($a_value)
Toggle rows-per-page selector.
__construct($a_parent_obj, $a_parent_cmd, array $a_results)
Constructor.