ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
ilUsersGalleryGUI Class Reference

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

+ Collaboration diagram for ilUsersGalleryGUI:

Public Member Functions

 executeCommand ()
 

Protected Member Functions

 view ()
 Displays the participants gallery. More...
 
 addActionSection (ilObjUser $user, array &$sections)
 
 populateTemplate (array $gallery_groups)
 

Protected Attributes

 $collection_provider
 
 $ctrl
 
 $tpl
 
 $lng
 
 $user
 
 $rbacsystem
 
 $factory
 
 $renderer
 

Detailed Description

Member Function Documentation

◆ addActionSection()

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

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

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

Referenced by populateTemplate().

120  {
121  $contact_btn_html = "";
122 
123  if (
124  ilBuddySystem::getInstance()->isEnabled() &&
125  $this->user->getId() != $user->getId() &&
126  !$this->user->isAnonymous() &&
127  !$user->isAnonymous()
128  ) {
129  $contact_btn_html = ilBuddySystemLinkButton::getInstanceByUserId($user->getId())->getHtml();
130  }
131 
132  include_once("./Services/User/Actions/classes/class.ilUserActionGUI.php");
133  include_once("./Services/User/Gallery/classes/class.ilGalleryUserActionContext.php");
134  $ua_gui = ilUserActionGUI::getInstance(new ilGalleryUserActionContext(), $this->tpl, $this->user->getId());
135  $list_html = $ua_gui->renderDropDown($user->getId());
136 
137  if ($contact_btn_html || $list_html) {
138  $sections[] = $this->factory->legacy("<div style='float:left; margin-bottom:5px;'>" . $contact_btn_html . "</div><div class='button-container'>&nbsp;" . $list_html . "</div>");
139  }
140  }
Gallery context for user actions.
static getInstance(ilUserActionContext $a_user_action_context, ilTemplate $a_global_tpl, $a_current_user_id)
Get instance.
user()
Definition: user.php:4
getId()
get object id public
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ executeCommand()

ilUsersGalleryGUI::executeCommand ( )

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

References $_GET, and ilUtil\stripSlashes().

84  {
85  $next_class = $this->ctrl->getNextClass();
86  $cmd = $this->ctrl->getCmd('view');
87 
88  switch ($next_class) {
89  case 'ilpublicuserprofilegui':
90  require_once 'Services/User/classes/class.ilPublicUserProfileGUI.php';
91  $profile_gui = new ilPublicUserProfileGUI(ilUtil::stripSlashes($_GET['user']));
92  $profile_gui->setBackUrl($this->ctrl->getLinkTarget($this, 'view'));
93  $this->ctrl->forwardCommand($profile_gui);
94  break;
95 
96  default:
97  switch ($cmd) {
98  default:
99  $this->$cmd();
100  break;
101  }
102  break;
103  }
104  }
$_GET["client_id"]
GUI class for public user profile presentation.
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
+ Here is the call graph for this function:

◆ populateTemplate()

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

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

References $tpl, $user, addActionSection(), ilPanelGUI\getInstance(), ilBuddyList\getInstanceByGlobalUser(), and ilUsersGalleryGroup\isHighlighted().

Referenced by view().

147  {
149  $tpl = new ilTemplate('tpl.users_gallery.html', true, true, 'Services/User');
150 
151  require_once 'Services/UIComponent/Panel/classes/class.ilPanelGUI.php';
152  $panel = ilPanelGUI::getInstance();
153  $panel->setBody($this->lng->txt('no_gallery_users_available'));
154  $tpl->setVariable('NO_ENTRIES_HTML', json_encode($panel->getHTML()));
155 
156  $groups_with_users = array_filter($gallery_groups, function (ilUsersGalleryGroup $group) {
157  return count($group) > 0;
158  });
159  $groups_with_highlight = array_filter($groups_with_users, function (ilUsersGalleryGroup $group) {
160  return $group->isHighlighted();
161  });
162 
163  if (0 == count($groups_with_users)) {
164  $tpl->setVariable('NO_GALLERY_USERS', $panel->getHTML());
165  return $tpl;
166  }
167 
168  require_once 'Services/UIComponent/Panel/classes/class.ilPanelGUI.php';
169  $panel = ilPanelGUI::getInstance();
170  $panel->setBody($this->lng->txt('no_gallery_users_available'));
171  $tpl->setVariable('NO_ENTRIES_HTML', json_encode($panel->getHTML()));
172 
173  require_once 'Services/User/Gallery/classes/class.ilUsersGallerySortedUserGroup.php';
174  require_once 'Services/User/Gallery/classes/class.ilUsersGalleryUserCollectionPublicNameSorter.php';
175 
176  $cards = [];
177 
178  foreach ($gallery_groups as $group) {
180 
181  foreach ($group as $user) {
182  $card = $this->factory->card()->standard($user->getPublicName());
183  $avatar = $this->factory->image()->standard($user->getAggregatedUser()->getPersonalPicturePath('big'), $user->getPublicName());
184 
185  $sections = [];
186 
187  if (count($groups_with_highlight) > 0) {
188  $card = $card->withHighlight($group->isHighlighted());
189  }
190 
191  $sections[] = $this->factory->listing()->descriptive(
192  [
193  $this->lng->txt("username") => $user->getAggregatedUser()->getLogin(),
194  $this->lng->txt("crs_contact_responsibility") => $group->getLabel()
195  ]
196  );
197 
198  $this->addActionSection($user->getAggregatedUser(), $sections);
199 
200  if ($user->hasPublicProfile()) {
201  $this->ctrl->setParameterByClass('ilpublicuserprofilegui', 'user', $user->getAggregatedUser()->getId());
202  $public_profile_url = $this->ctrl->getLinkTargetByClass('ilpublicuserprofilegui', 'getHTML');
203 
204  $avatar = $avatar->withAction($public_profile_url);
205  $card = $card->withTitleAction($public_profile_url);
206  }
207 
208  $card = $card->withImage($avatar)->withSections($sections);
209 
210  $cards[] = $card;
211  }
212  }
213 
214  $tpl->setVariable('GALLERY_HTML', $this->renderer->render($this->factory->deck($cards)));
215 
216  if ($this->collection_provider->hasRemovableUsers()) {
217  $tpl->touchBlock('js_remove_handler');
218  }
219 
220  return $tpl;
221  }
static getInstanceByGlobalUser()
Class ilUsersGallerySortedUserGroup.
isHighlighted()
Returns whether or not it is a highlighted group.boolean
special template class to simplify handling of ITX/PEAR
static getInstance()
Get instance.
addActionSection(ilObjUser $user, array &$sections)
Class ilUsersGalleryGroup.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ view()

ilUsersGalleryGUI::view ( )
protected

Displays the participants gallery.

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

References $template, and populateTemplate().

110  {
111  $template = $this->populateTemplate($this->collection_provider->getGroupedCollections());
112  $this->tpl->setContent($template->get());
113  }
$template
populateTemplate(array $gallery_groups)
+ Here is the call graph for this function:

Field Documentation

◆ $collection_provider

ilUsersGalleryGUI::$collection_provider
protected

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

◆ $ctrl

ilUsersGalleryGUI::$ctrl
protected

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

◆ $factory

ilUsersGalleryGUI::$factory
protected

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

◆ $lng

ilUsersGalleryGUI::$lng
protected

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

◆ $rbacsystem

ilUsersGalleryGUI::$rbacsystem
protected

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

◆ $renderer

ilUsersGalleryGUI::$renderer
protected

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

◆ $tpl

ilUsersGalleryGUI::$tpl
protected

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

Referenced by populateTemplate().

◆ $user

ilUsersGalleryGUI::$user
protected

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

Referenced by populateTemplate().


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