24 include_once
"./Modules/SurveyQuestionPool/classes/class.SurveyQuestionGUI.php";
41 include_once
"./Modules/SurveyQuestionPool/classes/class.SurveyTextQuestion.php";
60 $maxchars->setSize(5);
61 $maxchars->setDecimals(0);
67 $textwidth->setSize(3);
68 $textwidth->setDecimals(0);
69 $textwidth->setMinValue(10);
75 $textheight->setSize(3);
77 $textheight->setDecimals(0);
78 $textheight->setMinValue(1);
82 if ($this->object->getMaxChars() > 0)
84 $maxchars->setValue($this->object->getMaxChars());
86 $textwidth->setValue($this->object->getTextWidth());
87 $textheight->setValue($this->object->getTextHeight());
92 $max = $a_form->
getInput(
"maxchars");
93 $this->
object->setMaxChars(strlen($max) ? $max : null);
94 $this->
object->setTextWidth($a_form->
getInput(
"textwidth"));
95 $this->
object->setTextHeight($a_form->
getInput(
"textheight"));
98 public function getPrintView($question_title = 1, $show_questiontext = 1, $survey_id = null)
100 $template =
new ilTemplate(
"tpl.il_svy_qpl_text_printview.html", TRUE, TRUE,
"Modules/SurveyQuestionPool");
101 if ($show_questiontext)
107 $template->setVariable(
"QUESTION_TITLE", $this->object->getTitle());
109 $template->setVariable(
"TEXT_ANSWER", $this->lng->txt(
"answer"));
111 $template->setVariable(
"TEXTBOX", $this->lng->txt(
"textbox"));
112 $template->setVariable(
"TEXTBOX_WIDTH", $this->object->getTextWidth()*16);
113 $template->setVariable(
"TEXTBOX_HEIGHT", $this->object->getTextHeight()*16);
114 $template->setVariable(
"QUESTION_ID", $this->object->getId());
115 if ($this->object->getMaxChars())
117 $template->setVariable(
"TEXT_MAXCHARS", sprintf($this->lng->txt(
"text_maximum_chars_allowed"), $this->
object->getMaxChars()));
119 return $template->get();
130 public function getWorkingForm($working_data =
"", $question_title = 1, $show_questiontext = 1, $error_message =
"", $survey_id = null)
132 $template =
new ilTemplate(
"tpl.il_svy_out_text.html", TRUE, TRUE,
"Modules/SurveyQuestionPool");
133 $template->setCurrentBlock(
"material_text");
135 $template->parseCurrentBlock();
137 if ($this->object->getTextHeight() == 1)
139 $template->setCurrentBlock(
"textinput");
140 if (is_array($working_data))
142 if (strlen($working_data[0][
"textanswer"]))
147 $template->setVariable(
"QUESTION_ID", $this->object->getId());
148 $template->setVariable(
"WIDTH", $this->object->getTextWidth());
149 if ($this->object->getMaxChars())
151 $template->setVariable(
"MAXLENGTH",
" maxlength=\"" . $this->object->getMaxChars() .
"\"");
153 $template->parseCurrentBlock();
157 $template->setCurrentBlock(
"textarea");
158 if (is_array($working_data))
162 $template->setVariable(
"QUESTION_ID", $this->object->getId());
163 $template->setVariable(
"WIDTH", $this->object->getTextWidth());
164 $template->setVariable(
"HEIGHT", $this->object->getTextHeight());
165 $template->parseCurrentBlock();
167 $template->setCurrentBlock(
"question_data_text");
168 if ($show_questiontext)
174 $template->setVariable(
"QUESTION_TITLE", $this->object->getTitle());
176 $template->setVariable(
"TEXT_ANSWER", $this->lng->txt(
"answer"));
177 $template->setVariable(
"LABEL_QUESTION_ID", $this->object->getId());
178 if (strcmp($error_message,
"") != 0)
180 $template->setVariable(
"ERROR_MESSAGE",
"<p class=\"warning\">$error_message</p>");
182 if ($this->object->getMaxChars())
184 $template->setVariable(
"TEXT_MAXCHARS", sprintf($this->lng->txt(
"text_maximum_chars_allowed"), $this->
object->getMaxChars()));
186 $template->parseCurrentBlock();
187 return $template->get();
205 if (count($this->cumulated) == 0)
209 include_once
"./Modules/Survey/classes/class.ilObjSurvey.php";
214 $nr_of_users =
sizeof($finished_ids);
216 $this->cumulated =& $this->
object->getCumulatedResults($survey_id, $nr_of_users, $finished_ids);
220 include_once
"./Services/UICore/classes/class.ilTemplate.php";
221 $template =
new ilTemplate(
"tpl.il_svy_svy_cumulated_results_detail.html", TRUE, TRUE,
"Modules/Survey");
223 $template->setCurrentBlock(
"detail_row");
224 $template->setVariable(
"TEXT_OPTION", $this->lng->txt(
"question"));
225 $questiontext = $this->
object->getQuestiontext();
226 $template->setVariable(
"TEXT_OPTION_VALUE", $this->object->prepareTextareaOutput($questiontext, TRUE));
227 $template->parseCurrentBlock();
228 $template->setCurrentBlock(
"detail_row");
229 $template->setVariable(
"TEXT_OPTION", $this->lng->txt(
"question_type"));
230 $template->setVariable(
"TEXT_OPTION_VALUE", $this->lng->txt($this->getQuestionType()));
231 $template->parseCurrentBlock();
232 $template->setCurrentBlock(
"detail_row");
233 $template->setVariable(
"TEXT_OPTION", $this->lng->txt(
"users_answered"));
234 $template->setVariable(
"TEXT_OPTION_VALUE", $this->cumulated[
"USERS_ANSWERED"]);
235 $template->parseCurrentBlock();
236 $template->setCurrentBlock(
"detail_row");
237 $template->setVariable(
"TEXT_OPTION", $this->lng->txt(
"users_skipped"));
238 $template->setVariable(
"TEXT_OPTION_VALUE", $this->cumulated[
"USERS_SKIPPED"]);
239 $template->parseCurrentBlock();
241 $template->setCurrentBlock(
"detail_row");
242 $template->setVariable(
"TEXT_OPTION", $this->lng->txt(
"given_answers"));
244 if (is_array($this->cumulated[
"textvalues"]))
246 foreach ($this->cumulated[
"textvalues"] as $textvalue)
248 $textvalues .=
"<li>" . preg_replace(
"/\n/",
"<br>", $textvalue) .
"</li>";
251 $textvalues =
"<ul>$textvalues</ul>";
252 $template->setVariable(
"TEXT_OPTION_VALUE", $textvalues);
253 $template->parseCurrentBlock();
255 $template->setVariable(
"QUESTION_TITLE",
"$counter. ".$this->object->getTitle());
256 return $template->get();