ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
SurveyTextQuestionGUI Class Reference

Text survey question GUI representation. More...

+ Inheritance diagram for SurveyTextQuestionGUI:
+ Collaboration diagram for SurveyTextQuestionGUI:

Public Member Functions

 setQuestionTabs ()
 
 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)
 
 getWorkingForm ($working_data="", $question_title=1, $show_questiontext=1, $error_message="", $survey_id=null)
 Creates the question output form for the learner. More...
 
- Public Member Functions inherited from SurveyQuestionGUI
 __construct ($a_id=-1)
 
 setQuestionTabs ()
 
executeCommand ()
 
 getQuestionType ()
 Returns the question type string. More...
 
 setBackUrl ($a_url)
 
 setQuestionTabsForClass ($guiclass)
 
 getPrintView ($question_title=1, $show_questiontext=1)
 
 preview ()
 Creates a preview of the question. More...
 
 getWorkingForm ($working_data="", $question_title=1, $show_questiontext=1, $error_message="", $survey_id=null)
 
 material ($checkonly=false)
 Material tab of the survey questions. More...
 
 deleteMaterial ()
 
 addMaterial ()
 Add materials to a question. More...
 
 removeMaterial ()
 
 cancelExplorer ()
 
 addPG ()
 
 addST ()
 
 addGIT ()
 
 linkChilds ()
 
 savePhrase ($a_reload=false)
 Creates an output to save the current answers as a phrase. More...
 
 confirmSavePhrase ()
 Save a new phrase to the database. More...
 

Protected Member Functions

 initObject ()
 
 addFieldsToEditForm (ilPropertyFormGUI $a_form)
 
 importEditFormValues (ilPropertyFormGUI $a_form)
 
- Protected Member Functions inherited from SurveyQuestionGUI
 initObject ()
 
 outQuestionText ($template)
 
 initEditForm ()
 
 addCommandButtons ($a_form)
 
 editQuestion (ilPropertyFormGUI $a_form=null)
 
 saveSync ()
 
 saveReturn ()
 
 saveForm ()
 
 save ($a_return=false, $a_sync=false)
 
 copySyncForm ()
 
 syncCopies ()
 
 originalSyncForm ()
 
 sync ()
 
 cancelSync ()
 
 redirectAfterSaving ($a_return=false)
 Redirect to calling survey or to edit form. More...
 
 cancel ()
 
 validateEditForm (ilPropertyFormGUI $a_form)
 
 addFieldsToEditForm (ilPropertyFormGUI $a_form)
 
 importEditFormValues (ilPropertyFormGUI $a_form)
 
 getPrintViewQuestionTitle ($question_title=1)
 
 getMaterialOutput ()
 Creates the HTML output of the question material(s) More...
 
 initPhrasesForm ()
 
 addPhrase (ilPropertyFormGUI $a_form=null)
 Creates an output for the addition of phrases. More...
 
 addSelectedPhrase ()
 
 renderStatisticsDetailsTable (array $a_head, array $a_rows, array $a_foot=null)
 

Additional Inherited Members

- Static Public Member Functions inherited from SurveyQuestionGUI
static _getQuestionGUI ($questiontype, $question_id=-1)
 Creates a question gui representation. More...
 
static _getGUIClassNameForId ($a_q_id)
 
static _getClassNameForQType ($q_type)
 
- Data Fields inherited from SurveyQuestionGUI
 $object
 
- Protected Attributes inherited from SurveyQuestionGUI
 $rbacsystem
 
 $user
 
 $access
 
 $tree
 
 $toolbar
 
 $tabs
 
 $tpl
 
 $lng
 
 $ctrl
 
 $cumulated
 
 $parent_url
 
 $log
 

Detailed Description

Text survey question GUI representation.

The SurveyTextQuestionGUI class encapsulates the GUI representation for text survey question types.

Author
Helmut Schottmüller helmu.nosp@m.t.sc.nosp@m.hottm.nosp@m.uell.nosp@m.er@ma.nosp@m.c.co.nosp@m.m
Version
$Id$

Definition at line 37 of file class.SurveyTextQuestionGUI.php.

Member Function Documentation

◆ addFieldsToEditForm()

SurveyTextQuestionGUI::addFieldsToEditForm ( ilPropertyFormGUI  $a_form)
protected

