ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
class.ilOrgUnitUserAssignmentTableGUI.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (c) 1998-2013 ILIAS open source, Extended GPL, see docs/LICENSE */
3 
5 
10 {
11 
15  protected $ilOrgUnitPosition;
19  protected $ctrl;
23  protected $parent_obj;
24 
25 
34  {
35  $this->parent_obj = $parent_obj;
36  $this->ilOrgUnitPosition = $position;
37  $this->ctrl = $GLOBALS["DIC"]->ctrl();
38  $this->setPrefix("il_orgu_" . $position->getId());
39  $this->setFormName('il_orgu_' . $position->getId());
40  $this->setId("il_orgu_" . $position->getId());
41 
42  parent::__construct($parent_obj, $parent_cmd);
43 
44  $this->setFormAction($this->ctrl->getFormAction($parent_obj));
45  $this->setTableHeaders();
46  $this->setTopCommands(true);
47  $this->setEnableHeader(true);
48  $this->setShowRowsSelector(true);
49  $this->setShowTemplates(false);
50  $this->setEnableHeader(true);
51  $this->setEnableTitle(true);
52  $this->setTitle($position->getTitle());
53  $this->setRowTemplate("tpl.staff_row.html", "Modules/OrgUnit");
54  $this->parseData();
55  }
56 
57 
58  protected function setTableHeaders()
59  {
60  $this->addColumn($this->lng->txt("firstname"), "first_name");
61  $this->addColumn($this->lng->txt("lastname"), "last_name");
62  $this->addColumn($this->lng->txt("action"));
63  }
64 
65 
66  public function parseData()
67  {
69  ->getAssignements($_GET["ref_id"], $this->ilOrgUnitPosition));
70 
71  $this->setData($data);
72  }
73 
74 
80  protected function parseRows($user_ids)
81  {
82  $data = array();
83  foreach ($user_ids as $user_id) {
84  $set = array();
85  $this->setRowForUser($set, $user_id);
86  $data[] = $set;
87  }
88 
89  return $data;
90  }
91 
92 
97  protected function setRowForUser(&$set, $user_id)
98  {
99  $user = new ilObjUser($user_id);
100  $set["first_name"] = $user->getFirstname();
101  $set["last_name"] = $user->getLastname();
102  $set["user_object"] = $user;
103  $set["user_id"] = $user_id;
104  }
105 
106 
110  public function fillRow($set)
111  {
112  global $DIC;
113 
114  $lng = $DIC['lng'];
115  $ilAccess = $DIC['ilAccess'];
116  $this->tpl->setVariable("FIRST_NAME", $set["first_name"]);
117  $this->tpl->setVariable("LAST_NAME", $set["last_name"]);
118  // $this->ctrl->setParameterByClass(ilLearningProgressGUI::class, "obj_id", $set["user_id"]);
119  // $this->ctrl->setParameterByClass(ilObjOrgUnitGUI::class, "obj_id", $set["user_id"]);
120  $this->ctrl->setParameterByClass(ilOrgUnitUserAssignmentGUI::class, 'usr_id', $set["user_id"]);
121  $this->ctrl->setParameterByClass(ilOrgUnitUserAssignmentGUI::class, 'position_id', $this->ilOrgUnitPosition->getId());
122  $selection = new ilAdvancedSelectionListGUI();
123  $selection->setListTitle($lng->txt("Actions"));
124  $selection->setId("selection_list_user_lp_" . $set["user_id"]);
125 
126  if ($ilAccess->checkAccess("view_learning_progress", "", $_GET["ref_id"])
129  $selection->addItem($lng->txt("show_learning_progress"), "show_learning_progress", $this->ctrl->getLinkTargetByClass(array(
130  ilAdministrationGUI::class,
131  ilObjOrgUnitGUI::class,
132  ilLearningProgressGUI::class,
133  ), ""));
134  }
135  if ($ilAccess->checkAccess("write", "", $_GET["ref_id"])) {
136  $this->addActions($selection);
137  }
138  $this->tpl->setVariable("ACTIONS", $selection->getHTML());
139  }
140 
141 
145  protected function addActions(&$selection)
146  {
147  $selection->addItem($this->lng->txt("remove"), "delete_from_employees", $this->ctrl->getLinkTargetByClass(ilOrgUnitUserAssignmentGUI::class, ilOrgUnitUserAssignmentGUI::CMD_CONFIRM));
148  }
149 }
global $DIC
Definition: saml.php:7
$_GET["client_id"]
setShowTemplates($a_value)
Toggle templates.
$GLOBALS['loaded']
Global hash that tracks already loaded includes.
setId($a_val)
Set id.
setTitle($a_title, $a_icon=0, $a_icon_alt=0)
Set title and title icon.
static _enabledUserRelatedData()
check wether user related tracking is enabled or not
static _enabledLearningProgress()
check wether learing progress is enabled or not
setTopCommands($a_val)
Set top commands (display command buttons on top of table, too)
Class ilTable2GUI.
setPrefix($a_prefix)
setRowTemplate($a_template, $a_template_dir="")
Set row template.
Create styles array
The data for the language used.
User interface class for advanced drop-down selection lists.
setFormAction($a_form_action, $a_multipart=false)
Set Form action parameter.
Class ilOrgUnitPosition.
__construct(BaseCommands $parent_obj, $parent_cmd, ilOrgUnitPosition $position)
ilOrgUnitUserAssignmentTableGUI constructor.
setFormName($a_formname="")
Set Form name.
addColumn( $a_text, $a_sort_field="", $a_width="", $a_is_checkbox_action_column=false, $a_class="", $a_tooltip="", $a_tooltip_with_html=false)
Add a column to the header.
setShowRowsSelector($a_value)
Toggle rows-per-page selector.
setEnableHeader($a_enableheader)
Set Enable Header.
setEnableTitle($a_enabletitle)
Set Enable Title.
Class ilOrgUnitUserAssignmentTableGUI.