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

ACL access handler GUI. More...

+ Collaboration diagram for ilWorkspaceAccessGUI:

Public Member Functions

 __construct ($a_node_id, $a_access_handler, $a_is_portfolio=false, $a_footer=null)
 
 setBlockingMessage ($a_val)
 Set blocking message. More...
 
 getBlockingMessage ()
 Get blocking message. More...
 
 executeCommand ()
 
 addPermissionHandler ()
 
 removePermission ()
 

Data Fields

const PERMISSION_REGISTERED = -1
 
const PERMISSION_ALL_PASSWORD = -3
 
const PERMISSION_ALL = -5
 

Protected Member Functions

 setObjectTitle ()
 restore object title More...
 
 getAccessHandler ()
 
 share ()
 
 initPasswordForm ()
 
 showPasswordForm (ilPropertyFormGUI $a_form=null)
 
 savePasswordForm ()
 

Protected Attributes

 $tabs
 
 $tpl
 
 $toolbar
 
 $user
 
 $settings
 
 $ctrl
 
 $lng
 
 $node_id
 
 $access_handler
 
 $footer
 
 $blocking_message = ""
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ilWorkspaceAccessGUI::__construct (   $a_node_id,
  $a_access_handler,
  $a_is_portfolio = false,
  $a_footer = null 
)

Definition at line 57 of file class.ilWorkspaceAccessGUI.php.

References $DIC, $ilCtrl, $lng, settings(), and user().

58  {
59  global $DIC;
60 
61  $this->tabs = $DIC->tabs();
62  $this->tpl = $DIC["tpl"];
63  $this->toolbar = $DIC->toolbar();
64  $this->user = $DIC->user();
65  $this->settings = $DIC->settings();
66  $ilCtrl = $DIC->ctrl();
67  $lng = $DIC->language();
68 
69  $this->ctrl = $ilCtrl;
70  $this->lng = $lng;
71  $this->node_id = $a_node_id;
72  $this->access_handler = $a_access_handler;
73  $this->is_portfolio = (bool) $a_is_portfolio;
74  $this->footer = $a_footer;
75  }
settings()
Definition: settings.php:2
global $DIC
Definition: saml.php:7
user()
Definition: user.php:4
global $ilCtrl
Definition: ilias.php:18
+ Here is the call graph for this function:

Member Function Documentation

◆ addPermissionHandler()

ilWorkspaceAccessGUI::addPermissionHandler ( )

Definition at line 266 of file class.ilWorkspaceAccessGUI.php.

References getAccessHandler(), ilUserAccountSettings\getInstance(), and showPasswordForm().

267  {
268  switch ($_REQUEST["action"]) {
269  case "user":
270 
271  include_once './Services/User/classes/class.ilUserAccountSettings.php';
272  if (ilUserAccountSettings::getInstance()->isUserAccessRestricted()) {
273  $this->ctrl->redirectByClass("ilsingleusersharegui");
274  } else {
275  $this->ctrl->setParameterByClass("ilmailsearchgui", "ref", "wsp");
276  $this->ctrl->redirectByClass("ilmailsearchgui");
277  }
278 
279  // no break
280  case "group":
281  $this->ctrl->setParameterByClass("ilmailsearchgroupsgui", "ref", "wsp");
282  $this->ctrl->redirectByClass("ilmailsearchgroupsgui");
283 
284  // no break
285  case "course":
286  $this->ctrl->setParameterByClass("ilmailsearchcoursesgui", "ref", "wsp");
287  $this->ctrl->redirectByClass("ilmailsearchcoursesgui");
288 
289  // no break
290  case "registered":
291  $this->getAccessHandler()->addPermission($this->node_id, self::PERMISSION_REGISTERED);
292  ilUtil::sendSuccess($this->lng->txt("wsp_permission_registered_info"), true);
293  $this->ctrl->redirect($this, "share");
294 
295  // no break
296  case "password":
297  $this->showPasswordForm();
298  break;
299 
300  case "all":
301  $this->getAccessHandler()->addPermission($this->node_id, self::PERMISSION_ALL);
302  ilUtil::sendSuccess($this->lng->txt("wsp_permission_all_info"), true);
303  $this->ctrl->redirect($this, "share");
304  }
305  }
static getInstance()
Singelton get instance.
showPasswordForm(ilPropertyFormGUI $a_form=null)
+ Here is the call graph for this function:

◆ executeCommand()

ilWorkspaceAccessGUI::executeCommand ( )

Definition at line 98 of file class.ilWorkspaceAccessGUI.php.

References $tabs, $tpl, and setObjectTitle().

99  {
100  $ilTabs = $this->tabs;
101  $tpl = $this->tpl;
102 
103  $next_class = $this->ctrl->getNextClass($this);
104  $cmd = $this->ctrl->getCmd();
105 
106  switch ($next_class) {
107  case "ilmailsearchcoursesgui":
108  $ilTabs->setBackTarget(
109  $this->lng->txt("back"),
110  $this->ctrl->getLinkTarget($this, "share")
111  );
112  include_once('Services/Contact/classes/class.ilMailSearchCoursesGUI.php');
113  $csearch = new ilMailSearchCoursesGUI($this->access_handler, $this->node_id);
114  $this->ctrl->setReturn($this, 'share');
115  $this->ctrl->forwardCommand($csearch);
116 
117  $this->setObjectTitle();
118  break;
119 
120  case "ilmailsearchgroupsgui":
121  $ilTabs->setBackTarget(
122  $this->lng->txt("back"),
123  $this->ctrl->getLinkTarget($this, "share")
124  );
125  include_once('Services/Contact/classes/class.ilMailSearchGroupsGUI.php');
126  $gsearch = new ilMailSearchGroupsGUI($this->access_handler, $this->node_id);
127  $this->ctrl->setReturn($this, 'share');
128  $this->ctrl->forwardCommand($gsearch);
129 
130  $this->setObjectTitle();
131  break;
132 
133  case "ilmailsearchgui":
134  $ilTabs->setBackTarget(
135  $this->lng->txt("back"),
136  $this->ctrl->getLinkTarget($this, "share")
137  );
138  include_once('Services/Contact/classes/class.ilMailSearchGUI.php');
139  $usearch = new ilMailSearchGUI($this->access_handler, $this->node_id);
140  $this->ctrl->setReturn($this, 'share');
141  $this->ctrl->forwardCommand($usearch);
142 
143  $this->setObjectTitle();
144  break;
145 
146  case "ilsingleusersharegui":
147  $ilTabs->setBackTarget(
148  $this->lng->txt("back"),
149  $this->ctrl->getLinkTarget($this, "share")
150  );
151  include_once('Services/PersonalWorkspace/classes/class.ilSingleUserShareGUI.php');
152  $ushare = new ilSingleUserShareGUI($this->access_handler, $this->node_id);
153  $this->ctrl->setReturn($this, 'share');
154  $this->ctrl->forwardCommand($ushare);
155 
156  $this->setObjectTitle();
157  break;
158 
159  case "ilpublicuserprofilegui":
160  $ilTabs->clearTargets();
161  $ilTabs->setBackTarget(
162  $this->lng->txt("back"),
163  $this->ctrl->getLinkTarget($this, "share")
164  );
165 
166  include_once('./Services/User/classes/class.ilPublicUserProfileGUI.php');
167  $prof = new ilPublicUserProfileGUI($_REQUEST["user"]);
168  $prof->setBackUrl($this->ctrl->getLinkTarget($this, "share"));
169  $tpl->setContent($prof->getHTML());
170  break;
171 
172  default:
173  // $this->prepareOutput();
174  if (!$cmd) {
175  $cmd = "share";
176  }
177  return $this->$cmd();
178  }
179 
180  return true;
181  }
setObjectTitle()
restore object title
GUI class for public user profile presentation.
+ Here is the call graph for this function:

◆ getAccessHandler()

ilWorkspaceAccessGUI::getAccessHandler ( )
protected

Definition at line 200 of file class.ilWorkspaceAccessGUI.php.

References $access_handler.

Referenced by addPermissionHandler(), removePermission(), savePasswordForm(), and share().

+ Here is the caller graph for this function:

◆ getBlockingMessage()

ilWorkspaceAccessGUI::getBlockingMessage ( )

Get blocking message.

Returns
string blocking message

Definition at line 92 of file class.ilWorkspaceAccessGUI.php.

References $blocking_message.

Referenced by share().

+ Here is the caller graph for this function:

◆ initPasswordForm()

ilWorkspaceAccessGUI::initPasswordForm ( )
protected

Definition at line 317 of file class.ilWorkspaceAccessGUI.php.

References $form, and $password.

Referenced by savePasswordForm(), and showPasswordForm().

318  {
319  include_once "Services/Form/classes/class.ilPropertyFormGUI.php";
320  $form = new ilPropertyFormGUI();
321  $form->setFormAction($this->ctrl->getFormAction($this));
322  $form->setTitle($this->lng->txt("wsp_set_permission_all_password"));
323 
324  $password = new ilPasswordInputGUI($this->lng->txt("password"), "password");
325  $password->setRequired(true);
326  $form->addItem($password);
327 
328  $form->addCommandButton('savepasswordform', $this->lng->txt("save"));
329  $form->addCommandButton('share', $this->lng->txt("cancel"));
330 
331  return $form;
332  }
This class represents a property form user interface.
if(isset($_POST['submit'])) $form
This class represents a password property in a property form.
$password
Definition: cron.php:14
+ Here is the caller graph for this function:

◆ removePermission()

ilWorkspaceAccessGUI::removePermission ( )

Definition at line 307 of file class.ilWorkspaceAccessGUI.php.

References getAccessHandler().

308  {
309  if ($_REQUEST["obj_id"]) {
310  $this->getAccessHandler()->removePermission($this->node_id, (int) $_REQUEST["obj_id"]);
311  ilUtil::sendSuccess($this->lng->txt("wsp_permission_removed"), true);
312  }
313 
314  $this->ctrl->redirect($this, "share");
315  }
+ Here is the call graph for this function:

◆ savePasswordForm()

ilWorkspaceAccessGUI::savePasswordForm ( )
protected

Definition at line 344 of file class.ilWorkspaceAccessGUI.php.

References $form, getAccessHandler(), initPasswordForm(), and showPasswordForm().

345  {
346  $form = $this->initPasswordForm();
347  if ($form->checkInput()) {
348  $this->getAccessHandler()->addPermission(
349  $this->node_id,
350  self::PERMISSION_ALL_PASSWORD,
351  md5($form->getInput("password"))
352  );
353  ilUtil::sendSuccess($this->lng->txt("wsp_permission_all_pw_info"), true);
354  $this->ctrl->redirect($this, "share");
355  }
356 
357  $form->setValuesByPost();
358  $this->showPasswordForm($form);
359  }
if(isset($_POST['submit'])) $form
showPasswordForm(ilPropertyFormGUI $a_form=null)
+ Here is the call graph for this function:

◆ setBlockingMessage()

ilWorkspaceAccessGUI::setBlockingMessage (   $a_val)

Set blocking message.

Parameters
string$a_valblocking message

Definition at line 82 of file class.ilWorkspaceAccessGUI.php.

Referenced by ilObjPortfolioGUI\executeCommand().

83  {
84  $this->blocking_message = $a_val;
85  }
+ Here is the caller graph for this function:

◆ setObjectTitle()

ilWorkspaceAccessGUI::setObjectTitle ( )
protected

restore object title

Returns
string

Definition at line 188 of file class.ilWorkspaceAccessGUI.php.

References $node_id, $tpl, and ilObject\_lookupTitle().

Referenced by executeCommand().

189  {
190  $tpl = $this->tpl;
191 
192  if (!$this->is_portfolio) {
193  $obj_id = $this->access_handler->getTree()->lookupObjectId($this->node_id);
194  } else {
195  $obj_id = $this->node_id;
196  }
197  $tpl->setTitle(ilObject::_lookupTitle($obj_id));
198  }
static _lookupTitle($a_id)
lookup object title
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ share()

ilWorkspaceAccessGUI::share ( )
protected

Definition at line 205 of file class.ilWorkspaceAccessGUI.php.

References $footer, $ilSetting, $ilUser, PHPMailer\PHPMailer\$options, $settings, $table, $toolbar, $tpl, $user, ilParticipants\_getMembershipByType(), getAccessHandler(), getBlockingMessage(), and ilSubmitButton\getInstance().

