ILIAS  Release_4_1_x_branch Revision 61804
 All Data Structures Namespaces Files Functions Variables Groups Pages
class.ilRandomTestROInputGUI.php
Go to the documentation of this file.
1 <?php
2 /*
3  +-----------------------------------------------------------------------------+
4  | ILIAS open source |
5  +-----------------------------------------------------------------------------+
6  | Copyright (c) 1998-2007 ILIAS open source, University of Cologne |
7  | |
8  | This program is free software; you can redistribute it and/or |
9  | modify it under the terms of the GNU General Public License |
10  | as published by the Free Software Foundation; either version 2 |
11  | of the License, or (at your option) any later version. |
12  | |
13  | This program is distributed in the hope that it will be useful, |
14  | but WITHOUT ANY WARRANTY; without even the implied warranty of |
15  | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
16  | GNU General Public License for more details. |
17  | |
18  | You should have received a copy of the GNU General Public License |
19  | along with this program; if not, write to the Free Software |
20  | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
21  +-----------------------------------------------------------------------------+
22 */
23 
32 {
33  protected $values = array();
34 
41  function __construct($a_title = "", $a_postvar = "")
42  {
43  parent::__construct($a_title, $a_postvar);
44  $this->setRequired(true);
45  }
46 
52  function setValue($a_value)
53  {
54  }
55 
56  public function setValueByArray($a_values)
57  {
58  }
59 
65  function setValues($a_values)
66  {
67  $this->values = $a_values;
68  }
69 
75  function getValues()
76  {
77  return $this->values;
78  }
79 
85  function checkInput()
86  {
87  return $this->checkSubItemsInput();
88  }
89 
95  function insert(&$a_tpl)
96  {
97  global $lng;
98 
99  $tpl = new ilTemplate("tpl.prop_randomtestroinput.html", true, true, "Modules/Test");
100  $i = 0;
101  foreach ($this->values as $value)
102  {
103  if ($value['num_of_q'] > 0)
104  {
105  $tpl->setCurrentBlock("num_of_q");
106  $tpl->setVariable("NUM_OF_Q", $value['num_of_q']);
107  $tpl->setVariable("TEXT_FROM", $lng->txt('questions_from'));
108  $tpl->parseCurrentBlock();
109  }
110  $tpl->setCurrentBlock("row");
111  $class = ($i % 2 == 0) ? "even" : "odd";
112  if ($i == 0) $class .= " first";
113  if ($i == count($this->values)-1) $class .= " last";
114  $tpl->setVariable("ROW_CLASS", $class);
115  $tpl->setVariable("QPL_VALUE", ilUtil::prepareFormOutput($value['title']));
116  $tpl->setVariable("COUNT_VALUE", "(" . $value['count'] . " " . $lng->txt('assQuestions') . ")");
117  $tpl->parseCurrentBlock();
118  $i++;
119  }
120  $tpl->setVariable("ELEMENT_ID", $this->getPostVar());
121 
122  $a_tpl->setCurrentBlock("prop_generic");
123  $a_tpl->setVariable("PROP_GENERIC", $tpl->get());
124  $a_tpl->parseCurrentBlock();
125  }
126 }