ILIAS  trunk Revision v13.0_alpha-62-g3b72d83f2e5
SurveyTextQuestionGUI Class Reference

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V. 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 (int $question_title=1, bool $show_questiontext=true, ?int $survey_id=null, ?array $working_data=null)
 
 getWorkingForm (?array $working_data=null, int $question_title=1, bool $show_questiontext=true, string $error_message="", ?int $survey_id=null, bool $compress_view=false)
 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 (string $a_url)
 
 setQuestionTabsForClass (string $guiclass)
 
 getPrintView (int $question_title=1, bool $show_questiontext=true, ?int $survey_id=null, ?array $working_data=null)
 
 preview ()
 
 getWorkingForm (?array $working_data=null, int $question_title=1, bool $show_questiontext=true, string $error_message="", ?int $survey_id=null, bool $compress_view=false)
 

Protected Member Functions

 initObject ()
 
 addFieldsToEditForm (ilPropertyFormGUI $a_form)
 
 importEditFormValues (ilPropertyFormGUI $a_form)
 
- Protected Member Functions inherited from SurveyQuestionGUI
 initObject ()
 
 outQuestionText (ilTemplate $template)
 
 initEditForm ()
 
 addCommandButtons (ilPropertyFormGUI $a_form)
 
 editQuestion (?ilPropertyFormGUI $a_form=null)
 
 saveSync ()
 
 saveReturn ()
 
 saveForm ()
 
 save (bool $a_return=false, bool $a_sync=false)
 
 copySyncForm ()
 
 syncCopies ()
 
 originalSyncForm ()
 
 sync ()
 
 cancelSync ()
 
 redirectAfterSaving (bool $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 (int $question_title=1)
 
 getQuestionTitle (int $question_title_mode=1)
 
 renderStatisticsDetailsTable (array $a_head, array $a_rows, ?array $a_foot=null)
 

Additional Inherited Members

- Static Public Member Functions inherited from SurveyQuestionGUI
static _getQuestionGUI (?string $questiontype, int $question_id=-1)
 Creates a question gui representation. More...
 
static _getGUIClassNameForId (int $a_q_id)
 
static _getClassNameForQType (string $q_type)
 
- Data Fields inherited from SurveyQuestionGUI
SurveyQuestion $object = null
 
- Protected Attributes inherited from SurveyQuestionGUI
ILIAS Survey InternalDomainService $domain
 
ILIAS Survey InternalGUIService $gui
 
EditingGUIRequest $request
 
EditManager $edit_manager
 
ilRbacSystem $rbacsystem
 
ilObjUser $user
 
ilAccessHandler $access
 
ilTree $tree
 
ilToolbarGUI $toolbar
 
ilTabsGUI $tabs
 
ilGlobalTemplateInterface $tpl
 
ilLanguage $lng
 
ilCtrl $ctrl
 
array $cumulated = []
 
string $parent_url = ""
 
ilLogger $log
 
ilHtmlPurifierInterface $purifier
 

Detailed Description

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V.

ILIAS is licensed with the GPL-3.0, see https://www.gnu.org/licenses/gpl-3.0.en.html You should have received a copy of said license along with the source code, too.

If this is not the case or you just want to try ILIAS, you'll find us at: https://www.ilias.de https://github.com/ILIAS-eLearning 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 27 of file class.SurveyTextQuestionGUI.php.

Member Function Documentation

◆ addFieldsToEditForm()

SurveyTextQuestionGUI::addFieldsToEditForm ( ilPropertyFormGUI  $a_form)
protected

Reimplemented from SurveyQuestionGUI.

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

44 : void
45 {
46 // maximum number of characters
47 $maxchars = new ilNumberInputGUI($this->lng->txt("maxchars"), "maxchars");
48 $maxchars->setRequired(false);
49 $maxchars->setSize(5);
50 $maxchars->setDecimals(0);
51 $a_form->addItem($maxchars);
52
53 // values
54 if ($this->object->getMaxChars() > 0) {
55 $maxchars->setValue((string) $this->object->getMaxChars());
56 }
57 }
This class represents a number property in a property form.

References ilPropertyFormGUI\addItem(), ILIAS\Repository\lng(), and ILIAS\Repository\object().

+ Here is the call graph for this function:

◆ getParsedAnswers()

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

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

68 : array {
69 $res = array();
70 if (is_array($a_working_data) && isset($a_working_data[0])) {
71 $res[] = array("textanswer" => trim((string) ($a_working_data[0]["textanswer"] ?? "")));
72 }
73
74 return $res;
75 }
foreach($_POST as $key=> $value) $res

References $res.

◆ getPrintView()

SurveyTextQuestionGUI::getPrintView ( int  $question_title = 1,
bool  $show_questiontext = true,
?int  $survey_id = null,
?array  $working_data = null 
)

Reimplemented from SurveyQuestionGUI.

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

82 : string {
83 $user_answer = null;
84 if ($working_data) {
85 $user_answer = $this->getParsedAnswers($working_data);
86 $user_answer = $user_answer[0]["textanswer"];
87 }
88
89 $template = new ilTemplate("tpl.il_svy_qpl_text_printview.html", true, true, "components/ILIAS/SurveyQuestionPool");
90 if ($show_questiontext) {
91 $this->outQuestionText($template);
92 }
93 if ($question_title) {
94 $template->setVariable("QUESTION_TITLE", $this->getPrintViewQuestionTitle($question_title));
95 }
96 $template->setVariable("QUESTION_ID", $this->object->getId());
97 $template->setVariable("TEXT_ANSWER", $this->lng->txt("answer"));
98 if (is_array($working_data) && trim((string) $user_answer)) {
99 $template->setVariable("TEXT", nl2br($user_answer));
100 } else {
101 $template->setVariable("TEXTBOX_IMAGE", ilUtil::getHtmlPath(ilUtil::getImagePath("textbox.png")));
102 $template->setVariable("TEXTBOX", $this->lng->txt("textbox"));
103 }
104 if ($this->object->getMaxChars()) {
105 $template->setVariable("TEXT_MAXCHARS", sprintf($this->lng->txt("text_maximum_chars_allowed"), $this->object->getMaxChars()));
106 }
107 return $template->get();
108 }
getPrintViewQuestionTitle(int $question_title=1)
outQuestionText(ilTemplate $template)
getParsedAnswers(?array $a_working_data=null, $a_only_user_anwers=false)
special template class to simplify handling of ITX/PEAR
static getHtmlPath(string $relative_path)
get url of path
static getImagePath(string $image_name, string $module_path="", string $mode="output", bool $offline=false)
get image path (for images located in a template directory)

◆ getWorkingForm()

SurveyTextQuestionGUI::getWorkingForm ( ?array  $working_data = null,
int  $question_title = 1,
bool  $show_questiontext = true,
string  $error_message = "",
?int  $survey_id = null,
bool  $compress_view = false 
)

Creates the question output form for the learner.

Reimplemented from SurveyQuestionGUI.

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

125 : string {
126 $template = new ilTemplate("tpl.il_svy_out_text.html", true, true, "components/ILIAS/SurveyQuestionPool");
127
128 $template->setCurrentBlock("textarea");
129 if (is_array($working_data) && isset($working_data[0]["textanswer"])) {
130 $template->setVariable(
131 "VALUE_ANSWER",
132 ilLegacyFormElementsUtil::prepareFormOutput((string) $working_data[0]["textanswer"])
133 );
134 }
135 $template->setVariable("QUESTION_ID", $this->object->getId());
136
137 $template->parseCurrentBlock();
138 $template->setCurrentBlock("question_data_text");
139 if ($show_questiontext) {
140 $this->outQuestionText($template);
141 }
142 $template->setVariable("QUESTION_TITLE", $this->getQuestionTitle($question_title));
143 $template->setVariable("TEXT_ANSWER", $this->lng->txt("answer"));
144 $template->setVariable("LABEL_QUESTION_ID", $this->object->getId());
145 if (strcmp($error_message, "") !== 0) {
146 $template->setVariable("ERROR_MESSAGE", "<p class=\"warning\">$error_message</p>");
147 }
148 if ($this->object->getMaxChars()) {
149 $template->setVariable("TEXT_MAXCHARS", sprintf($this->lng->txt("text_maximum_chars_allowed"), $this->object->getMaxChars()));
150 }
151 $template->parseCurrentBlock();
152 return $template->get();
153 }
getQuestionTitle(int $question_title_mode=1)
static prepareFormOutput($a_str, bool $a_strip=false)

References ilLegacyFormElementsUtil\prepareFormOutput().

+ Here is the call graph for this function:

◆ importEditFormValues()

SurveyTextQuestionGUI::importEditFormValues ( ilPropertyFormGUI  $a_form)
protected

Reimplemented from SurveyQuestionGUI.

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

59 : void
60 {
61 $max = $a_form->getInput("maxchars");
62 $this->object->setMaxChars((int) $max);
63 }
getInput(string $a_post_var, bool $ensureValidation=true)
Returns the input of an item, if item provides getInput method and as fallback the value of the HTTP-...

References ilPropertyFormGUI\getInput().

+ Here is the call graph for this function:

◆ initObject()

SurveyTextQuestionGUI::initObject ( )
protected

Reimplemented from SurveyQuestionGUI.

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

29 : void
30 {
31 $this->object = new SurveyTextQuestion();
32 }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...

◆ setQuestionTabs()

SurveyTextQuestionGUI::setQuestionTabs ( )

Reimplemented from SurveyQuestionGUI.

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

39 : void
40 {
41 $this->setQuestionTabsForClass("surveytextquestiongui");
42 }
setQuestionTabsForClass(string $guiclass)

References SurveyQuestionGUI\setQuestionTabsForClass().

+ Here is the call graph for this function:

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