ILIAS  trunk Revision v12.0_alpha-1221-g4e438232683
ilMMSubItemTableComponent Class Reference
+ Inheritance diagram for ilMMSubItemTableComponent:
+ Collaboration diagram for ilMMSubItemTableComponent:

Public Member Functions

 __construct (private Pons $pons, TokenContainer $token_container, private ilMMItemRepository $repository, private ?ilMMItemFacadeInterface $parent_item, private bool $write_access)
 
 getRows (OrderingRowBuilder $row_builder, array $visible_column_ids)
 This is called by the (ordering-)table to retrieve rows; map data-records to rows using the $row_builder e.g. More...
 
 get ()
 
 getRows (OrderingRowBuilder $row_builder, array $visible_column_ids)
 This is called by the (ordering-)table to retrieve rows; map data-records to rows using the $row_builder e.g. More...
 

Data Fields

const ACTION_EDIT = 'edit'
 
const ACTION_TRANSLATE = 'translate'
 
const ACTION_ACTIVATE = 'activate'
 
const ACTION_DEACTIVATE = 'deactivate'
 
const ACTION_MOVE = 'move'
 
const ACTION_DELETE = 'delete'
 

Private Attributes

UIServices $ui
 
URLBuilder $url_builder = null
 
URLBuilderToken $token = null
 
Factory $ui_factory
 
Renderer $ui_renderer
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ilMMSubItemTableComponent::__construct ( private Pons  $pons,
TokenContainer  $token_container,
private ilMMItemRepository  $repository,
private ?ilMMItemFacadeInterface  $parent_item,
private bool  $write_access 
)

Definition at line 70 of file class.ilMMSubItemTableComponent.php.

76 {
77 $this->ui_factory = $this->pons->out()->ui()->factory();
78 $this->ui_renderer = $this->pons->out()->ui()->renderer();
79 $this->url_builder = $token_container->builder();
80 $this->token = $token_container->token();
81 }

References ILIAS\GlobalScreen\GUI\Input\TokenContainer\builder(), and ILIAS\GlobalScreen\GUI\Input\TokenContainer\token().

+ Here is the call graph for this function:

Member Function Documentation

◆ get()

ilMMSubItemTableComponent::get ( )

Definition at line 138 of file class.ilMMSubItemTableComponent.php.

138 : Component|array
139 {
140 if ($this->write_access) {
141 $actions = [
142 self::ACTION_EDIT => $this->ui_factory->table()->action()->single(
143 $this->pons->i18n()->t('edit'),
144 $this->url_builder->withURI(
145 $this->pons->flow()->getHereAsURI(ilMMSubItemGUI::CMD_EDIT)
146 ),
147 $this->token
148 )->withAsync(true),
149 self::ACTION_TRANSLATE => $this->ui_factory->table()->action()->single(
150 $this->pons->i18n()->t('translate'),
151 $this->url_builder->withURI(
152 $this->pons->flow()->getTranslationAsURI()
153 ),
154 $this->token
155 )->withAsync(true),
156 self::ACTION_ACTIVATE => $this->ui_factory->table()->action()->standard(
157 $this->pons->i18n()->t('activate'),
158 $this->url_builder->withURI(
159 $this->pons->flow()->getHereAsURI(ilMMSubItemGUI::CMD_ACTIVATE)
160 ),
161 $this->token
162 ),
163 self::ACTION_DEACTIVATE => $this->ui_factory->table()->action()->standard(
164 $this->pons->i18n()->t('deactivate'),
165 $this->url_builder->withURI(
166 $this->pons->flow()->getHereAsURI(ilMMSubItemGUI::CMD_DEACTIVATE)
167 ),
168 $this->token
169 ),
170 self::ACTION_MOVE => $this->ui_factory->table()->action()->standard(
171 $this->pons->i18n()->t('move'),
172 $this->url_builder->withURI(
173 $this->pons->flow()->getHereAsURI(ilMMSubItemGUI::CMD_CONFIRM_MOVE)
174 ),
175 $this->token
176 )->withAsync(true),
177 self::ACTION_DELETE => $this->ui_factory->table()->action()->standard(
178 $this->pons->i18n()->t('delete'),
179 $this->url_builder->withURI(
180 $this->pons->flow()->getHereAsURI(ilMMSubItemGUI::CMD_CONFIRM_DELETE)
181 ),
182 $this->token
183 )->withAsync(true),
184 ];
185 } else {
186 $actions = [];
187 }
188 return [
189 $this
190 ->ui_factory
191 ->table()
192 ->ordering(
193 $this,
194 $this->pons->flow()->getHereAsURI(ilMMSubItemGUI::CMD_SAVE_ORDER),
195 $this->parent_item?->getDefaultTitle() ?? $this->pons->i18n()->t('mme_lost_items'),
196 [
197 'title' => $this->ui_factory->table()->column()->text(
198 $this->pons->i18n()->t('title', 'sub'),
199 ),
200 'active' => $this->ui_factory->table()->column()->boolean(
201 $this->pons->i18n()->t('active', 'sub'),
202 $this->pons->out()->ok(),
203 $this->pons->out()->nok(),
204 ),
205 'status' => $this->ui_factory->table()->column()->text(
206 $this->pons->i18n()->t('status', 'sub'),
207 ),
208 'type' => $this->ui_factory->table()->column()->text(
209 $this->pons->i18n()->t('type', 'topitem'),
210 ),
211 'provider' => $this->ui_factory->table()->column()->text(
212 $this->pons->i18n()->t('provider', 'topitem'),
213 ),
214 ]
215 )->withRequest(
216 $this->pons->in()->request()
217 )
218 ->withOrderingDisabled(!$this->write_access)
219 ->withActions($actions)
220 ];
221 }
const CMD_CONFIRM_DELETE

