ILIAS  trunk Revision v12.0_alpha-1329-g1094ddb0c33
ILIAS\File\Icon\IconListingUI Class Reference
+ Collaboration diagram for ILIAS\File\Icon\IconListingUI:

Public Member Functions

 __construct (private IconRepositoryInterface $icon_repo, private ilObjFileIconsOverviewGUI $gui, private bool $write_access)
 
 getFilter ()
 
 getIconList ()
 
 getDeletionModals ()
 

Protected Member Functions

 initListing ()
 

Private Member Functions

 initFilter ()
 
 getDeletionConfirmationModal (Icon $a_icon)
 

Private Attributes

ilCtrl $ctrl
 
ilLanguage $lng
 
Factory $ui_factory
 
ILIAS Refinery Factory $refinery
 
Services $storage
 
array $deletion_modals = []
 
Standard $icon_list
 
ilUIFilterService $filter_service
 
ILIAS UI Component Input Container Filter Standard $filter
 

Detailed Description

Author
Lukas Zehnder lukas.nosp@m.@sr..nosp@m.solut.nosp@m.ions

Definition at line 31 of file IconListingUI.php.

Constructor & Destructor Documentation

◆ __construct()

ILIAS\File\Icon\IconListingUI::__construct ( private IconRepositoryInterface  $icon_repo,
private ilObjFileIconsOverviewGUI  $gui,
private bool  $write_access 
)

Definition at line 43 of file IconListingUI.php.

47 {
48 global $DIC;
49
50 $this->ctrl = $DIC->ctrl();
51 $this->lng = $DIC->language();
52 $this->lng->loadLanguageModule('file');
53 $this->ui_factory = $DIC->ui()->factory();
54 $this->refinery = $DIC->refinery();
55 $this->storage = $DIC->resourceStorage();
56 $this->filter_service = $DIC->uiService()->filter();
57
58 $this->initFilter();
59 $this->initListing();
60 }
global $DIC
Definition: shib_login.php:26

References $DIC, ILIAS\Repository\ctrl(), ILIAS\File\Icon\IconListingUI\initFilter(), ILIAS\File\Icon\IconListingUI\initListing(), ILIAS\Repository\lng(), and ILIAS\Repository\refinery().

+ Here is the call graph for this function:

Member Function Documentation

◆ getDeletionConfirmationModal()

ILIAS\File\Icon\IconListingUI::getDeletionConfirmationModal ( Icon  $a_icon)
private

Definition at line 189 of file IconListingUI.php.

189 : Interruptive
190 {
191 $target = $this->ctrl->getLinkTargetByClass(
192 ilObjFileIconsOverviewGUI::class,
194 );
195 $rid = $this->refinery->kindlyTo()->string()->transform($a_icon->getRid());
196
197 $id = $this->storage->manage()->find($rid);
198 $icon_src = "";
199 if ($id !== null) {
200 $icon_src = $this->storage->consume()->src($id)->getSrc();
201 }
202 $img_icon = $this->ui_factory->image()->standard(
203 $icon_src,
204 "Icon"
205 );
206 $txt_suffixes = $this->lng->txt('suffixes') . ": " . $this->icon_repo->turnSuffixesArrayIntoString(
207 $a_icon->getSuffixes()
208 );
209
210 return $this->ui_factory->modal()->interruptive(
211 $this->lng->txt("delete"),
212 $this->lng->txt('msg_confirm_entry_deletion'),
213 $target
214 )->withAffectedItems([
215 $this->ui_factory->modal()->interruptiveItem()->standard(
216 $rid,
217 $txt_suffixes,
218 $img_icon
219 )
220 ]);
221 }
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23

References $id, ILIAS\File\Icon\ilObjFileIconsOverviewGUI\CMD_DELETE, ILIAS\Repository\ctrl(), ILIAS\File\Icon\Icon\getRid(), ILIAS\File\Icon\Icon\getSuffixes(), ILIAS\Repository\lng(), and ILIAS\Repository\refinery().

Referenced by ILIAS\File\Icon\IconListingUI\initListing().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getDeletionModals()

ILIAS\File\Icon\IconListingUI::getDeletionModals ( )
Returns
mixed[]

Definition at line 184 of file IconListingUI.php.

184 : array
185 {
187 }

References ILIAS\File\Icon\IconListingUI\$deletion_modals.

◆ getFilter()

ILIAS\File\Icon\IconListingUI::getFilter ( )

Definition at line 89 of file IconListingUI.php.

90 {
91 return $this->filter;
92 }
ILIAS UI Component Input Container Filter Standard $filter
This describes a standard filter.
Definition: Standard.php:27

References ILIAS\File\Icon\IconListingUI\$filter.

◆ getIconList()

ILIAS\File\Icon\IconListingUI::getIconList ( )

Definition at line 176 of file IconListingUI.php.

176 : Standard
177 {
178 return $this->icon_list;
179 }

References ILIAS\File\Icon\IconListingUI\$icon_list.

◆ initFilter()

ILIAS\File\Icon\IconListingUI::initFilter ( )
private

Definition at line 62 of file IconListingUI.php.

62 : void
63 {
64 // Filters
65 $this->filter = $this->filter_service->standard(
66 $this->gui::class . '_filter7',
67 $this->ctrl->getLinkTarget($this->gui),
68 [
69 'suffixes' => $this->ui_factory->input()->field()->text($this->lng->txt('suffixes')),
70 'active' => $this->ui_factory->input()->field()->select($this->lng->txt('status'), [
71 '1' => $this->lng->txt('active'),
72 '0' => $this->lng->txt('inactive'),
73 ])->withValue('1'),
74 'is_default_icon' => $this->ui_factory->input()->field()->select($this->lng->txt('default'), [
75 '1' => $this->lng->txt('yes'),
76 '0' => $this->lng->txt('no'),
77 ])
78 ],
79 [
80 'suffix' => true,
81 'status' => true,
82 'type' => true,
83 ],
84 true,
85 true
86 );
87 }
filter(string $filter_id, array $class_path, string $cmd, bool $activated=true, bool $expanded=true)

References ILIAS\Repository\ctrl(), and ILIAS\Repository\filter().

Referenced by ILIAS\File\Icon\IconListingUI\__construct().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ initListing()

ILIAS\File\Icon\IconListingUI::initListing ( )
protected

Definition at line 94 of file IconListingUI.php.

