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

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)
 
 validateEditForm (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 MultipleChoice survey question GUI representation The SurveyMultipleChoiceQuestionGUI class encapsulates the GUI representation for multiple choice 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.SurveyMultipleChoiceQuestionGUI.php.

Member Function Documentation

◆ addFieldsToEditForm()

SurveyMultipleChoiceQuestionGUI::addFieldsToEditForm ( ilPropertyFormGUI  $a_form)
protected

Reimplemented from SurveyQuestionGUI.

Definition at line 43 of file class.SurveyMultipleChoiceQuestionGUI.php.

43 : void
44 {
45 // orientation
46 $orientation = new ilRadioGroupInputGUI($this->lng->txt("orientation"), "orientation");
47 $orientation->setRequired(false);
48 $orientation->addOption(new ilRadioOption($this->lng->txt('vertical'), '0'));
49 $orientation->addOption(new ilRadioOption($this->lng->txt('horizontal'), '1'));
50 $a_form->addItem($orientation);
51
52 // minimum answers
53 $minanswers = new ilCheckboxInputGUI($this->lng->txt("use_min_answers"), "use_min_answers");
54 $minanswers->setValue('1');
55 $minanswers->setOptionTitle($this->lng->txt("use_min_answers_option"));
56 $minanswers->setRequired(false);
57
58 $nranswers = new ilNumberInputGUI($this->lng->txt("nr_min_answers"), "nr_min_answers");
59 $nranswers->setSize(5);
60 $nranswers->setDecimals(0);
61 $nranswers->setRequired(false);
62 $nranswers->setMinValue(1);
63 $minanswers->addSubItem($nranswers);
64
65 $nrmaxanswers = new ilNumberInputGUI($this->lng->txt("nr_max_answers"), "nr_max_answers");
66 $nrmaxanswers->setSize(5);
67 $nrmaxanswers->setDecimals(0);
68 $nrmaxanswers->setRequired(false);
69 $nrmaxanswers->setMinValue(1);
70 $minanswers->addSubItem($nrmaxanswers);
71
72 $a_form->addItem($minanswers);
73
74 // Answers
75 $answers = new ilCategoryWizardInputGUI($this->lng->txt("answers"), "answers");
76 $answers->setRequired(false);
77 $answers->setAllowMove(true);
78 $answers->setShowWizard(false);
79 $answers->setUseOtherAnswer(true);
80 $answers->setShowNeutralCategory(true);
81 $answers->setNeutralCategoryTitle($this->lng->txt('svy_neutral_answer'));
82 $answers->setDisabledScale(false);
83 $a_form->addItem($answers);
84
85
86 // values
87 $orientation->setValue((string) $this->object->getOrientation());
88 $minanswers->setChecked((bool) $this->object->use_min_answers);
89 $nranswers->setValue($this->object->nr_min_answers);
90 $nrmaxanswers->setValue($this->object->nr_max_answers);
91 if (!$this->object->getCategories()->getCategoryCount()) {
92 $this->object->getCategories()->addCategory("");
93 }
94 $answers->setValues($this->object->getCategories());
95 }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This class represents a checkbox property in a property form.
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(), and ILIAS\Repository\object().

+ Here is the call graph for this function:

◆ getParsedAnswers()

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

Definition at line 173 of file class.SurveyMultipleChoiceQuestionGUI.php.

176 : array {
177 if (is_array($a_working_data)) {
178 $user_answers = $a_working_data;
179 }
180
181 $options = array();
182 for ($i = 0; $i < $this->object->categories->getCategoryCount(); $i++) {
183 $cat = $this->object->categories->getCategory($i);
184 $value = ($cat->scale) ? ($cat->scale - 1) : $i;
185
186 $checked = "unchecked";
187 $text = null;
188 if (is_array($a_working_data)) {
189 foreach ($user_answers as $user_answer) {
190 if ($value == $user_answer["value"]) {
191 $checked = "checked";
192 if ($user_answer["textanswer"]) {
193 $text = $user_answer["textanswer"];
194 }
195 break;
196 }
197 }
198 }
199
200 // "other" options have to be last or horizontal will be screwed
201 $idx = $cat->other . "_" . $value;
202
203 if (!$a_only_user_anwers || $checked === "checked") {
204 $options[$idx] = array(
205 "value" => $value
206 ,"title" => trim((string) $cat->title)
207 ,"other" => (bool) $cat->other
208 ,"checked" => $checked
209 ,"textanswer" => $text
210 );
211 }
212
213 ksort($options);
214 }
215
216 return array_values($options);
217 }
$text
Definition: xapiexit.php:21

◆ getPrintView()

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

Reimplemented from SurveyQuestionGUI.

Definition at line 219 of file class.SurveyMultipleChoiceQuestionGUI.php.

224 : string {
225 $options = $this->getParsedAnswers($working_data);
226
227 $template = new ilTemplate("tpl.il_svy_qpl_mc_printview.html", true, true, "components/ILIAS/SurveyQuestionPool");
228 switch ($this->object->getOrientation()) {
229 case 0:
230 // vertical orientation
231 foreach ($options as $option) {
232 if ($option["other"]) {
233 $template->setCurrentBlock("other_row");
234 $template->setVariable("IMAGE_CHECKBOX", ilUtil::getHtmlPath(ilUtil::getImagePath("object/checkbox_" . $option["checked"] . ".png")));
235 $template->setVariable("ALT_CHECKBOX", $this->lng->txt($option["checked"]));
236 $template->setVariable("TITLE_CHECKBOX", $this->lng->txt($option["checked"]));
237 $template->setVariable(
238 "OTHER_LABEL",
240 );
241 $template->setVariable("OTHER_ANSWER", $option["textanswer"]
242 ? ilLegacyFormElementsUtil::prepareFormOutput($option["textanswer"])
243 : "&nbsp;");
244 } else {
245 $template->setCurrentBlock("mc_row");
246 $template->setVariable("IMAGE_CHECKBOX", ilUtil::getHtmlPath(ilUtil::getImagePath("object/checkbox_" . $option["checked"] . ".png")));
247 $template->setVariable("ALT_CHECKBOX", $this->lng->txt($option["checked"]));
248 $template->setVariable("TITLE_CHECKBOX", $this->lng->txt($option["checked"]));
249 $template->setVariable("TEXT_MC", ilLegacyFormElementsUtil::prepareFormOutput($option["title"]));
250 }
251 $template->parseCurrentBlock();
252 }
253 break;
254 case 1:
255 // horizontal orientation
256 foreach ($options as $option) {
257 $template->setCurrentBlock("checkbox_col");
258 $template->setVariable("IMAGE_CHECKBOX", ilUtil::getHtmlPath(ilUtil::getImagePath("object/checkbox_" . $option["checked"] . ".png")));
259 $template->setVariable("ALT_CHECKBOX", $this->lng->txt($option["checked"]));
260 $template->setVariable("TITLE_CHECKBOX", $this->lng->txt($option["checked"]));
261 $template->parseCurrentBlock();
262 }
263 foreach ($options as $option) {
264 if ($option["other"]) {
265 $template->setCurrentBlock("other_text_col");
266 $template->setVariable(
267 "OTHER_LABEL",
269 );
270 $template->setVariable("OTHER_ANSWER", $option["textanswer"]
271 ? ilLegacyFormElementsUtil::prepareFormOutput($option["textanswer"])
272 : "&nbsp;");
273 } else {
274 $template->setCurrentBlock("text_col");
275 $template->setVariable("TEXT_MC", ilLegacyFormElementsUtil::prepareFormOutput($option["title"]));
276 }
277 $template->parseCurrentBlock();
278 }
279 break;
280 }
281
282 if ($this->object->use_min_answers) {
283 $template->setCurrentBlock('min_max_msg');
284 if ($this->object->nr_min_answers > 0 && $this->object->nr_max_answers > 0) {
285 $template->setVariable('MIN_MAX_MSG', sprintf($this->lng->txt('msg_min_max_nr_answers'), $this->object->nr_min_answers, $this->object->nr_max_answers));
286 } elseif ($this->object->nr_min_answers > 0) {
287 $template->setVariable('MIN_MAX_MSG', sprintf($this->lng->txt('msg_min_nr_answers'), $this->object->nr_min_answers));
288 } elseif ($this->object->nr_max_answers > 0) {
289 $template->setVariable('MIN_MAX_MSG', sprintf($this->lng->txt('msg_max_nr_answers'), $this->object->nr_max_answers));
290 }
291 $template->parseCurrentBlock();
292 }
293 if ($show_questiontext) {
294 $this->outQuestionText($template);
295 }
296 if ($question_title) {
297 $template->setVariable("QUESTION_TITLE", $this->getPrintViewQuestionTitle($question_title));
298 }
299 $template->parseCurrentBlock();
300 return $template->get();
301 }
getParsedAnswers(?array $a_working_data=null, $a_only_user_anwers=false)
getPrintViewQuestionTitle(int $question_title=1)
outQuestionText(ilTemplate $template)
static prepareFormOutput($a_str, bool $a_strip=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()

SurveyMultipleChoiceQuestionGUI::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 311 of file class.SurveyMultipleChoiceQuestionGUI.php.

318 : string {
319 $template = new ilTemplate("tpl.il_svy_out_mc.html", true, true, "components/ILIAS/SurveyQuestionPool");
320 switch ($this->object->getOrientation()) {
321 case 0:
322 // vertical orientation
323 for ($i = 0; $i < $this->object->categories->getCategoryCount(); $i++) {
324 $cat = $this->object->categories->getCategory($i);
325 if ($cat->other) {
326 $template->setCurrentBlock("other_row");
327 if (strlen($cat->title ?? "")) {
328 $template->setVariable("OTHER_LABEL", $cat->title);
329 }
330 $template->setVariable("VALUE_MC", ($cat->scale) ? ($cat->scale - 1) : $i);
331 $template->setVariable("QUESTION_ID", $this->object->getId());
332 if (is_array($working_data)) {
333 foreach ($working_data as $value) {
334 if (strlen((string) ($value["value"] ?? ""))) {
335 if ($value["value"] == $cat->scale - 1) {
336 $template->setVariable("OTHER_VALUE", ' value="' . ilLegacyFormElementsUtil::prepareFormOutput(
337 $value['textanswer']
338 ) . '"');
339 if (!($value['uncheck'] ?? false)) {
340 $template->setVariable("CHECKED_MC", " checked=\"checked\"");
341 }
342 }
343 }
344 }
345 }
346 } else {
347 $template->setCurrentBlock("mc_row");
348 if ($cat->neutral) {
349 $template->setVariable('ROWCLASS', ' class="neutral"');
350 }
351 $template->setVariable("TEXT_MC", ilLegacyFormElementsUtil::prepareFormOutput($cat->title));
352 $template->setVariable("VALUE_MC", ($cat->scale) ? ($cat->scale - 1) : $i);
353 $template->setVariable("QUESTION_ID", $this->object->getId());
354 if (is_array($working_data)) {
355 foreach ($working_data as $value) {
356 if (strlen((string) ($value["value"] ?? ""))) {
357 if ($value["value"] == $cat->scale - 1) {
358 if (!($value['uncheck'] ?? false)) {
359 $template->setVariable("CHECKED_MC", " checked=\"checked\"");
360 }
361 }
362 }
363 }
364 }
365 }
366 $template->parseCurrentBlock();
367 $template->touchBlock('outer_row');
368 }
369 break;
370 case 1:
371 // horizontal orientation
372
373 // #15477 - reverting the categorizing of answers
374 for ($i = 0; $i < $this->object->categories->getCategoryCount(); $i++) {
375 $cat = $this->object->categories->getCategory($i);
376
377 // checkbox
378 $template->setCurrentBlock("checkbox_col");
379 if ($cat->neutral) {
380 $template->setVariable('COLCLASS', ' neutral');
381 }
382 $template->setVariable("VALUE_MC", ($cat->scale) ? ($cat->scale - 1) : $i);
383 $template->setVariable("QUESTION_ID", $this->object->getId());
384 if (is_array($working_data)) {
385 foreach ($working_data as $value) {
386 if (strlen((string) ($value["value"] ?? ""))) {
387 if ($value["value"] == $cat->scale - 1) {
388 if (!($value['uncheck'] ?? false)) {
389 $template->setVariable("CHECKED_MC", " checked=\"checked\"");
390 }
391 }
392 }
393 }
394 }
395 $template->parseCurrentBlock();
396
397 // answer & input
398 if ($cat->other) {
399 $template->setCurrentBlock("text_other_col");
400 $template->setVariable("VALUE_MC", ($cat->scale) ? ($cat->scale - 1) : $i);
401 $template->setVariable("QUESTION_ID", $this->object->getId());
402 if (strlen($cat->title ?? "")) {
403 $template->setVariable("OTHER_LABEL", $cat->title);
404 }
405 if (is_array($working_data)) {
406 foreach ($working_data as $value) {
407 if (strlen((string) ($value["value"] ?? ""))) {
408 if ($value["value"] == $cat->scale - 1) {
409 $template->setVariable("OTHER_VALUE", ' value="' . ilLegacyFormElementsUtil::prepareFormOutput(
410 $value['textanswer']
411 ) . '"');
412 }
413 }
414 }
415 }
416 }
417 // answer
418 else {
419 $template->setCurrentBlock("text_col");
420 if ($cat->neutral) {
421 $template->setVariable('COLCLASS', ' neutral');
422 }
423 $template->setVariable("VALUE_MC", ($cat->scale) ? ($cat->scale - 1) : $i);
424 $template->setVariable("TEXT_MC", ilLegacyFormElementsUtil::prepareFormOutput($cat->title));
425 $template->setVariable("QUESTION_ID", $this->object->getId());
426 }
427 $template->parseCurrentBlock();
428 $template->touchBlock('text_outer_col');
429 }
430 break;
431 }
432
433 $template->setCurrentBlock("question_data");
434 if ($this->object->use_min_answers) {
435 $template->setCurrentBlock('min_max_msg');
436 if ($this->object->nr_min_answers > 0 && $this->object->nr_max_answers > 0) {
437 if ($this->object->nr_min_answers == $this->object->nr_max_answers) {
438 $template->setVariable('MIN_MAX_MSG', sprintf($this->lng->txt('msg_min_max_exact_answers'), $this->object->nr_min_answers));
439 } else {
440 $template->setVariable('MIN_MAX_MSG', sprintf($this->lng->txt('msg_min_max_nr_answers'), $this->object->nr_min_answers, $this->object->nr_max_answers));
441 }
442 } elseif ($this->object->nr_min_answers > 0) {
443 $template->setVariable('MIN_MAX_MSG', sprintf($this->lng->txt('msg_min_nr_answers'), $this->object->nr_min_answers));
444 } elseif ($this->object->nr_max_answers > 0) {
445 $template->setVariable('MIN_MAX_MSG', sprintf($this->lng->txt('msg_max_nr_answers'), $this->object->nr_max_answers));
446 }
447 $template->parseCurrentBlock();
448 }
449 if (strcmp($error_message, "") !== 0) {
450 $template->setVariable("ERROR_MESSAGE", "<p class=\"warning\">$error_message</p>");
451 }
452 if ($show_questiontext) {
453 $this->outQuestionText($template);
454 }
455 $template->setVariable("QUESTION_TITLE", $this->getQuestionTitle($question_title));
456 $template->parseCurrentBlock();
457 return $template->get();
458 }
getQuestionTitle(int $question_title_mode=1)

References ILIAS\Repository\object(), ilLegacyFormElementsUtil\prepareFormOutput(), and ilTemplate\setCurrentBlock().

+ Here is the call graph for this function:

◆ importEditFormValues()

SurveyMultipleChoiceQuestionGUI::importEditFormValues ( ilPropertyFormGUI  $a_form)
protected

Reimplemented from SurveyQuestionGUI.

Definition at line 135 of file class.SurveyMultipleChoiceQuestionGUI.php.

135 : void
136 {
137 $this->object->setOrientation((int) $a_form->getInput("orientation"));
138 $this->object->use_other_answer = ($a_form->getInput('use_other_answer')) ? 1 : 0;
139 $this->object->other_answer_label = $this->object->use_other_answer ? (string) $a_form->getInput('other_answer_label') : "";
140 $this->object->use_min_answers = (bool) $a_form->getInput('use_min_answers');
141 $this->object->nr_min_answers = ($a_form->getInput('nr_min_answers') > 0) ? (string) $a_form->getInput('nr_min_answers') : "";
142 $this->object->nr_max_answers = ($a_form->getInput('nr_max_answers') > 0) ? (string) $a_form->getInput('nr_max_answers') : "";
143 $this->object->label = (string) $a_form->getInput('label');
144
145 $this->object->categories->flushCategories();
146
147 $answers = $this->request->getAnswers();
148 foreach ($answers['answer'] as $key => $value) {
149 if (strlen((string) ($value ?? ""))) {
150 $this->object->getCategories()->addCategory(
151 (string) $value,
152 (int) ($answers['other'][$key] ?? 0),
153 0,
154 null,
155 isset($answers['scale'][$key]) && $answers['scale'][$key] !== ''
156 ? (int) $answers['scale'][$key]
157 : null
158 );
159 }
160 }
161 if ($this->request->getNeutral() !== "") {
162 $neutral_scale = $this->request->getNeutralScale();
163 $this->object->getCategories()->addCategory(
164 $this->request->getNeutral(),
165 0,
166 1,
167 null,
168 $neutral_scale !== '' ? (int) $neutral_scale : null
169 );
170 }
171 }
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()

SurveyMultipleChoiceQuestionGUI::initObject ( )
protected

Reimplemented from SurveyQuestionGUI.

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

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

◆ setQuestionTabs()

SurveyMultipleChoiceQuestionGUI::setQuestionTabs ( )

Reimplemented from SurveyQuestionGUI.

Definition at line 38 of file class.SurveyMultipleChoiceQuestionGUI.php.

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

References SurveyQuestionGUI\setQuestionTabsForClass().

+ Here is the call graph for this function:

◆ validateEditForm()

SurveyMultipleChoiceQuestionGUI::validateEditForm ( ilPropertyFormGUI  $a_form)
protected

Reimplemented from SurveyQuestionGUI.

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

97 : bool
98 {
99 $errors = false;
100 if ($a_form->getInput("use_min_answers")) {
101 // #13927 - see importEditFormValues()
102 $cnt_answers = 0;
103 $answers = $this->request->getAnswers();
104 foreach ($answers['answer'] as $key => $value) {
105 if (strlen((string) ($value ?? ""))) {
106 $cnt_answers++;
107 }
108 }
109 if ($this->request->getNeutral() !== "") {
110 $cnt_answers++;
111 }
112 /* this would be the DB-values
113 $cnt_answers = $a_form->getItemByPostVar("answers");
114 $cnt_answers = $cnt_answers->getCategoryCount();
115 */
116 $min_anwers = (int) $a_form->getInput("nr_min_answers");
117 $max_anwers = (int) $a_form->getInput("nr_max_answers");
118
119 if ($min_anwers &&
120 $min_anwers > $cnt_answers) {
121 $a_form->getItemByPostVar("nr_min_answers")->setAlert($this->lng->txt('err_minvalueganswers'));
122 $errors = true;
123 }
124 if ($max_anwers > 0 &&
125 ($max_anwers > $cnt_answers || $max_anwers < $min_anwers)) {
126 $a_form->getItemByPostVar("nr_max_answers")->setAlert($this->lng->txt('err_maxvaluegeminvalue'));
127 $errors = true;
128 }
129 }
130
131 $this->tpl->setOnScreenMessage('failure', $this->lng->txt('form_input_not_valid'));
132 return !$errors;
133 }
getItemByPostVar(string $a_post_var)

References ilPropertyFormGUI\getInput(), ilPropertyFormGUI\getItemByPostVar(), ILIAS\Repository\int(), and ILIAS\Repository\lng().

+ Here is the call graph for this function:

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