ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
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 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
 

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 25 of file class.SurveyMetricQuestionGUI.php.

Member Function Documentation

◆ addFieldsToEditForm()

SurveyMetricQuestionGUI::addFieldsToEditForm ( ilPropertyFormGUI  $a_form)
protected

Reimplemented from SurveyQuestionGUI.

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

42 : void
43 {
44 // subtype
45 $subtype = new ilRadioGroupInputGUI($this->lng->txt("subtype"), "type");
46 $subtype->setRequired(true);
47 $a_form->addItem($subtype);
48
49 // #10652
50 $opt = new ilRadioOption($this->lng->txt('non_ratio'), SurveyMetricQuestion::SUBTYPE_NON_RATIO, $this->lng->txt("metric_subtype_description_interval"));
51 $subtype->addOption($opt);
52
53 // minimum value
54 $minimum1 = new ilNumberInputGUI($this->lng->txt("minimum"), "minimum3");
55 $minimum1->setRequired(false);
56 $minimum1->setSize(6);
57 $opt->addSubItem($minimum1);
58
59 // maximum value
60 $maximum1 = new ilNumberInputGUI($this->lng->txt("maximum"), "maximum3");
61 $maximum1->setRequired(false);
62 $maximum1->setSize(6);
63 $opt->addSubItem($maximum1);
64
65 $opt = new ilRadioOption($this->lng->txt('ratio_non_absolute'), SurveyMetricQuestion::SUBTYPE_RATIO_NON_ABSOLUTE, $this->lng->txt("metric_subtype_description_rationonabsolute"));
66 $subtype->addOption($opt);
67
68 // minimum value
69 $minimum2 = new ilNumberInputGUI($this->lng->txt("minimum"), "minimum4");
70 $minimum2->setRequired(false);
71 $minimum2->setSize(6);
72 $minimum2->setMinValue(0);
73 $opt->addSubItem($minimum2);
74
75 // maximum value
76 $maximum2 = new ilNumberInputGUI($this->lng->txt("maximum"), "maximum4");
77 $maximum2->setRequired(false);
78 $maximum2->setSize(6);
79 $opt->addSubItem($maximum2);
80
81 $opt = new ilRadioOption($this->lng->txt('ratio_absolute'), SurveyMetricQuestion::SUBTYPE_RATIO_ABSOLUTE, $this->lng->txt("metric_subtype_description_ratioabsolute"));
82 $subtype->addOption($opt);
83
84 // minimum value
85 $minimum3 = new ilNumberInputGUI($this->lng->txt("minimum"), "minimum5");
86 $minimum3->setRequired(false);
87 $minimum3->setSize(6);
88 $minimum3->setMinValue(0);
89 $minimum3->setDecimals(0);
90 $opt->addSubItem($minimum3);
91
92 // maximum value
93 $maximum3 = new ilNumberInputGUI($this->lng->txt("maximum"), "maximum5");
94 $maximum3->setDecimals(0);
95 $maximum3->setRequired(false);
96 $maximum3->setSize(6);
97 $opt->addSubItem($maximum3);
98
99
100 // values
101 $subtype->setValue($this->object->getSubtype());
102
103 switch ($this->object->getSubtype()) {
105 $minimum1->setValue($this->object->getMinimum());
106 $maximum1->setValue($this->object->getMaximum());
107 break;
108
110 $minimum2->setValue($this->object->getMinimum());
111 $maximum2->setValue($this->object->getMaximum());
112 break;
113
115 $minimum3->setValue($this->object->getMinimum());
116 $maximum3->setValue($this->object->getMaximum());
117 break;
118 }
119 }
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 136 of file class.SurveyMetricQuestionGUI.php.

139 : array {
140 $res = array();
141
142 if (is_array($a_working_data)) {
143 $res[] = array("value" => ($a_working_data[0]["value"] ?? null));
144 }
145
146 return $res;
147 }
$res
Definition: ltiservices.php:69

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 154 of file class.SurveyMetricQuestionGUI.php.

159 : string {
160 $user_answer = null;
161 if ($working_data) {
162 $user_answer = $this->getParsedAnswers($working_data);
163 $user_answer = $user_answer[0]["value"];
164 }
165 $template = new ilTemplate("tpl.il_svy_qpl_metric_printview.html", true, true, "components/ILIAS/SurveyQuestionPool");
166 $template->setVariable("MIN_MAX", $this->object->getMinMaxText());
167
168 if ($show_questiontext) {
169 $this->outQuestionText($template);
170 }
171 if ($question_title) {
172 $template->setVariable("QUESTION_TITLE", $this->getPrintViewQuestionTitle($question_title));
173 }
174 $template->setVariable("TEXT_ANSWER", $this->lng->txt("answer"));
175 $template->setVariable("QUESTION_ID", $this->object->getId());
176
177 if (!is_array($working_data) || !trim((string) $user_answer)) {
178 $len = 10;
179 $solution_text = str_repeat(" ", 10);
180 } else {
181 $solution_text = $user_answer;
182 }
183 $template->setVariable("TEXT_SOLUTION", $solution_text);
184
185 $template->parseCurrentBlock();
186 return $template->get();
187 }
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 194 of file class.SurveyMetricQuestionGUI.php.

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

◆ importEditFormValues()

SurveyMetricQuestionGUI::importEditFormValues ( ilPropertyFormGUI  $a_form)
protected

Reimplemented from SurveyQuestionGUI.

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

121 : void
122 {
123 $type = (int) $a_form->getInput("type");
124 $this->object->setOrientation((int) $a_form->getInput("orientation"));
125 $this->object->setSubtype((int) $type);
126 $min = ($a_form->getInput("minimum" . $type) != "")
127 ? (float) $a_form->getInput("minimum" . $type)
128 : null;
129 $max = ($a_form->getInput("maximum" . $type) != "")
130 ? (float) $a_form->getInput("maximum" . $type)
131 : null;
132 $this->object->setMinimum($min);
133 $this->object->setMaximum($max);
134 }
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 27 of file class.SurveyMetricQuestionGUI.php.

27 : void
28 {
29 $this->object = new SurveyMetricQuestion();
30 }
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 37 of file class.SurveyMetricQuestionGUI.php.

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