ILIAS  release_8 Revision v8.24
class.ilOrgUnitUserAssignmentTableGUI.php
Go to the documentation of this file.
1<?php
18/* Copyright (c) 1998-2013 ILIAS open source, Extended GPL, see docs/LICENSE */
19
21
26{
28
30 {
31 $this->parent_obj = $parent_obj;
32 $this->ilOrgUnitPosition = $position;
33 $this->ctrl = $GLOBALS["DIC"]->ctrl();
34 $this->setPrefix("il_orgu_" . $position->getId());
35 $this->setFormName('il_orgu_' . $position->getId());
36 $this->setId("il_orgu_" . $position->getId());
37
39
40 $this->setFormAction($this->ctrl->getFormAction($parent_obj));
41 $this->setTableHeaders();
42 $this->setTopCommands(true);
43 $this->setEnableHeader(true);
44 $this->setShowRowsSelector(true);
45 $this->setShowTemplates(false);
46 $this->setEnableHeader(true);
47 $this->setEnableTitle(true);
48 $this->setTitle($position->getTitle());
49 $this->setRowTemplate("tpl.staff_row.html", "Modules/OrgUnit");
50 $this->parseData();
51 }
52
53 private function setTableHeaders(): void
54 {
55 $this->addColumn($this->lng->txt("login"), "login");
56 $this->addColumn($this->lng->txt("firstname"), "first_name");
57 $this->addColumn($this->lng->txt("lastname"), "last_name");
58 $this->addColumn($this->lng->txt("action"));
59 }
60
61 public function parseData(): void
62 {
64 ->getAssignements($_GET["ref_id"], $this->ilOrgUnitPosition));
65 $this->setData($data);
66 }
67
71 private function parseRows(array $user_ids): array
72 {
73 $data = [];
74 foreach ($user_ids as $user_id) {
75 $data[] = $this->getRowForUser($user_id);
76 }
77 return $data;
78 }
79
80 private function getRowForUser(int $user_id): array
81 {
82 $user = new ilObjUser($user_id);
83 return [
84 'login' => $user->getLogin(),
85 'first_name' => $user->getFirstname(),
86 'last_name' => $user->getLastname(),
87 'user_object' => $user,
88 'user_id' => $user_id,
89 'active' => $user->getActive()
90 ];
91 }
92
93 public function fillRow(array $a_set): void
94 {
95 global $DIC;
96
97 $lng = $DIC['lng'];
98 $ilAccess = $DIC['ilAccess'];
99 $this->tpl->setVariable("LOGIN", $a_set["login"]);
100 $this->tpl->setVariable("FIRST_NAME", $a_set["first_name"]);
101 $this->tpl->setVariable("LAST_NAME", $a_set["last_name"]);
102
103 if($a_set["active"] === false) {
104 $this->tpl->setVariable("INACTIVE", $this->lng->txt('usr_account_inactive'));
105 }
106
107 $this->ctrl->setParameterByClass(ilOrgUnitUserAssignmentGUI::class, 'usr_id', $a_set["user_id"]);
108 $this->ctrl->setParameterByClass(
109 ilOrgUnitUserAssignmentGUI::class,
110 'position_id',
111 $this->ilOrgUnitPosition->getId()
112 );
113 $selection = new ilAdvancedSelectionListGUI();
114 $selection->setListTitle($lng->txt("Actions"));
115 $selection->setId("selection_list_user_lp_" . $a_set["user_id"]);
116
117 if ($ilAccess->checkAccess("view_learning_progress", "", $_GET["ref_id"])
120 ) {
121 $this->ctrl->setParameterByClass(ilLearningProgressGUI::class, 'obj_id', $a_set["user_id"]);
122 $selection->addItem(
123 $lng->txt("show_learning_progress"),
124 "show_learning_progress",
125 $this->ctrl->getLinkTargetByClass(array(
126 ilAdministrationGUI::class,
127 ilObjOrgUnitGUI::class,
128 ilLearningProgressGUI::class,
129 ), "")
130 );
131 }
132 if ($ilAccess->checkAccess("write", "", $_GET["ref_id"])) {
133 $selection->addItem(
134 $this->lng->txt("remove"),
135 "delete_from_employees",
136 $this->ctrl->getLinkTargetByClass(
137 ilOrgUnitUserAssignmentGUI::class,
139 )
140 );
141 }
142 $this->tpl->setVariable("ACTIONS", $selection->getHTML());
143 }
144}
if(!defined('PATH_SEPARATOR')) $GLOBALS['_PEAR_default_error_mode']
Definition: PEAR.php:64
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
txt(string $a_topic, string $a_default_lang_fallback_mod="")
gets the text for a given topic if the topic is not in the list, the topic itself with "-" will be re...
User class.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Class ilOrgUnitUserAssignmentTableGUI.
fillRow(array $a_set)
Standard Version of Fill Row.
__construct(BaseCommands $parent_obj, string $parent_cmd, ilOrgUnitPosition $position)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
setShowRowsSelector(bool $a_value)
Toggle rows-per-page selector.
setTitle(string $a_title, string $a_icon="", string $a_icon_alt="")
setEnableTitle(bool $a_enabletitle)
setFormName(string $a_name="")
setShowTemplates(bool $a_value)
setPrefix(string $a_prefix)
set prefix for sort and offset fields (if you have two or more tables on a page that you want to sort...
setFormAction(string $a_form_action, bool $a_multipart=false)
addColumn(string $a_text, string $a_sort_field="", string $a_width="", bool $a_is_checkbox_action_column=false, string $a_class="", string $a_tooltip="", bool $a_tooltip_with_html=false)
setEnableHeader(bool $a_enableheader)
setTopCommands(bool $a_val)
setRowTemplate(string $a_template, string $a_template_dir="")
Set row template.
setId(string $a_val)
setData(array $a_data)
Set table data.
ilLanguage $lng
global $DIC
Definition: feed.php:28
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
$_GET['client_id']
Definition: saml1-acs.php:21