24include_once
"./Modules/SurveyQuestionPool/classes/class.SurveyQuestionGUI.php";
41 include_once
"./Modules/SurveyQuestionPool/classes/class.SurveyMetricQuestion.php";
59 $subtype->setRequired(
true);
64 $subtype->addOption($opt);
68 $minimum1->setRequired(
false);
69 $minimum1->setSize(6);
70 $opt->addSubItem($minimum1);
74 $maximum1->setRequired(
false);
75 $maximum1->setSize(6);
76 $opt->addSubItem($maximum1);
79 $subtype->addOption($opt);
83 $minimum2->setRequired(
false);
84 $minimum2->setSize(6);
85 $minimum2->setMinValue(0);
86 $opt->addSubItem($minimum2);
90 $maximum2->setRequired(
false);
91 $maximum2->setSize(6);
92 $opt->addSubItem($maximum2);
95 $subtype->addOption($opt);
99 $minimum3->setRequired(
false);
100 $minimum3->setSize(6);
101 $minimum3->setMinValue(0);
102 $minimum3->setDecimals(0);
103 $opt->addSubItem($minimum3);
107 $maximum3->setDecimals(0);
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));
144 public function getParsedAnswers(array $a_working_data =
null, $a_only_user_anwers =
false)
148 if(is_array($a_working_data))
150 $res[] = array(
"value" => $a_working_data[0][
"value"]);
163 function getPrintView($question_title = 1, $show_questiontext = 1, $survey_id =
null, array $a_working_data =
null)
169 $user_answer = $user_answer[0][
"value"];
172 $template =
new ilTemplate(
"tpl.il_svy_qpl_metric_printview.html", TRUE, TRUE,
"Modules/SurveyQuestionPool");
173 $template->setVariable(
"MIN_MAX", $this->object->getMinMaxText());
175 if ($show_questiontext)
183 $template->setVariable(
"TEXT_ANSWER", $this->lng->txt(
"answer"));
184 $template->setVariable(
"QUESTION_ID", $this->object->getId());
186 if(!is_array($a_working_data) || !trim($user_answer))
190 for ($i = 0; $i < 10; $i++) $solution_text .=
" ";
194 $solution_text = $user_answer;
196 $template->setVariable(
"TEXT_SOLUTION", $solution_text);
198 $template->parseCurrentBlock();
199 return $template->get();
214 function getWorkingForm($working_data =
"", $question_title = 1, $show_questiontext = 1, $error_message =
"", $survey_id =
null)
216 $template =
new ilTemplate(
"tpl.il_svy_out_metric.html", TRUE, TRUE,
"Modules/SurveyQuestionPool");
217 $template->setCurrentBlock(
"material_metric");
219 $template->parseCurrentBlock();
220 $template->setVariable(
"MIN_MAX", $this->object->getMinMaxText());
236 $template->setVariable(
"QUESTIONTEXT", $this->object->prepareTextareaOutput($questiontext, TRUE));
237 if ($show_questiontext)
243 $template->setVariable(
"QUESTION_TITLE", $this->object->getTitle());
245 $template->setVariable(
"TEXT_ANSWER", $this->lng->txt(
"answer"));
246 $template->setVariable(
"QUESTION_ID", $this->object->getId());
247 if (is_array($working_data))
249 $template->setVariable(
"VALUE_METRIC", $working_data[0][
"value"]);
252 $template->setVariable(
"INPUT_SIZE", 10);
254 if (strcmp($error_message,
"") != 0)
256 $template->setVariable(
"ERROR_MESSAGE",
"<p class=\"warning\">$error_message</p>");
258 $template->parseCurrentBlock();
259 return $template->get();
An exception for terminatinating execution or to throw for unit testing.
Metric survey question GUI representation.
addFieldsToEditForm(ilPropertyFormGUI $a_form)
getWorkingForm($working_data="", $question_title=1, $show_questiontext=1, $error_message="", $survey_id=null)
Creates the question output form for the learner.
importEditFormValues(ilPropertyFormGUI $a_form)
getParsedAnswers(array $a_working_data=null, $a_only_user_anwers=false)
getPrintView($question_title=1, $show_questiontext=1, $survey_id=null, array $a_working_data=null)
Creates a HTML representation of the question.
const SUBTYPE_RATIO_NON_ABSOLUTE
const SUBTYPE_RATIO_ABSOLUTE
Basic class for all survey question types.
getPrintViewQuestionTitle($question_title=1)
outQuestionText($template)
setQuestionTabsForClass($guiclass)
getMaterialOutput()
Creates the HTML output of the question material(s)
This class represents an option in a radio group.
special template class to simplify handling of ITX/PEAR