ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
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)
 
 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

 $ctrl
 
 $lng
 
 $node_id
 
 $access_handler
 
 $footer
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

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

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

References $ilCtrl, $lng, and footer.

29  {
30  global $ilCtrl, $lng;
31 
32  $this->ctrl = $ilCtrl;
33  $this->lng = $lng;
34  $this->node_id = $a_node_id;
35  $this->access_handler = $a_access_handler;
36  $this->is_portfolio = (bool)$a_is_portfolio;
37  $this->footer = $a_footer;
38  }
Set header footer
Definition: 04printing.php:58
global $ilCtrl
Definition: ilias.php:18

Member Function Documentation

◆ addPermissionHandler()

ilWorkspaceAccessGUI::addPermissionHandler ( )

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

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

199  {
200  switch($_REQUEST["action"])
201  {
202  case "user":
203 
204  include_once './Services/User/classes/class.ilUserAccountSettings.php';
205  if(ilUserAccountSettings::getInstance()->isUserAccessRestricted())
206  {
207  $this->ctrl->redirectByClass("ilsingleusersharegui");
208  }
209  else
210  {
211  $this->ctrl->setParameterByClass("ilmailsearchgui", "ref", "wsp");
212  $this->ctrl->redirectByClass("ilmailsearchgui");
213  }
214 
215  case "group":
216  $this->ctrl->setParameterByClass("ilmailsearchgroupsgui", "ref", "wsp");
217  $this->ctrl->redirectByClass("ilmailsearchgroupsgui");
218 
219  case "course":
220  $this->ctrl->setParameterByClass("ilmailsearchcoursesgui", "ref", "wsp");
221  $this->ctrl->redirectByClass("ilmailsearchcoursesgui");
222 
223  case "registered":
224  $this->getAccessHandler()->addPermission($this->node_id, self::PERMISSION_REGISTERED);
225  ilUtil::sendSuccess($this->lng->txt("wsp_permission_registered_info"), true);
226  $this->ctrl->redirect($this, "share");
227 
228  case "password":
229  $this->showPasswordForm();
230  break;
231 
232  case "all":
233  $this->getAccessHandler()->addPermission($this->node_id, self::PERMISSION_ALL);
234  ilUtil::sendSuccess($this->lng->txt("wsp_permission_all_info"), true);
235  $this->ctrl->redirect($this, "share");
236  }
237  }
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
static getInstance()
Singelton get instance.
showPasswordForm(ilPropertyFormGUI $a_form=null)
+ Here is the call graph for this function:

◆ executeCommand()

ilWorkspaceAccessGUI::executeCommand ( )

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

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

41  {
42  global $ilTabs, $tpl;
43 
44  $next_class = $this->ctrl->getNextClass($this);
45  $cmd = $this->ctrl->getCmd();
46 
47  switch($next_class)
48  {
49  case "ilmailsearchcoursesgui";
50  $ilTabs->setBackTarget($this->lng->txt("back"),
51  $this->ctrl->getLinkTarget($this, "share"));
52  include_once('Services/Contact/classes/class.ilMailSearchCoursesGUI.php');
53  $csearch = new ilMailSearchCoursesGUI($this->access_handler, $this->node_id);
54  $this->ctrl->setReturn($this, 'share');
55  $this->ctrl->forwardCommand($csearch);
56 
57  $this->setObjectTitle();
58  break;
59 
60  case "ilmailsearchgroupsgui";
61  $ilTabs->setBackTarget($this->lng->txt("back"),
62  $this->ctrl->getLinkTarget($this, "share"));
63  include_once('Services/Contact/classes/class.ilMailSearchGroupsGUI.php');
64  $gsearch = new ilMailSearchGroupsGUI($this->access_handler, $this->node_id);
65  $this->ctrl->setReturn($this, 'share');
66  $this->ctrl->forwardCommand($gsearch);
67 
68  $this->setObjectTitle();
69  break;
70 
71  case "ilmailsearchgui";
72  $ilTabs->setBackTarget($this->lng->txt("back"),
73  $this->ctrl->getLinkTarget($this, "share"));
74  include_once('Services/Contact/classes/class.ilMailSearchGUI.php');
75  $usearch = new ilMailSearchGUI($this->access_handler, $this->node_id);
76  $this->ctrl->setReturn($this, 'share');
77  $this->ctrl->forwardCommand($usearch);
78 
79  $this->setObjectTitle();
80  break;
81 
82  case "ilsingleusersharegui";
83  $ilTabs->setBackTarget($this->lng->txt("back"),
84  $this->ctrl->getLinkTarget($this, "share"));
85  include_once('Services/PersonalWorkspace/classes/class.ilSingleUserShareGUI.php');
86  $ushare = new ilSingleUserShareGUI($this->access_handler, $this->node_id);
87  $this->ctrl->setReturn($this, 'share');
88  $this->ctrl->forwardCommand($ushare);
89 
90  $this->setObjectTitle();
91  break;
92 
93  case "ilpublicuserprofilegui";
94  $ilTabs->clearTargets();
95  $ilTabs->setBackTarget($this->lng->txt("back"),
96  $this->ctrl->getLinkTarget($this, "share"));
97 
98  include_once('./Services/User/classes/class.ilPublicUserProfileGUI.php');
99  $prof = new ilPublicUserProfileGUI($_REQUEST["user"]);
100  $prof->setBackUrl($this->ctrl->getLinkTarget($this, "share"));
101  $tpl->setContent($prof->getHTML());
102  break;
103 
104  default:
105  // $this->prepareOutput();
106  if(!$cmd)
107  {
108  $cmd = "share";
109  }
110  return $this->$cmd();
111  }
112 
113  return true;
114  }
setObjectTitle()
restore object title
$cmd
Definition: sahs_server.php:35
global $tpl
Definition: ilias.php:8
GUI class for public user profile presentation.
+ Here is the call graph for this function:

