ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
class.ilADTSearchBridgeRange.php
Go to the documentation of this file.
1<?php
2
3require_once "Services/ADT/classes/Bridges/class.ilADTSearchBridge.php";
4
6{
7 protected $adt_lower; // [ilADT]
8 protected $adt_upper; // [ilADT]
9
10 protected function setDefinition(ilADTDefinition $a_adt_def)
11 {
12 if($this->isValidADTDefinition($a_adt_def))
13 {
14 $factory = ilADTFactory::getInstance();
15 $this->adt_lower = $factory->getInstanceByDefinition($a_adt_def);
16 $this->adt_upper = $factory->getInstanceByDefinition($a_adt_def);
17 return;
18 }
19
20 throw new Exception('ilADTSearchBridge type mismatch.');
21 }
22
28 public function getLowerADT()
29 {
30 return $this->adt_lower;
31 }
32
38 public function getUpperADT()
39 {
40 return $this->adt_upper;
41 }
42
43 public function isNull()
44 {
45 return ($this->getLowerADT()->isNull() && $this->getUpperADT()->isNull());
46 }
47
48 public function isValid()
49 {
50 return ($this->getLowerADT()->isValid() && $this->getUpperADT()->isValid());
51 }
52
53 public function validate()
54 {
55 if(!$this->isValid())
56 {
57 $tmp = array();
58 $mess = $this->getLowerADT()->getValidationErrors();
59 foreach($mess as $error_code)
60 {
61 $tmp[] = $this->getLowerADT()->translateErrorCode($error_code);
62 }
63 if($tmp)
64 {
65 $field = $this->getForm()->getItemByPostvar($this->addToElementId("lower"));
66 $field->setAlert(implode("<br />", $tmp));
67 }
68
69 $tmp = array();
70 $mess = $this->getUpperADT()->getValidationErrors();
71 foreach($mess as $error_code)
72 {
73 $tmp[] = $this->getUpperADT()->translateErrorCode($error_code);
74 }
75 if($tmp)
76 {
77 $field = $this->getForm()->getItemByPostvar($this->addToElementId("upper"));
78 $field->setAlert(implode("<br />", $tmp));
79 }
80
81 return false;
82 }
83
84 return true;
85 }
86}
87
88?>
ADT definition base class.
static getInstance()
Get singleton.
setDefinition(ilADTDefinition $a_adt_def)
Set ADT definition.
validate()
Validate current data.
ADT search bridge base class.
addToElementId($a_add)
Add sub-element.
isValidADTDefinition(ilADTDefinition $a_adt_def)
Check if given ADT definition is valid.