206  {
207  $ilToolbar = $this->toolbar;
208  $tpl = $this->tpl;
211 
212 
213  // blocking message
214  if ($this->getBlockingMessage() != "") {
215  $tpl->setContent($this->getBlockingMessage());
216  return;
217  }
218 
219  $options = array();
220  $options["user"] = $this->lng->txt("wsp_set_permission_single_user");
221 
222  include_once 'Modules/Group/classes/class.ilGroupParticipants.php';
223  $grp_ids = ilGroupParticipants::_getMembershipByType($ilUser->getId(), 'grp');
224  if (sizeof($grp_ids)) {
225  $options["group"] = $this->lng->txt("wsp_set_permission_group");
226  }
227 
228  include_once 'Modules/Course/classes/class.ilCourseParticipants.php';
229  $crs_ids = ilCourseParticipants::_getMembershipByType($ilUser->getId(), 'crs');
230  if (sizeof($crs_ids)) {
231  $options["course"] = $this->lng->txt("wsp_set_permission_course");
232  }
233 
234  if (!$this->getAccessHandler()->hasRegisteredPermission($this->node_id)) {
235  $options["registered"] = $this->lng->txt("wsp_set_permission_registered");
236  }
237 
238  if ($ilSetting->get("enable_global_profiles")) {
239  if (!$this->getAccessHandler()->hasGlobalPasswordPermission($this->node_id)) {
240  $options["password"] = $this->lng->txt("wsp_set_permission_all_password");
241  }
242 
243  if (!$this->getAccessHandler()->hasGlobalPermission($this->node_id)) {
244  $options["all"] = $this->lng->txt("wsp_set_permission_all");
245  }
246  }
247 
248  include_once "Services/Form/classes/class.ilPropertyFormGUI.php";
249  $actions = new ilSelectInputGUI("", "action");
250  $actions->setOptions($options);
251  $ilToolbar->addStickyItem($actions);
252 
253  $ilToolbar->setFormAction($this->ctrl->getFormAction($this));
254 
255  include_once "Services/UIComponent/Button/classes/class.ilSubmitButton.php";
256  $button = ilSubmitButton::getInstance();
257  $button->setCaption("add");
258  $button->setCommand("addpermissionhandler");
259  $ilToolbar->addStickyItem($button);
260 
261  include_once "Services/PersonalWorkspace/classes/class.ilWorkspaceAccessTableGUI.php";
262  $table = new ilWorkspaceAccessTableGUI($this, "share", $this->node_id, $this->getAccessHandler());
263  $tpl->setContent($table->getHTML() . $this->footer);
264  }
This class represents a selection list property in a property form.
static _getMembershipByType($a_usr_id, $a_type, $a_only_member_role=false)
get membership by type Get course or group membership
getBlockingMessage()
Get blocking message.
$ilUser
Definition: imgupload.php:18
global $ilSetting
Definition: privfeed.php:17
Workspace access handler table GUI class.
if(empty($password)) $table
Definition: pwgen.php:24
+ Here is the call graph for this function:

◆ showPasswordForm()

ilWorkspaceAccessGUI::showPasswordForm ( ilPropertyFormGUI  $a_form = null)
protected

Definition at line 334 of file class.ilWorkspaceAccessGUI.php.

References $tpl, and initPasswordForm().

Referenced by addPermissionHandler(), and savePasswordForm().

335  {
336  $tpl = $this->tpl;
337 
338  if (!$a_form) {
339  $a_form = $this->initPasswordForm();
340  }
341  $tpl->setContent($a_form->getHTML());
342  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Field Documentation

◆ $access_handler

ilWorkspaceAccessGUI::$access_handler
protected

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

Referenced by getAccessHandler().

◆ $blocking_message

ilWorkspaceAccessGUI::$blocking_message = ""
protected

Definition at line 55 of file class.ilWorkspaceAccessGUI.php.

Referenced by getBlockingMessage().

◆ $ctrl

ilWorkspaceAccessGUI::$ctrl
protected

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

◆ $footer

ilWorkspaceAccessGUI::$footer
protected

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

Referenced by share().

◆ $lng

ilWorkspaceAccessGUI::$lng
protected

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

Referenced by __construct().

◆ $node_id

ilWorkspaceAccessGUI::$node_id
protected

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

Referenced by setObjectTitle().

◆ $settings

ilWorkspaceAccessGUI::$settings
protected

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

Referenced by share().

◆ $tabs

ilWorkspaceAccessGUI::$tabs
protected

Definition at line 20 of file class.ilWorkspaceAccessGUI.php.

Referenced by executeCommand().

◆ $toolbar

ilWorkspaceAccessGUI::$toolbar
protected

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

Referenced by share().

◆ $tpl

ilWorkspaceAccessGUI::$tpl
protected

◆ $user

ilWorkspaceAccessGUI::$user
protected

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

Referenced by share().

◆ PERMISSION_ALL

◆ PERMISSION_ALL_PASSWORD

◆ PERMISSION_REGISTERED


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