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

Public Member Functions

 __construct (private Pons $pons, TokenContainer $token_container, private ilMMItemRepository $repository, 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_SUB_TEMS = 'edit_sub_tems'
 
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

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

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ilMMTopItemTableComponent::__construct ( private Pons  $pons,
TokenContainer  $token_container,
private ilMMItemRepository  $repository,
private bool  $write_access 
)

Definition at line 72 of file class.ilMMTopItemTableComponent.php.

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

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()

ilMMTopItemTableComponent::get ( )

Definition at line 198 of file class.ilMMTopItemTableComponent.php.

198 : Component|array
199 {
200 $actions = [
201 self::ACTION_EDIT_SUB_TEMS => $this->ui_factory->table()->action()->single(
202 $this->pons->i18n()->t('edit_sub_tems'),
203 $this->url_builder->withURI(
204 $this->pons->flow()->getTargetURI(ilMMSubItemGUI::class, ilMMSubItemGUI::CMD_DEFAULT)
205 ),
206 $this->token
207 ),
208 ];
209 if ($this->write_access) {
210 $actions = array_merge($actions, [
211 self::ACTION_EDIT => $this->ui_factory->table()->action()->single(
212 $this->pons->i18n()->t('edit'),
213 $this->url_builder->withURI(
214 $this->pons->flow()->getHereAsURI(ilMMTopItemGUI::CMD_EDIT)
215 ),
216 $this->token
217 )->withAsync(true),
218 self::ACTION_TRANSLATE => $this->ui_factory->table()->action()->single(
219 $this->pons->i18n()->t('translate'),
220 $this->url_builder->withURI(
221 $this->pons->flow()->getTranslationAsURI()
222 ),
223 $this->token
224 )->withAsync(true),
225 self::ACTION_ACTIVATE => $this->ui_factory->table()->action()->standard(
226 $this->pons->i18n()->t('activate'),
227 $this->url_builder->withURI(
228 $this->pons->flow()->getHereAsURI(ilMMTopItemGUI::CMD_ACTIVATE)
229 ),
230 $this->token
231 ),
232 self::ACTION_DEACTIVATE => $this->ui_factory->table()->action()->standard(
233 $this->pons->i18n()->t('deactivate'),
234 $this->url_builder->withURI(
235 $this->pons->flow()->getHereAsURI(ilMMTopItemGUI::CMD_DEACTIVATE)
236 ),
237 $this->token
238 ),
239 self::ACTION_MOVE => $this->ui_factory->table()->action()->standard(
240 $this->pons->i18n()->t('move'),
241 $this->url_builder->withURI(
242 $this->pons->flow()->getHereAsURI(ilMMTopItemGUI::CMD_SELECT_PARENT)
243 ),
244 $this->token
245 )->withAsync(true),
246 self::ACTION_DELETE => $this->ui_factory->table()->action()->standard(
247 $this->pons->i18n()->t('delete'),
248 $this->url_builder->withURI(
249 $this->pons->flow()->getHereAsURI(ilMMTopItemGUI::CMD_CONFIRM_DELETE)
250 ),
251 $this->token
252 )->withAsync(true),
253 ]);
254 }
255
256 return [
257 $this->ui_factory
258 ->table()
259 ->ordering(
260 $this,
261 $this->pons->flow()->getHereAsURI(ilMMTopItemGUI::CMD_SAVE_ORDER),
262 $this->pons->i18n()->t('subtab_topitems'),
263 [
264 'title' => $this->ui_factory->table()->column()->link(
265 $this->pons->i18n()->t('title', 'topitem'),
266 ),
267 'active' => $this->ui_factory->table()->column()->boolean(
268 $this->pons->i18n()->t('active', 'topitem'),
269 $this->pons->out()->ok(),
270 $this->pons->out()->nok(),
271 ),
272 'status' => $this->ui_factory->table()->column()->text(
273 $this->pons->i18n()->t('status', 'sub')
274 ),
275 'sub_items' => $this->ui_factory->table()->column()->text(
276 $this->pons->i18n()->t('subentries', 'topitem'),
277 ),
278 'type' => $this->ui_factory->table()->column()->text(
279 $this->pons->i18n()->t('type', 'topitem'),
280 ),
281 'provider' => $this->ui_factory->table()->column()->text(
282 $this->pons->i18n()->t('provider', 'topitem'),
283 ),
284 ]
285 )
286 ->withOrderingDisabled(!$this->write_access)
287 ->withRequest($this->pons->in()->request())
288 ->withActions(
289 $actions
290 )
291 ];
292 }
const CMD_CONFIRM_DELETE

References $token, ilMMBaseGUI\CMD_ACTIVATE, ilMMBaseGUI\CMD_CONFIRM_DELETE, ilMMBaseGUI\CMD_DEACTIVATE, ilMMBaseGUI\CMD_DEFAULT, ilMMBaseGUI\CMD_EDIT, ilMMBaseGUI\CMD_SAVE_ORDER, and ilMMTopItemGUI\CMD_SELECT_PARENT.

◆ getRows()

ilMMTopItemTableComponent::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 84 of file class.ilMMTopItemTableComponent.php.

84 : Generator
85 {
86 foreach ($this->repository->getTopItems() as $top_item) {
87 $id = $top_item['identification'];
88 $item = $this->repository->getItemFacade(
89 $this->repository->resolveIdentificationFromString($id)
90 );
91
92 $link = $this->ui_factory->link()->standard(
93 $item->getDefaultTitle(),
94 (string) $this->url_builder
95 ->withURI(
96 $this->pons->flow()->getTargetURI(ilMMSubItemGUI::class, ilMMSubItemGUI::CMD_DEFAULT)
97 )
98 ->withParameter($this->token, $this->hash($id))
99 ->buildURI()
100 )->withDisabled(
101 !$item->canHaveChildren()
102 );
103
104 $remark = $item->getStatus() !== null ? $this->ui_renderer->render($item->getStatus()) : '';
105
106 if (preg_match('/-[^-]*-/', $remark)) {
107 // this is a language variable, translate it
108 $substr = substr($remark, 1, -1);
109 $remark = $this->pons->i18n()->t($substr);
110 }
111
112 yield $row_builder->buildOrderingRow(
113 $this->hash($id),
114 [
115 'title' => $link,
116 'active' => $item->isActivated(),
117 'status' => $remark,
118 'sub_items' => ($item->canHaveChildren() ? $item->getAmountOfChildren() : '-'),
119 'css_id' => "mm_" . $item->identification()->getInternalIdentifier(),
120 'type' => $item->getTypeForPresentation(),
121 'provider' => $item->getProviderNameForPresentation(),
122 ]
123 )->withDisabledAction(
124 self::ACTION_ACTIVATE,
125 !$this->write_access || $item->isActivated()
126 )->withDisabledAction(
127 self::ACTION_DEACTIVATE,
128 !$this->write_access || !$item->isActivated(),
129 )->withDisabledAction(
130 self::ACTION_MOVE,
131 !$this->write_access || !$item->isInterchangeable()
132 )->withDisabledAction(
133 self::ACTION_DELETE,
134 !$this->write_access || !$item->isCustom()
135 )->withDisabledAction(
136 self::ACTION_EDIT,
137 !$this->write_access
138 )->withDisabledAction(
139 self::ACTION_TRANSLATE,
140 !$this->write_access
141 )->withDisabledAction(
142 self::ACTION_EDIT_SUB_TEMS,
143 !$item->canHaveChildren()
144 )->withDisabledAction(
145 self::ACTION_DEACTIVATE,
146 !$item->canBeDeactivated(),
147 );
148 }
149
150 // Lost Items
151 if ($this->repository->hasLostItems()) {
152 yield $row_builder->buildOrderingRow(
153 $this->hash('lost_items'),
154 [
155 'title' => $this->ui_factory->link()->standard(
156 $this->pons->i18n()->t('mme_lost_items'),
157 (string) $this->url_builder
158 ->withURI(
159 $this->pons->flow()->getTargetURI(ilMMSubItemGUI::class, ilMMSubItemGUI::CMD_DEFAULT)
160 )
161 ->withParameter($this->token, $this->hash('lost_items'))
162 ->buildURI()
163 ),
164 'active' => false,
165 'status' => '',
166 'sub_items' => '-',
167 'css_id' => "mm_lost_items",
168 'type' => '-',
169 'provider' => '-',
170 ]
171 )->withDisabledAction(
172 self::ACTION_EDIT,
173 true
174 )->withDisabledAction(
175 self::ACTION_TRANSLATE,
176 true
177 )->withDisabledAction(
178 self::ACTION_ACTIVATE,
179 true
180 )->withDisabledAction(
181 self::ACTION_DEACTIVATE,
182 true,
183 )->withDisabledAction(
184 self::ACTION_MOVE,
185 true
186 )->withDisabledAction(
187 self::ACTION_DELETE,
188 true
189 )->withDisabledAction(
190 self::ACTION_EDIT_SUB_TEMS,
191 true
192 );
193
194 }
195
196 }
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
buildOrderingRow(string $id, array $record)

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

+ Here is the call graph for this function:

Field Documentation

◆ $token

URLBuilderToken ilMMTopItemTableComponent::$token = null
private

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

Referenced by get().

◆ $ui_factory

Factory ilMMTopItemTableComponent::$ui_factory
private

Definition at line 69 of file class.ilMMTopItemTableComponent.php.

◆ $ui_renderer

Renderer ilMMTopItemTableComponent::$ui_renderer
private

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

◆ $url_builder

URLBuilder ilMMTopItemTableComponent::$url_builder = null
private

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

◆ ACTION_ACTIVATE

const ilMMTopItemTableComponent::ACTION_ACTIVATE = 'activate'

Definition at line 54 of file class.ilMMTopItemTableComponent.php.

◆ ACTION_DEACTIVATE

const ilMMTopItemTableComponent::ACTION_DEACTIVATE = 'deactivate'

Definition at line 58 of file class.ilMMTopItemTableComponent.php.

◆ ACTION_DELETE

const ilMMTopItemTableComponent::ACTION_DELETE = 'delete'

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

◆ ACTION_EDIT

const ilMMTopItemTableComponent::ACTION_EDIT = 'edit'

Definition at line 46 of file class.ilMMTopItemTableComponent.php.

◆ ACTION_EDIT_SUB_TEMS

const ilMMTopItemTableComponent::ACTION_EDIT_SUB_TEMS = 'edit_sub_tems'

Definition at line 42 of file class.ilMMTopItemTableComponent.php.

◆ ACTION_MOVE

const ilMMTopItemTableComponent::ACTION_MOVE = 'move'

Definition at line 62 of file class.ilMMTopItemTableComponent.php.

◆ ACTION_TRANSLATE

const ilMMTopItemTableComponent::ACTION_TRANSLATE = 'translate'

Definition at line 50 of file class.ilMMTopItemTableComponent.php.


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