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,
true);
75 $textheight->setSize(3);
77 $textheight->setDecimals(0);
78 $textheight->setMinValue(1);
82 if ($this->
object->getMaxChars() > 0) {
83 $maxchars->setValue($this->
object->getMaxChars());
85 $textwidth->setValue($this->
object->getTextWidth());
86 $textheight->setValue($this->
object->getTextHeight());
91 $max = $a_form->
getInput(
"maxchars");
92 $this->
object->setMaxChars(strlen($max) ? $max : null);
93 $this->
object->setTextWidth($a_form->
getInput(
"textwidth"));
94 $this->
object->setTextHeight($a_form->
getInput(
"textheight"));
101 if (is_array($a_working_data)) {
102 $res[] =
array(
"textanswer"=>trim($a_working_data[0][
"textanswer"]));
108 public function getPrintView($question_title = 1, $show_questiontext = 1, $survey_id = null,
array $a_working_data = null)
111 if ($a_working_data) {
113 $user_answer = $user_answer[0][
"textanswer"];
116 $template =
new ilTemplate(
"tpl.il_svy_qpl_text_printview.html",
true,
true,
"Modules/SurveyQuestionPool");
117 if ($show_questiontext) {
120 if ($question_title) {
124 $template->setVariable(
"TEXT_ANSWER", $this->lng->txt(
"answer"));
125 if (is_array($a_working_data) && trim($user_answer)) {
126 $template->setVariable(
"TEXT", nl2br($user_answer));
129 $template->setVariable(
"TEXTBOX", $this->lng->txt(
"textbox"));
130 $template->setVariable(
"TEXTBOX_WIDTH", $this->
object->getTextWidth()*16);
131 $template->setVariable(
"TEXTBOX_HEIGHT", $this->
object->getTextHeight()*16);
133 if ($this->
object->getMaxChars()) {
134 $template->setVariable(
"TEXT_MAXCHARS", sprintf($this->lng->txt(
"text_maximum_chars_allowed"), $this->
object->getMaxChars()));
147 public function getWorkingForm($working_data =
"", $question_title = 1, $show_questiontext = 1, $error_message =
"", $survey_id = null)
149 $template =
new ilTemplate(
"tpl.il_svy_out_text.html",
true,
true,
"Modules/SurveyQuestionPool");
150 $template->setCurrentBlock(
"material_text");
154 if ($this->
object->getTextHeight() == 1) {
156 if (is_array($working_data)) {
157 if (strlen($working_data[0][
"textanswer"])) {
163 if ($this->
object->getMaxChars()) {
164 $template->setVariable(
"MAXLENGTH",
" maxlength=\"" . $this->
object->getMaxChars() .
"\"");
169 if (is_array($working_data)) {
177 $template->setCurrentBlock(
"question_data_text");
178 if ($show_questiontext) {
181 if ($question_title) {
184 $template->setVariable(
"TEXT_ANSWER", $this->lng->txt(
"answer"));
186 if (strcmp($error_message,
"") != 0) {
187 $template->setVariable(
"ERROR_MESSAGE",
"<p class=\"warning\">$error_message</p>");
189 if ($this->
object->getMaxChars()) {
190 $template->setVariable(
"TEXT_MAXCHARS", sprintf($this->lng->txt(
"text_maximum_chars_allowed"), $this->
object->getMaxChars()));
addFieldsToEditForm(ilPropertyFormGUI $a_form)
setQuestionTabsForClass($guiclass)
static prepareFormOutput($a_str, $a_strip=false)
prepares string output for html forms public
getMaterialOutput()
Creates the HTML output of the question material(s)
outQuestionText($template)
Text survey question GUI representation.
getWorkingForm($working_data="", $question_title=1, $show_questiontext=1, $error_message="", $survey_id=null)
Creates the question output form for the learner.
foreach($_POST as $key=> $value) $res
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
special template class to simplify handling of ITX/PEAR
static getHtmlPath($relative_path)
get url of path
Create styles array
The data for the language used.
getParsedAnswers(array $a_working_data=null, $a_only_user_anwers=false)
Create new PHPExcel object
obj_idprivate
importEditFormValues(ilPropertyFormGUI $a_form)
getPrintViewQuestionTitle($question_title=1)
getPrintView($question_title=1, $show_questiontext=1, $survey_id=null, array $a_working_data=null)
Basic class for all survey question types.