◆ getAccessHandler()

ilWorkspaceAccessGUI::getAccessHandler ( )
protected

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

References $access_handler.

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

+ Here is the caller graph for this function:

◆ initPasswordForm()

ilWorkspaceAccessGUI::initPasswordForm ( )
protected

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

References ilFormPropertyGUI\setRequired().

Referenced by savePasswordForm(), and showPasswordForm().

251  {
252  include_once "Services/Form/classes/class.ilPropertyFormGUI.php";
253  $form = new ilPropertyFormGUI();
254  $form->setFormAction($this->ctrl->getFormAction($this));
255  $form->setTitle($this->lng->txt("wsp_set_permission_all_password"));
256 
257  $password = new ilPasswordInputGUI($this->lng->txt("password"), "password");
258  $password->setRequired(true);
259  $form->addItem($password);
260 
261  $form->addCommandButton('savepasswordform', $this->lng->txt("save"));
262  $form->addCommandButton('share', $this->lng->txt("cancel"));
263 
264  return $form;
265  }
This class represents a property form user interface.
This class represents a password property in a property form.
setRequired($a_required)
Set Required.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ removePermission()

ilWorkspaceAccessGUI::removePermission ( )

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

References getAccessHandler(), and ilUtil\sendSuccess().

240  {
241  if($_REQUEST["obj_id"])
242  {
243  $this->getAccessHandler()->removePermission($this->node_id, (int)$_REQUEST["obj_id"]);
244  ilUtil::sendSuccess($this->lng->txt("wsp_permission_removed"), true);
245  }
246 
247  $this->ctrl->redirect($this, "share");
248  }
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
+ Here is the call graph for this function:

◆ savePasswordForm()

ilWorkspaceAccessGUI::savePasswordForm ( )
protected

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

References getAccessHandler(), initPasswordForm(), ilUtil\sendSuccess(), and showPasswordForm().

279  {
280  $form = $this->initPasswordForm();
281  if($form->checkInput())
282  {
283  $this->getAccessHandler()->addPermission($this->node_id,
284  self::PERMISSION_ALL_PASSWORD, md5($form->getInput("password")));
285  ilUtil::sendSuccess($this->lng->txt("wsp_permission_all_pw_info"), true);
286  $this->ctrl->redirect($this, "share");
287  }
288 
289  $form->setValuesByPost();
290  $this->showPasswordForm($form);
291  }
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
showPasswordForm(ilPropertyFormGUI $a_form=null)
+ Here is the call graph for this function:

◆ setObjectTitle()

ilWorkspaceAccessGUI::setObjectTitle ( )
protected

restore object title

Returns
string

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

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

Referenced by executeCommand().

