ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
ilSingleUserShareGUI Class Reference
+ Collaboration diagram for ilSingleUserShareGUI:

Public Member Functions

 __construct ($wsp_access_handler=null, $wsp_node_id=null)
 
 executeCommand ()
 
 initShareForm (ilPropertyFormGUI $form=null)
 
 getShareForm ()
 
 cancel ()
 

Protected Member Functions

 saveShare ()
 

Protected Attributes

 $tpl
 
 $ctrl
 
 $lng
 

Detailed Description

Author
Jesús López lopez.nosp@m.@lei.nosp@m.fos.c.nosp@m.om
Version
$Id$

Definition at line 10 of file class.ilSingleUserShareGUI.php.

Constructor & Destructor Documentation

◆ __construct()

ilSingleUserShareGUI::__construct (   $wsp_access_handler = null,
  $wsp_node_id = null 
)

Definition at line 16 of file class.ilSingleUserShareGUI.php.

References $DIC.

17  {
18  global $DIC;
19 
20  $this->tpl = $DIC['tpl'];
21  $this->ctrl = $DIC['ilCtrl'];
22  $this->lng = $DIC['lng'];
23 
24  // personal workspace
25  $this->wsp_access_handler = $wsp_access_handler;
26  $this->wsp_node_id = $wsp_node_id;
27  }
global $DIC

Member Function Documentation

◆ cancel()

ilSingleUserShareGUI::cancel ( )

Definition at line 104 of file class.ilSingleUserShareGUI.php.

105  {
106  $this->ctrl->returnToParent($this);
107  }

◆ executeCommand()

ilSingleUserShareGUI::executeCommand ( )

Definition at line 29 of file class.ilSingleUserShareGUI.php.

References $cmd.

30  {
31  $forward_class = $this->ctrl->getNextClass($this);
32 
33  switch($forward_class)
34  {
35  default:
36  if (!($cmd = $this->ctrl->getCmd()))
37  {
38  $cmd = "initShareForm";
39  }
40  $this->$cmd();
41  break;
42  }
43  return true;
44  }
$cmd
Definition: sahs_server.php:35

◆ getShareForm()

ilSingleUserShareGUI::getShareForm ( )

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

References ilTextInputGUI\setSize().

Referenced by initShareForm(), and saveShare().

56  {
57  include_once './Services/Form/classes/class.ilPropertyFormGUI.php';
58  $form = new ilPropertyFormGUI();
59 
60  $form->setTitle($this->lng->txt("share_content"));
61  $form->setId('share_usr');
62 
63  $form->setFormAction($this->ctrl->getFormAction($this, 'saveShare'));
64 
65  $inp = new ilTextInputGUI($this->lng->txt("share_with"), 'name');
66  $inp->setSize(20);
67  $form->addItem($inp);
68 
69  $form->addCommandButton('saveShare', $this->lng->txt("share"));
70  $form->addCommandButton('cancel', $this->lng->txt("cancel"));
71 
72  return $form;
73  }
This class represents a property form user interface.
setSize($a_size)
Set Size.
This class represents a text property in a property form.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ initShareForm()

ilSingleUserShareGUI::initShareForm ( ilPropertyFormGUI  $form = null)

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

References getShareForm().

47  {
48  if(!($form instanceof ilPropertyFormGUI))
49  {
50  $form = $this->getShareForm();
51  }
52  $this->tpl->setContent($form->getHTML());
53  }
This class represents a property form user interface.
+ Here is the call graph for this function:

◆ saveShare()

ilSingleUserShareGUI::saveShare ( )
protected

Definition at line 75 of file class.ilSingleUserShareGUI.php.

References ilObjUser\_lookupId(), getShareForm(), ilUtil\sendFailure(), ilUtil\sendInfo(), and ilUtil\sendSuccess().

76  {
77  $form = $this->getShareForm();
78 
79  if($form->checkInput())
80  {
81  if($user_id = ilObjUser::_lookupId($form->getInput('name')))
82  {
83  $existing = $this->wsp_access_handler->getPermissions($this->wsp_node_id);
84 
85  if(!in_array($user_id, $existing))
86  {
87  $this->wsp_access_handler->addPermission($this->wsp_node_id, $user_id);
88  ilUtil::sendSuccess($this->lng->txt("element_shared"),true);
89  }
90  else
91  {
92  ilUtil::sendInfo($this->lng->txt("element_already_shared"),true);
93  }
94  $this->ctrl->returnToParent($this);
95  }
96  else
97  {
98  ilUtil::sendFailure($this->lng->txt('search_no_match'),true);
99  }
100  }
101  $this->ctrl->redirect($this);
102  }
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
static _lookupId($a_user_str)
Lookup id by login.
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
+ Here is the call graph for this function:

Field Documentation

◆ $ctrl

ilSingleUserShareGUI::$ctrl
protected

Definition at line 13 of file class.ilSingleUserShareGUI.php.

◆ $lng

ilSingleUserShareGUI::$lng
protected

Definition at line 14 of file class.ilSingleUserShareGUI.php.

◆ $tpl

ilSingleUserShareGUI::$tpl
protected

Definition at line 12 of file class.ilSingleUserShareGUI.php.


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