ILIAS  trunk Revision v11.0_alpha-1744-gb0451eebef4
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
ilSingleUserShareGUI Class Reference

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V. More...

+ Collaboration diagram for ilSingleUserShareGUI:

Public Member Functions

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

Protected Member Functions

 saveShare ()
 

Protected Attributes

int $wsp_node_id
 
 $wsp_access_handler
 
ilGlobalTemplateInterface $tpl
 
ilCtrl $ctrl
 
ilLanguage $lng
 

Detailed Description

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V.

ILIAS is licensed with the GPL-3.0, see https://www.gnu.org/licenses/gpl-3.0.en.html You should have received a copy of said license along with the source code, too.

If this is not the case or you just want to try ILIAS, you'll find us at: https://www.ilias.de https://github.com/ILIAS-eLearning

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

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

Constructor & Destructor Documentation

◆ __construct()

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

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

References $DIC, $wsp_access_handler, $wsp_node_id, ILIAS\Repository\ctrl(), and ILIAS\Repository\lng().

36  {
37  global $DIC;
38 
39  $this->tpl = $DIC->ui()->mainTemplate();
40  $this->ctrl = $DIC->ctrl();
41  $this->lng = $DIC->language();
42 
43  // personal workspace
44  $this->wsp_access_handler = $wsp_access_handler;
45  $this->wsp_node_id = $wsp_node_id;
46  }
global $DIC
Definition: shib_login.php:22
+ Here is the call graph for this function:

Member Function Documentation

◆ cancel()

ilSingleUserShareGUI::cancel ( )

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

References ILIAS\Repository\ctrl().

111  : void
112  {
113  $this->ctrl->returnToParent($this);
114  }
+ Here is the call graph for this function:

◆ executeCommand()

ilSingleUserShareGUI::executeCommand ( )

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

References ILIAS\Repository\ctrl().

48  : void
49  {
50  $forward_class = $this->ctrl->getNextClass($this);
51 
52  switch ($forward_class) {
53  default:
54  if (!($cmd = $this->ctrl->getCmd())) {
55  $cmd = "initShareForm";
56  }
57  $this->$cmd();
58  break;
59  }
60  }
+ Here is the call graph for this function:

◆ getShareForm()

ilSingleUserShareGUI::getShareForm ( )

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

References ILIAS\Repository\ctrl(), and ILIAS\Repository\lng().

Referenced by initShareForm(), and saveShare().

71  {
72  $form = new ilPropertyFormGUI();
73 
74  $form->setTitle($this->lng->txt("share_content"));
75  $form->setId('share_usr');
76 
77  $form->setFormAction($this->ctrl->getFormAction($this, 'saveShare'));
78 
79  $inp = new ilTextInputGUI($this->lng->txt("share_with"), 'name');
80  $inp->setSize(20);
81  $form->addItem($inp);
82 
83  $form->addCommandButton('saveShare', $this->lng->txt("share"));
84  $form->addCommandButton('cancel', $this->lng->txt("cancel"));
85 
86  return $form;
87  }
+ 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 62 of file class.ilSingleUserShareGUI.php.

References getShareForm().

62  : void
63  {
64  if (!($form instanceof ilPropertyFormGUI)) {
65  $form = $this->getShareForm();
66  }
67  $this->tpl->setContent($form->getHTML());
68  }
+ Here is the call graph for this function:

◆ saveShare()

ilSingleUserShareGUI::saveShare ( )
protected

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

References $user_id, ilObjUser\_lookupId(), ILIAS\Repository\ctrl(), getShareForm(), and ILIAS\Repository\lng().

89  : void
90  {
91  $form = $this->getShareForm();
92 
93  if ($form->checkInput()) {
94  if ($user_id = ilObjUser::_lookupId((string) $form->getInput('name'))) {
95  $existing = $this->wsp_access_handler->getPermissions($this->wsp_node_id);
96 
97  if (!in_array($user_id, $existing)) {
98  $this->wsp_access_handler->addPermission($this->wsp_node_id, $user_id);
99  $this->tpl->setOnScreenMessage('success', $this->lng->txt("element_shared"), true);
100  } else {
101  $this->tpl->setOnScreenMessage('info', $this->lng->txt("element_already_shared"), true);
102  }
103  $this->ctrl->returnToParent($this);
104  } else {
105  $this->tpl->setOnScreenMessage('failure', $this->lng->txt('search_no_match'), true);
106  }
107  }
108  $this->ctrl->redirect($this);
109  }
static _lookupId($a_user_str)
+ Here is the call graph for this function:

Field Documentation

◆ $ctrl

ilCtrl ilSingleUserShareGUI::$ctrl
protected

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

◆ $lng

ilLanguage ilSingleUserShareGUI::$lng
protected

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

◆ $tpl

ilGlobalTemplateInterface ilSingleUserShareGUI::$tpl
protected

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

◆ $wsp_access_handler

ilSingleUserShareGUI::$wsp_access_handler
protected

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

Referenced by __construct().

◆ $wsp_node_id

int ilSingleUserShareGUI::$wsp_node_id
protected

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

Referenced by __construct().


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