ILIAS  release_9 Revision v9.13-25-g2c18ec4c24f
ilUsersGalleryGUI Class Reference

ilUsersGalleryGUI: ilPublicUserProfileGUI ilUsersGalleryGUI: ilCourseMembershipGUI, ilGroupMembershipGUI More...

+ Collaboration diagram for ilUsersGalleryGUI:

Public Member Functions

 executeCommand ()
 

Protected Member Functions

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

Private Attributes

ilCtrl $ctrl
 
ilGlobalTemplateInterface $tpl
 
ilLanguage $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 211 of file class.ilUsersGalleryGUI.php.

References ILIAS\Repository\ctrl().

Referenced by getCardForUser().

215  : array {
216  $this->ctrl->setParameterByClass(
217  ilPublicUserProfileGUI::class,
218  'user',
219  $user_id
220  );
221  $public_profile_url = $this->ctrl->getLinkTargetByClass(
222  ilPublicUserProfileGUI::class,
223  'getHTML'
224  );
225 
226  return [
227  $avatar->withAction($public_profile_url),
228  $card->withTitleAction($public_profile_url)
229  ];
230  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ executeCommand()

ilUsersGalleryGUI::executeCommand ( )

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

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

74  : void
75  {
76  $next_class = $this->ctrl->getNextClass();
77  $cmd = $this->ctrl->getCmd('view');
78 
79  switch (strtolower($next_class)) {
80  case strtolower(ilPublicUserProfileGUI::class):
81  $profile_gui = new ilPublicUserProfileGUI(
82  $this->http->wrapper()->query()->retrieve(
83  'user',
84  $this->refinery->kindlyTo()->int()
85  )
86  );
87  $profile_gui->setBackUrl($this->ctrl->getLinkTarget($this, 'view'));
88  $this->ctrl->forwardCommand($profile_gui);
89  break;
90 
91  default:
92  switch ($cmd) {
93  default:
94  $this->$cmd();
95  break;
96  }
97  break;
98  }
99  }
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 183 of file class.ilUsersGalleryGUI.php.

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

Referenced by getCardForUser().

183  : ?LegacyComponent
184  {
185  $contact_btn_html = "";
186 
187  if (!$this->user->isAnonymous() &&
188  !$user->isAnonymous() &&
189  ilBuddySystem::getInstance()->isEnabled() &&
190  $this->user->getId() !== $user->getId()
191  ) {
192  $contact_btn_html = ilBuddySystemLinkButton::getInstanceByUserId($user->getId())->getHtml();
193  }
194 
195  $list_html = $this->user_action_gui->renderDropDown($user->getId());
196 
197  if ($contact_btn_html || $list_html) {
198  return $this->ui_factory->legacy(
199  "<div style='display:grid; grid-template-columns: max-content max-content;'>"
200  . "<div>"
201  . $contact_btn_html
202  . "</div><div style='margin-left: 5px;'>"
203  . $list_html
204  . "</div></div>"
205  );
206  }
207 
208  return null;
209  }
+ 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 147 of file class.ilUsersGalleryGUI.php.

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

Referenced by populateTemplate().

150  : StandardCard {
151  $card = $this->ui_factory->card()->standard($user->getPublicName())
152  ->withHighlight($group->isHighlighted());
153  $avatar = $this->ui_factory->image()->standard(
154  $user->getAggregatedUser()->getPersonalPicturePath('big'),
155  $user->getPublicName()
156  );
157 
158  $sections = [];
159 
160  $sections[] = $this->ui_factory->listing()->descriptive(
161  [
162  $this->lng->txt("username") => $user->getAggregatedUser()->getLogin(),
163  $this->lng->txt("crs_contact_responsibility") => $group->getLabel()
164  ]
165  );
166 
167  $actions_section = $this->getActionsSection($user->getAggregatedUser());
168  if ($actions_section !== null) {
169  $sections[] = $actions_section;
170  }
171 
172  if ($user->hasPublicProfile()) {
173  list($avatar, $card) = $this->addPublicProfileLinksToAvatarAndCard(
174  $avatar,
175  $card,
176  $user->getAggregatedUser()->getId()
177  );
178  }
179 
180  return $card->withImage($avatar)->withSections($sections);
181  }
addPublicProfileLinksToAvatarAndCard(Image $avatar, StandardCard $card, int $user_id)
getActionsSection(ilObjUser $user)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ populateTemplate()

ilUsersGalleryGUI::populateTemplate ( array  $gallery_groups)
protected
Parameters
array<ilUsersGalleryUserCollection>$gallery_groups

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

References $tpl, getCardForUser(), ilPanelGUI\getInstance(), ILIAS\Repository\lng(), ilGlobalTemplateInterface\setVariable(), and ilGlobalTemplateInterface\touchBlock().

Referenced by view().

110  : ilTemplate
111  {
112  $tpl = new ilTemplate('tpl.users_gallery.html', true, true, 'Services/User');
113 
114  $panel = ilPanelGUI::getInstance();
115  $panel->setBody($this->lng->txt('no_gallery_users_available'));
116  $tpl->setVariable('NO_ENTRIES_HTML', json_encode($panel->getHTML(), JSON_THROW_ON_ERROR));
117 
118  $groups_with_users = array_filter(
119  $gallery_groups,
120  static fn(ilUsersGalleryGroup $group): bool => count($group) > 0
121  );
122 
123  if (count($groups_with_users) === 0) {
124  $tpl->setVariable('NO_GALLERY_USERS', $panel->getHTML());
125  return $tpl;
126  }
127 
128  $cards = [];
129 
130  foreach ($gallery_groups as $group) {
132 
133  foreach ($sorted_group as $user) {
134  $cards[] = $this->getCardForUser($user, $sorted_group);
135  }
136  }
137 
138  $tpl->setVariable('GALLERY_HTML', $this->ui_renderer->render($this->ui_factory->deck($cards)));
139 
140  if ($this->collection_provider->hasRemovableUsers()) {
141  $tpl->touchBlock('js_remove_handler');
142  }
143 
144  return $tpl;
145  }
touchBlock(string $block)
overwrites ITX::touchBlock.
setVariable(string $variable, $value='')
Sets the given variable to the given value.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
ilGlobalTemplateInterface $tpl
static getInstance()
getCardForUser(ilUsersGalleryUser $user, ilUsersGalleryUserCollection $group)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ view()

ilUsersGalleryGUI::view ( )
protected

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

References populateTemplate().

101  : void
102  {
103  $template = $this->populateTemplate($this->collection_provider->getGroupedCollections());
104  $this->tpl->setContent($template->get());
105  }
populateTemplate(array $gallery_groups)
+ Here is the call graph for this function:

Field Documentation

◆ $ctrl

ilCtrl ilUsersGalleryGUI::$ctrl
private

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

◆ $http

GlobalHttpState ilUsersGalleryGUI::$http
private

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

◆ $lng

ilLanguage ilUsersGalleryGUI::$lng
private

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

◆ $rbacsystem

ilRbacSystem ilUsersGalleryGUI::$rbacsystem
private

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

◆ $refinery

Refinery ilUsersGalleryGUI::$refinery
private

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

◆ $tpl

ilGlobalTemplateInterface ilUsersGalleryGUI::$tpl
private

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

Referenced by populateTemplate().

◆ $ui_factory

UIFactory ilUsersGalleryGUI::$ui_factory
private

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

◆ $ui_renderer

Renderer ilUsersGalleryGUI::$ui_renderer
private

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

◆ $user

ilObjUser ilUsersGalleryGUI::$user
private

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

◆ $user_action_gui

ilUserActionGUI ilUsersGalleryGUI::$user_action_gui
private

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


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