4 include_once(
"./Services/Table/classes/class.ilTable2GUI.php");
28 $lng->loadLanguageModule(
'grp');
31 $this->obj_id = $ilObjDataCache->lookupObjId($this->ref_id);
33 $this->
setId(
"tblcrsprtgrp");
40 $this->
setTitle($this->lng->txt(
'crs_grp_assignments'));
43 $this->
addColumn($this->lng->txt(
"name"),
"name",
'70%');
44 $this->
addColumn($this->lng->txt(
"crs_groups_nr"),
"groups_number");
45 $this->
addColumn($this->lng->txt(
"groups"));
49 $this->
setFormAction($ilCtrl->getFormAction($a_parent_obj, $a_parent_cmd));
50 $this->
setRowTemplate(
"tpl.crs_members_grp_row.html",
"Modules/Course");
69 global $tree, $ilAccess;
71 $parent_node = $tree->getNodeData($this->ref_id);
72 $groups = $tree->getSubTree($parent_node,
true,
"grp");
75 include_once(
'./Modules/Group/classes/class.ilGroupParticipants.php');
76 $this->participants = $this->groups = $this->groups_rights = array();
77 foreach(
$groups as $idx => $group_data)
80 if($group_data[
"parent"] != $this->ref_id && $tree->checkForParentType($group_data[
"ref_id"],
"grp",
true))
86 $this->groups[$group_data[
"ref_id"]] = $group_data[
"title"];
87 $this->groups_rights[$group_data[
"ref_id"]][
"write"] = (bool)$ilAccess->checkAccess(
"write",
"", $group_data[
"ref_id"]);
88 $this->groups_rights[$group_data[
"ref_id"]][
"edit_permission"] = (bool)$ilAccess->checkAccess(
"edit_permission",
"", $group_data[
"ref_id"]);
90 $this->participants[$group_data[
"ref_id"]][
"members"] = $gobj->getMembers();
91 $this->participants[$group_data[
"ref_id"]][
"admins"] = $gobj->getAdmins();
105 $this->filter[
"name"] = $item->getValue();
110 $item->setOptions(array(
"" => $lng->txt(
"all"))+$this->groups);
111 $this->filter[
"group"] = $item->getValue();
122 include_once(
'./Modules/Course/classes/class.ilCourseParticipants.php');
124 $members = $part->getMembers();
127 include_once
'./Services/User/classes/class.ilUserUtil.php';
131 $user_groups = array(
"members"=>array(),
"admins"=>array());
132 $user_groups_number = 0;
133 foreach(array_keys($this->participants) as $group_id)
135 if(in_array(
$usr_id, $this->participants[$group_id][
"members"]))
137 $user_groups[
"members"][$group_id] = $this->groups[$group_id];
138 $user_groups_number++;
140 else if(in_array(
$usr_id, $this->participants[$group_id][
"admins"]))
142 $user_groups[
"admins"][$group_id] = $this->groups[$group_id];
143 $user_groups_number++;
147 if((!$this->filter[
"name"] || stristr(
$name, $this->filter[
"name"])) &&
148 (!$this->filter[
"group"] || array_key_exists($this->filter[
"group"], $user_groups[
"members"]) ||
149 array_key_exists($this->filter[
"group"], $user_groups[
"admins"])))
151 $usr_data[] = array(
"usr_id" =>
$usr_id,
153 "groups" => $user_groups,
154 "groups_number" => $user_groups_number
160 $usr_data = array_slice($usr_data, (
int)$this->
getOffset(), (
int)$this->
getLimit());
177 $this->tpl->setVariable(
"VAL_ID", $a_set[
"usr_id"]);
179 $this->tpl->setVariable(
"TXT_USER", $a_set[
"name"]);
180 $this->tpl->setVariable(
"VAL_GROUP_NUMBER", $a_set[
"groups_number"]);
182 if(
sizeof($a_set[
"groups"]))
189 if((
$type ==
"admins" && $this->groups_rights[$grp_id][
"edit_permission"]) ||
190 (
$type ==
"members" && $this->groups_rights[$grp_id][
"write"]))
192 $this->tpl->setCurrentBlock(
"groups_remove");
194 $this->tpl->setVariable(
"TXT_GROUP_REMOVE", $lng->txt(
"grp_unsubscribe"));
196 $ilCtrl->setParameter($this->parent_obj,
"usr_id", $a_set[
"usr_id"]);
197 $ilCtrl->setParameter($this->parent_obj,
"grp_id", $grp_id);
198 $this->tpl->setVariable(
"URL_REMOVE", $ilCtrl->getLinkTarget($this->parent_obj,
"confirmremove"));
199 $ilCtrl->setParameter($this->parent_obj,
"grp_id",
"");
200 $ilCtrl->setParameter($this->parent_obj,
"usr_id",
"");
202 $this->tpl->parseCurrentBlock();
205 $this->tpl->setCurrentBlock(
"groups");
206 $this->tpl->setVariable(
"TXT_GROUP_TITLE",
$title);
207 $this->tpl->parseCurrentBlock();