24 include_once
"./Modules/SurveyQuestionPool/classes/class.SurveyQuestionGUI.php";
41 include_once
"./Modules/SurveyQuestionPool/classes/class.SurveyMetricQuestion.php";
64 $subtype->addOption($opt);
69 $minimum1->setSize(6);
70 $opt->addSubItem($minimum1);
75 $maximum1->setSize(6);
76 $opt->addSubItem($maximum1);
79 $subtype->addOption($opt);
84 $minimum2->setSize(6);
85 $minimum2->setMinValue(0);
86 $opt->addSubItem($minimum2);
91 $maximum2->setSize(6);
92 $opt->addSubItem($maximum2);
95 $subtype->addOption($opt);
100 $minimum3->setSize(6);
101 $minimum3->setMinValue(0);
102 $minimum3->setDecimals(0);
103 $opt->addSubItem($minimum3);
108 $maximum3->setRequired(
false);
109 $maximum3->setSize(6);
110 $opt->addSubItem($maximum3);
114 $subtype->setValue($this->object->getSubtype());
116 switch($this->object->getSubtype())
119 $minimum1->setValue($this->object->getMinimum());
120 $maximum1->setValue($this->object->getMaximum());
124 $minimum2->setValue($this->object->getMinimum());
125 $maximum2->setValue($this->object->getMaximum());
129 $minimum3->setValue($this->object->getMinimum());
130 $maximum3->setValue($this->object->getMaximum());
137 $type = (int)$a_form->
getInput(
"type");
138 $this->
object->setOrientation($a_form->
getInput(
"orientation"));
139 $this->
object->setSubtype($type);
140 $this->
object->setMinimum($a_form->
getInput(
"minimum".$type));
141 $this->
object->setMaximum($a_form->
getInput(
"maximum".$type));
151 function getPrintView($question_title = 1, $show_questiontext = 1, $survey_id = null)
153 $template =
new ilTemplate(
"tpl.il_svy_qpl_metric_printview.html", TRUE, TRUE,
"Modules/SurveyQuestionPool");
154 $template->setVariable(
"MIN_MAX", $this->object->getMinMaxText());
156 $template->setVariable(
"QUESTIONTEXT", $this->object->prepareTextareaOutput($questiontext, TRUE));
157 if ($show_questiontext)
163 $template->setVariable(
"QUESTION_TITLE", $this->object->getTitle());
165 $template->setVariable(
"TEXT_ANSWER", $this->lng->txt(
"answer"));
166 $template->setVariable(
"QUESTION_ID", $this->object->getId());
170 for ($i = 0; $i < 10; $i++) $solution_text .=
" ";
171 $template->setVariable(
"TEXT_SOLUTION", $solution_text);
173 $template->parseCurrentBlock();
174 return $template->get();
189 function getWorkingForm($working_data =
"", $question_title = 1, $show_questiontext = 1, $error_message =
"", $survey_id = null)
191 $template =
new ilTemplate(
"tpl.il_svy_out_metric.html", TRUE, TRUE,
"Modules/SurveyQuestionPool");
192 $template->setCurrentBlock(
"material_metric");
194 $template->parseCurrentBlock();
195 $template->setVariable(
"MIN_MAX", $this->object->getMinMaxText());
211 $template->setVariable(
"QUESTIONTEXT", $this->object->prepareTextareaOutput($questiontext, TRUE));
212 if ($show_questiontext)
218 $template->setVariable(
"QUESTION_TITLE", $this->object->getTitle());
220 $template->setVariable(
"TEXT_ANSWER", $this->lng->txt(
"answer"));
221 $template->setVariable(
"QUESTION_ID", $this->object->getId());
222 if (is_array($working_data))
224 $template->setVariable(
"VALUE_METRIC", $working_data[0][
"value"]);
227 $template->setVariable(
"INPUT_SIZE", 10);
229 if (strcmp($error_message,
"") != 0)
231 $template->setVariable(
"ERROR_MESSAGE",
"<p class=\"warning\">$error_message</p>");
233 $template->parseCurrentBlock();
234 return $template->get();
252 if (count($this->cumulated) == 0)
256 include_once
"./Modules/Survey/classes/class.ilObjSurvey.php";
261 $nr_of_users =
sizeof($finished_ids);
263 $this->cumulated =& $this->
object->getCumulatedResults($survey_id, $nr_of_users, $finished_ids);
267 include_once
"./Services/UICore/classes/class.ilTemplate.php";
268 $template =
new ilTemplate(
"tpl.il_svy_svy_cumulated_results_detail.html", TRUE, TRUE,
"Modules/Survey");
270 $template->setCurrentBlock(
"detail_row");
271 $template->setVariable(
"TEXT_OPTION", $this->lng->txt(
"question"));
272 $questiontext = $this->
object->getQuestiontext();
273 $template->setVariable(
"TEXT_OPTION_VALUE", $this->object->prepareTextareaOutput($questiontext, TRUE));
274 $template->parseCurrentBlock();
275 $template->setCurrentBlock(
"detail_row");
276 $template->setVariable(
"TEXT_OPTION", $this->lng->txt(
"question_type"));
277 $template->setVariable(
"TEXT_OPTION_VALUE", $this->lng->txt($this->getQuestionType()));
278 $template->parseCurrentBlock();
279 $template->setCurrentBlock(
"detail_row");
280 $template->setVariable(
"TEXT_OPTION", $this->lng->txt(
"users_answered"));
281 $template->setVariable(
"TEXT_OPTION_VALUE", $this->cumulated[
"USERS_ANSWERED"]);
282 $template->parseCurrentBlock();
283 $template->setCurrentBlock(
"detail_row");
284 $template->setVariable(
"TEXT_OPTION", $this->lng->txt(
"users_skipped"));
285 $template->setVariable(
"TEXT_OPTION_VALUE", $this->cumulated[
"USERS_SKIPPED"]);
286 $template->parseCurrentBlock();
287 $template->setCurrentBlock(
"detail_row");
288 $template->setVariable(
"TEXT_OPTION", $this->lng->txt(
"subtype"));
289 switch ($this->object->getSubType())
292 $template->setVariable(
"TEXT_OPTION_VALUE", $this->lng->txt(
"non_ratio"));
295 $template->setVariable(
"TEXT_OPTION_VALUE", $this->lng->txt(
"ratio_non_absolute"));
298 $template->setVariable(
"TEXT_OPTION_VALUE", $this->lng->txt(
"ratio_absolute"));
301 $template->parseCurrentBlock();
313 $template->setCurrentBlock(
"detail_row");
314 $template->setVariable(
"TEXT_OPTION", $this->lng->txt(
"median"));
315 $template->setVariable(
"TEXT_OPTION_VALUE", $this->cumulated[
"MEDIAN"]);
316 $template->parseCurrentBlock();
317 $template->setCurrentBlock(
"detail_row");
318 $template->setVariable(
"TEXT_OPTION", $this->lng->txt(
"arithmetic_mean"));
319 $template->setVariable(
"TEXT_OPTION_VALUE", $this->cumulated[
"ARITHMETIC_MEAN"]);
320 $template->parseCurrentBlock();
322 $template->setCurrentBlock(
"detail_row");
323 $template->setVariable(
"TEXT_OPTION", $this->lng->txt(
"values"));
325 if (is_array($this->cumulated[
"values"]))
327 foreach ($this->cumulated[
"values"] as $key => $value)
329 $values .=
"<li>" . $value[
"value"] .
": n=" . $value[
"selected"] .
330 " (" . sprintf(
"%.2f", 100*$value[
"percentage"]) .
"%)</li>";
333 $values =
"<ol>$values</ol>";
334 $template->setVariable(
"TEXT_OPTION_VALUE", $values);
335 $template->parseCurrentBlock();
339 $template->setCurrentBlock(
"detail_row");
340 $template->setVariable(
"TEXT_OPTION", $this->lng->txt(
"chart"));
341 $template->setVariable(
"TEXT_OPTION_VALUE", $this->
renderChart(
"svy_ch_".$this->object->getId(), $this->cumulated[
"values"]));
342 $template->parseCurrentBlock();
345 $template->setVariable(
"QUESTION_TITLE",
"$counter. ".$this->object->getTitle());
346 return $template->get();
351 include_once
"Services/Chart/classes/class.ilChart.php";
352 $chart =
new ilChart($a_id, 700, 400);
355 $chart->setLegend($legend);
358 $data->setLabel($this->lng->txt(
"users_answered"));
359 $data->setBarOptions(0.1,
"center");
364 foreach($a_values as $idx => $answer)
366 $data->addPoint($answer[
"value"], $answer[
"selected"]);
367 $labels[$answer[
"value"]] = $answer[
"value"];
369 $chart->addData($data);
371 $chart->setTicks($labels,
false,
true);
374 return "<div style=\"margin:10px\">".$chart->getHTML().
"</div>";