References $token, ilMMBaseGUI\CMD_ACTIVATE, ilMMBaseGUI\CMD_CONFIRM_DELETE, ilMMSubItemGUI\CMD_CONFIRM_MOVE, ilMMBaseGUI\CMD_DEACTIVATE, ilMMBaseGUI\CMD_EDIT, and ilMMBaseGUI\CMD_SAVE_ORDER.

◆ getRows()

ilMMSubItemTableComponent::getRows ( OrderingRowBuilder  $row_builder,
array  $visible_column_ids 
)

This is called by the (ordering-)table to retrieve rows; map data-records to rows using the $row_builder e.g.

yield $row_builder->buildOrderingRow($row_id, $record).

Implements ILIAS\UI\Component\Table\OrderingRetrieval.

Definition at line 83 of file class.ilMMSubItemTableComponent.php.

83 : Generator
84 {
85 if ($this->parent_item === null) {
86 $items = $this->repository->getLostItems();
87 } else {
88 $items = $this->repository->getSubItemsForTable($this->parent_item);
89 }
90
91 foreach ($items as $sub_item) {
92 $id = $sub_item['identification'];
93 $item = $this->repository->getItemFacade(
94 $this->repository->resolveIdentificationFromString($id)
95 );
96
97 $remark = $item->getStatus() !== null ? $this->ui_renderer->render($item->getStatus()) : '';
98
99 if (preg_match('/^-\w+-$/', $remark)) {
100 // this is a language variable, translate it
101 $remark = $this->pons->i18n()->t(substr($remark, 1, -1));
102 }
103
104 yield $row_builder->buildOrderingRow(
105 $this->hash($id),
106 [
107 'title' => $item->getDefaultTitle(),
108 'active' => $item->isActivated(),
109 'status' => $remark,
110 'type' => $item->getTypeForPresentation(),
111 'provider' => $item->getProviderNameForPresentation(),
112 ]
113 )->withDisabledAction(
114 self::ACTION_ACTIVATE,
115 !$this->write_access || $item->isActivated()
116 )->withDisabledAction(
117 self::ACTION_DEACTIVATE,
118 !$this->write_access || !$item->isActivated(),
119 )->withDisabledAction(
120 self::ACTION_MOVE,
121 !$this->write_access || !$item->isInterchangeable()
122 )->withDisabledAction(
123 self::ACTION_DELETE,
124 !$this->write_access || !$item->isCustom()
125 )->withDisabledAction(
126 self::ACTION_TRANSLATE,
127 !$this->write_access
128 )->withDisabledAction(
129 self::ACTION_EDIT,
130 !$this->write_access
131 )->withDisabledAction(
132 self::ACTION_DEACTIVATE,
133 !$item->canBeDeactivated(),
134 );
135 }
136 }
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
buildOrderingRow(string $id, array $record)

References $id, ILIAS\UI\Component\Table\OrderingRowBuilder\buildOrderingRow(), and ILIAS\UI\examples\Deck\repository().

+ Here is the call graph for this function:

Field Documentation

◆ $token

URLBuilderToken ilMMSubItemTableComponent::$token = null
private

Definition at line 66 of file class.ilMMSubItemTableComponent.php.

Referenced by get().

◆ $ui

UIServices ilMMSubItemTableComponent::$ui
private

Definition at line 64 of file class.ilMMSubItemTableComponent.php.

◆ $ui_factory

Factory ilMMSubItemTableComponent::$ui_factory
private

Definition at line 67 of file class.ilMMSubItemTableComponent.php.

◆ $ui_renderer

Renderer ilMMSubItemTableComponent::$ui_renderer
private

Definition at line 68 of file class.ilMMSubItemTableComponent.php.

◆ $url_builder

URLBuilder ilMMSubItemTableComponent::$url_builder = null
private

Definition at line 65 of file class.ilMMSubItemTableComponent.php.

◆ ACTION_ACTIVATE

const ilMMSubItemTableComponent::ACTION_ACTIVATE = 'activate'

Definition at line 51 of file class.ilMMSubItemTableComponent.php.

◆ ACTION_DEACTIVATE

const ilMMSubItemTableComponent::ACTION_DEACTIVATE = 'deactivate'

Definition at line 55 of file class.ilMMSubItemTableComponent.php.

◆ ACTION_DELETE

const ilMMSubItemTableComponent::ACTION_DELETE = 'delete'

Definition at line 63 of file class.ilMMSubItemTableComponent.php.

◆ ACTION_EDIT

const ilMMSubItemTableComponent::ACTION_EDIT = 'edit'

Definition at line 43 of file class.ilMMSubItemTableComponent.php.

◆ ACTION_MOVE

const ilMMSubItemTableComponent::ACTION_MOVE = 'move'

Definition at line 59 of file class.ilMMSubItemTableComponent.php.

◆ ACTION_TRANSLATE

const ilMMSubItemTableComponent::ACTION_TRANSLATE = 'translate'

Definition at line 47 of file class.ilMMSubItemTableComponent.php.


The documentation for this class was generated from the following file: