ILIAS  trunk Revision v12.0_alpha-16-g3e876e53c80
class.ilMediaObjectOverviewGUI.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
23use ILIAS\Data\Factory as DataFactory;
27
29{
32 protected DataFactory $data_factory;
33
34 public function __construct(
35 protected SubObjectRetrieval $sub_object_retrieval
36 ) {
37 global $DIC;
38
39 $this->domain = $DIC->mediaObjects()->internal()->domain();
40 $this->gui = $DIC->mediaObjects()->internal()->gui();
41 $this->data_factory = new DataFactory();
42
43 $this->domain->lng()->loadLanguageModule('mob');
44 }
45
46 public function executeCommand(): void
47 {
48 $ctrl = $this->gui->ctrl();
49
50 switch ($ctrl->getNextClass($this)) {
51 default:
52 $cmd = $ctrl->getCmd('show');
53 $this->$cmd();
54 break;
55 }
56 }
57
58 protected function show(): void
59 {
60 $filter = $this->getFilter('show');
61 $table_builder = $this->getTableBuilder('show');
62 $table = $table_builder->getTable()->filterData($filter->getData() ?? []);
63
64 $this->gui->ui()->mainTemplate()->setContent($filter->render() . $table->render());
65 }
66
67 protected function getFilter(string $cmd): FilterAdapterGUI
68 {
69 $lng = $this->domain->lng();
70 $lom = $this->domain->learningObjectMetadata();
71
72 $filter = $this->gui->filter(
73 'mob_overview_filter',
74 [self::class],
75 $cmd
76 );
77
78 $filter = $filter->text('title', $lng->txt('mob'));
79 if ($lom->copyrightHelper()->isCopyrightSelectionActive()) {
80 $cp_selection = [];
81 foreach ($lom->copyrightHelper()->getAllCopyrightPresets() as $copyright) {
82 $cp_selection[$copyright->identifier()] = $copyright->title();
83 }
84 $filter = $filter->multiSelect('copyright', $lng->txt('mob_copyright'), $cp_selection);
85 }
86 $filter = $filter->duration('last_update', $lng->txt('mob_last_update'), true);
87
88 return $filter;
89 }
90
91 protected function getTableBuilder(string $cmd): TableBuilder
92 {
93 return new TableBuilder(
94 $this->domain,
95 $this->gui,
96 $this->data_factory,
97 $this->sub_object_retrieval,
98 $this,
99 $cmd
100 );
101 }
102}
Builds data types.
Definition: Factory.php:36
__construct(protected SubObjectRetrieval $sub_object_retrieval)
global $lng
Definition: privfeed.php:31
global $DIC
Definition: shib_login.php:26