ILIAS  trunk Revision v12.0_alpha-16-g3e876e53c80
TableBuilder.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
22
26use ilLanguage;
27use ilCtrl;
28use ILIAS\UI\Factory as UIFactory;
30
32{
33 protected ilCtrl $ctrl;
34 protected QuestionInfo $question_info;
35 protected ilLanguage $lng;
36 protected UIFactory $ui_factory;
37
38 public function __construct(
39 object $parent_gui,
40 string $parent_cmd,
41 protected int $obj_id
42 ) {
43 global $DIC;
44
45 $this->ctrl = $DIC->ctrl();
46 $this->question_info = $DIC->testQuestion();
47 $this->lng = $DIC->language();
48 $this->ui_factory = $DIC->ui()->factory();
49
50 $this->lng->loadLanguageModule('cont');
51
52 parent::__construct($parent_gui, $parent_cmd, true);
53 }
54
55 protected function getId(): string
56 {
57 return 'question_usage';
58 }
59
60 protected function getTitle(): string
61 {
62 return $this->lng->txt('cont_question_page_usage');
63 }
64
65 protected function getRetrieval(): RetrievalInterface
66 {
67 return new Retrieval(
68 $this->obj_id,
69 $this->ctrl,
70 $this->question_info
71 );
72 }
73
74 protected function transformRow(array $data_row): array
75 {
76 $data = [
77 'id' => $data_row['id'],
78 'title' => $data_row['title'] ?? '',
79 'page' => $this->ui_factory->link()->standard(
80 $data_row['page_title'] ?? '',
81 $data_row['page_link'] ?? ''
82 )
83 ];
84 return $data;
85 }
86
88 {
89 return $table
90 ->textColumn('title', $this->lng->txt('cont_question'))
91 ->linkColumn('page', $this->lng->txt('cont_page_usage'));
92 }
93}
Builds a Color from either hex- or rgb values.
Definition: Factory.php:31
transformRow(array $data_row)
transform raw data array to table row data array
__construct(object $parent_gui, string $parent_cmd, protected int $obj_id)
textColumn(string $key, string $title, bool $sortable=false)
Class ilCtrl provides processing control methods.
language handling
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
global $DIC
Definition: shib_login.php:26