ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
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 {
18  protected $lng;
19 
20 
24  public function __construct()
25  {
26  global $DIC;
27 
28  parent::__construct();
29  $this->lng = $DIC->language();
30  }
31 
32  public function getType()
33  {
34  return "bool";
35  }
36 
37 
38  // PEER REVIEW
39 
40  public function addToPeerReviewForm($a_value = null)
41  {
42  $lng = $this->lng;
43 
44  if (!$this->isRequired()) {
45  $input = new ilCheckboxInputGUI($this->getTitle(), "prccc_bool_" . $this->getId());
46  $input->setInfo($this->getDescription());
47  $input->setRequired($this->isRequired());
48  $input->setChecked($a_value > 0);
49  } else {
50  $input = new ilSelectInputGUI($this->getTitle(), "prccc_bool_" . $this->getId());
51  $input->setInfo($this->getDescription());
52  $input->setRequired($this->isRequired());
53  $input->setValue($a_value);
54  $options = array();
55  if (!$a_value) {
56  $options[""] = $lng->txt("please_select");
57  }
58  $options[1] = $lng->txt("yes");
59  $options[-1] = $lng->txt("no");
60  $input->setOptions($options);
61  }
62  $this->form->addItem($input);
63  }
64 
65  public function importFromPeerReviewForm()
66  {
67  return (int) $this->form->getInput("prccc_bool_" . $this->getId());
68  }
69 
70  public function hasValue($a_value)
71  {
72  return (int) $a_value;
73  }
74 
75  public function getHTML($a_value)
76  {
77  $lng = $this->lng;
78 
79  $caption = null;
80  if ($this->isRequired() && $a_value < 0) {
81  $caption = $lng->txt("no");
82  } elseif ($a_value == 1) {
83  $caption = $lng->txt("yes");
84  }
85  return $caption;
86  }
87 }
Class ilExcCriteria.
This class represents a selection list property in a property form.
global $DIC
Definition: saml.php:7
This class represents a checkbox property in a property form.
addToPeerReviewForm($a_value=null)
Create styles array
The data for the language used.
Class ilExcCriteriaBool.
if(!isset($_REQUEST['ReturnTo'])) if(!isset($_REQUEST['AuthId'])) $options
Definition: as_login.php:20