24 ilOrgUnitDefaultPermissionGUI::class,
25 ilOrgUnitUserAssignmentGUI::class,
41 self::initAuthoritiesRenderer();
43 $b->setUrl($this->ctrl()->getLinkTarget($this, self::CMD_ADD));
44 $b->setCaption(
'add_position');
45 $this->dic()->toolbar()->addButtonInstance($b);
52 protected function add()
55 $this->tpl()->setContent(
$form->getHTML());
62 if (
$form->saveObject()) {
64 $this->ctrl()->redirect($this, self::CMD_INDEX);
67 $this->tpl()->setContent(
$form->getHTML());
78 $this->tpl()->setContent(
$form->getHTML());
86 $form->setValuesByPost();
87 if (
$form->saveObject()) {
89 $this->ctrl()->redirect($this, self::CMD_INDEX);
92 $this->tpl()->setContent(
$form->getHTML());
99 if ($position->isCorePosition()) {
103 $assignments = $ilOrgUnitUserAssignmentQueries->getUserAssignmentsOfPosition($position->getId());
107 foreach ($assignments as $assignment) {
109 $assignment->delete();
119 if ($position->isCorePosition()) {
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") .
": ";
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());
137 $authority_string .= implode(
", ", $position->getAuthorities());
138 $confirmation->addItem(
'authorities',
true, $authority_string);
141 $userIdsOfPosition = $ilOrgUnitUserAssignmentQueries->getUserIdsOfPosition($position->getId());
143 $usersOfPosition = $ilOrgUnitUserQueries->findAllUsersByUserIds($userIdsOfPosition);
144 $userNames = $ilOrgUnitUserQueries->getAllUserNames($usersOfPosition);
146 $confirmation->addItem(
'users',
true, $user_string . implode(
', ', $userNames));
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());
154 $this->tpl()->setContent($confirmation->getHTML());
158 protected function delete()
160 if (
$_POST[
'assign_users']) {
164 $position->deleteWithAllDependencies();
166 $this->ctrl()->redirect($this, self::CMD_INDEX);
172 $this->ctrl()->redirect($this, self::CMD_INDEX);
181 $get = $this->dic()->http()->request()->getQueryParams()[self::AR_ID];
182 $post = $this->dic()->http()->request()->getParsedBody()[self::AR_ID];
197 public static function initAuthoritiesRenderer()
200 $lang->loadLanguageModule(
'orgu');
208 foreach ($lang_keys as
$key) {
216 $ilOrgUnitAuthority = ilOrgUnitAuthority::find(
$id);
218 switch ($ilOrgUnitAuthority->getScope()) {
223 $in_txt =
$t[
"scope_" . $ilOrgUnitAuthority->getScope()];
227 switch ($ilOrgUnitAuthority->getOver()) {
229 $over_txt =
$t[
"over_" . $ilOrgUnitAuthority->getOver()];
237 return " " .
$t[
"over"] .
" " . $over_txt .
" " .
$t[
"in"] .
" " . $in_txt;
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));
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
static findOrCreateAssignment($user_id, $position_id, $orgu_id)
const CORE_POSITION_EMPLOYEE
$GLOBALS['loaded']
Global hash that tracks already loaded includes.
if(!array_key_exists('StateId', $_REQUEST)) $id
static getCorePosition($core_identifier)
Class ilOrgUnitPositionGUI.
if(isset($_POST['submit'])) $form
pushSubTab($subtab_id, $url)
static replaceNameRenderer(Closure $closure)
Create styles array
The data for the language used.
Class ilOrgUnitUserQueries.
static findOrGetInstance($primary_key, array $add_constructor_args=array())
if(empty($password)) $table
Class ilOrgUnitPositionTableGUI.
const CMD_CONFIRM_DELETION
const SCOPE_SUBSEQUENT_ORGUS
Confirmation screen class.