ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
class.ilExcCriteriaBool.php
Go to the documentation of this file.
1 <?php
2 
3 /* Copyright (c) 1998-2010 ILIAS open source, Extended GPL, see docs/LICENSE */
4 
5 include_once "Modules/Exercise/classes/class.ilExcCriteria.php";
6 
14 {
15  public function getType()
16  {
17  return "bool";
18  }
19 
20 
21  // PEER REVIEW
22 
23  public function addToPeerReviewForm($a_value = null)
24  {
25  global $lng;
26 
27  if(!$this->isRequired())
28  {
29  $input = new ilCheckboxInputGUI($this->getTitle(), "prccc_bool_".$this->getId());
30  $input->setInfo($this->getDescription());
31  $input->setRequired($this->isRequired());
32  $input->setChecked($a_value > 0);
33  }
34  else
35  {
36  $input = new ilSelectInputGUI($this->getTitle(), "prccc_bool_".$this->getId());
37  $input->setInfo($this->getDescription());
38  $input->setRequired($this->isRequired());
39  $input->setValue($a_value);
40  $options = array();
41  if(!$a_value)
42  {
43  $options[""] = $lng->txt("please_select");
44  }
45  $options[1] = $lng->txt("yes");
46  $options[-1] = $lng->txt("no");
47  $input->setOptions($options);
48  }
49  $this->form->addItem($input);
50  }
51 
52  public function importFromPeerReviewForm()
53  {
54  return (int)$this->form->getInput("prccc_bool_".$this->getId());
55  }
56 
57  public function hasValue($a_value)
58  {
59  return (int)$a_value;
60  }
61 
62  public function getHTML($a_value)
63  {
64  global $lng;
65 
66  $caption = null;
67  if($this->isRequired() && $a_value < 0)
68  {
69  $caption = $lng->txt("no");
70  }
71  else if($a_value == 1)
72  {
73  $caption = $lng->txt("yes");
74  }
75  return $caption;
76  }
77 }
Class ilExcCriteria.
This class represents a selection list property in a property form.
This class represents a checkbox property in a property form.
addToPeerReviewForm($a_value=null)
if(!is_array($argv)) $options
Create styles array
The data for the language used.
global $lng
Definition: privfeed.php:17
Class ilExcCriteriaBool.