ILIAS  trunk Revision v13.0_alpha-62-g3b72d83f2e5
SurveyMetricQuestionGUI 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 SurveyMetricQuestionGUI:
+ Collaboration diagram for SurveyMetricQuestionGUI:

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)
 Creates a HTML representation of the question Creates a HTML representation of the question. More...
 
 getWorkingForm (?array $working_data=null, int $question_title=1, bool $show_questiontext=true, string $error_message="", ?int $survey_id=null, bool $compress_view=false)
 
- 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 Metric survey question GUI representation The SurveyMetricQuestionGUI class encapsulates the GUI representation for metric 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.SurveyMetricQuestionGUI.php.

Member Function Documentation

◆ addFieldsToEditForm()

SurveyMetricQuestionGUI::addFieldsToEditForm ( ilPropertyFormGUI  $a_form)
protected

Reimplemented from SurveyQuestionGUI.

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

44 : void
45 {
46 // subtype
47 $subtype = new ilRadioGroupInputGUI($this->lng->txt("subtype"), "type");
48 $subtype->setRequired(true);
49 $a_form->addItem($subtype);
50
51 // #10652
52 $opt = new ilRadioOption($this->lng->txt('non_ratio'), (string) SurveyMetricQuestion::SUBTYPE_NON_RATIO, $this->lng->txt("metric_subtype_description_interval"));
53 $subtype->addOption($opt);
54
55 // minimum value
56 $minimum1 = new ilNumberInputGUI($this->lng->txt("minimum"), "minimum3");
57 $minimum1->setRequired(false);
58 $minimum1->setSize(6);
59 $opt->addSubItem($minimum1);
60
61 // maximum value
62 $maximum1 = new ilNumberInputGUI($this->lng->txt("maximum"), "maximum3");
63 $maximum1->setRequired(false);
64 $maximum1->setSize(6);
65 $opt->addSubItem($maximum1);
66
67 $opt = new ilRadioOption($this->lng->txt('ratio_non_absolute'), (string) SurveyMetricQuestion::SUBTYPE_RATIO_NON_ABSOLUTE, $this->lng->txt("metric_subtype_description_rationonabsolute"));
68 $subtype->addOption($opt);
69
70 // minimum value
71 $minimum2 = new ilNumberInputGUI($this->lng->txt("minimum"), "minimum4");
72 $minimum2->setRequired(false);
73 $minimum2->setSize(6);
74 $minimum2->setMinValue(0.0);
75 $opt->addSubItem($minimum2);
76
77 // maximum value
78 $maximum2 = new ilNumberInputGUI($this->lng->txt("maximum"), "maximum4");
79 $maximum2->setRequired(false);
80 $maximum2->setSize(6);
81 $opt->addSubItem($maximum2);
82
83 $opt = new ilRadioOption($this->lng->txt('ratio_absolute'), (string) SurveyMetricQuestion::SUBTYPE_RATIO_ABSOLUTE, $this->lng->txt("metric_subtype_description_ratioabsolute"));
84 $subtype->addOption($opt);
85
86 // minimum value
87 $minimum3 = new ilNumberInputGUI($this->lng->txt("minimum"), "minimum5");
88 $minimum3->setRequired(false);
89 $minimum3->setSize(6);
90 $minimum3->setMinValue(0.0);
91 $minimum3->setDecimals(0);
92 $opt->addSubItem($minimum3);
93
94 // maximum value
95 $maximum3 = new ilNumberInputGUI($this->lng->txt("maximum"), "maximum5");
96 $maximum3->setDecimals(0);
97 $maximum3->setRequired(false);
98 $maximum3->setSize(6);
99 $opt->addSubItem($maximum3);
100
101
102 // values
103 $subtype->setValue((string) $this->object->getSubtype());
104
105 switch ($this->object->getSubtype()) {
107 $minimum1->setValue($this->object->getMinimum() === null ? null : (string) $this->object->getMinimum());
108 $maximum1->setValue($this->object->getMaximum() === null ? null : (string) $this->object->getMaximum());
109 break;
110
112 $minimum2->setValue($this->object->getMinimum() === null ? null : (string) $this->object->getMinimum());
113 $maximum2->setValue($this->object->getMaximum() === null ? null : (string) $this->object->getMaximum());
114 break;
115
117 $minimum3->setValue($this->object->getMinimum() === null ? null : (string) $this->object->getMinimum());
118 $maximum3->setValue($this->object->getMaximum() === null ? null : (string) $this->object->getMaximum());
119 break;
120 }
121 }
This class represents a number property in a property form.
This class represents a property in a property form.
This class represents an option in a radio group.

References ilPropertyFormGUI\addItem(), ILIAS\Repository\lng(), ILIAS\Repository\object(), SurveyMetricQuestion\SUBTYPE_NON_RATIO, SurveyMetricQuestion\SUBTYPE_RATIO_ABSOLUTE, and SurveyMetricQuestion\SUBTYPE_RATIO_NON_ABSOLUTE.

