ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
All Data Structures Namespaces Files Functions Variables Modules Pages
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 
12 {
16  protected $lng;
17 
18 
22  public function __construct()
23  {
24  global $DIC;
25 
27  $this->lng = $DIC->language();
28  }
29 
30  public function getType()
31  {
32  return "bool";
33  }
34 
35 
36  // PEER REVIEW
37 
38  public function addToPeerReviewForm($a_value = null)
39  {
40  $lng = $this->lng;
41 
42  if (!$this->isRequired()) {
43  $input = new ilCheckboxInputGUI($this->getTitle(), "prccc_bool_" . $this->getId());
44  $input->setInfo($this->getDescription());
45  $input->setRequired($this->isRequired());
46  $input->setChecked($a_value > 0);
47  } else {
48  $input = new ilSelectInputGUI($this->getTitle(), "prccc_bool_" . $this->getId());
49  $input->setInfo($this->getDescription());
50  $input->setRequired($this->isRequired());
51  $input->setValue($a_value);
52  $options = array();
53  if (!$a_value) {
54  $options[""] = $lng->txt("please_select");
55  }
56  $options[1] = $lng->txt("yes");
57  $options[-1] = $lng->txt("no");
58  $input->setOptions($options);
59  }
60  $this->form->addItem($input);
61  }
62 
63  public function importFromPeerReviewForm()
64  {
65  return (int) $this->form->getInput("prccc_bool_" . $this->getId());
66  }
67 
68  public function hasValue($a_value)
69  {
70  return (int) $a_value;
71  }
72 
73  public function getHTML($a_value)
74  {
75  $lng = $this->lng;
76 
77  $caption = null;
78  if ($this->isRequired() && $a_value < 0) {
79  $caption = $lng->txt("no");
80  } elseif ($a_value == 1) {
81  $caption = $lng->txt("yes");
82  }
83  return $caption;
84  }
85 }
Class ilExcCriteria.
This class represents a checkbox property in a property form.
addToPeerReviewForm($a_value=null)
__construct(Container $dic, ilPlugin $plugin)
Class ilExcCriteriaBool.
$DIC
Definition: xapitoken.php:46