ILIAS  trunk Revision v11.0_alpha-1749-g1a06bdef097
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
ilUsersGalleryGUI Class Reference

ilUsersGalleryGUI: ilPublicUserProfileGUI 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

Member Function Documentation

◆ addPublicProfileLinksToAvatarAndCard()

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

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

References ILIAS\Repository\ctrl().

Referenced by getCardForUser().

231  : array {
232  $this->ctrl->setParameterByClass(
233  ilPublicUserProfileGUI::class,
234  'user',
235  $user_id
236  );
237  $public_profile_url = $this->ctrl->getLinkTargetByClass(
238  ilPublicUserProfileGUI::class,
239  'getHTML'
240  );
241 
242  return [
243  $avatar->withAction($public_profile_url),
244  $card->withTitleAction($public_profile_url)
245  ];
246  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ addUserRemovalJsForUserContacts()

ilUsersGalleryGUI::addUserRemovalJsForUserContacts ( )
protected

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

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

Referenced by view().

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

◆ executeCommand()

ilUsersGalleryGUI::executeCommand ( )

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

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

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

◆ getActionsSection()

ilUsersGalleryGUI::getActionsSection ( ilObjUser  $user)
protected

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

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

Referenced by getCardForUser().

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

◆ getCardForUser()

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

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

References addPublicProfileLinksToAvatarAndCard(), getActionsSection(), ilUsersGalleryUser\getAggregatedUser(), ilUsersGalleryUserCollection\getLabel(), ilUsersGalleryUser\getPublicName(), ilUsersGalleryUser\hasPublicProfile(), ilUsersGalleryUserCollection\isHighlighted(), ILIAS\Repository\lng(), and null.

Referenced by view().

166  : StandardCard {
167  $card = $this->ui_factory->card()->standard($user->getPublicName())
168  ->withHighlight($group->isHighlighted());
169  $avatar = $this->ui_factory->image()->standard(
170  $user->getAggregatedUser()->getPersonalPicturePath('big'),
171  $user->getPublicName()
172  );
173 
174  $sections = [];
175 
176  $sections[] = $this->ui_factory->listing()->descriptive(
177  [
178  $this->lng->txt("username") => $user->getAggregatedUser()->getLogin(),
179  $this->lng->txt("crs_contact_responsibility") => $group->getLabel()
180  ]
181  );
182 
183  $actions_section = $this->getActionsSection($user->getAggregatedUser());
184  if ($actions_section !== null) {
185  $sections[] = $actions_section;
186  }
187 
188  if ($user->hasPublicProfile()) {
189  list($avatar, $card) = $this->addPublicProfileLinksToAvatarAndCard(
190  $avatar,
191  $card,
192  $user->getAggregatedUser()->getId()
193  );
194  }
195 
196  return $card->withImage($avatar)->withSections($sections);
197  }
addPublicProfileLinksToAvatarAndCard(Image $avatar, StandardCard $card, int $user_id)
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
getActionsSection(ilObjUser $user)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ view()

ilUsersGalleryGUI::view ( )
protected

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

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

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

Field Documentation

◆ $ctrl

ilCtrl ilUsersGalleryGUI::$ctrl
private

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

◆ $http

GlobalHttpState ilUsersGalleryGUI::$http
private

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

◆ $lng

Language ilUsersGalleryGUI::$lng
private

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

◆ $rbacsystem

ilRbacSystem ilUsersGalleryGUI::$rbacsystem
private

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

◆ $refinery

Refinery ilUsersGalleryGUI::$refinery
private

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

◆ $tpl

ilGlobalTemplateInterface ilUsersGalleryGUI::$tpl
private

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

◆ $ui_factory

UIFactory ilUsersGalleryGUI::$ui_factory
private

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

◆ $ui_renderer

Renderer ilUsersGalleryGUI::$ui_renderer
private

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

◆ $user

ilObjUser ilUsersGalleryGUI::$user
private

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

◆ $user_action_gui

ilUserActionGUI ilUsersGalleryGUI::$user_action_gui
private

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


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