+ Here is the call graph for this function:

◆ getParsedAnswers()

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

Definition at line 140 of file class.SurveyMetricQuestionGUI.php.

143 : array {
144 $res = array();
145
146 if (is_array($a_working_data)) {
147 $res[] = array("value" => ($a_working_data[0]["value"] ?? null));
148 }
149
150 return $res;
151 }
foreach($_POST as $key=> $value) $res

References $res.

◆ getPrintView()

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

Creates a HTML representation of the question Creates a HTML representation of the question.

Parameters
array | null$working_data*
int | null$survey_id,*@access private

Reimplemented from SurveyQuestionGUI.

Definition at line 158 of file class.SurveyMetricQuestionGUI.php.

163 : string {
164 $user_answer = null;
165 if ($working_data) {
166 $user_answer = $this->getParsedAnswers($working_data);
167 $user_answer = $user_answer[0]["value"];
168 }
169 $template = new ilTemplate("tpl.il_svy_qpl_metric_printview.html", true, true, "components/ILIAS/SurveyQuestionPool");
170 $template->setVariable("MIN_MAX", $this->object->getMinMaxText());
171
172 if ($show_questiontext) {
173 $this->outQuestionText($template);
174 }
175 if ($question_title) {
176 $template->setVariable("QUESTION_TITLE", $this->getPrintViewQuestionTitle($question_title));
177 }
178 $template->setVariable("TEXT_ANSWER", $this->lng->txt("answer"));
179 $template->setVariable("QUESTION_ID", $this->object->getId());
180
181 if (!is_array($working_data) || !trim((string) $user_answer)) {
182 $len = 10;
183 $solution_text = str_repeat(" ", 10);
184 } else {
185 $solution_text = $user_answer;
186 }
187 $template->setVariable("TEXT_SOLUTION", $solution_text);
188
189 $template->parseCurrentBlock();
190 return $template->get();
191 }
getParsedAnswers(?array $a_working_data=null, $a_only_user_anwers=false)
getPrintViewQuestionTitle(int $question_title=1)
outQuestionText(ilTemplate $template)
special template class to simplify handling of ITX/PEAR

◆ getWorkingForm()

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

Reimplemented from SurveyQuestionGUI.

Definition at line 198 of file class.SurveyMetricQuestionGUI.php.

205 : string {
206 $template = new ilTemplate("tpl.il_svy_out_metric.html", true, true, "components/ILIAS/SurveyQuestionPool");
207 $template->setVariable("MIN_MAX", $this->object->getMinMaxText());
208
209 if ($show_questiontext) {
210 $this->outQuestionText($template);
211 }
212 $template->setVariable("QUESTION_TITLE", $this->getQuestionTitle($question_title));
213 $template->setVariable("TEXT_ANSWER", $this->lng->txt("answer"));
214 $template->setVariable("QUESTION_ID", $this->object->getId());
215 if (is_array($working_data)) {
216 $template->setVariable("VALUE_METRIC", $working_data[0]["value"] ?? "");
217 }
218
219 $template->setVariable("INPUT_SIZE", 10);
220
221 if (strcmp($error_message, "") !== 0) {
222 $template->setVariable("ERROR_MESSAGE", "<p class=\"warning\">$error_message</p>");
223 }
224 $template->parseCurrentBlock();
225 return $template->get();
226 }
getQuestionTitle(int $question_title_mode=1)

◆ importEditFormValues()

SurveyMetricQuestionGUI::importEditFormValues ( ilPropertyFormGUI  $a_form)
protected

Reimplemented from SurveyQuestionGUI.

Definition at line 123 of file class.SurveyMetricQuestionGUI.php.

123 : void
124 {
125 $type = (int) $a_form->getInput("type");
126 $this->object->setOrientation((int) $a_form->getInput("orientation"));
127 $this->object->setSubtype((int) $type);
128 $min_input = str_replace(',', '.', (string) $a_form->getInput("minimum" . $type));
129 $max_input = str_replace(',', '.', (string) $a_form->getInput("maximum" . $type));
130 $min = ($min_input != "")
131 ? (float) $min_input
132 : null;
133 $max = ($max_input != "")
134 ? (float) $max_input
135 : null;
136 $this->object->setMinimum($min);
137 $this->object->setMaximum($max);
138 }
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(), and ILIAS\Repository\int().

+ Here is the call graph for this function:

◆ initObject()

SurveyMetricQuestionGUI::initObject ( )
protected

Reimplemented from SurveyQuestionGUI.

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

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

◆ setQuestionTabs()

SurveyMetricQuestionGUI::setQuestionTabs ( )

Reimplemented from SurveyQuestionGUI.

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

39 : void
40 {
41 $this->setQuestionTabsForClass("surveymetricquestiongui");
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: