ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
ilUsersGalleryGUI Class Reference

@ilCtrl_Calls ilUsersGalleryGUI: ILIAS\User\Profile\PublicProfileGUI @ilCtrl_isCalledBy ilUsersGalleryGUI: ilCourseMembershipGUI, ilGroupMembershipGUI More...

+ Collaboration diagram for ilUsersGalleryGUI:

Public Member Functions

 executeCommand ()
 

Protected Member Functions

 view ()
 
 addUserRemovalJsForUserContacts ()
 
 getCardForUser (ilUsersGalleryUser $user, ilUsersGalleryUserCollection $group)
 
 getActionsSection (ilObjUser $user)
 
 addPublicProfileLinksToAvatarAndCard (Image $avatar, StandardCard $card, int $user_id)
 

Private Attributes

ilCtrl $ctrl
 
ilGlobalTemplateInterface $tpl
 
Language $lng
 
ilObjUser $user
 
ilRbacSystem $rbacsystem
 
UIFactory $ui_factory
 
Renderer $ui_renderer
 
GlobalHttpState $http
 
Refinery $refinery
 
ilUserActionGUI $user_action_gui
 

Detailed Description

@ilCtrl_Calls ilUsersGalleryGUI: ILIAS\User\Profile\PublicProfileGUI @ilCtrl_isCalledBy ilUsersGalleryGUI: ilCourseMembershipGUI, ilGroupMembershipGUI

Definition at line 35 of file class.ilUsersGalleryGUI.php.

Member Function Documentation

◆ addPublicProfileLinksToAvatarAndCard()

ilUsersGalleryGUI::addPublicProfileLinksToAvatarAndCard ( Image  $avatar,
StandardCard  $card,
int  $user_id 
)
protected

Definition at line 228 of file class.ilUsersGalleryGUI.php.

232 : array {
233 $this->ctrl->setParameterByClass(
234 PublicProfileGUI::class,
235 'user',
237 );
238 $public_profile_url = $this->ctrl->getLinkTargetByClass(
239 PublicProfileGUI::class,
240 'getHTML'
241 );
242
243 return [
244 $avatar->withAction($public_profile_url),
245 $card->withTitleAction($public_profile_url)
246 ];
247 }

◆ addUserRemovalJsForUserContacts()

ilUsersGalleryGUI::addUserRemovalJsForUserContacts ( )
protected

Definition at line 136 of file class.ilUsersGalleryGUI.php.

136 : void
137 {
138 $message = json_encode(
139 $this->ui_renderer->render(
140 $this->ui_factory->messageBox()->info(
141 $this->lng->txt('no_gallery_users_available')
142 )
143 ),
144 JSON_THROW_ON_ERROR
145 );
146 $onload_js = <<<JS
147 let stateChangedListener = (event) => {
148 const {buddyId, newState, oldState} = event.detail;
149
150 if (newState === 'ilBuddySystemUnlinkedRelationState') {
151 document.querySelector('.il-deck [data-buddy-id="' + buddyId + '"]').closest('.il-card').parentElement.remove();
152 if (document.querySelectorAll('.il-card.thumbnail').length === 0) {
153 document.querySelector('.il-deck').innerHTML = {$message};
154 }
155 }
156 return true;
157 };
158
159 document.addEventListener('il.bs.stateChange.afterStateChangePerformed', stateChangedListener);
160JS;
161 $this->tpl->addOnLoadCode($onload_js);
162 }
$message
Definition: xapiexit.php:31

References $message, and ILIAS\Repository\event().

Referenced by view().

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

◆ executeCommand()

ilUsersGalleryGUI::executeCommand ( )

Definition at line 77 of file class.ilUsersGalleryGUI.php.

77 : void
78 {
79 $next_class = $this->ctrl->getNextClass();
80 $cmd = $this->ctrl->getCmd('view');
81
82 switch (strtolower($next_class)) {
83 case strtolower(PublicProfileGUI::class):
84 $profile_gui = new PublicProfileGUI(
85 $this->http->wrapper()->query()->retrieve(
86 'user',
87 $this->refinery->kindlyTo()->int()
88 )
89 );
90 $profile_gui->setBackUrl($this->ctrl->getLinkTarget($this, 'view'));
91 $this->ctrl->forwardCommand($profile_gui);
92 break;
93
94 default:
95 switch ($cmd) {
96 default:
97 $this->$cmd();
98 break;
99 }
100 break;
101 }
102 }
GUI class for public user profile presentation.
setBackUrl(string $backurl)
Set Back Link URL.
static http()
Fetches the global http state from ILIAS.

References ILIAS\Repository\ctrl(), and ILIAS\FileDelivery\http().

+ Here is the call graph for this function:

◆ getActionsSection()

ilUsersGalleryGUI::getActionsSection ( ilObjUser  $user)
protected

Definition at line 200 of file class.ilUsersGalleryGUI.php.

200 : ?LegacyComponent
201 {
202 $contact_btn_html = "";
203
204 if (!$this->user->isAnonymous() &&
205 !$user->isAnonymous() &&
206 ilBuddySystem::getInstance()->isEnabled() &&
207 $this->user->getId() !== $user->getId()
208 ) {
209 $contact_btn_html = ilBuddySystemLinkButton::getInstanceByUserId($user->getId())->getHtml();
210 }
211
212 $list_html = $this->user_action_gui->renderDropDown($user->getId());
213
214 if ($contact_btn_html || $list_html) {
215 return $this->ui_factory->legacy()->content(
216 "<div style='display:grid; grid-template-columns: max-content max-content;'>"
217 . "<div>"
218 . $contact_btn_html
219 . "</div><div style='margin-left: 5px;'>"
220 . $list_html
221 . "</div></div>"
222 );
223 }
224
225 return null;
226 }

References ilObject\getId(), ilBuddySystem\getInstance(), ilBuddySystemLinkButton\getInstanceByUserId(), ilObjUser\isAnonymous(), and ILIAS\Repository\user().

+ Here is the call graph for this function:

◆ getCardForUser()

ilUsersGalleryGUI::getCardForUser ( ilUsersGalleryUser  $user,
ilUsersGalleryUserCollection  $group 
)
protected

Definition at line 164 of file class.ilUsersGalleryGUI.php.

167 : StandardCard {
168 $card = $this->ui_factory->card()->standard($user->getPublicName())
169 ->withHighlight($group->isHighlighted());
170 $avatar = $this->ui_factory->image()->standard(
171 $user->getAggregatedUser()->getPersonalPicturePath('big'),
173 );
174
175 $sections = [];
176
177 $sections[] = $this->ui_factory->listing()->descriptive(
178 [
179 $this->lng->txt("username") => $user->getAggregatedUser()->getLogin(),
180 $this->lng->txt("crs_contact_responsibility") => $group->getLabel()
181 ]
182 );
183
184 $actions_section = $this->getActionsSection($user->getAggregatedUser());
185 if ($actions_section !== null) {
186 $sections[] = $actions_section;
187 }
188
189 if ($user->hasPublicProfile()) {
190 list($avatar, $card) = $this->addPublicProfileLinksToAvatarAndCard(
191 $avatar,
192 $card,
193 $user->getAggregatedUser()->getId()
194 );
195 }
196
197 return $card->withImage($avatar)->withSections($sections);
198 }
getPersonalPicturePath(string $a_size='small', bool $a_force_pic=false)
addPublicProfileLinksToAvatarAndCard(Image $avatar, StandardCard $card, int $user_id)
getActionsSection(ilObjUser $user)

Referenced by view().

+ Here is the caller graph for this function:

◆ view()

ilUsersGalleryGUI::view ( )
protected

Definition at line 104 of file class.ilUsersGalleryGUI.php.

104 : void
105 {
106 $gallery_groups = $this->collection_provider->getGroupedCollections();
107 $groups_with_users = array_filter(
108 $gallery_groups,
109 static fn(ilUsersGalleryGroup $group): bool => count($group) > 0
110 );
111
112 if (count($groups_with_users) === 0) {
113 $this->tpl->setOnScreenMessage('info', $this->lng->txt('no_gallery_users_available'));
114 return;
115 }
116
117 $cards = [];
118
119 foreach ($gallery_groups as $group) {
121
122 foreach ($sorted_group as $user) {
123 $cards[] = $this->getCardForUser($user, $sorted_group);
124 }
125 }
126
127 if ($this->collection_provider->hasRemovableUsers()) {
129 }
130
131 $this->tpl->setContent(
132 $this->ui_renderer->render($this->ui_factory->deck($cards))
133 );
134 }
getCardForUser(ilUsersGalleryUser $user, ilUsersGalleryUserCollection $group)

References $user, addUserRemovalJsForUserContacts(), getCardForUser(), and ILIAS\Repository\lng().

+ Here is the call graph for this function:

Field Documentation

◆ $ctrl

ilCtrl ilUsersGalleryGUI::$ctrl
private

Definition at line 37 of file class.ilUsersGalleryGUI.php.

◆ $http

GlobalHttpState ilUsersGalleryGUI::$http
private

Definition at line 44 of file class.ilUsersGalleryGUI.php.

◆ $lng

Language ilUsersGalleryGUI::$lng
private

Definition at line 39 of file class.ilUsersGalleryGUI.php.

◆ $rbacsystem

ilRbacSystem ilUsersGalleryGUI::$rbacsystem
private

Definition at line 41 of file class.ilUsersGalleryGUI.php.

◆ $refinery

Refinery ilUsersGalleryGUI::$refinery
private

Definition at line 45 of file class.ilUsersGalleryGUI.php.

◆ $tpl

ilGlobalTemplateInterface ilUsersGalleryGUI::$tpl
private

Definition at line 38 of file class.ilUsersGalleryGUI.php.

◆ $ui_factory

UIFactory ilUsersGalleryGUI::$ui_factory
private

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

◆ $ui_renderer

Renderer ilUsersGalleryGUI::$ui_renderer
private

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

◆ $user

ilObjUser ilUsersGalleryGUI::$user
private

Definition at line 40 of file class.ilUsersGalleryGUI.php.

Referenced by view().

◆ $user_action_gui

ilUserActionGUI ilUsersGalleryGUI::$user_action_gui
private

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


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