Commit 3bf3443e authored by Clare Lenihan's avatar Clare Lenihan Committed by Clare Lenihan
Browse files

added comments

parent 7c58a477
...@@ -75,6 +75,11 @@ else if ($filter == 'all'){ ...@@ -75,6 +75,11 @@ else if ($filter == 'all'){
$groups = search_group($query, $groupsperpage, $offset, $type); $groups = search_group($query, $groupsperpage, $offset, $type);
// gets more data about the groups found by search_group
// including type if the user is associated with the group in some way
// and the first three members by id
// does this by finding the lowest id, then the next lowest, then the third lowest in subselects
// which is just horrible :(
if ($groups['data']) { if ($groups['data']) {
$groupids = array(); $groupids = array();
foreach ($groups['data'] as $group) { foreach ($groups['data'] as $group) {
......
...@@ -59,6 +59,7 @@ $form = pieform(array( ...@@ -59,6 +59,7 @@ $form = pieform(array(
), ),
)); ));
// different filters join on the different kinds of association
if ($filter == 'all') { if ($filter == 'all') {
$sql = ' $sql = '
INNER JOIN ( INNER JOIN (
...@@ -121,6 +122,13 @@ else if ($filter == 'request') { ...@@ -121,6 +122,13 @@ else if ($filter == 'request') {
$count = count_records_sql('SELECT COUNT(g.*) FROM {group} g ' . $sql, $values); $count = count_records_sql('SELECT COUNT(g.*) FROM {group} g ' . $sql, $values);
// almost the same as query used in find - common parts should probably be pulled out
// gets the groups filtered by
// including type if the user is associated with the group in some way
// and the first three members by id
// does this by finding the lowest id, then the next lowest, then the third lowest in subselects
// which is just horrible :(
$sql = 'SELECT g.id, g.name, g.description, g.owner, g.jointype, m.member1 AS member1, m.member2 AS member2, t.type, MIN(gm.member) AS member3, COUNT(gm2.*) AS membercount, COUNT(gmr.*) AS requests $sql = 'SELECT g.id, g.name, g.description, g.owner, g.jointype, m.member1 AS member1, m.member2 AS member2, t.type, MIN(gm.member) AS member3, COUNT(gm2.*) AS membercount, COUNT(gmr.*) AS requests
FROM {group} g FROM {group} g
LEFT JOIN ( LEFT JOIN (
......
...@@ -56,6 +56,7 @@ function group_user_can_leave($group, $userid=null) { ...@@ -56,6 +56,7 @@ function group_user_can_leave($group, $userid=null) {
/** /**
* removes a user from a group * removes a user from a group
* removed view access given by the user to the group
* *
* @param int $group id of group * @param int $group id of group
* @param int $user id of user to remove * @param int $user id of user to remove
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment