ILIAS  trunk Revision v11.0_alpha-1715-g7fc467680fb
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
class.ilADTPresentationBridge.php
Go to the documentation of this file.
1 <?php
2 
19 declare(strict_types=1);
20 
27 {
28  protected ilADT $adt;
32  protected $decorator;
33  protected ilLanguage $lng;
34 
35  public function __construct(ilADT $a_adt)
36  {
37  global $DIC;
38 
39  $this->lng = $DIC->language();
40 
41  $this->setADT($a_adt);
42  }
43 
44  abstract protected function isValidADT(ilADT $a_adt): bool;
45 
46  protected function setADT(ilADT $a_adt): void
47  {
48  if (!$this->isValidADT($a_adt)) {
49  throw new InvalidArgumentException('ADTPresentationBridge Type mismatch.');
50  }
51  $this->adt = $a_adt;
52  }
53 
54  public function getADT(): ?ilADT
55  {
56  return $this->adt;
57  }
58 
59  public function getList(): string
60  {
61  return $this->getHTML();
62  }
63 
64  abstract public function getHTML(): string;
65 
70  abstract public function getSortable();
71 
78  public function setDecoratorCallBack(?array $a_callback): void
79  {
80  $this->decorator = $a_callback;
81  }
82 
88  protected function decorate($a_value)
89  {
90  if (is_callable($this->decorator)) {
91  $a_value = call_user_func($this->decorator, $a_value);
92  }
93  return $a_value;
94  }
95 }
setDecoratorCallBack(?array $a_callback)
Takes as input an array consisting of the object that the method that should be called back to belong...
decorate($a_value)
Decorate value.
ADT base class.
Definition: class.ilADT.php:25
getSortable()
Get sortable value presentation.
global $DIC
Definition: shib_login.php:22
isValidADT(ilADT $a_adt)
ADT presentation bridge base class.