ILIAS  release_4-4 Revision
All Data Structures Namespaces Files Functions Variables Modules Pages
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, and $lng.

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  }
global $ilCtrl
Definition: ilias.php:18

Member Function Documentation

◆ addPermissionHandler()

ilWorkspaceAccessGUI::addPermissionHandler ( )

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

References $_REQUEST, getAccessHandler(), ilUtil\sendSuccess(), and showPasswordForm().

188  {
189  switch($_REQUEST["action"])
190  {
191  case "user":
192  $this->ctrl->setParameterByClass("ilmailsearchgui", "ref", "wsp");
193  $this->ctrl->redirectByClass("ilmailsearchgui");
194 
195  case "group":
196  $this->ctrl->setParameterByClass("ilmailsearchgroupsgui", "ref", "wsp");
197  $this->ctrl->redirectByClass("ilmailsearchgroupsgui");
198 
199  case "course":
200  $this->ctrl->setParameterByClass("ilmailsearchcoursesgui", "ref", "wsp");
201  $this->ctrl->redirectByClass("ilmailsearchcoursesgui");
202 
203  case "registered":
204  $this->getAccessHandler()->addPermission($this->node_id, self::PERMISSION_REGISTERED);
205  ilUtil::sendSuccess($this->lng->txt("wsp_permission_registered_info"), true);
206  $this->ctrl->redirect($this, "share");
207 
208  case "password":
209  $this->showPasswordForm();
210  break;
211 
212  case "all":
213  $this->getAccessHandler()->addPermission($this->node_id, self::PERMISSION_ALL);
214  ilUtil::sendSuccess($this->lng->txt("wsp_permission_all_info"), true);
215  $this->ctrl->redirect($this, "share");
216  }
217  }
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
showPasswordForm(ilPropertyFormGUI $a_form=null)
if($_REQUEST['ilias_path']) define('ILIAS_HTTP_PATH' $_REQUEST['ilias_path']
Definition: index.php:7
+ Here is the call graph for this function:

◆ executeCommand()

ilWorkspaceAccessGUI::executeCommand ( )

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

References $_REQUEST, $cmd, $ilErr, $tpl, getAccessHandler(), and setObjectTitle().

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

◆ getAccessHandler()

ilWorkspaceAccessGUI::getAccessHandler ( )
protected

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

References $access_handler.

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

+ Here is the caller graph for this function:

◆ initPasswordForm()

ilWorkspaceAccessGUI::initPasswordForm ( )
protected

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

References ilFormPropertyGUI\setRequired().

Referenced by savePasswordForm(), and showPasswordForm().

231  {
232  include_once "Services/Form/classes/class.ilPropertyFormGUI.php";
233  $form = new ilPropertyFormGUI();
234  $form->setFormAction($this->ctrl->getFormAction($this));
235  $form->setTitle($this->lng->txt("wsp_set_permission_all_password"));
236 
237  $password = new ilPasswordInputGUI($this->lng->txt("password"), "password");
238  $password->setRequired(true);
239  $form->addItem($password);
240 
241  $form->addCommandButton('savepasswordform', $this->lng->txt("save"));
242  $form->addCommandButton('share', $this->lng->txt("cancel"));
243 
244  return $form;
245  }
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 219 of file class.ilWorkspaceAccessGUI.php.

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

220  {
221  if($_REQUEST["obj_id"])
222  {
223  $this->getAccessHandler()->removePermission($this->node_id, (int)$_REQUEST["obj_id"]);
224  ilUtil::sendSuccess($this->lng->txt("wsp_permission_removed"), true);
225  }
226 
227  $this->ctrl->redirect($this, "share");
228  }
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
if($_REQUEST['ilias_path']) define('ILIAS_HTTP_PATH' $_REQUEST['ilias_path']
Definition: index.php:7
+ Here is the call graph for this function:

◆ savePasswordForm()

ilWorkspaceAccessGUI::savePasswordForm ( )
protected

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

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

259  {
260  $form = $this->initPasswordForm();
261  if($form->checkInput())
262  {
263  $this->getAccessHandler()->addPermission($this->node_id,
264  self::PERMISSION_ALL_PASSWORD, md5($form->getInput("password")));
265  ilUtil::sendSuccess($this->lng->txt("wsp_permission_all_info"), true);
266  $this->ctrl->redirect($this, "share");
267  }
268 
269  $form->setValuesByPost();
270  $this->showPasswordForm($form);
271  }
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 115 of file class.ilWorkspaceAccessGUI.php.

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

Referenced by executeCommand().

116  {
117  global $tpl;
118 
119  if(!$this->is_portfolio)
120  {
121  $obj_id = $this->access_handler->getTree()->lookupObjectId($this->node_id);
122  }
123  else
124  {
125  $obj_id = $this->node_id;
126  }
127  $tpl->setTitle(ilObject::_lookupTitle($obj_id));
128  }
static _lookupTitle($a_id)
lookup object title
if(isset($_FILES['img_file']['size']) && $_FILES['img_file']['size'] > 0) $tpl
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ share()

ilWorkspaceAccessGUI::share ( )
protected

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

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

136  {
137  global $ilToolbar, $tpl, $ilUser, $ilSetting;
138 
139  $options = array();
140  $options["user"] = $this->lng->txt("wsp_set_permission_single_user");
141 
142  include_once 'Modules/Group/classes/class.ilGroupParticipants.php';
143  $grp_ids = ilGroupParticipants::_getMembershipByType($ilUser->getId(), 'grp');
144  if(sizeof($grp_ids))
145  {
146  $options["group"] = $this->lng->txt("wsp_set_permission_group");
147  }
148 
149  include_once 'Modules/Course/classes/class.ilCourseParticipants.php';
150  $crs_ids = ilCourseParticipants::_getMembershipByType($ilUser->getId(), 'crs');
151  if(sizeof($crs_ids))
152  {
153  $options["course"] = $this->lng->txt("wsp_set_permission_course");
154  }
155 
156  if(!$this->getAccessHandler()->hasRegisteredPermission($this->node_id))
157  {
158  $options["registered"] = $this->lng->txt("wsp_set_permission_registered");
159  }
160 
161  if($ilSetting->get("enable_global_profiles"))
162  {
163  if(!$this->getAccessHandler()->hasGlobalPasswordPermission($this->node_id))
164  {
165  $options["password"] = $this->lng->txt("wsp_set_permission_all_password");
166  }
167 
168  if(!$this->getAccessHandler()->hasGlobalPermission($this->node_id))
169  {
170  $options["all"] = $this->lng->txt("wsp_set_permission_all");
171  }
172  }
173 
174  include_once "Services/Form/classes/class.ilPropertyFormGUI.php";
175  $actions = new ilSelectInputGUI("", "action");
176  $actions->setOptions($options);
177  $ilToolbar->addInputItem($actions);
178 
179  $ilToolbar->setFormAction($this->ctrl->getFormAction($this));
180  $ilToolbar->addFormButton($this->lng->txt("add"), "addpermissionhandler");
181 
182  include_once "Services/PersonalWorkspace/classes/class.ilWorkspaceAccessTableGUI.php";
183  $table = new ilWorkspaceAccessTableGUI($this, "share", $this->node_id, $this->getAccessHandler());
184  $tpl->setContent($table->getHTML().$this->footer);
185  }
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
if(!is_array($argv)) $options
if(isset($_FILES['img_file']['size']) && $_FILES['img_file']['size'] > 0) $tpl
global $ilUser
Definition: imgupload.php:15
global $ilSetting
Definition: privfeed.php:40
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 247 of file class.ilWorkspaceAccessGUI.php.

References $tpl, and initPasswordForm().

Referenced by addPermissionHandler(), and savePasswordForm().

248  {
249  global $tpl;
250 
251  if(!$a_form)
252  {
253  $a_form = $this->initPasswordForm();
254  }
255  $tpl->setContent($a_form->getHTML());
256  }
if(isset($_FILES['img_file']['size']) && $_FILES['img_file']['size'] > 0) $tpl
+ 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: