ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
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  {
22  $formValues[] = new ASS_AnswerSimple(
23  $modelValue->getExpression(),
24  $modelValue->getPoints(),
25  $modelValue->getOrderIndex() - 1
26  );
27  }
28 
29  if( !count($formValues) )
30  {
31  $formValues[] = new ASS_AnswerSimple('', 0, 1);
32  }
33 
34  parent::setValues($formValues);
35  }
36 
37  public function getValues()
38  {
39  $formValues = parent::getValues();
40 
41  $modelValues = array();
42 
43  foreach($formValues as $formValue)
44  {
46  $expression->setExpression($formValue->getAnswertext());
47  $expression->setPoints($formValue->getPoints());
48  $expression->setOrderIndex($formValue->getOrder() + 1);
49  $modelValues[] = $expression;
50  }
51 
52  return $modelValues;
53  }
54 
59  protected function getTextInputLabel($lng)
60  {
61  return $lng->txt('tst_sol_comp_expressions');
62  }
63 
68  protected function getPointsInputLabel($lng)
69  {
70  return $lng->txt('tst_comp_points');
71  }
72 
76  protected function getTemplate()
77  {
78  return "tpl.prop_lac_expression_input.html";
79  }
80 
81  protected function sanitizeSuperGlobalSubmitValue()
82  {
83  if( isset($_POST[$this->getPostVar()]) && is_array($_POST[$this->getPostVar()]) )
84  {
85  $_POST[$this->getPostVar()] = ilUtil::stripSlashesRecursive($_POST[$this->getPostVar()], false);
86  }
87  }
88 }
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.
global $lng
Definition: privfeed.php:17
$_POST["username"]