ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
class.ilUsersGalleryGUI.php
Go to the documentation of this file.
1<?php
2/* Copyright (c) 1998-2015 ILIAS open source, Extended GPL, see docs/LICENSE */
3
4require_once 'Services/User/interfaces/interface.ilGalleryUsers.php';
5require_once 'Services/User/classes/class.ilUserUtil.php';
6require_once 'Services/Contact/BuddySystem/classes/class.ilBuddySystem.php';
7require_once 'Services/Contact/BuddySystem/classes/class.ilBuddyList.php';
8require_once 'Services/Contact/BuddySystem/classes/class.ilBuddySystemLinkButton.php';
9require_once 'Services/Contact/BuddySystem/classes/class.ilBuddySystemRelation.php';
10require_once 'Services/Contact/BuddySystem/classes/states/class.ilBuddySystemRelationStateFactory.php';
11require_once 'Services/Mail/classes/class.ilMailFormCall.php';
12
18{
22 protected $object;
23
27 protected $ctrl;
28
32 protected $tpl;
33
37 protected $lng;
38
42 protected $user;
43
47 protected $rbacsystem;
48
52 protected $contact_array;
53
57 public function __construct(ilGalleryUsers $object)
58 {
67
68 $this->ctrl = $ilCtrl;
69 $this->object = $object;
70 $this->tpl = $tpl;
71 $this->lng = $lng;
72 $this->user = $ilUser;
73 $this->rbacsystem = $rbacsystem;
74 }
75
79 public function executeCommand()
80 {
81 $next_class = $this->ctrl->getNextClass();
82 $cmd = $this->ctrl->getCmd('view');
83
84 switch($next_class)
85 {
86 case 'ilpublicuserprofilegui':
87 require_once 'Services/User/classes/class.ilPublicUserProfileGUI.php';
88 $profile_gui = new ilPublicUserProfileGUI(ilUtil::stripSlashes($_GET['user']));
89 $profile_gui->setBackUrl($this->ctrl->getLinkTarget($this, 'view'));
90 $this->ctrl->forwardCommand($profile_gui);
91 break;
92
93 default:
94 switch($cmd)
95 {
96 default:
97 $this->$cmd();
98 break;
99 }
100 break;
101 }
102 }
103
107 protected function view()
108 {
109 $template = $this->buildHTML($this->object->getGalleryUsers());
110 $this->tpl->setContent($template->get());
111 }
112
118 {
119 if(
120 ilBuddySystem::getInstance()->isEnabled() &&
121 $this->user->getId() != $user->getId() &&
122 !$this->user->isAnonymous() &&
123 !$user->isAnonymous()
124 )
125 {
127 $tpl->setVariable('BUDDY_HTML', $button->getHtml());
128 }
129 }
130
135 protected function buildHTML($users)
136 {
137 $buddylist = ilBuddyList::getInstanceByGlobalUser();
138 $tpl = new ilTemplate('tpl.users_gallery.html', true, true, 'Services/User');
139
140 require_once 'Services/UIComponent/Panel/classes/class.ilPanelGUI.php';
141 $panel = ilPanelGUI::getInstance();
142 $panel->setBody($this->lng->txt('no_gallery_users_available'));
143 $tpl->setVariable('NO_ENTRIES_HTML', json_encode($panel->getHTML()));
144
145 if(!count($users))
146 {
147 $tpl->setVariable('NO_GALLERY_USERS', $panel->getHTML());
148 return $tpl;
149 }
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 foreach($users as $user_data)
157 {
161 $user = $user_data['user'];
162
163 if($user_data['public_profile'])
164 {
165 $tpl->setCurrentBlock('linked_image');
166 $this->ctrl->setParameterByClass('ilpublicuserprofilegui', 'user', $user->getId());
167 $profile_target = $this->ctrl->getLinkTargetByClass('ilpublicuserprofilegui', 'getHTML');
168 $tpl->setVariable('LINK_PROFILE', $profile_target);
169 $tpl->setVariable('PUBLIC_NAME', $user_data['public_name']);
170 }
171 else
172 {
173 $tpl->setCurrentBlock('unlinked_image');
174 $tpl->setVariable('PUBLIC_NAME', $user->getLogin());
175 }
176 $tpl->setVariable('SRC_USR_IMAGE', $user->getPersonalPicturePath('small'));
177 $tpl->parseCurrentBlock();
178
179 $tpl->setCurrentBlock('user');
180
181 $tpl->setVariable('BUDDYLIST_STATUS', get_class($buddylist->getRelationByUserId($user->getId())->getState()));
182 $tpl->setVariable('USER_CC_CLASS', $this->object->getUserCssClass());
183 $tpl->setVariable('USER_ID', $user->getId());
184 $this->renderLinkButton($tpl, $user);
185 $tpl->parseCurrentBlock();
186 }
187
188 return $tpl;
189 }
190}
$_GET["client_id"]
static getInstance()
Get instance.
GUI class for public user profile presentation.
special template class to simplify handling of ITX/PEAR
@ilCtrl_Calls ilUsersGalleryGUI: ilPublicUserProfileGUI @ilCtrl_isCalledBy ilUsersGalleryGUI: ilObjCo...
view()
Displays the participants gallery.
renderLinkButton(ilTemplate $tpl, ilObjUser $user)
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
global $ilCtrl
Definition: ilias.php:18
Interface ilGalleryUsers.
$cmd
Definition: sahs_server.php:35
global $ilUser
Definition: imgupload.php:15