ILIAS  release_8 Revision v8.19
All Data Structures Namespaces Files Functions Variables Modules Pages
ilUsersGalleryGUI Class Reference

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V. More...

+ Collaboration diagram for ilUsersGalleryGUI:

Public Member Functions

 executeCommand ()
 

Protected Member Functions

 view ()
 
 addActionSection (ilObjUser $user, array &$sections)
 
 populateTemplate (array $gallery_groups)
 

Protected Attributes

ilUsersGalleryCollectionProvider $collection_provider
 
ilCtrl $ctrl
 
ilGlobalTemplateInterface $tpl
 
ilLanguage $lng
 
ilObjUser $user
 
ilRbacSystem $rbacsystem
 
ILIAS UI Factory $factory
 
ILIAS UI Renderer $renderer
 
ILIAS HTTP GlobalHttpState $http
 
ILIAS Refinery Factory $refinery
 

Detailed Description

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V.

ILIAS is licensed with the GPL-3.0, see https://www.gnu.org/licenses/gpl-3.0.en.html You should have received a copy of said license along with the source code, too.

If this is not the case or you just want to try ILIAS, you'll find us at: https://www.ilias.de https://github.com/ILIAS-eLearning ilUsersGalleryGUI: ilPublicUserProfileGUI ilUsersGalleryGUI: ilCourseMembershipGUI, ilGroupMembershipGUI

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

Member Function Documentation

◆ addActionSection()

ilUsersGalleryGUI::addActionSection ( ilObjUser  $user,
array &  $sections 
)
protected
Parameters
ilObjUser$user

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

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

Referenced by populateTemplate().

93  : void
94  {
95  $contact_btn_html = "";
96 
97  if (
98  !$this->user->isAnonymous() &&
99  !$user->isAnonymous() &&
100  ilBuddySystem::getInstance()->isEnabled() &&
101  $this->user->getId() !== $user->getId()
102  ) {
103  $contact_btn_html = ilBuddySystemLinkButton::getInstanceByUserId($user->getId())->getHtml();
104  }
105 
106  $ua_gui = ilUserActionGUI::getInstance(new ilGalleryUserActionContext(), $this->tpl, $this->user->getId());
107  $list_html = $ua_gui->renderDropDown($user->getId());
108 
109  if ($contact_btn_html || $list_html) {
110  $sections[] = $this->factory->legacy(
111  "<div style='float:left; margin-bottom:5px;'>" . $contact_btn_html . "</div><div class='button-container'>&nbsp;" . $list_html . "</div>"
112  );
113  }
114  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static getInstance(ilUserActionContext $a_user_action_context, ilGlobalTemplateInterface $a_global_tpl, int $a_current_user_id)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ executeCommand()

ilUsersGalleryGUI::executeCommand ( )

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

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

56  : void
57  {
58  $next_class = $this->ctrl->getNextClass();
59  $cmd = $this->ctrl->getCmd('view');
60 
61  switch (strtolower($next_class)) {
62  case strtolower(ilPublicUserProfileGUI::class):
63  $profile_gui = new ilPublicUserProfileGUI(
64  $this->http->wrapper()->query()->retrieve(
65  'user',
66  $this->refinery->kindlyTo()->int()
67  )
68  );
69  $profile_gui->setBackUrl($this->ctrl->getLinkTarget($this, 'view'));
70  $this->ctrl->forwardCommand($profile_gui);
71  break;
72 
73  default:
74  switch ($cmd) {
75  default:
76  $this->$cmd();
77  break;
78  }
79  break;
80  }
81  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static http()
Fetches the global http state from ILIAS.
setBackUrl(string $a_backurl)
Set Back Link URL.
+ Here is the call graph for this function:

◆ populateTemplate()

ilUsersGalleryGUI::populateTemplate ( array  $gallery_groups)
protected
Parameters
ilUsersGalleryUserCollection[]$gallery_groups
Returns
ilTemplate

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

References $panel, $tpl, addActionSection(), ILIAS\Repository\ctrl(), ilPanelGUI\getInstance(), ilBuddyList\getInstanceByGlobalUser(), ilUsersGalleryGroup\isHighlighted(), ILIAS\Repository\lng(), ilGlobalTemplateInterface\setVariable(), and ilGlobalTemplateInterface\touchBlock().

Referenced by view().

120  : ilTemplate
121  {
123  $tpl = new ilTemplate('tpl.users_gallery.html', true, true, 'Services/User');
124 
126  $panel->setBody($this->lng->txt('no_gallery_users_available'));
127  $tpl->setVariable('NO_ENTRIES_HTML', json_encode($panel->getHTML(), JSON_THROW_ON_ERROR));
128 
129  $groups_with_users = array_filter($gallery_groups, static function (ilUsersGalleryGroup $group): bool {
130  return count($group) > 0;
131  });
132  $groups_with_highlight = array_filter($groups_with_users, static function (ilUsersGalleryGroup $group): bool {
133  return $group->isHighlighted();
134  });
135 
136  if (0 === count($groups_with_users)) {
137  $tpl->setVariable('NO_GALLERY_USERS', $panel->getHTML());
138  return $tpl;
139  }
140 
142  $panel->setBody($this->lng->txt('no_gallery_users_available'));
143  $tpl->setVariable('NO_ENTRIES_HTML', json_encode($panel->getHTML(), JSON_THROW_ON_ERROR));
144 
145  $cards = [];
146 
147  foreach ($gallery_groups as $group) {
149 
150  foreach ($group as $user) {
151  $card = $this->factory->card()->standard($user->getPublicName());
152  $avatar = $this->factory->image()->standard(
153  $user->getAggregatedUser()->getPersonalPicturePath('big'),
154  $user->getPublicName()
155  );
156 
157  $sections = [];
158 
159  if (count($groups_with_highlight) > 0) {
160  $card = $card->withHighlight($group->isHighlighted());
161  }
162 
163  $sections[] = $this->factory->listing()->descriptive(
164  [
165  $this->lng->txt("username") => $user->getAggregatedUser()->getLogin(),
166  $this->lng->txt("crs_contact_responsibility") => $group->getLabel()
167  ]
168  );
169 
170  $this->addActionSection($user->getAggregatedUser(), $sections);
171 
172  if ($user->hasPublicProfile()) {
173  $this->ctrl->setParameterByClass(
174  ilPublicUserProfileGUI::class,
175  'user',
176  $user->getAggregatedUser()->getId()
177  );
178  $public_profile_url = $this->ctrl->getLinkTargetByClass(ilPublicUserProfileGUI::class, 'getHTML');
179 
180  $avatar = $avatar->withAction($public_profile_url);
181  $card = $card->withTitleAction($public_profile_url);
182  }
183 
184  $card = $card->withImage($avatar)->withSections($sections);
185 
186  $cards[] = $card;
187  }
188  }
189 
190  $tpl->setVariable('GALLERY_HTML', $this->renderer->render($this->factory->deck($cards)));
191 
192  if ($this->collection_provider->hasRemovableUsers()) {
193  $tpl->touchBlock('js_remove_handler');
194  }
195 
196  return $tpl;
197  }
static getInstanceByGlobalUser()
touchBlock(string $block)
overwrites ITX::touchBlock.
if(isset($_FILES['img_file']) &&is_array($_FILES['img_file'])) $panel
Definition: imgupload.php:198
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
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()
addActionSection(ilObjUser $user, array &$sections)
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 83 of file class.ilUsersGalleryGUI.php.

References populateTemplate().

83  : void
84  {
85  $template = $this->populateTemplate($this->collection_provider->getGroupedCollections());
86  $this->tpl->setContent($template->get());
87  }
populateTemplate(array $gallery_groups)
+ Here is the call graph for this function:

Field Documentation

◆ $collection_provider

ilUsersGalleryCollectionProvider ilUsersGalleryGUI::$collection_provider
protected

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

◆ $ctrl

ilCtrl ilUsersGalleryGUI::$ctrl
protected

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

◆ $factory

ILIAS UI Factory ilUsersGalleryGUI::$factory
protected

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

◆ $http

ILIAS HTTP GlobalHttpState ilUsersGalleryGUI::$http
protected

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

◆ $lng

ilLanguage ilUsersGalleryGUI::$lng
protected

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

◆ $rbacsystem

ilRbacSystem ilUsersGalleryGUI::$rbacsystem
protected

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

◆ $refinery

ILIAS Refinery Factory ilUsersGalleryGUI::$refinery
protected

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

◆ $renderer

ILIAS UI Renderer ilUsersGalleryGUI::$renderer
protected

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

◆ $tpl

ilGlobalTemplateInterface ilUsersGalleryGUI::$tpl
protected

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

Referenced by populateTemplate().

◆ $user

ilObjUser ilUsersGalleryGUI::$user
protected

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


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