ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
class.ilADTPresentationBridge.php
Go to the documentation of this file.
1<?php
2/* Copyright (c) 1998-2009 ILIAS open source, Extended GPL, see docs/LICENSE */
3
12{
13 protected $adt; // [ilADT]
14 protected $decorator; // [String|Array]
15
22 public function __construct(ilADT $a_adt)
23 {
24 $this->setADT($a_adt);
25 }
26
27
28 //
29 // properties
30 //
31
40 abstract protected function isValidADT(ilADT $a_adt);
41
48 protected function setADT(ilADT $a_adt)
49 {
50 if (!$this->isValidADT($a_adt)) {
51 throw new Exception('ADTPresentationBridge Type mismatch.');
52 }
53
54 $this->adt = $a_adt;
55 }
56
62 public function getADT()
63 {
64 return $this->adt;
65 }
66
72 public function getList()
73 {
74 return $this->getHTML();
75 }
76
82 abstract public function getHTML();
83
89 abstract public function getSortable();
90
96 public function setDecoratorCallBack($a_callback)
97 {
98 $this->decorator = $a_callback;
99 }
100
107 protected function decorate($a_value)
108 {
109 if (is_callable($this->decorator)) {
110 $a_value = call_user_func($this->decorator, $a_value);
111 }
112 return $a_value;
113 }
114}
An exception for terminatinating execution or to throw for unit testing.
ADT presentation bridge base class.
__construct(ilADT $a_adt)
Constructor.
getSortable()
Get sortable value presentation.
isValidADT(ilADT $a_adt)
Check if given ADT is valid.
setDecoratorCallBack($a_callback)
Set decorator callback.
getHTML()
Get HTML presentation.
ADT base class.
Definition: class.ilADT.php:12