Commit 3c07972e authored by Ruslan Kabalin's avatar Ruslan Kabalin Committed by Francois Marier
Browse files

Show group visiblity in "Group About" and "Find Groups" listings


Signed-off-by: default avatarRuslan Kabalin <ruslan.kabalin@luns.net.uk>
Signed-off-by: default avatarFrancois Marier <francois@catalyst.net.nz>
parent 873fdcd7
...@@ -87,9 +87,9 @@ if ($groups['data']) { ...@@ -87,9 +87,9 @@ if ($groups['data']) {
$groupids[] = $group->id; $groupids[] = $group->id;
} }
$groups['data'] = get_records_sql_assoc( $groups['data'] = get_records_sql_assoc(
"SELECT g1.id, g1.name, g1.description, g1.jointype, g1.grouptype, g1.role, g1.membershiptype, g1.membercount, COUNT(gmr.member) AS requests "SELECT g1.id, g1.name, g1.description, g1.public, g1.jointype, g1.grouptype, g1.role, g1.membershiptype, g1.membercount, COUNT(gmr.member) AS requests
FROM ( FROM (
SELECT g.id, g.name, g.description, g.jointype, g.grouptype, gm.role, t.membershiptype, COUNT(gm.member) AS membercount SELECT g.id, g.name, g.description, g.public, g.jointype, g.grouptype, gm.role, t.membershiptype, COUNT(gm.member) AS membercount
FROM {group} g FROM {group} g
LEFT JOIN {group_member} gm ON (gm.group = g.id) LEFT JOIN {group_member} gm ON (gm.group = g.id)
LEFT JOIN ( LEFT JOIN (
...@@ -110,11 +110,11 @@ if ($groups['data']) { ...@@ -110,11 +110,11 @@ if ($groups['data']) {
INNER JOIN {group_member_request} gmr ON (gmr.group = g.id AND gmr.member = ?) INNER JOIN {group_member_request} gmr ON (gmr.group = g.id AND gmr.member = ?)
) t ON t.id = g.id ) t ON t.id = g.id
WHERE g.id IN (" . implode($groupids, ',') . ') WHERE g.id IN (" . implode($groupids, ',') . ')
GROUP BY g.id, g.name, g.description, g.jointype, g.grouptype, gm.role, t.membershiptype GROUP BY g.id, g.name, g.description, g.public, g.jointype, g.grouptype, gm.role, t.membershiptype
ORDER BY g.name ORDER BY g.name
) g1 ) g1
LEFT JOIN {group_member_request} gmr ON (gmr.group = g1.id) LEFT JOIN {group_member_request} gmr ON (gmr.group = g1.id)
GROUP BY g1.id, g1.name, g1.description, g1.jointype, g1.grouptype, g1.role, g1.membershiptype, g1.membercount', GROUP BY g1.id, g1.name, g1.description, g1.public, g1.jointype, g1.grouptype, g1.role, g1.membershiptype, g1.membercount',
array($USER->get('id'), $USER->get('id'), $USER->get('id'), $USER->get('id')) array($USER->get('id'), $USER->get('id'), $USER->get('id'), $USER->get('id'))
); );
if ($groups['data']) { if ($groups['data']) {
......
...@@ -67,6 +67,7 @@ $string['Admin'] = 'Admin'; ...@@ -67,6 +67,7 @@ $string['Admin'] = 'Admin';
$string['grouptype'] = 'Group type'; $string['grouptype'] = 'Group type';
$string['publiclyviewablegroup'] = 'Publicly Viewable Group?'; $string['publiclyviewablegroup'] = 'Publicly Viewable Group?';
$string['publiclyviewablegroupdescription'] = 'Allow anyone (including people who aren\'t members of this site) to view this group, including the forums?'; $string['publiclyviewablegroupdescription'] = 'Allow anyone (including people who aren\'t members of this site) to view this group, including the forums?';
$string['publicvisibility'] = 'Publicly visible';
$string['usersautoadded'] = 'Users auto-added?'; $string['usersautoadded'] = 'Users auto-added?';
$string['usersautoaddeddescription'] = 'Automatically put all new users into this group?'; $string['usersautoaddeddescription'] = 'Automatically put all new users into this group?';
$string['grouptypedescription'] = '%s > %s'; $string['grouptypedescription'] = '%s > %s';
......
...@@ -1153,18 +1153,18 @@ function group_get_associated_groups($userid, $filter='all', $limit=20, $offset= ...@@ -1153,18 +1153,18 @@ function group_get_associated_groups($userid, $filter='all', $limit=20, $offset=
// gets the groups filtered by above // gets the groups filtered by above
// and the first three members by id // and the first three members by id
$sql = 'SELECT g1.id, g1.name, g1.description, g1.jointype, g1.grouptype, g1.membershiptype, g1.reason, g1.role, g1.membercount, COUNT(gmr.member) AS requests $sql = 'SELECT g1.id, g1.name, g1.description, g1.public, g1.jointype, g1.grouptype, g1.membershiptype, g1.reason, g1.role, g1.membercount, COUNT(gmr.member) AS requests
FROM ( FROM (
SELECT g.id, g.name, g.description, g.jointype, g.grouptype, t.membershiptype, t.reason, t.role, COUNT(gm.member) AS membercount SELECT g.id, g.name, g.description, g.public, g.jointype, g.grouptype, t.membershiptype, t.reason, t.role, COUNT(gm.member) AS membercount
FROM {group} g FROM {group} g
LEFT JOIN {group_member} gm ON (gm.group = g.id)' . LEFT JOIN {group_member} gm ON (gm.group = g.id)' .
$sql . ' $sql . '
WHERE g.deleted = ? WHERE g.deleted = ?
GROUP BY g.id, g.name, g.description, g.jointype, g.grouptype, t.membershiptype, t.reason, t.role GROUP BY g.id, g.name, g.description, g.public, g.jointype, g.grouptype, t.membershiptype, t.reason, t.role
ORDER BY g.name ORDER BY g.name
) g1 ) g1
LEFT JOIN {group_member_request} gmr ON (gmr.group = g1.id) LEFT JOIN {group_member_request} gmr ON (gmr.group = g1.id)
GROUP BY g1.id, g1.name, g1.description, g1.jointype, g1.grouptype, g1.membershiptype, g1.reason, g1.role, g1.membercount'; GROUP BY g1.id, g1.name, g1.description, g1.public, g1.jointype, g1.grouptype, g1.membershiptype, g1.reason, g1.role, g1.membercount';
$groups = get_records_sql_assoc($sql, $values, $offset, $limit); $groups = get_records_sql_assoc($sql, $values, $offset, $limit);
......
<h3><a href="{$WWWROOT}group/view.php?id={$group->id|escape}">{$group->name|escape}</a></h3> <h3><a href="{$WWWROOT}group/view.php?id={$group->id|escape}">{$group->name|escape}</a></h3>
<h6>{foreach name=admins from=$group->admins item=id}<a href="{$WWWROOT}user/view.php?id={$id|escape}">{$id|display_name|escape}</a>{if !$.foreach.admins.last}, {/if}{/foreach}</h6> <h6>{foreach name=admins from=$group->admins item=id}<a href="{$WWWROOT}user/view.php?id={$id|escape}">{$id|display_name|escape}</a>{if !$.foreach.admins.last}, {/if}{/foreach}</h6>
<div>{str tag="grouptype" section="group"}: {$group->grouptypedescription}</div> <div>{str tag="grouptype" section="group"}: {$group->grouptypedescription}</div>
<div>{str tag="publicvisibility" section="group"}: {if $group->public}{str tag="yes"}{else}{str tag="no"}{/if}</div>
{$group->description} {$group->description}
<div>{str tag="memberslist" section="group"} <div>{str tag="memberslist" section="group"}
{foreach name=members from=$group->members item=member} {foreach name=members from=$group->members item=member}
......
...@@ -4,6 +4,7 @@ ...@@ -4,6 +4,7 @@
<a href="{$WWWROOT}user/view.php?id={$id|escape}">{$id|display_name|escape}</a>{if !$.foreach.admins.last}, {/if} <a href="{$WWWROOT}user/view.php?id={$id|escape}">{$id|display_name|escape}</a>{if !$.foreach.admins.last}, {/if}
{/foreach}</li> {/foreach}</li>
<li><label>{str tag="grouptype" section="group"}:</label> {$group->grouptypedescription}</li> <li><label>{str tag="grouptype" section="group"}:</label> {$group->grouptypedescription}</li>
<li><label>{str tag="publicvisibility" section="group"}:</label> {if $group->public}{str tag="yes"}{else}{str tag="no"}{/if}</li>
<li><label>{str tag=Created section=group}:</label> {$group->ctime}</li> <li><label>{str tag=Created section=group}:</label> {$group->ctime}</li>
<li><span><label>{str tag=Members section=group}:</label> {$membercount}&nbsp;</span> <li><span><label>{str tag=Members section=group}:</label> {$membercount}&nbsp;</span>
<span><label>{str tag=Views section=view}:</label> {$viewcount}&nbsp;</span> <span><label>{str tag=Views section=view}:</label> {$viewcount}&nbsp;</span>
......
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