4 include_once(
"./Services/Table/classes/class.ilTable2GUI.php");
24 public function __construct($a_parent_obj, $a_parent_cmd, $ref_id)
29 $ilObjDataCache = $DIC[
'ilObjDataCache'];
32 $lng->loadLanguageModule(
'grp');
34 $this->ref_id = $ref_id;
35 $this->obj_id = $ilObjDataCache->lookupObjId($this->ref_id);
37 $this->
setId(
'tblcrsprtgrp_' . $ref_id);
39 parent::__construct($a_parent_obj, $a_parent_cmd);
44 $this->
setTitle($this->lng->txt(
'crs_grp_assignments'));
47 $this->
addColumn($this->lng->txt(
"name"),
"name",
'35%');
48 $this->
addColumn($this->lng->txt(
"login"),
"login",
'35%');
49 $this->
addColumn($this->lng->txt(
"crs_groups_nr"),
"groups_number");
50 $this->
addColumn($this->lng->txt(
"groups"));
55 $this->
setRowTemplate(
"tpl.crs_members_grp_row.html",
"Modules/Course");
61 $selectable_groups = [];
62 foreach ($this->groups as $ref_id => $something) {
63 if ($this->groups_rights[$ref_id][
'manage_members']) {
64 $selectable_groups[$ref_id] = $this->groups[$ref_id];
67 if (count($selectable_groups)) {
72 $this->lng->txt(
"crs_add_to_group")
91 $ilAccess = $DIC[
'ilAccess'];
93 $parent_node =
$tree->getNodeData($this->ref_id);
96 include_once(
'./Modules/Group/classes/class.ilGroupParticipants.php');
97 $this->participants = $this->groups = $this->groups_rights = array();
98 foreach (
$groups as $idx => $group_data) {
100 if ($group_data[
"parent"] != $this->ref_id &&
$tree->checkForParentType($group_data[
"ref_id"],
"grp",
true)) {
103 $this->groups[$group_data[
"ref_id"]] = $group_data[
"title"];
104 $this->groups_rights[$group_data[
"ref_id"]][
"manage_members"] = (bool)
105 $GLOBALS[
'DIC']->access()->checkRbacOrPositionPermissionAccess(
108 $group_data[
'ref_id']
112 $this->groups_rights[$group_data[
"ref_id"]][
"edit_permission"] = (bool)
113 $GLOBALS[
'DIC']->access()->checkAccess(
116 $group_data[
"ref_id"]
121 $members =
$GLOBALS[
'DIC']->access()->filterUserIdsByRbacOrPositionOfCurrentUser(
124 $group_data[
'ref_id'],
127 $admins =
$GLOBALS[
'DIC']->access()->filterUserIdsByRbacOrPositionOfCurrentUser(
130 $group_data[
'ref_id'],
134 $this->participants[$group_data[
"ref_id"]][
"members"] = $members;
135 $this->participants[$group_data[
"ref_id"]][
"admins"] = $admins;
151 $this->filter[
"name"] = $item->getValue();
155 $item->setOptions(array(
"" =>
$lng->txt(
"all")) + $this->groups);
156 $this->filter[
"group"] = $item->getValue();
166 include_once(
'./Modules/Course/classes/class.ilCourseParticipants.php');
168 $members =
$GLOBALS[
'DIC']->access()->filterUserIdsByRbacOrPositionOfCurrentUser(
175 if (count($members)) {
176 include_once
'./Services/User/classes/class.ilUserUtil.php';
178 foreach ($members as $usr_id) {
181 $user_groups = array(
"members" => array(),
"admins" => array());
182 $user_groups_number = 0;
183 foreach (array_keys($this->participants) as $group_id) {
184 if (in_array($usr_id, $this->participants[$group_id][
"members"])) {
185 $user_groups[
"members"][$group_id] = $this->groups[$group_id];
186 $user_groups_number++;
187 } elseif (in_array($usr_id, $this->participants[$group_id][
"admins"])) {
188 $user_groups[
"admins"][$group_id] = $this->groups[$group_id];
189 $user_groups_number++;
193 if ((!$this->filter[
"name"] || stristr(implode(
"",
$name), $this->filter[
"name"])) &&
194 (!$this->filter[
"group"] || array_key_exists($this->filter[
"group"], $user_groups[
"members"]) ||
195 array_key_exists($this->filter[
"group"], $user_groups[
"admins"]))) {
196 $usr_data[] = array(
"usr_id" => $usr_id,
197 "name" =>
$name[
"lastname"] .
", " .
$name[
"firstname"],
198 "groups" => $user_groups,
199 "groups_number" => $user_groups_number,
200 "login" => $name[
"login"]
206 $usr_data = array_slice($usr_data, (
int) $this->
getOffset(), (
int) $this->
getLimit());
226 $this->tpl->setVariable(
"VAL_ID", $a_set[
"usr_id"]);
228 $this->tpl->setVariable(
"TXT_USER", $a_set[
"name"]);
229 $this->tpl->setVariable(
"TXT_LOGIN", $a_set[
"login"]);
230 $this->tpl->setVariable(
"VAL_GROUP_NUMBER", $a_set[
"groups_number"]);
232 if (
sizeof($a_set[
"groups"])) {
236 (
$type ==
"admins" && $this->groups_rights[$grp_id][
"edit_permission"]) ||
237 (
$type ==
"members" && $this->groups_rights[$grp_id][
"manage_members"])
239 $this->tpl->setCurrentBlock(
"groups_remove");
241 $this->tpl->setVariable(
"TXT_GROUP_REMOVE",
$lng->txt(
"grp_unsubscribe"));
243 $ilCtrl->setParameter($this->parent_obj,
"usr_id", $a_set[
"usr_id"]);
244 $ilCtrl->setParameter($this->parent_obj,
"grp_id", $grp_id);
245 $this->tpl->setVariable(
"URL_REMOVE",
$ilCtrl->getLinkTarget($this->parent_obj,
"confirmremove"));
246 $ilCtrl->setParameter($this->parent_obj,
"grp_id",
"");
247 $ilCtrl->setParameter($this->parent_obj,
"usr_id",
"");
249 $this->tpl->parseCurrentBlock();
252 $this->tpl->setCurrentBlock(
"groups");
253 $this->tpl->setVariable(
"TXT_GROUP_TITLE",
$title);
254 $this->tpl->parseCurrentBlock();
static _lookupName($a_user_id)
lookup user name
__construct($a_parent_obj, $a_parent_cmd, $ref_id)
Constructor.
initGroups()
find groups in course, exclude groups in groups
static _getInstanceByObjId($a_obj_id)
Get singleton instance.
addFilterItemByMetaType($id, $type=self::FILTER_TEXT, $a_optional=false, $caption=null)
Add filter by standard type.
setTitle($a_title, $a_icon=0, $a_icon_alt=0)
Set title and title icon.
setSelectAllCheckbox($a_select_all_checkbox, $a_select_all_on_top=false)
Set the name of the checkbox that should be toggled with a select all button.
setRowTemplate($a_template, $a_template_dir="")
Set row template.
static _getInstanceByObjId($a_obj_id)
Get singleton instance.
addMultiItemSelectionButton($a_sel_var, $a_options, $a_cmd, $a_text, $a_default_selection='')
Add Selection List + Command button for selected items.
setFormAction($a_form_action, $a_multipart=false)
Set Form action parameter.
fillRow($a_set)
Fill table row.
getItems()
Build item rows for given object and filter(s)
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.
setEnableHeader($a_enableheader)
Set Enable Header.
setMaxCount($a_max_count)
set max.
$GLOBALS['JPEG_Segment_Names']
Global Variable: XMP_tag_captions.
setLimit($a_limit=0, $a_default_limit=0)