ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
class.ilRandomTestROInputGUI.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (c) 1998-2013 ILIAS open source, Extended GPL, see docs/LICENSE */
3 
12 {
13  protected $values = array();
14 
21  public function __construct($a_title = "", $a_postvar = "")
22  {
23  parent::__construct($a_title, $a_postvar);
24  $this->setRequired(true);
25  }
26 
32  public function setValue($a_value)
33  {
34  }
35 
36  public function setValueByArray($a_values)
37  {
38  }
39 
45  public function setValues($a_values)
46  {
47  $this->values = $a_values;
48  }
49 
55  public function getValues()
56  {
57  return $this->values;
58  }
59 
65  public function checkInput()
66  {
67  return $this->checkSubItemsInput();
68  }
69 
75  public function insert(&$a_tpl)
76  {
77  global $lng;
78 
79  $tpl = new ilTemplate("tpl.prop_randomtestroinput.html", true, true, "Modules/Test");
80  $i = 0;
81  foreach ($this->values as $value) {
82  if ($value['num_of_q'] > 0) {
83  $tpl->setCurrentBlock("num_of_q");
84  $tpl->setVariable("NUM_OF_Q", $value['num_of_q']);
85  $tpl->setVariable("TEXT_FROM", $lng->txt('questions_from'));
86  $tpl->parseCurrentBlock();
87  }
88  $tpl->setCurrentBlock("row");
89  $class = ($i % 2 == 0) ? "even" : "odd";
90  if ($i == 0) {
91  $class .= " first";
92  }
93  if ($i == count($this->values)-1) {
94  $class .= " last";
95  }
96  $tpl->setVariable("ROW_CLASS", $class);
97  $tpl->setVariable("QPL_VALUE", ilUtil::prepareFormOutput($value['title']));
98  $tpl->setVariable("COUNT_VALUE", "(" . $value['count'] . " " . $lng->txt('assQuestions') . ")");
99  $tpl->parseCurrentBlock();
100  $i++;
101  }
102  $tpl->setVariable("ELEMENT_ID", $this->getPostVar());
103 
104  $a_tpl->setCurrentBlock("prop_generic");
105  $a_tpl->setVariable("PROP_GENERIC", $tpl->get());
106  $a_tpl->parseCurrentBlock();
107  }
108 }
static prepareFormOutput($a_str, $a_strip=false)
prepares string output for html forms public
This class represents a random test input property in a property form.
$tpl
Definition: ilias.php:10
getPostVar()
Get Post Variable.
__construct($a_title="", $a_postvar="")
Constructor.
special template class to simplify handling of ITX/PEAR
Create styles array
The data for the language used.
This class represents a property that may include a sub form.
insert(&$a_tpl)
Insert property html.
$i
Definition: disco.tpl.php:19
checkInput()
Check input, strip slashes etc.
setRequired($a_required)
Set Required.