ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
ilOrgUnitUserAssignmentGUI Class Reference

Class ilOrgUnitUserAssignmentGUI. More...

+ Inheritance diagram for ilOrgUnitUserAssignmentGUI:
+ Collaboration diagram for ilOrgUnitUserAssignmentGUI:

Public Member Functions

 executeCommand ()
 
 addStaff ()
 
 addSubTabs ()
 
- Public Member Functions inherited from ILIAS\Modules\OrgUnit\ARHelper\BaseCommands
 getParentGui ()
 
 setParentGui ($parent_gui)
 
 executeCommand ()
 
 addSubTabs ()
 

Data Fields

const CMD_ASSIGNMENTS_RECURSIVE = 'assignmentsRecursive'
 
const SUBTAB_ASSIGNMENTS = 'user_assignments'
 
const SUBTAB_ASSIGNMENTS_RECURSIVE = 'user_assignments_recursive'
 
- Data Fields inherited from ILIAS\Modules\OrgUnit\ARHelper\BaseCommands
const CMD_INDEX = "index"
 
const CMD_ADD = "add"
 
const CMD_CREATE = "create"
 
const CMD_EDIT = "edit"
 
const CMD_UPDATE = "update"
 
const CMD_CONFIRM = "confirm"
 
const CMD_CONFIRM_RECURSIVE = "confirmRecursive"
 
const CMD_DELETE = "delete"
 
const CMD_DELETE_RECURSIVE = "deleteRecursive"
 
const CMD_CANCEL = "cancel"
 
const AR_ID = "arid"
 

Protected Member Functions

 index ()
 
 assignmentsRecursive ()
 
 confirm ()
 
 confirmRecursive ()
 
 delete ()
 
 deleteRecursive ()
 
 cancel ()
 
- Protected Member Functions inherited from ILIAS\Modules\OrgUnit\ARHelper\BaseCommands
 index ()
 
 getPossibleNextClasses ()
 
 getActiveTabId ()
 
 cancel ()
 
 setContent ($html)
 
 pushSubTab ($subtab_id, $url)
 
 activeSubTab ($subtab_id)
 
 getParentRefId ()
 

Additional Inherited Members

- Protected Attributes inherited from ILIAS\Modules\OrgUnit\ARHelper\BaseCommands
 $parent_gui = null
 

Detailed Description

Member Function Documentation

◆ addStaff()

ilOrgUnitUserAssignmentGUI::addStaff ( )

Definition at line 156 of file class.ilOrgUnitUserAssignmentGUI.php.

157 {
158 if (!$this->dic()->access()->checkAccess("write", "", $this->getParentRefId())) {
159 ilUtil::sendFailure($this->txt("permission_denied"), true);
160 $this->ctrl()->redirect($this, self::CMD_INDEX);
161 }
162
163 $users = explode(',', $_POST['user_login']);
164 $user_ids = array();
165 foreach ($users as $user) {
166 $user_id = ilObjUser::_lookupId($user);
167 if ($user_id) {
168 $user_ids[] = $user_id;
169 }
170 }
171
172 if (!count($user_ids)) {
173 ilUtil::sendFailure($this->txt("user_not_found"), true);
174 $this->ctrl()->redirect($this, self::CMD_INDEX);
175 }
176
177 $position_id = isset($_POST['user_type']) ? $_POST['user_type'] : 0;
178
179 if (!$position_id && !$position = ilOrgUnitPosition::find($position_id)) {
180 ilUtil::sendFailure($this->txt("user_not_found"), true);
181 $this->ctrl()->redirect($this, self::CMD_INDEX);
182 }
183 foreach ($user_ids as $user_id) {
184 ilOrgUnitUserAssignment::findOrCreateAssignment($user_id, $position_id, $this->getParentRefId());
185 }
186
187 ilUtil::sendSuccess($this->txt("users_successfuly_added"), true);
188 $this->ctrl()->redirect($this, self::CMD_INDEX);
189 }
$_POST["username"]
static _lookupId($a_user_str)
Lookup id by login.
static findOrCreateAssignment($user_id, $position_id, $orgu_id)
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.

References $_POST, ilObjUser\_lookupId(), ilOrgUnitUserAssignment\findOrCreateAssignment(), ILIAS\Modules\OrgUnit\ARHelper\BaseCommands\getParentRefId(), and ilUtil\sendFailure().

Referenced by executeCommand().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ addSubTabs()

ilOrgUnitUserAssignmentGUI::addSubTabs ( )

Reimplemented from ILIAS\Modules\OrgUnit\ARHelper\BaseCommands.

Definition at line 191 of file class.ilOrgUnitUserAssignmentGUI.php.

192 {
193 $this->pushSubTab(self::SUBTAB_ASSIGNMENTS, $this->ctrl()
194 ->getLinkTarget($this, self::CMD_INDEX));
195 $this->pushSubTab(self::SUBTAB_ASSIGNMENTS_RECURSIVE, $this->ctrl()
196 ->getLinkTarget($this, self::CMD_ASSIGNMENTS_RECURSIVE));
197 }

References ILIAS\Modules\OrgUnit\ARHelper\BaseCommands\pushSubTab().

Referenced by assignmentsRecursive(), and index().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ assignmentsRecursive()

ilOrgUnitUserAssignmentGUI::assignmentsRecursive ( )
protected

Definition at line 74 of file class.ilOrgUnitUserAssignmentGUI.php.

75 {
76 $this->addSubTabs();
77 $this->activeSubTab(self::SUBTAB_ASSIGNMENTS_RECURSIVE);
78 // Tables
79 $html = '';
80 foreach (ilOrgUnitPosition::getActiveForPosition($this->getParentRefId()) as $ilOrgUnitPosition) {
81 $ilOrgUnitRecursiveUserAssignmentTableGUI =
83 $this,
84 self::CMD_ASSIGNMENTS_RECURSIVE,
85 $ilOrgUnitPosition
86 );
87 $html .= $ilOrgUnitRecursiveUserAssignmentTableGUI->getHTML();
88 }
89 $this->setContent($html);
90 }
static getActiveForPosition($orgu_ref_id)

References ILIAS\Modules\OrgUnit\ARHelper\BaseCommands\activeSubTab(), addSubTabs(), ilOrgUnitPosition\getActiveForPosition(), ILIAS\Modules\OrgUnit\ARHelper\BaseCommands\getParentRefId(), and ILIAS\Modules\OrgUnit\ARHelper\BaseCommands\setContent().

+ Here is the call graph for this function:

◆ cancel()

ilOrgUnitUserAssignmentGUI::cancel ( )
protected

Reimplemented from ILIAS\Modules\OrgUnit\ARHelper\BaseCommands.

Definition at line 150 of file class.ilOrgUnitUserAssignmentGUI.php.

151 {
152 $this->ctrl()->redirect($this, self::CMD_INDEX);
153 }

Referenced by delete(), and deleteRecursive().

+ Here is the caller graph for this function:

◆ confirm()

ilOrgUnitUserAssignmentGUI::confirm ( )
protected

Definition at line 93 of file class.ilOrgUnitUserAssignmentGUI.php.

94 {
95 $confirmation = $this->getConfirmationGUI();
96 $confirmation->setConfirm($this->txt('remove_user'), self::CMD_DELETE);
97
98 $this->setContent($confirmation->getHTML());
99 }

References ILIAS\Modules\OrgUnit\ARHelper\BaseCommands\setContent().

+ Here is the call graph for this function:

◆ confirmRecursive()

ilOrgUnitUserAssignmentGUI::confirmRecursive ( )
protected

Definition at line 101 of file class.ilOrgUnitUserAssignmentGUI.php.

102 {
103 $confirmation = $this->getConfirmationGUI();
104 $confirmation->setConfirm($this->txt('remove_user'), self::CMD_DELETE_RECURSIVE);
105
106 $this->setContent($confirmation->getHTML());
107 }

References ILIAS\Modules\OrgUnit\ARHelper\BaseCommands\setContent().

+ Here is the call graph for this function:

◆ delete()

ilOrgUnitUserAssignmentGUI::delete ( )
protected

Definition at line 126 of file class.ilOrgUnitUserAssignmentGUI.php.

127 {
128 $r = $this->http()->request();
130 ->getAssignmentOrFail($_POST['usr_id'], $r->getQueryParams()['position_id'], $this->getParentRefId());
131 $ua->delete();
132 ilUtil::sendSuccess($this->txt('remove_successful'), true);
133 $this->cancel();
134 }
static http()
Fetches the global http state from ILIAS.

References $_POST, cancel(), ilOrgUnitUserAssignmentQueries\getInstance(), and ILIAS\FileDelivery\http().

+ Here is the call graph for this function:

◆ deleteRecursive()

ilOrgUnitUserAssignmentGUI::deleteRecursive ( )
protected

Definition at line 136 of file class.ilOrgUnitUserAssignmentGUI.php.

137 {
138 $r = $this->http()->request();
140 ->getAssignmentsOfUserIdAndPosition((int) $_POST['usr_id'], (int) $r->getQueryParams()['position_id'])
141 ;
142
143 foreach ($assignments as $assignment) {
144 $assignment->delete();
145 }
146 ilUtil::sendSuccess($this->txt('remove_successful'), true);
147 $this->cancel();
148 }