Reimplemented from SurveyQuestionGUI.

Definition at line 55 of file class.SurveyTextQuestionGUI.php.

56 {
57 // maximum number of characters
58 $maxchars = new ilNumberInputGUI($this->lng->txt("maxchars"), "maxchars");
59 $maxchars->setRequired(false);
60 $maxchars->setSize(5);
61 $maxchars->setDecimals(0);
62 $a_form->addItem($maxchars);
63
64 // textwidth
65 $textwidth = new ilNumberInputGUI($this->lng->txt("width"), "textwidth");
66 $textwidth->setRequired(true);
67 $textwidth->setSize(3);
68 $textwidth->setDecimals(0);
69 $textwidth->setMinValue(10, true);
70 $a_form->addItem($textwidth);
71
72 // textheight
73 $textheight = new ilNumberInputGUI($this->lng->txt("height"), "textheight");
74 $textheight->setRequired(true);
75 $textheight->setSize(3);
76
77 $textheight->setDecimals(0);
78 $textheight->setMinValue(1);
79 $a_form->addItem($textheight);
80
81 // values
82 if ($this->object->getMaxChars() > 0) {
83 $maxchars->setValue($this->object->getMaxChars());
84 }
85 $textwidth->setValue($this->object->getTextWidth());
86 $textheight->setValue($this->object->getTextHeight());
87 }
This class represents a number property in a property form.
addItem($a_item)
Add Item (Property, SectionHeader).

References ilPropertyFormGUI\addItem().

+ Here is the call graph for this function:

◆ getParsedAnswers()

SurveyTextQuestionGUI::getParsedAnswers ( array  $a_working_data = null,
  $a_only_user_anwers = false 
)

Definition at line 97 of file class.SurveyTextQuestionGUI.php.

98 {
99 $res = array();
100
101 if (is_array($a_working_data)) {
102 $res[] = array("textanswer" => trim($a_working_data[0]["textanswer"]));
103 }
104
105 return $res;
106 }
foreach($_POST as $key=> $value) $res

References $res.

Referenced by getPrintView().

+ Here is the caller graph for this function:

◆ getPrintView()

SurveyTextQuestionGUI::getPrintView (   $question_title = 1,
  $show_questiontext = 1,
  $survey_id = null,
array  $a_working_data = null 
)

Definition at line 108 of file class.SurveyTextQuestionGUI.php.

109 {
110 $user_answer = null;
111 if ($a_working_data) {
112 $user_answer = $this->getParsedAnswers($a_working_data);
113 $user_answer = $user_answer[0]["textanswer"];
114 }
115
116 $template = new ilTemplate("tpl.il_svy_qpl_text_printview.html", true, true, "Modules/SurveyQuestionPool");
117 if ($show_questiontext) {
119 }
120 if ($question_title) {
121 $template->setVariable("QUESTION_TITLE", $this->getPrintViewQuestionTitle($question_title));
122 }
123 $template->setVariable("QUESTION_ID", $this->object->getId());
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));
127 } else {
128 $template->setVariable("TEXTBOX_IMAGE", ilUtil::getHtmlPath(ilUtil::getImagePath("textbox.png")));
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);
132 }
133 if ($this->object->getMaxChars()) {
134 $template->setVariable("TEXT_MAXCHARS", sprintf($this->lng->txt("text_maximum_chars_allowed"), $this->object->getMaxChars()));
135 }
136 return $template->get();
137 }
getPrintViewQuestionTitle($question_title=1)
getParsedAnswers(array $a_working_data=null, $a_only_user_anwers=false)
special template class to simplify handling of ITX/PEAR
static getHtmlPath($relative_path)
get url of path
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
$template

References $template, ilUtil\getHtmlPath(), ilUtil\getImagePath(), getParsedAnswers(), SurveyQuestionGUI\getPrintViewQuestionTitle(), and SurveyQuestionGUI\outQuestionText().

+ Here is the call graph for this function:

◆ getWorkingForm()

SurveyTextQuestionGUI::getWorkingForm (   $working_data = "",
  $question_title = 1,
  $show_questiontext = 1,
  $error_message = "",
  $survey_id = null 
)

Creates the question output form for the learner.