94 : void
95 {
96 $icon_items = [];
97 $this->icon_repo->getIcons();
98
99 // Filterting
100 $filter_data = $this->filter_service->getData($this->filter) ?? [];
101
102 foreach ($this->icon_repo->getIconsForFilter($filter_data) as $icon) {
103 $this->ctrl->setParameterByClass(
104 ilObjFileIconsOverviewGUI::class,
106 $icon->getRid()
107 );
108 $edit_target = $this->ctrl->getLinkTargetByClass(
109 ilObjFileIconsOverviewGUI::class,
111 );
112 $change_activation_target = $this->ctrl->getLinkTargetByClass(
113 ilObjFileIconsOverviewGUI::class,
115 );
116 $this->deletion_modals[] = $deletion_modal = $this->getDeletionConfirmationModal($icon);
117
118 if ($this->write_access) {
119 $item_action_entries = [
120 $this->ui_factory->button()->shy(
121 $this->lng->txt('de_activate_icon'),
122 $change_activation_target
123 )
124 ];
125 if (!$icon->isDefaultIcon()) {
126 $item_action_entries[] = $this->ui_factory->button()->shy($this->lng->txt('edit'), $edit_target);
127 $item_action_entries[] = $this->ui_factory->button()->shy($this->lng->txt('delete'), '#')->withOnClick(
128 $deletion_modal->getShowSignal()
129 );
130 }
131 } else {
132 $item_action_entries = [];
133 }
134
135 $item_actions = $this->ui_factory->dropdown()->standard($item_action_entries);
136
137 $id = $this->storage->manage()->find($icon->getRid());
138 $icon_src = "";
139 if ($id !== null) {
140 $icon_src = $this->storage->consume()->src($id)->getSrc();
141 }
142
143 $suffixes_array_into_string = $this->icon_repo->turnSuffixesArrayIntoString(
144 $icon->getSuffixes()
145 );
146
147 $icon_image = $this->ui_factory->symbol()->icon()->custom(
148 $icon_src,
149 "Icon $suffixes_array_into_string"
150 )->withSize('large');
151
152 $icon_items[] = $this->ui_factory->item()
153 ->standard($this->lng->txt('icon') . " $suffixes_array_into_string")
154 ->withActions($item_actions)
155 ->withProperties(
156 [
157 $this->lng->txt('active') => $icon->isActive() ? $this->lng->txt(
158 'yes'
159 ) : $this->lng->txt('no'),
160 $this->lng->txt('default') => $icon->isDefaultIcon(
161 ) ? $this->lng->txt('yes') : $this->lng->txt('no'),
162 $this->lng->txt(
163 'suffixes'
164 ) => $suffixes_array_into_string
165 ]
166 )
167 ->withLeadIcon($icon_image);
168 }
169
170 $this->icon_list = $this->ui_factory->panel()->listing()->standard(
171 $this->lng->txt('suffix_specific_icons'),
172 [$this->ui_factory->item()->group("", $icon_items)]
173 );
174 }
getDeletionConfirmationModal(Icon $a_icon)

References $id, ILIAS\File\Icon\ilObjFileIconsOverviewGUI\CMD_CHANGE_ACTIVATION, ILIAS\File\Icon\ilObjFileIconsOverviewGUI\CMD_OPEN_UPDATING_FORM, ILIAS\Repository\ctrl(), ILIAS\Repository\filter(), ILIAS\File\Icon\IconListingUI\getDeletionConfirmationModal(), ILIAS\Repository\lng(), and ILIAS\File\Icon\ilObjFileIconsOverviewGUI\P_RID.

Referenced by ILIAS\File\Icon\IconListingUI\__construct().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Field Documentation

◆ $ctrl

ilCtrl ILIAS\File\Icon\IconListingUI::$ctrl
private

Definition at line 33 of file IconListingUI.php.

◆ $deletion_modals

array ILIAS\File\Icon\IconListingUI::$deletion_modals = []
private

Definition at line 38 of file IconListingUI.php.

Referenced by ILIAS\File\Icon\IconListingUI\getDeletionModals().

◆ $filter

ILIAS UI Component Input Container Filter Standard ILIAS\File\Icon\IconListingUI::$filter
private

Definition at line 41 of file IconListingUI.php.

Referenced by ILIAS\File\Icon\IconListingUI\getFilter().

◆ $filter_service

ilUIFilterService ILIAS\File\Icon\IconListingUI::$filter_service
private

Definition at line 40 of file IconListingUI.php.

◆ $icon_list

Standard ILIAS\File\Icon\IconListingUI::$icon_list
private

Definition at line 39 of file IconListingUI.php.

Referenced by ILIAS\File\Icon\IconListingUI\getIconList().

◆ $lng

ilLanguage ILIAS\File\Icon\IconListingUI::$lng
private

Definition at line 34 of file IconListingUI.php.

◆ $refinery

ILIAS Refinery Factory ILIAS\File\Icon\IconListingUI::$refinery
private

Definition at line 36 of file IconListingUI.php.

◆ $storage

Services ILIAS\File\Icon\IconListingUI::$storage
private

Definition at line 37 of file IconListingUI.php.

◆ $ui_factory

Factory ILIAS\File\Icon\IconListingUI::$ui_factory
private

Definition at line 35 of file IconListingUI.php.


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