ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
CommonTableBuilder.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
22
24
25abstract class CommonTableBuilder
26{
28
29 public function __construct(
30 protected object $parent_gui,
31 protected string $parent_cmd,
32 bool $numeric_ids = true
33 ) {
34 $this->table = new TableAdapterGUI(
35 $this->getId(),
36 $this->getTitle(),
37 $this->getRetrieval(),
38 $parent_gui,
39 $parent_cmd,
40 $this->getNamespace(),
41 $this->getOrderingCommand(),
42 \Closure::fromCallable([$this, 'activeAction']),
43 \Closure::fromCallable([$this, 'transformRow']),
44 $numeric_ids
45 );
46 $this->table = $this->build($this->table);
47 }
48
49 abstract protected function getId(): string;
50
51 abstract protected function getTitle(): string;
52
53 abstract protected function getRetrieval(): RetrievalInterface;
54
55 protected function getNamespace(): string
56 {
57 return "";
58 }
59
60 protected function getOrderingCommand(): string
61 {
62 return "";
63 }
64
65 protected function activeAction(string $action, array $data_row): bool
66 {
67 return true;
68 }
69
73 protected function transformRow(array $data_row): array
74 {
75 return $data_row;
76 }
77
78 abstract protected function build(TableAdapterGUI $table): TableAdapterGUI;
79
80 final public function getTable(
82 return $this->table;
83 }
84}
activeAction(string $action, array $data_row)
__construct(protected object $parent_gui, protected string $parent_cmd, bool $numeric_ids=true)
transformRow(array $data_row)
transform raw data array to table row data array
return['delivery_method'=> 'php',]
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...