ILIAS  trunk Revision v12.0_alpha-377-g3641b37b9db
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 (ilPortfolioAccessHandler|ilWorkspaceAccessHandler|null $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
 
ilPortfolioAccessHandler ilWorkspaceAccessHandler $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 ( ilPortfolioAccessHandler|ilWorkspaceAccessHandler|null  $wsp_access_handler = null,
?int  $wsp_node_id = null 
)

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

33 {
34 global $DIC;
35
36 $this->tpl = $DIC->ui()->mainTemplate();
37 $this->ctrl = $DIC->ctrl();
38 $this->lng = $DIC->language();
39
40 // personal workspace
41 $this->wsp_access_handler = $wsp_access_handler;
42 $this->wsp_node_id = $wsp_node_id;
43 }
ilPortfolioAccessHandler ilWorkspaceAccessHandler $wsp_access_handler
global $DIC
Definition: shib_login.php:26

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

+ Here is the call graph for this function:

Member Function Documentation

◆ cancel()

ilSingleUserShareGUI::cancel ( )

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

108 : void
109 {
110 $this->ctrl->returnToParent($this);
111 }

References ILIAS\Repository\ctrl().

+ Here is the call graph for this function:

◆ executeCommand()

ilSingleUserShareGUI::executeCommand ( )

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

45 : void
46 {
47 $forward_class = $this->ctrl->getNextClass($this);
48
49 switch ($forward_class) {
50 default:
51 if (!($cmd = $this->ctrl->getCmd())) {
52 $cmd = "initShareForm";
53 }
54 $this->$cmd();
55 break;
56 }
57 }

References ILIAS\Repository\ctrl().

+ Here is the call graph for this function:

◆ getShareForm()

ilSingleUserShareGUI::getShareForm ( )

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

68 {
69 $form = new ilPropertyFormGUI();
70
71 $form->setTitle($this->lng->txt("share_content"));
72 $form->setId('share_usr');
73
74 $form->setFormAction($this->ctrl->getFormAction($this, 'saveShare'));
75
76 $inp = new ilTextInputGUI($this->lng->txt("share_with"), 'name');
77 $inp->setSize(20);
78 $form->addItem($inp);
79
80 $form->addCommandButton('saveShare', $this->lng->txt("share"));
81 $form->addCommandButton('cancel', $this->lng->txt("cancel"));
82
83 return $form;
84 }
This class represents a property form user interface.
This class represents a text property in a property form.

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

Referenced by initShareForm(), and saveShare().

+ 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 59 of file class.ilSingleUserShareGUI.php.

59 : void
60 {
61 if (!($form instanceof ilPropertyFormGUI)) {
62 $form = $this->getShareForm();
63 }
64 $this->tpl->setContent($form->getHTML());
65 }

References getShareForm().

+ Here is the call graph for this function:

◆ saveShare()

ilSingleUserShareGUI::saveShare ( )
protected

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

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

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

+ Here is the call graph for this function:

Field Documentation

◆ $ctrl

ilCtrl ilSingleUserShareGUI::$ctrl
protected

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

◆ $lng

ilLanguage ilSingleUserShareGUI::$lng
protected

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

◆ $tpl

ilGlobalTemplateInterface ilSingleUserShareGUI::$tpl
protected

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

◆ $wsp_access_handler

ilPortfolioAccessHandler ilWorkspaceAccessHandler ilSingleUserShareGUI::$wsp_access_handler
protected

Definition at line 25 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: