ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
ilOrgUnitPositionGUI Class Reference

Class ilOrgUnitPositionGUI. More...

+ Inheritance diagram for ilOrgUnitPositionGUI:
+ Collaboration diagram for ilOrgUnitPositionGUI:

Public Member Functions

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

Data Fields

const SUBTAB_SETTINGS = 'settings'
 
const SUBTAB_PERMISSIONS = 'obj_orgunit_positions'
 
const CMD_CONFIRM_DELETION = 'confirmDeletion'
 
const CMD_ASSIGN = 'assign'
 
- 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_DELETE = "delete"
 
const CMD_CANCEL = "cancel"
 
const AR_ID = "arid"
 

Protected Member Functions

 getPossibleNextClasses ()
 
 getActiveTabId ()
 
 index ()
 
 add ()
 
 create ()
 
 edit ()
 
 update ()
 
 assign ()
 
 confirmDeletion ()
 
 delete ()
 
 cancel ()
 
 getARIdFromRequest ()
 
 getPositionFromRequest ()
 
- 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

◆ add()

ilOrgUnitPositionGUI::add ( )
protected

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

References $form.

53  {
55  $this->tpl()->setContent($form->getHTML());
56  }
Class ilOrgUnitPositionFormGUI.
if(isset($_POST['submit'])) $form
Class ilOrgUnitPosition.

◆ addSubTabs()

ilOrgUnitPositionGUI::addSubTabs ( )

Definition at line 242 of file class.ilOrgUnitPositionGUI.php.

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

Referenced by edit().

