ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
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.

17 {
18 global $tpl, $ilCtrl, $lng;
19
20 $this->tpl = $tpl;
21 $this->ctrl = $ilCtrl;
22 $this->lng = $lng;
23
24 // personal workspace
25 $this->wsp_access_handler = $wsp_access_handler;
26 $this->wsp_node_id = $wsp_node_id;
27 }
global $ilCtrl
Definition: ilias.php:18

References $ilCtrl, $lng, and $tpl.

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.

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

References $cmd.

◆ getShareForm()

ilSingleUserShareGUI::getShareForm ( )

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

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.
This class represents a text property in a property form.

Referenced by initShareForm(), and saveShare().

+ Here is the caller graph for this function:

◆ initShareForm()

ilSingleUserShareGUI::initShareForm ( ilPropertyFormGUI  $form = null)

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

47 {
48 if(!($form instanceof ilPropertyFormGUI))
49 {
50 $form = $this->getShareForm();
51 }
52 $this->tpl->setContent($form->getHTML());
53 }

References getShareForm().

+ Here is the call graph for this function:

◆ saveShare()

ilSingleUserShareGUI::saveShare ( )
protected

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

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 _lookupId($a_user_str)
Lookup id by login.
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.

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

+ 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.

Referenced by __construct().

◆ $tpl

ilSingleUserShareGUI::$tpl
protected

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

Referenced by __construct().


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