ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
class.ilLogicalAnswerComparisonExpressionInputGUI.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (c) 1998-2013 ILIAS open source, Extended GPL, see docs/LICENSE */
3 
4 require_once 'Modules/TestQuestionPool/classes/class.ilAnswerWizardInputGUI.php';
5 require_once 'Modules/TestQuestionPool/classes/class.assAnswerSimple.php';
6 require_once 'Modules/TestQuestionPool/classes/class.ilAssQuestionSolutionComparisonExpression.php';
7 
15 {
16  public function setValues($modelValues)
17  {
18  $formValues = array();
19 
20  foreach ($modelValues as $modelValue) {
21  $formValues[] = new ASS_AnswerSimple(
22  $modelValue->getExpression(),
23  $modelValue->getPoints(),
24  $modelValue->getOrderIndex() - 1
25  );
26  }
27 
28  if (!count($formValues)) {
29  $formValues[] = new ASS_AnswerSimple('', 0, 1);
30  }
31 
32  parent::setValues($formValues);
33  }
34 
35  public function getValues()
36  {
37  $formValues = parent::getValues();
38 
39  $modelValues = array();
40 
41  foreach ($formValues as $formValue) {
43  $expression->setExpression($formValue->getAnswertext());
44  $expression->setPoints($formValue->getPoints());
45  $expression->setOrderIndex($formValue->getOrder() + 1);
46  $modelValues[] = $expression;
47  }
48 
49  return $modelValues;
50  }
51 
56  protected function getTextInputLabel($lng)
57  {
58  return $lng->txt('tst_sol_comp_expressions');
59  }
60 
65  protected function getPointsInputLabel($lng)
66  {
67  return $lng->txt('tst_comp_points');
68  }
69 
73  protected function getTemplate()
74  {
75  return "tpl.prop_lac_expression_input.html";
76  }
77 
78  protected function sanitizeSuperGlobalSubmitValue()
79  {
80  if (isset($_POST[$this->getPostVar()]) && is_array($_POST[$this->getPostVar()])) {
81  $_POST[$this->getPostVar()] = ilUtil::stripSlashesRecursive($_POST[$this->getPostVar()], false);
82  }
83  }
84 }
getPostVar()
Get Post Variable.
This class represents a single choice wizard property in a property form.
Class for simple answers.
static stripSlashesRecursive($a_data, $a_strip_html=true, $a_allow="")
Strip slashes from array and sub-arrays.
Create styles array
The data for the language used.
$_POST["username"]