243  {
244  $this->ctrl()->saveParameter($this, 'arid');
245  $this->ctrl()->saveParameterByClass(ilOrgUnitDefaultPermissionGUI::class, 'arid');
246  $this->pushSubTab(self::SUBTAB_SETTINGS, $this->ctrl()
247  ->getLinkTarget($this, self::CMD_INDEX));
248  $this->pushSubTab(self::SUBTAB_PERMISSIONS, $this->ctrl()
249  ->getLinkTargetByClass(ilOrgUnitDefaultPermissionGUI::class, self::CMD_INDEX));
250  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ assign()

ilOrgUnitPositionGUI::assign ( )
protected

Definition at line 96 of file class.ilOrgUnitPositionGUI.php.

References cancel(), ilOrgUnitPosition\CORE_POSITION_EMPLOYEE, ilOrgUnitUserAssignment\findOrCreateAssignment(), ilOrgUnitPosition\getCorePosition(), ilOrgUnitUserAssignmentQueries\getInstance(), getPositionFromRequest(), and ilUtil\sendSuccess().

Referenced by delete().

97  {
98  $position = $this->getPositionFromRequest();
99  if ($position->isCorePosition()) {
100  $this->cancel();
101  }
102  $ilOrgUnitUserAssignmentQueries = ilOrgUnitUserAssignmentQueries::getInstance();
103  $assignments = $ilOrgUnitUserAssignmentQueries->getUserAssignmentsOfPosition($position->getId());
104 
106 
107  foreach ($assignments as $assignment) {
108  ilOrgUnitUserAssignment::findOrCreateAssignment($assignment->getUserId(), $employee_position->getId(), $assignment->getOrguId());
109  $assignment->delete();
110  }
111 
112  ilUtil::sendSuccess($this->txt('msg_assignment_to_employee_done'), true);
113  }
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
static findOrCreateAssignment($user_id, $position_id, $orgu_id)
static getCorePosition($core_identifier)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ cancel()

ilOrgUnitPositionGUI::cancel ( )
protected

Definition at line 170 of file class.ilOrgUnitPositionGUI.php.

Referenced by assign(), and confirmDeletion().

171  {
172  $this->ctrl()->redirect($this, self::CMD_INDEX);
173  }
+ Here is the caller graph for this function:

◆ confirmDeletion()

ilOrgUnitPositionGUI::confirmDeletion ( )
protected

Definition at line 116 of file class.ilOrgUnitPositionGUI.php.

References cancel(), ilOrgUnitUserAssignmentQueries\getInstance(), and getPositionFromRequest().

117  {
118  $position = $this->getPositionFromRequest();
119  if ($position->isCorePosition()) {
120  $this->cancel();
121  }
122  self::initAuthoritiesRenderer();
123  $this->dic()->language()->loadLanguageModule('orgu');
124  $position_string = $this->dic()->language()->txt("position") . ": ";
125  $authority_string = $this->dic()->language()->txt("authorities") . ": ";
126  $user_string = $this->dic()->language()->txt("user_assignments") . ": ";
127  $ilOrgUnitUserAssignmentQueries = ilOrgUnitUserAssignmentQueries::getInstance();
128 
129  $confirmation = new ilConfirmationGUI();
130  $confirmation->setFormAction($this->ctrl()->getFormAction($this));
131  $confirmation->setCancel($this->txt(self::CMD_CANCEL), self::CMD_CANCEL);
132  $confirmation->setConfirm($this->txt(self::CMD_DELETE), self::CMD_DELETE);
133  $confirmation->setHeaderText($this->txt('msg_confirm_deletion'));
134  $confirmation->addItem(self::AR_ID, $position->getId(), $position_string
135  . $position->getTitle());
136  // Authorities
137  $authority_string .= implode(", ", $position->getAuthorities());
138  $confirmation->addItem('authorities', true, $authority_string);
139 
140  // Amount uf user-assignments
141  $userIdsOfPosition = $ilOrgUnitUserAssignmentQueries->getUserIdsOfPosition($position->getId());
142  $ilOrgUnitUserQueries = new ilOrgUnitUserQueries();
143  $usersOfPosition = $ilOrgUnitUserQueries->findAllUsersByUserIds($userIdsOfPosition);
144  $userNames = $ilOrgUnitUserQueries->getAllUserNames($usersOfPosition);
145 
146  $confirmation->addItem('users', true, $user_string . implode(', ', $userNames));
147 
148  $checkbox_assign_users = new ilCheckboxInputGUI('', 'assign_users');
149  $checkbox_assign_users->setChecked(true);
150  $checkbox_assign_users->setValue(1);
151  $checkbox_assign_users->setOptionTitle('Assign affected users to employee role');
152  $confirmation->addItem('assign_users', '', $checkbox_assign_users->render());
153 
154  $this->tpl()->setContent($confirmation->getHTML());
155  }
This class represents a checkbox property in a property form.
Class ilOrgUnitUserQueries.
Confirmation screen class.
+ Here is the call graph for this function:

◆ create()

ilOrgUnitPositionGUI::create ( )
protected

Definition at line 59 of file class.ilOrgUnitPositionGUI.php.

References $form, and ilUtil\sendSuccess().

60  {
62  if ($form->saveObject()) {
63  ilUtil::sendSuccess($this->txt('msg_position_created'), true);
64  $this->ctrl()->redirect($this, self::CMD_INDEX);
65  }
66 
67  $this->tpl()->setContent($form->getHTML());
68  }
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
Class ilOrgUnitPositionFormGUI.
if(isset($_POST['submit'])) $form
Class ilOrgUnitPosition.
+ Here is the call graph for this function:

◆ delete()

ilOrgUnitPositionGUI::delete ( )
protected

Definition at line 158 of file class.ilOrgUnitPositionGUI.php.

References $_POST, assign(), getPositionFromRequest(), and ilUtil\sendSuccess().

159  {
160  if ($_POST['assign_users']) {
161  $this->assign();
162  }
163  $position = $this->getPositionFromRequest();
164  $position->deleteWithAllDependencies();
165  ilUtil::sendSuccess($this->txt('msg_deleted'), true);
166  $this->ctrl()->redirect($this, self::CMD_INDEX);
167  }
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
$_POST["username"]
+ Here is the call graph for this function:

◆ edit()

ilOrgUnitPositionGUI::edit ( )
protected

Definition at line 71 of file class.ilOrgUnitPositionGUI.php.

References $form, ILIAS\Modules\OrgUnit\ARHelper\BaseCommands\activeSubTab(), addSubTabs(), and getPositionFromRequest().

72  {
73  $this->addSubTabs();
74  $this->activeSubTab(self::SUBTAB_SETTINGS);
75  $position = $this->getPositionFromRequest();
76  $form = new ilOrgUnitPositionFormGUI($this, $position);
77  $form->fillForm();
78  $this->tpl()->setContent($form->getHTML());
79  }
Class ilOrgUnitPositionFormGUI.
if(isset($_POST['submit'])) $form
+ Here is the call graph for this function:

◆ getActiveTabId()

ilOrgUnitPositionGUI::getActiveTabId ( )
protected
Returns
string

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

References ilObjOrgUnitGUI\TAB_POSITIONS.

34  {
36  }

◆ getARIdFromRequest()

ilOrgUnitPositionGUI::getARIdFromRequest ( )
protected
Returns
mixed

Definition at line 179 of file class.ilOrgUnitPositionGUI.php.

References $post.

Referenced by getPositionFromRequest().

180  {
181  $get = $this->dic()->http()->request()->getQueryParams()[self::AR_ID];
182  $post = $this->dic()->http()->request()->getParsedBody()[self::AR_ID];
183 
184  return $post ? $post : $get;
185  }
$post
Definition: post.php:34
+ Here is the caller graph for this function:

◆ getPositionFromRequest()

ilOrgUnitPositionGUI::getPositionFromRequest ( )
protected
Returns

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

References $GLOBALS, $id, $key, $lang, $t, array, ActiveRecord\findOrGetInstance(), getARIdFromRequest(), ilOrgUnitAuthority\OVER_EVERYONE, ilOrgUnitAuthority\replaceNameRenderer(), ilOrgUnitAuthority\SCOPE_ALL_ORGUS, ilOrgUnitAuthority\SCOPE_SAME_ORGU, and ilOrgUnitAuthority\SCOPE_SUBSEQUENT_ORGUS.

Referenced by assign(), confirmDeletion(), delete(), edit(), and update().

192  {
193  return ilOrgUnitPosition::find($this->getARIdFromRequest());
194  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getPossibleNextClasses()

ilOrgUnitPositionGUI::getPossibleNextClasses ( )
protected
Returns
array

Definition at line 21 of file class.ilOrgUnitPositionGUI.php.

References array.

22  {
23  return array(
24  ilOrgUnitDefaultPermissionGUI::class,
25  ilOrgUnitUserAssignmentGUI::class,
26  );
27  }
Create styles array
The data for the language used.

◆ index()

ilOrgUnitPositionGUI::index ( )
protected

Definition at line 39 of file class.ilOrgUnitPositionGUI.php.

References $table, ilLinkButton\getInstance(), and ILIAS\Modules\OrgUnit\ARHelper\BaseCommands\setContent().

40  {
41  self::initAuthoritiesRenderer();
43  $b->setUrl($this->ctrl()->getLinkTarget($this, self::CMD_ADD));
44  $b->setCaption('add_position');
45  $this->dic()->toolbar()->addButtonInstance($b);
46 
47  $table = new ilOrgUnitPositionTableGUI($this, self::CMD_INDEX);
48  $this->setContent($table->getHTML());
49  }
if(empty($password)) $table
Definition: pwgen.php:24
Class ilOrgUnitPositionTableGUI.
+ Here is the call graph for this function:

◆ update()

ilOrgUnitPositionGUI::update ( )
protected

Definition at line 82 of file class.ilOrgUnitPositionGUI.php.

References $form, getPositionFromRequest(), and ilUtil\sendSuccess().

83  {
84  $position = $this->getPositionFromRequest();
85  $form = new ilOrgUnitPositionFormGUI($this, $position);
86  $form->setValuesByPost();
87  if ($form->saveObject()) {
88  ilUtil::sendSuccess($this->txt('msg_position_updated'), true);
89  $this->ctrl()->redirect($this, self::CMD_INDEX);
90  }
91 
92  $this->tpl()->setContent($form->getHTML());
93  }
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
Class ilOrgUnitPositionFormGUI.
if(isset($_POST['submit'])) $form
+ Here is the call graph for this function:

Field Documentation

◆ CMD_ASSIGN

const ilOrgUnitPositionGUI::CMD_ASSIGN = 'assign'

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

◆ CMD_CONFIRM_DELETION

const ilOrgUnitPositionGUI::CMD_CONFIRM_DELETION = 'confirmDeletion'

◆ SUBTAB_PERMISSIONS

const ilOrgUnitPositionGUI::SUBTAB_PERMISSIONS = 'obj_orgunit_positions'

Definition at line 13 of file class.ilOrgUnitPositionGUI.php.

Referenced by ilOrgUnitDefaultPermissionGUI\index().

◆ SUBTAB_SETTINGS

const ilOrgUnitPositionGUI::SUBTAB_SETTINGS = 'settings'

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


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