ILIAS  Release_5_0_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
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  function __construct($a_title = "", $a_postvar = "")
22  {
23  parent::__construct($a_title, $a_postvar);
24  $this->setRequired(true);
25  }
26 
32  function setValue($a_value)
33  {
34  }
35 
36  public function setValueByArray($a_values)
37  {
38  }
39 
45  function setValues($a_values)
46  {
47  $this->values = $a_values;
48  }
49 
55  function getValues()
56  {
57  return $this->values;
58  }
59 
65  function checkInput()
66  {
67  return $this->checkSubItemsInput();
68  }
69 
75  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  {
83  if ($value['num_of_q'] > 0)
84  {
85  $tpl->setCurrentBlock("num_of_q");
86  $tpl->setVariable("NUM_OF_Q", $value['num_of_q']);
87  $tpl->setVariable("TEXT_FROM", $lng->txt('questions_from'));
88  $tpl->parseCurrentBlock();
89  }
90  $tpl->setCurrentBlock("row");
91  $class = ($i % 2 == 0) ? "even" : "odd";
92  if ($i == 0) $class .= " first";
93  if ($i == count($this->values)-1) $class .= " last";
94  $tpl->setVariable("ROW_CLASS", $class);
95  $tpl->setVariable("QPL_VALUE", ilUtil::prepareFormOutput($value['title']));
96  $tpl->setVariable("COUNT_VALUE", "(" . $value['count'] . " " . $lng->txt('assQuestions') . ")");
97  $tpl->parseCurrentBlock();
98  $i++;
99  }
100  $tpl->setVariable("ELEMENT_ID", $this->getPostVar());
101 
102  $a_tpl->setCurrentBlock("prop_generic");
103  $a_tpl->setVariable("PROP_GENERIC", $tpl->get());
104  $a_tpl->parseCurrentBlock();
105  }
106 }