122  {
123  global $tpl;
124 
125  if(!$this->is_portfolio)
126  {
127  $obj_id = $this->access_handler->getTree()->lookupObjectId($this->node_id);
128  }
129  else
130  {
131  $obj_id = $this->node_id;
132  }
133  $tpl->setTitle(ilObject::_lookupTitle($obj_id));
134  }
static _lookupTitle($a_id)
lookup object title
global $tpl
Definition: ilias.php:8
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ share()

ilWorkspaceAccessGUI::share ( )
protected

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

References $ilSetting, $ilUser, $options, $tpl, ilParticipants\_getMembershipByType(), array, getAccessHandler(), and ilSubmitButton\getInstance().

142  {
143  global $ilToolbar, $tpl, $ilUser, $ilSetting;
144 
145  $options = array();
146  $options["user"] = $this->lng->txt("wsp_set_permission_single_user");
147 
148  include_once 'Modules/Group/classes/class.ilGroupParticipants.php';
149  $grp_ids = ilGroupParticipants::_getMembershipByType($ilUser->getId(), 'grp');
150  if(sizeof($grp_ids))
151  {
152  $options["group"] = $this->lng->txt("wsp_set_permission_group");
153  }
154 
155  include_once 'Modules/Course/classes/class.ilCourseParticipants.php';
156  $crs_ids = ilCourseParticipants::_getMembershipByType($ilUser->getId(), 'crs');
157  if(sizeof($crs_ids))
158  {
159  $options["course"] = $this->lng->txt("wsp_set_permission_course");
160  }
161 
162  if(!$this->getAccessHandler()->hasRegisteredPermission($this->node_id))
163  {
164  $options["registered"] = $this->lng->txt("wsp_set_permission_registered");
165  }
166 
167  if($ilSetting->get("enable_global_profiles"))
168  {
169  if(!$this->getAccessHandler()->hasGlobalPasswordPermission($this->node_id))
170  {
171  $options["password"] = $this->lng->txt("wsp_set_permission_all_password");
172  }
173 
174  if(!$this->getAccessHandler()->hasGlobalPermission($this->node_id))
175  {
176  $options["all"] = $this->lng->txt("wsp_set_permission_all");
177  }
178  }
179 
180  include_once "Services/Form/classes/class.ilPropertyFormGUI.php";
181  $actions = new ilSelectInputGUI("", "action");
182  $actions->setOptions($options);
183  $ilToolbar->addStickyItem($actions);
184 
185  $ilToolbar->setFormAction($this->ctrl->getFormAction($this));
186 
187  include_once "Services/UIComponent/Button/classes/class.ilSubmitButton.php";
188  $button = ilSubmitButton::getInstance();
189  $button->setCaption("add");
190  $button->setCommand("addpermissionhandler");
191  $ilToolbar->addStickyItem($button);
192 
193  include_once "Services/PersonalWorkspace/classes/class.ilWorkspaceAccessTableGUI.php";
194  $table = new ilWorkspaceAccessTableGUI($this, "share", $this->node_id, $this->getAccessHandler());
195  $tpl->setContent($table->getHTML().$this->footer);
196  }
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
global $tpl
Definition: ilias.php:8
if(!is_array($argv)) $options
$ilUser
Definition: imgupload.php:18
Create styles array
The data for the language used.
global $ilSetting
Definition: privfeed.php:17
Workspace access handler table GUI class.
+ Here is the call graph for this function:

◆ showPasswordForm()

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

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

References $tpl, and initPasswordForm().

Referenced by addPermissionHandler(), and savePasswordForm().

268  {
269  global $tpl;
270 
271  if(!$a_form)
272  {
273  $a_form = $this->initPasswordForm();
274  }
275  $tpl->setContent($a_form->getHTML());
276  }
global $tpl
Definition: ilias.php:8
+ 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 20 of file class.ilWorkspaceAccessGUI.php.

Referenced by getAccessHandler().

◆ $ctrl

ilWorkspaceAccessGUI::$ctrl
protected

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

◆ $footer

ilWorkspaceAccessGUI::$footer
protected

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

◆ $lng

ilWorkspaceAccessGUI::$lng
protected

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

Referenced by __construct().

◆ $node_id

ilWorkspaceAccessGUI::$node_id
protected

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

Referenced by setObjectTitle().

◆ PERMISSION_ALL

◆ PERMISSION_ALL_PASSWORD

◆ PERMISSION_REGISTERED


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