ILIAS  release_9 Revision v9.13-25-g2c18ec4c24f
ilOrgUnitPositionGUI Class Reference

Class ilOrgUnitPositionGUI. More...

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

Public Member Functions

 __construct ()
 
 addSubTabs ()
 
- Public Member Functions inherited from ILIAS\Modules\OrgUnit\ARHelper\BaseCommands
 getParentGui ()
 
 setParentGui (BaseCommands $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_CONFIRM_RECURSIVE = "confirmRecursive"
 
const CMD_DELETE = "delete"
 
const CMD_DELETE_RECURSIVE = "deleteRecursive"
 
const CMD_CANCEL = "cancel"
 
const AR_ID = "arid"
 

Protected Member Functions

 getPossibleNextClasses ()
 
 getActiveTabId ()
 
 index ()
 
 add ()
 
 create ()
 
 edit ()
 
 update ()
 
 assign ()
 
 confirmDeletion ()
 
 delete ()
 
 cancel ()
 
 getPositionFromRequest ()
 
- Protected Member Functions inherited from ILIAS\Modules\OrgUnit\ARHelper\BaseCommands
 __construct ()
 
 index ()
 
 getPossibleNextClasses ()
 
 getActiveTabId ()
 
 cancel ()
 
 setContent (string $html)
 
 pushSubTab (string $subtab_id, string $url)
 
 activeSubTab (string $subtab_id)
 
 getParentRefId ()
 

Protected Attributes

ilToolbarGUI $toolbar
 
ILIAS UI Component Link Factory $link_factory
 
ilOrgUnitPositionDBRepository $positionRepo
 
ilOrgUnitUserAssignmentDBRepository $assignmentRepo
 
- Protected Attributes inherited from ILIAS\Modules\OrgUnit\ARHelper\BaseCommands
BaseCommands $parent_gui = null
 

Private Member Functions

 getAuthorityDescription (array $authorities)
 Returns descriptions for authorities as an array of strings. More...
 

Private Attributes

ilCtrl $ctrl
 
ilGlobalTemplateInterface $tpl
 
ilLanguage $lng
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ilOrgUnitPositionGUI::__construct ( )

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

References $DIC, $dic, $ref_id, ILIAS\MetaData\Repository\Validation\Data\__construct(), ilObjOrgUnitAccess\_checkAccessPositions(), ILIAS\Repository\ctrl(), ilOrgUnitLocalDIC\dic(), ILIAS\Repository\initRequest(), ILIAS\Repository\lng(), and ILIAS\Repository\toolbar().

45  {
47  $this->positionRepo = $dic["repo.Positions"];
48  $this->assignmentRepo = $dic["repo.UserAssignments"];
49  $this->ctrl = $dic['ctrl'];
50  $this->lng = $dic['lng'];
51 
52  $to_int = $dic['refinery']->kindlyTo()->int();
53  $ref_id = $dic['query']->retrieve('ref_id', $to_int);
54  $this->link_factory = $dic['ui.factory']->link();
55 
57 
58  global $DIC;
59  $this->toolbar = $DIC->toolbar();
60  $this->tpl = $DIC->ui()->mainTemplate();
61 
62  $this->initRequest(
63  $DIC->http(),
64  $dic['refinery']
65  );
66 
68  $this->tpl->setOnScreenMessage('failure', $this->lng->txt("permission_denied"), true);
69  $this->ctrl->redirectByClass(ilObjOrgUnitGUI::class);
70  }
71  }
global $DIC
Definition: feed.php:28
initRequest(HTTP\Services $http, Refinery\Factory $refinery, ?array $passed_query_params=null, ?array $passed_post_data=null)
Query params and post data parameters are used for testing.
$ref_id
Definition: ltiauth.php:67
__construct(VocabulariesInterface $vocabularies)
static _checkAccessPositions(int $ref_id)
$dic
Definition: result.php:32
+ Here is the call graph for this function:

