ILIAS  release_8 Revision v8.19
All Data Structures Namespaces Files Functions Variables Modules Pages
class.ilRandomTestROInputGUI.php
Go to the documentation of this file.
1 <?php
2 
27 {
28  protected $values = array();
29 
36  public function __construct($a_title = "", $a_postvar = "")
37  {
38  parent::__construct($a_title, $a_postvar);
39  $this->setRequired(true);
40  }
41 
47  public function setValue($a_value)
48  {
49  }
50 
51  public function setValueByArray($a_values)
52  {
53  }
54 
60  public function setValues($a_values)
61  {
62  $this->values = $a_values;
63  }
64 
70  public function getValues(): array
71  {
72  return $this->values;
73  }
74 
79  public function checkInput(): bool
80  {
81  return $this->checkSubItemsInput();
82  }
83 
87  public function insert($a_tpl)
88  {
89  global $DIC;
90  $lng = $DIC['lng'];
91 
92  $tpl = new ilTemplate("tpl.prop_randomtestroinput.html", true, true, "Modules/Test");
93  $i = 0;
94  foreach ($this->values as $value) {
95  if ($value['num_of_q'] > 0) {
96  $tpl->setCurrentBlock("num_of_q");
97  $tpl->setVariable("NUM_OF_Q", $value['num_of_q']);
98  $tpl->setVariable("TEXT_FROM", $lng->txt('questions_from'));
99  $tpl->parseCurrentBlock();
100  }
101  $tpl->setCurrentBlock("row");
102  $class = ($i % 2 == 0) ? "even" : "odd";
103  if ($i == 0) {
104  $class .= " first";
105  }
106  if ($i == count($this->values) - 1) {
107  $class .= " last";
108  }
109  $tpl->setVariable("ROW_CLASS", $class);
110  $tpl->setVariable("QPL_VALUE", ilLegacyFormElementsUtil::prepareFormOutput($value['title']));
111  $tpl->setVariable("COUNT_VALUE", "(" . $value['count'] . " " . $lng->txt('assQuestions') . ")");
112  $tpl->parseCurrentBlock();
113  $i++;
114  }
115  $tpl->setVariable("ELEMENT_ID", $this->getPostVar());
116 
117  $a_tpl->setCurrentBlock("prop_generic");
118  $a_tpl->setVariable("PROP_GENERIC", $tpl->get());
119  $a_tpl->parseCurrentBlock();
120  }
121 }
txt(string $a_topic, string $a_default_lang_fallback_mod="")
gets the text for a given topic if the topic is not in the list, the topic itself with "-" will be re...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static prepareFormOutput($a_str, bool $a_strip=false)
__construct($a_title="", $a_postvar="")
Constructor.
global $DIC
Definition: feed.php:28
insert($a_tpl)
Insert property html.
setRequired(bool $a_required)
__construct(Container $dic, ilPlugin $plugin)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
checkInput()
Check input, strip slashes etc.
if($DIC->http() ->request() ->getMethod()=="GET" &&isset($DIC->http() ->request() ->getQueryParams()['tex'])) $tpl
Definition: latex.php:41
$i
Definition: metadata.php:41