References $_POST, cancel(), ilOrgUnitUserAssignmentQueries\getInstance(), and ILIAS\FileDelivery\http().

+ Here is the call graph for this function:

◆ executeCommand()

ilOrgUnitUserAssignmentGUI::executeCommand ( )

Reimplemented from ILIAS\Modules\OrgUnit\ARHelper\BaseCommands.

Definition at line 20 of file class.ilOrgUnitUserAssignmentGUI.php.

21 {
22 if (!ilObjOrgUnitAccess::_checkAccessPositions((int) filter_input(INPUT_GET, "ref_id", FILTER_SANITIZE_NUMBER_INT))) {
23 ilUtil::sendFailure($this->lng()->txt("permission_denied"), true);
24 $this->ctrl()->redirectByClass(ilObjOrgUnitGUI::class);
25 }
26
27 $r = $this->http()->request();
28 switch ($this->ctrl()->getNextClass()) {
29 case strtolower(ilRepositorySearchGUI::class):
30 switch ($this->ctrl()->getCmd()) {
31 case 'addUserFromAutoComplete':
32 if ($r->getQueryParams()['addusertype'] == "staff") {
33 $this->addStaff();
34 }
35 break;
36 default:
37 $repo = new ilRepositorySearchGUI();
38 $this->ctrl()->forwardCommand($repo);
39 break;
40 }
41 break;
42
43 default:
44 parent::executeCommand();
45 break;
46 }
47 }
static _checkAccessPositions(int $ref_id)

References ilObjOrgUnitAccess\_checkAccessPositions(), addStaff(), ILIAS\FileDelivery\http(), and ilUtil\sendFailure().

+ Here is the call graph for this function:

◆ index()

ilOrgUnitUserAssignmentGUI::index ( )
protected

Reimplemented from ILIAS\Modules\OrgUnit\ARHelper\BaseCommands.

Definition at line 50 of file class.ilOrgUnitUserAssignmentGUI.php.

51 {
52 $this->addSubTabs();
53 $this->activeSubTab(self::SUBTAB_ASSIGNMENTS);
54
55 // Header
56 $types = ilOrgUnitPosition::getArray('id', 'title');
57 //$types = array();
58 $this->ctrl()->setParameterByClass(ilRepositorySearchGUI::class, 'addusertype', 'staff');
59 ilRepositorySearchGUI::fillAutoCompleteToolbar($this, $this->dic()->toolbar(), array(
60 'auto_complete_name' => $this->txt('user'),
61 'user_type' => $types,
62 'submit_name' => $this->txt('add'),
63 ));
64
65 // Tables
66 $html = '';
67 foreach (ilOrgUnitPosition::getActiveForPosition($this->getParentRefId()) as $ilOrgUnitPosition) {
68 $ilOrgUnitUserAssignmentTableGUI = new ilOrgUnitUserAssignmentTableGUI($this, self::CMD_INDEX, $ilOrgUnitPosition);
69 $html .= $ilOrgUnitUserAssignmentTableGUI->getHTML();
70 }
71 $this->setContent($html);
72 }
static getArray($key=null, $values=null)
Class ilOrgUnitUserAssignmentTableGUI.
static fillAutoCompleteToolbar($parent_object, ilToolbarGUI $toolbar=null, $a_options=array(), $a_sticky=false)
fill toolbar with

References ILIAS\Modules\OrgUnit\ARHelper\BaseCommands\activeSubTab(), addSubTabs(), ilRepositorySearchGUI\fillAutoCompleteToolbar(), ilOrgUnitPosition\getActiveForPosition(), ActiveRecord\getArray(), ILIAS\Modules\OrgUnit\ARHelper\BaseCommands\getParentRefId(), and ILIAS\Modules\OrgUnit\ARHelper\BaseCommands\setContent().

+ Here is the call graph for this function:

Field Documentation

◆ CMD_ASSIGNMENTS_RECURSIVE

const ilOrgUnitUserAssignmentGUI::CMD_ASSIGNMENTS_RECURSIVE = 'assignmentsRecursive'

Definition at line 15 of file class.ilOrgUnitUserAssignmentGUI.php.

◆ SUBTAB_ASSIGNMENTS

const ilOrgUnitUserAssignmentGUI::SUBTAB_ASSIGNMENTS = 'user_assignments'

Definition at line 17 of file class.ilOrgUnitUserAssignmentGUI.php.

◆ SUBTAB_ASSIGNMENTS_RECURSIVE

const ilOrgUnitUserAssignmentGUI::SUBTAB_ASSIGNMENTS_RECURSIVE = 'user_assignments_recursive'

Definition at line 18 of file class.ilOrgUnitUserAssignmentGUI.php.


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