ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
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 $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
Definition: saml.php:7

References $DIC.

Member Function Documentation

◆ cancel()

ilSingleUserShareGUI::cancel ( )

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

95 {
96 $this->ctrl->returnToParent($this);
97 }

◆ 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 default:
35 if (!($cmd = $this->ctrl->getCmd())) {
36 $cmd = "initShareForm";
37 }
38 $this->$cmd();
39 break;
40 }
41 return true;
42 }

◆ getShareForm()

ilSingleUserShareGUI::getShareForm ( )

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

53 {
54 include_once './Services/Form/classes/class.ilPropertyFormGUI.php';
56
57 $form->setTitle($this->lng->txt("share_content"));
58 $form->setId('share_usr');
59
60 $form->setFormAction($this->ctrl->getFormAction($this, 'saveShare'));
61
62 $inp = new ilTextInputGUI($this->lng->txt("share_with"), 'name');
63 $inp->setSize(20);
64 $form->addItem($inp);
65
66 $form->addCommandButton('saveShare', $this->lng->txt("share"));
67 $form->addCommandButton('cancel', $this->lng->txt("cancel"));
68
69 return $form;
70 }
This class represents a property form user interface.
This class represents a text property in a property form.
if(isset($_POST['submit'])) $form

References $form.

Referenced by initShareForm(), and saveShare().

+ Here is the caller graph for this function:

◆ initShareForm()

ilSingleUserShareGUI::initShareForm ( ilPropertyFormGUI  $form = null)

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

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

References $form, and getShareForm().

+ Here is the call graph for this function:

◆ saveShare()

ilSingleUserShareGUI::saveShare ( )
protected

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

73 {
74 $form = $this->getShareForm();
75
76 if ($form->checkInput()) {
77 if ($user_id = ilObjUser::_lookupId($form->getInput('name'))) {
78 $existing = $this->wsp_access_handler->getPermissions($this->wsp_node_id);
79
80 if (!in_array($user_id, $existing)) {
81 $this->wsp_access_handler->addPermission($this->wsp_node_id, $user_id);
82 ilUtil::sendSuccess($this->lng->txt("element_shared"), true);
83 } else {
84 ilUtil::sendInfo($this->lng->txt("element_already_shared"), true);
85 }
86 $this->ctrl->returnToParent($this);
87 } else {
88 ilUtil::sendFailure($this->lng->txt('search_no_match'), true);
89 }
90 }
91 $this->ctrl->redirect($this);
92 }
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 $form, 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.

◆ $tpl

ilSingleUserShareGUI::$tpl
protected

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


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