ILIAS  Release_5_0_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
class.ilADTSearchBridgeSingle.php
Go to the documentation of this file.
1 <?php
2 
3 require_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  {
13  $this->adt = ilADTFactory::getInstance()->getInstanceByDefinition($a_adt_def);
14  return;
15  }
16 
17  throw new Exception('ilADTSearchBridge type mismatch.');
18  }
19 
25  public function getADT()
26  {
27  return $this->adt;
28  }
29 
30  public function isNull()
31  {
32  return $this->getADT()->isNull();
33  }
34 
35  public function isValid()
36  {
37  return $this->getADT()->isValid();
38  }
39 
40  public function validate()
41  {
42  if(!$this->isValid())
43  {
44  $tmp = array();
45 
46  $mess = $this->getADT()->getValidationErrors();
47  foreach($mess as $error_code)
48  {
49  $tmp[] = $this->getADT()->translateErrorCode($error_code);
50  }
51 
52  $field = $this->getForm()->getItemByPostvar($this->getElementId());
53  $field->setAlert(implode("<br />", $tmp));
54 
55  return false;
56  }
57 
58  return true;
59  }
60 }
61 
62 ?>