ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
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

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

Member Function Documentation

◆ addFieldsToEditForm()

SurveyTextQuestionGUI::addFieldsToEditForm ( ilPropertyFormGUI  $a_form)
protected

Reimplemented from SurveyQuestionGUI.

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

31 {
32 // maximum number of characters
33 $maxchars = new ilNumberInputGUI($this->lng->txt("maxchars"), "maxchars");
34 $maxchars->setRequired(false);
35 $maxchars->setSize(5);
36 $maxchars->setDecimals(0);
37 $a_form->addItem($maxchars);
38
39 // textwidth
40 $textwidth = new ilNumberInputGUI($this->lng->txt("width"), "textwidth");
41 $textwidth->setRequired(true);
42 $textwidth->setSize(3);
43 $textwidth->setDecimals(0);
44 $textwidth->setMinValue(10, true);
45 $a_form->addItem($textwidth);
46
47 // textheight
48 $textheight = new ilNumberInputGUI($this->lng->txt("height"), "textheight");
49 $textheight->setRequired(true);
50 $textheight->setSize(3);
51
52 $textheight->setDecimals(0);
53 $textheight->setMinValue(1);
54 $a_form->addItem($textheight);
55
56 // values
57 if ($this->object->getMaxChars() > 0) {
58 $maxchars->setValue($this->object->getMaxChars());
59 }
60 $textwidth->setValue($this->object->getTextWidth());
61 $textheight->setValue($this->object->getTextHeight());
62 }
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 72 of file class.SurveyTextQuestionGUI.php.

73 {
74 $res = array();
75
76 if (is_array($a_working_data)) {
77 $res[] = array("textanswer" => trim($a_working_data[0]["textanswer"]));
78 }
79
80 return $res;
81 }
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 83 of file class.SurveyTextQuestionGUI.php.

84 {
85 $user_answer = null;
86 if ($a_working_data) {
87 $user_answer = $this->getParsedAnswers($a_working_data);
88 $user_answer = $user_answer[0]["textanswer"];
89 }
90
91 $template = new ilTemplate("tpl.il_svy_qpl_text_printview.html", true, true, "Modules/SurveyQuestionPool");
92 if ($show_questiontext) {
93 $this->outQuestionText($template);
94 }
95 if ($question_title) {
96 $template->setVariable("QUESTION_TITLE", $this->getPrintViewQuestionTitle($question_title));
97 }
98 $template->setVariable("QUESTION_ID", $this->object->getId());
99 $template->setVariable("TEXT_ANSWER", $this->lng->txt("answer"));
100 if (is_array($a_working_data) && trim($user_answer)) {
101 $template->setVariable("TEXT", nl2br($user_answer));
102 } else {
103 $template->setVariable("TEXTBOX_IMAGE", ilUtil::getHtmlPath(ilUtil::getImagePath("textbox.png")));
104 $template->setVariable("TEXTBOX", $this->lng->txt("textbox"));
105 $template->setVariable("TEXTBOX_WIDTH", $this->object->getTextWidth() * 16);
106 $template->setVariable("TEXTBOX_HEIGHT", $this->object->getTextHeight() * 16);
107 }
108 if ($this->object->getMaxChars()) {
109 $template->setVariable("TEXT_MAXCHARS", sprintf($this->lng->txt("text_maximum_chars_allowed"), $this->object->getMaxChars()));
110 }
111 return $template->get();
112 }
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)

References 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 122 of file class.SurveyTextQuestionGUI.php.

123 {
124 $template = new ilTemplate("tpl.il_svy_out_text.html", true, true, "Modules/SurveyQuestionPool");
125 $template->setCurrentBlock("material_text");
126 $template->setVariable("TEXT_MATERIAL", $this->getMaterialOutput());
127 $template->parseCurrentBlock();
128
129 if ($this->object->getTextHeight() == 1) {
130 $template->setCurrentBlock("textinput");
131 if (is_array($working_data)) {
132 if (strlen($working_data[0]["textanswer"])) {
133 $template->setVariable("VALUE_ANSWER", " value=\"" . ilUtil::prepareFormOutput($working_data[0]["textanswer"]) . "\"");
134 }
135 }
136 $template->setVariable("QUESTION_ID", $this->object->getId());
137 $template->setVariable("WIDTH", $this->object->getTextWidth());
138 if ($this->object->getMaxChars()) {
139 $template->setVariable("MAXLENGTH", " maxlength=\"" . $this->object->getMaxChars() . "\"");
140 }
141 $template->parseCurrentBlock();
142 } else {
143 $template->setCurrentBlock("textarea");
144 if (is_array($working_data)) {
145 $template->setVariable("VALUE_ANSWER", ilUtil::prepareFormOutput($working_data[0]["textanswer"]));
146 }
147 $template->setVariable("QUESTION_ID", $this->object->getId());
148 $template->setVariable("WIDTH", $this->object->getTextWidth());
149 $template->setVariable("HEIGHT", $this->object->getTextHeight());
150 $template->parseCurrentBlock();
151 }
152 $template->setCurrentBlock("question_data_text");
153 if ($show_questiontext) {
154 $this->outQuestionText($template);
155 }
156 if ($question_title) {
157 $template->setVariable("QUESTION_TITLE", $this->object->getTitle());
158 }
159 $template->setVariable("TEXT_ANSWER", $this->lng->txt("answer"));
160 $template->setVariable("LABEL_QUESTION_ID", $this->object->getId());
161 if (strcmp($error_message, "") != 0) {
162 $template->setVariable("ERROR_MESSAGE", "<p class=\"warning\">$error_message</p>");
163 }
164 if ($this->object->getMaxChars()) {
165 $template->setVariable("TEXT_MAXCHARS", sprintf($this->lng->txt("text_maximum_chars_allowed"), $this->object->getMaxChars()));
166 }
167 $template->parseCurrentBlock();
168 return $template->get();
169 }
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 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 64 of file class.SurveyTextQuestionGUI.php.

65 {
66 $max = $a_form->getInput("maxchars");
67 $this->object->setMaxChars(strlen($max) ? $max : null);
68 $this->object->setTextWidth($a_form->getInput("textwidth"));
69 $this->object->setTextHeight($a_form->getInput("textheight"));
70 }
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 15 of file class.SurveyTextQuestionGUI.php.

16 {
17 $this->object = new SurveyTextQuestion();
18 }
Text survey question.

◆ setQuestionTabs()

SurveyTextQuestionGUI::setQuestionTabs ( )

Reimplemented from SurveyQuestionGUI.

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

26 {
27 $this->setQuestionTabsForClass("surveytextquestiongui");
28 }

References SurveyQuestionGUI\setQuestionTabsForClass().

+ Here is the call graph for this function:

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