Member Function Documentation

◆ add()

ilOrgUnitPositionGUI::add ( )
protected

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

99  : void
100  {
101  $form = new ilOrgUnitPositionFormGUI($this, $this->positionRepo->create());
102  $this->tpl->setContent($form->getHTML());
103  }
Class ilOrgUnitPositionFormGUI.

◆ addSubTabs()

ilOrgUnitPositionGUI::addSubTabs ( )

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

References ILIAS\Repository\ctrl(), and ILIAS\Modules\OrgUnit\ARHelper\BaseCommands\pushSubTab().

Referenced by edit().

216  : void
217  {
218  $this->ctrl->saveParameter($this, 'arid');
219  $this->ctrl->saveParameterByClass(ilOrgUnitDefaultPermissionGUI::class, 'arid');
220  $this->pushSubTab(self::SUBTAB_SETTINGS, $this->ctrl
221  ->getLinkTarget($this, self::CMD_EDIT));
222  $this->pushSubTab(self::SUBTAB_PERMISSIONS, $this->ctrl
223  ->getLinkTargetByClass(
224  ilOrgUnitDefaultPermissionGUI::class,
225  self::CMD_INDEX
226  ));
227  }
pushSubTab(string $subtab_id, string $url)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ assign()

ilOrgUnitPositionGUI::assign ( )
protected

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

References cancel(), ilOrgUnitPosition\CORE_POSITION_EMPLOYEE, getPositionFromRequest(), and ILIAS\Repository\lng().

Referenced by delete().

139  : void
140  {
141  $position = $this->getPositionFromRequest();
142  if ($position->isCorePosition()) {
143  $this->cancel();
144  }
145 
146  $employee_position = $this->positionRepo->getSingle(ilOrgUnitPosition::CORE_POSITION_EMPLOYEE, 'core_identifier');
147  $assignments = $this->assignmentRepo->getByPosition($position->getId());
148  foreach ($assignments as $assignment) {
149  $this->assignmentRepo->store($assignment->withPositionId($employee_position->getId()));
150  }
151 
152  $this->tpl->setOnScreenMessage('success', $this->lng->txt('msg_assignment_to_employee_done'), true);
153  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ cancel()

ilOrgUnitPositionGUI::cancel ( )
protected

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

References ILIAS\Repository\ctrl().

Referenced by assign(), and confirmDeletion().

205  : void
206  {
207  $this->ctrl->redirect($this, self::CMD_INDEX);
208  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ confirmDeletion()

ilOrgUnitPositionGUI::confirmDeletion ( )
protected

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

References cancel(), ILIAS\Repository\ctrl(), getAuthorityDescription(), getPositionFromRequest(), and ILIAS\Repository\lng().

155  : void
156  {
157  $position = $this->getPositionFromRequest();
158  if ($position->isCorePosition()) {
159  $this->cancel();
160  }
161  $this->lng->loadLanguageModule('orgu');
162  $position_string = $this->lng->txt("position") . ": ";
163  $authority_string = $this->lng->txt("authorities") . ": ";
164  $user_string = $this->lng->txt("user_assignments") . ": ";
165 
166  $confirmation = new ilConfirmationGUI();
167  $confirmation->setFormAction($this->ctrl->getFormAction($this));
168  $confirmation->setCancel($this->lng->txt(self::CMD_CANCEL), self::CMD_CANCEL);
169  $confirmation->setConfirm($this->lng->txt(self::CMD_DELETE), self::CMD_DELETE);
170  $confirmation->setHeaderText($this->lng->txt('msg_confirm_deletion'));
171  $confirmation->addItem(self::AR_ID, (string) $position->getId(), $position_string
172  . $position->getTitle());
173  // Authorities
174  $authority_string .= implode(", ", $this->getAuthorityDescription($position->getAuthorities()));
175  $confirmation->addItem('authorities', '', $authority_string);
176 
177  // Amount uf user-assignments
178  $userIdsOfPosition = $this->assignmentRepo->getUsersByPosition($position->getId());
179  $ilOrgUnitUserQueries = new ilOrgUnitUserQueries();
180  $usersOfPosition = $ilOrgUnitUserQueries->findAllUsersByUserIds($userIdsOfPosition);
181  $userNames = $ilOrgUnitUserQueries->getAllUserNames($usersOfPosition);
182 
183  $confirmation->addItem('users', '', $user_string . implode(', ', $userNames));
184 
185  $checkbox_assign_users = new ilCheckboxInputGUI('', 'assign_users');
186  $checkbox_assign_users->setChecked(true);
187  $checkbox_assign_users->setValue('1');
188  $checkbox_assign_users->setOptionTitle('Assign affected users to employee role');
189  $confirmation->addItem('assign_users', '', $checkbox_assign_users->render());
190 
191  $this->tpl->setContent($confirmation->getHTML());
192  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
getAuthorityDescription(array $authorities)
Returns descriptions for authorities as an array of strings.
+ Here is the call graph for this function:

◆ create()

ilOrgUnitPositionGUI::create ( )
protected

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

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

105  : void
106  {
107  $form = new ilOrgUnitPositionFormGUI($this, $this->positionRepo->create());
108  if ($form->saveObject() === true) {
109  $this->tpl->setOnScreenMessage('success', $this->lng->txt('msg_position_created'), true);
110  $this->ctrl->redirect($this, self::CMD_INDEX);
111  }
112 
113  $this->tpl->setContent($form->getHTML());
114  }
Class ilOrgUnitPositionFormGUI.
+ Here is the call graph for this function:

◆ delete()

ilOrgUnitPositionGUI::delete ( )
protected

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

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

194  : void
195  {
196  if ($_POST['assign_users']) {
197  $this->assign();
198  }
199  $position = $this->getPositionFromRequest();
200  $this->positionRepo->delete($position->getId());
201  $this->tpl->setOnScreenMessage('success', $this->lng->txt('msg_deleted'), true);
202  $this->ctrl->redirect($this, self::CMD_INDEX);
203  }
+ Here is the call graph for this function:

◆ edit()

ilOrgUnitPositionGUI::edit ( )
protected

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

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

116  : void
117  {
118  $this->addSubTabs();
119  $this->activeSubTab(self::SUBTAB_SETTINGS);
120  $position = $this->getPositionFromRequest();
121  $form = new ilOrgUnitPositionFormGUI($this, $position);
122  $form->fillForm();
123  $this->tpl->setContent($form->getHTML());
124  }
Class ilOrgUnitPositionFormGUI.
+ Here is the call graph for this function:

◆ getActiveTabId()

ilOrgUnitPositionGUI::getActiveTabId ( )
protected

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

References ilObjOrgUnitGUI\TAB_POSITIONS.

81  : string
82  {
84  }

◆ getAuthorityDescription()

ilOrgUnitPositionGUI::getAuthorityDescription ( array  $authorities)
private

Returns descriptions for authorities as an array of strings.

Parameters
ilOrgUnitAuthority[]$authorities

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

References ILIAS\LTI\ToolProvider\$key, $lang, $lng, ilOrgUnitAuthority\OVER_EVERYONE, ilOrgUnitAuthority\SCOPE_SAME_ORGU, and ilOrgUnitAuthority\SCOPE_SUBSEQUENT_ORGUS.

Referenced by confirmDeletion().

234  : array
235  {
236  $lang = $this->lng;
237  $lang->loadLanguageModule('orgu');
238  $lang_keys = array(
239  'in',
240  'over',
244  );
245  $t = [];
246  foreach ($lang_keys as $key) {
247  $t[$key] = $lang->txt($key);
248  }
249 
250  $authority_description = [];
251  foreach ($authorities as $authority) {
252  switch ($authority->getOver()) {
254  $over_txt = $t["over_" . $authority->getOver()];
255  break;
256  default:
257  $over_txt = $this->positionRepo
258  ->getSingle($authority->getOver(), 'id')
259  ->getTitle();
260  break;
261  }
262 
263  $authority_description[] = " " . $t["over"] . " " . $over_txt . " " . $t["in"] . " " . $t["scope_" . $authority->getScope()];
264  }
265 
266  return $authority_description;
267  }
string $key
Consumer key/client ID value.
Definition: System.php:193
$lang
Definition: xapiexit.php:26
+ Here is the caller graph for this function:

◆ getPositionFromRequest()

ilOrgUnitPositionGUI::getPositionFromRequest ( )
protected

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

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

211  {
212  return $this->positionRepo->getSingle($this->int(self::AR_ID), 'id');
213  }
+ Here is the caller graph for this function:

◆ getPossibleNextClasses()

ilOrgUnitPositionGUI::getPossibleNextClasses ( )
protected

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

73  : array
74  {
75  return array(
76  ilOrgUnitDefaultPermissionGUI::class,
77  ilOrgUnitUserAssignmentGUI::class,
78  );
79  }

◆ index()

ilOrgUnitPositionGUI::index ( )
protected

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

References $url, ILIAS\Repository\ctrl(), ILIAS\Repository\lng(), ILIAS\Modules\OrgUnit\ARHelper\BaseCommands\setContent(), and ILIAS\Repository\toolbar().

86  : void
87  {
88  $url = $this->ctrl->getLinkTarget($this, self::CMD_ADD);
89  $link = $this->link_factory->standard(
90  $this->lng->txt('add_position'),
91  $url
92  );
93  $this->toolbar->addComponent($link);
94 
95  $table = new ilOrgUnitPositionTableGUI($this, self::CMD_INDEX);
96  $this->setContent($table->getHTML());
97  }
$url
Definition: ltiregstart.php:35
Class ilOrgUnitPositionTableGUI.
+ Here is the call graph for this function:

◆ update()

ilOrgUnitPositionGUI::update ( )
protected

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

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

126  : void
127  {
128  $position = $this->getPositionFromRequest();
129  $form = new ilOrgUnitPositionFormGUI($this, $position);
130  $form->setValuesByPost();
131  if ($form->saveObject() === true) {
132  $this->tpl->setOnScreenMessage('success', $this->lng->txt('msg_position_updated'), true);
133  $this->ctrl->redirect($this, self::CMD_INDEX);
134  }
135 
136  $this->tpl->setContent($form->getHTML());
137  }
Class ilOrgUnitPositionFormGUI.
+ Here is the call graph for this function:

Field Documentation

◆ $assignmentRepo

ilOrgUnitUserAssignmentDBRepository ilOrgUnitPositionGUI::$assignmentRepo
protected

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

◆ $ctrl

ilCtrl ilOrgUnitPositionGUI::$ctrl
private

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

◆ $link_factory

ILIAS UI Component Link Factory ilOrgUnitPositionGUI::$link_factory
protected

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

◆ $lng

ilLanguage ilOrgUnitPositionGUI::$lng
private

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

Referenced by getAuthorityDescription().

◆ $positionRepo

ilOrgUnitPositionDBRepository ilOrgUnitPositionGUI::$positionRepo
protected

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

◆ $toolbar

ilToolbarGUI ilOrgUnitPositionGUI::$toolbar
protected

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

◆ $tpl

ilGlobalTemplateInterface ilOrgUnitPositionGUI::$tpl
private

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

◆ CMD_ASSIGN

const ilOrgUnitPositionGUI::CMD_ASSIGN = 'assign'

Definition at line 35 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 33 of file class.ilOrgUnitPositionGUI.php.

Referenced by ilOrgUnitDefaultPermissionGUI\index().

◆ SUBTAB_SETTINGS

const ilOrgUnitPositionGUI::SUBTAB_SETTINGS = 'settings'

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


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