ILIAS  release_7 Revision v7.30-3-g800a261c036
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)) {
14 $this->adt_lower = $factory->getInstanceByDefinition($a_adt_def);
15 $this->adt_upper = $factory->getInstanceByDefinition($a_adt_def);
16 return;
17 }
18
19 throw new Exception('ilADTSearchBridge type mismatch.');
20 }
21
27 public function getLowerADT()
28 {
29 return $this->adt_lower;
30 }
31
37 public function getUpperADT()
38 {
39 return $this->adt_upper;
40 }
41
42 public function isNull()
43 {
44 return ($this->getLowerADT()->isNull() && $this->getUpperADT()->isNull());
45 }
46
47 public function isValid()
48 {
49 return ($this->getLowerADT()->isValid() && $this->getUpperADT()->isValid());
50 }
51
52 public function validate()
53 {
54 if (!$this->isValid()) {
55 $tmp = array();
56 $mess = $this->getLowerADT()->getValidationErrors();
57 foreach ($mess as $error_code) {
58 $tmp[] = $this->getLowerADT()->translateErrorCode($error_code);
59 }
60 if ($tmp) {
61 $field = $this->getForm()->getItemByPostvar($this->addToElementId("lower"));
62 $field->setAlert(implode("<br />", $tmp));
63 }
64
65 $tmp = array();
66 $mess = $this->getUpperADT()->getValidationErrors();
67 foreach ($mess as $error_code) {
68 $tmp[] = $this->getUpperADT()->translateErrorCode($error_code);
69 }
70 if ($tmp) {
71 $field = $this->getForm()->getItemByPostvar($this->addToElementId("upper"));
72 $field->setAlert(implode("<br />", $tmp));
73 }
74
75 return false;
76 }
77
78 return true;
79 }
80}
An exception for terminatinating execution or to throw for unit testing.
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.
$factory
Definition: metadata.php:58