ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
class.ilADTSearchBridgeSingle.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; // [ilADT]
8
9 protected function setDefinition(ilADTDefinition $a_adt_def)
10 {
11 if ($this->isValidADTDefinition($a_adt_def)) {
12 $this->adt = ilADTFactory::getInstance()->getInstanceByDefinition($a_adt_def);
13 return;
14 }
15
16 throw new Exception('ilADTSearchBridge type mismatch.');
17 }
18
24 public function getADT()
25 {
26 return $this->adt;
27 }
28
29 public function isNull()
30 {
31 return $this->getADT()->isNull();
32 }
33
34 public function isValid()
35 {
36 return $this->getADT()->isValid();
37 }
38
39 public function validate()
40 {
41 if (!$this->isValid()) {
42 $tmp = array();
43
44 $mess = $this->getADT()->getValidationErrors();
45 foreach ($mess as $error_code) {
46 $tmp[] = $this->getADT()->translateErrorCode($error_code);
47 }
48
49 $field = $this->getForm()->getItemByPostvar($this->getElementId());
50 $field->setAlert(implode("<br />", $tmp));
51
52 return false;
53 }
54
55 return true;
56 }
57}
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.
ADT search bridge base class.
getElementId()
Get element id.
isValidADTDefinition(ilADTDefinition $a_adt_def)
Check if given ADT definition is valid.