46 $subtype->setRequired(
true);
51 $subtype->addOption($opt);
55 $minimum1->setRequired(
false);
56 $minimum1->setSize(6);
57 $opt->addSubItem($minimum1);
61 $maximum1->setRequired(
false);
62 $maximum1->setSize(6);
63 $opt->addSubItem($maximum1);
66 $subtype->addOption($opt);
70 $minimum2->setRequired(
false);
71 $minimum2->setSize(6);
72 $minimum2->setMinValue(0);
73 $opt->addSubItem($minimum2);
77 $maximum2->setRequired(
false);
78 $maximum2->setSize(6);
79 $opt->addSubItem($maximum2);
82 $subtype->addOption($opt);
86 $minimum3->setRequired(
false);
87 $minimum3->setSize(6);
88 $minimum3->setMinValue(0);
89 $minimum3->setDecimals(0);
90 $opt->addSubItem($minimum3);
94 $maximum3->setDecimals(0);
95 $maximum3->setRequired(
false);
96 $maximum3->setSize(6);
97 $opt->addSubItem($maximum3);
101 $subtype->setValue($this->
object->getSubtype());
103 switch ($this->
object->getSubtype()) {
105 $minimum1->setValue($this->
object->getMinimum());
106 $maximum1->setValue($this->
object->getMaximum());
110 $minimum2->setValue($this->
object->getMinimum());
111 $maximum2->setValue($this->
object->getMaximum());
115 $minimum3->setValue($this->
object->getMinimum());
116 $maximum3->setValue($this->
object->getMaximum());
124 $this->
object->setOrientation((
int) $a_form->
getInput(
"orientation"));
125 $this->
object->setSubtype((
int) $type);
126 $min = ($a_form->
getInput(
"minimum" . $type) !=
"")
127 ? (
float) $a_form->
getInput(
"minimum" . $type)
129 $max = ($a_form->
getInput(
"maximum" . $type) !=
"")
130 ? (
float) $a_form->
getInput(
"maximum" . $type)
132 $this->
object->setMinimum($min);
133 $this->
object->setMaximum($max);
137 ?array $a_working_data =
null,
138 $a_only_user_anwers =
false
142 if (is_array($a_working_data)) {
143 $res[] = array(
"value" => ($a_working_data[0][
"value"] ??
null));
155 int $question_title = 1,
156 bool $show_questiontext =
true,
157 ?
int $survey_id =
null,
158 ?array $working_data =
null
162 $user_answer = $this->getParsedAnswers($working_data);
163 $user_answer = $user_answer[0][
"value"];
165 $template =
new ilTemplate(
"tpl.il_svy_qpl_metric_printview.html",
true,
true,
"components/ILIAS/SurveyQuestionPool");
166 $template->setVariable(
"MIN_MAX", $this->
object->getMinMaxText());
168 if ($show_questiontext) {
169 $this->outQuestionText($template);
171 if ($question_title) {
172 $template->setVariable(
"QUESTION_TITLE", $this->getPrintViewQuestionTitle($question_title));
174 $template->setVariable(
"TEXT_ANSWER", $this->
lng->txt(
"answer"));
175 $template->setVariable(
"QUESTION_ID", $this->
object->getId());
177 if (!is_array($working_data) || !trim((
string) $user_answer)) {
179 $solution_text = str_repeat(
" ", 10);
181 $solution_text = $user_answer;
183 $template->setVariable(
"TEXT_SOLUTION", $solution_text);
185 $template->parseCurrentBlock();
186 return $template->get();
195 ?array $working_data =
null,
196 int $question_title = 1,
197 bool $show_questiontext =
true,
198 string $error_message =
"",
199 ?
int $survey_id =
null,
200 bool $compress_view =
false
202 $template = new
ilTemplate(
"tpl.il_svy_out_metric.html",
true,
true,
"components/ILIAS/SurveyQuestionPool");
205 if ($show_questiontext) {
206 $this->outQuestionText($template);
208 $template->setVariable(
"QUESTION_TITLE", $this->getQuestionTitle($question_title));
209 $template->setVariable(
"TEXT_ANSWER", $this->
lng->txt(
"answer"));
210 $template->setVariable(
"QUESTION_ID", $this->
object->getId());
211 if (is_array($working_data)) {
212 $template->setVariable(
"VALUE_METRIC", $working_data[0][
"value"] ??
"");
215 $template->setVariable(
"INPUT_SIZE", 10);
217 if (strcmp($error_message,
"") !== 0) {
218 $template->setVariable(
"ERROR_MESSAGE",
"<p class=\"warning\">$error_message</p>");
220 $template->parseCurrentBlock();
221 return $template->get();
setVariable($variable, $value='')
Sets a variable value.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
addFieldsToEditForm(ilPropertyFormGUI $a_form)
getParsedAnswers(?array $a_working_data=null, $a_only_user_anwers=false)
importEditFormValues(ilPropertyFormGUI $a_form)
getPrintView(int $question_title=1, bool $show_questiontext=true, ?int $survey_id=null, ?array $working_data=null)
Creates a HTML representation of the question Creates a HTML representation of the question.
getWorkingForm(?array $working_data=null, int $question_title=1, bool $show_questiontext=true, string $error_message="", ?int $survey_id=null, bool $compress_view=false)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
const SUBTYPE_RATIO_NON_ABSOLUTE
const SUBTYPE_RATIO_ABSOLUTE
Basic class for all survey question types The SurveyQuestionGUI class defines and encapsulates basic ...
setQuestionTabsForClass(string $guiclass)
This class represents an option in a radio group.
special template class to simplify handling of ITX/PEAR