Reimplemented from SurveyQuestionGUI.

Definition at line 147 of file class.SurveyTextQuestionGUI.php.

148 {
149 $template = new ilTemplate("tpl.il_svy_out_text.html", true, true, "Modules/SurveyQuestionPool");
150 $template->setCurrentBlock("material_text");
151 $template->setVariable("TEXT_MATERIAL", $this->getMaterialOutput());
152 $template->parseCurrentBlock();
153
154 if ($this->object->getTextHeight() == 1) {
155 $template->setCurrentBlock("textinput");
156 if (is_array($working_data)) {
157 if (strlen($working_data[0]["textanswer"])) {
158 $template->setVariable("VALUE_ANSWER", " value=\"" . ilUtil::prepareFormOutput($working_data[0]["textanswer"]) . "\"");
159 }
160 }
161 $template->setVariable("QUESTION_ID", $this->object->getId());
162 $template->setVariable("WIDTH", $this->object->getTextWidth());
163 if ($this->object->getMaxChars()) {
164 $template->setVariable("MAXLENGTH", " maxlength=\"" . $this->object->getMaxChars() . "\"");
165 }
166 $template->parseCurrentBlock();
167 } else {
168 $template->setCurrentBlock("textarea");
169 if (is_array($working_data)) {
170 $template->setVariable("VALUE_ANSWER", ilUtil::prepareFormOutput($working_data[0]["textanswer"]));
171 }
172 $template->setVariable("QUESTION_ID", $this->object->getId());
173 $template->setVariable("WIDTH", $this->object->getTextWidth());
174 $template->setVariable("HEIGHT", $this->object->getTextHeight());
175 $template->parseCurrentBlock();
176 }
177 $template->setCurrentBlock("question_data_text");
178 if ($show_questiontext) {
180 }
181 if ($question_title) {
182 $template->setVariable("QUESTION_TITLE", $this->object->getTitle());
183 }
184 $template->setVariable("TEXT_ANSWER", $this->lng->txt("answer"));
185 $template->setVariable("LABEL_QUESTION_ID", $this->object->getId());
186 if (strcmp($error_message, "") != 0) {
187 $template->setVariable("ERROR_MESSAGE", "<p class=\"warning\">$error_message</p>");
188 }
189 if ($this->object->getMaxChars()) {
190 $template->setVariable("TEXT_MAXCHARS", sprintf($this->lng->txt("text_maximum_chars_allowed"), $this->object->getMaxChars()));
191 }
192 $template->parseCurrentBlock();
193 return $template->get();
194 }
getMaterialOutput()
Creates the HTML output of the question material(s)
static prepareFormOutput($a_str, $a_strip=false)
prepares string output for html forms @access public

References $template, SurveyQuestionGUI\getMaterialOutput(), SurveyQuestionGUI\outQuestionText(), and ilUtil\prepareFormOutput().

+ Here is the call graph for this function:

◆ importEditFormValues()

SurveyTextQuestionGUI::importEditFormValues ( ilPropertyFormGUI  $a_form)
protected

Reimplemented from SurveyQuestionGUI.

Definition at line 89 of file class.SurveyTextQuestionGUI.php.

90 {
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"));
95 }
getInput($a_post_var, $ensureValidation=true)
Returns the value of a HTTP-POST variable, identified by the passed id.

References ilPropertyFormGUI\getInput().

+ Here is the call graph for this function:

◆ initObject()

SurveyTextQuestionGUI::initObject ( )
protected

Reimplemented from SurveyQuestionGUI.

Definition at line 39 of file class.SurveyTextQuestionGUI.php.

40 {
41 include_once "./Modules/SurveyQuestionPool/classes/class.SurveyTextQuestion.php";
42 $this->object = new SurveyTextQuestion();
43 }
Text survey question.

◆ setQuestionTabs()

SurveyTextQuestionGUI::setQuestionTabs ( )

Reimplemented from SurveyQuestionGUI.

Definition at line 50 of file class.SurveyTextQuestionGUI.php.

51 {
52 $this->setQuestionTabsForClass("surveytextquestiongui");
53 }

References SurveyQuestionGUI\setQuestionTabsForClass().

+ Here is the call graph for this function:

The documentation for this class was generated from the following file: