Commit 739614d7 authored by Robert Lyon's avatar Robert Lyon Committed by Gerrit Code Review

Merge "Bug 1813500: Consolidate Find Groups and My Groups into one page"

parents f12cc1c9 6e2a97a6
......@@ -66,7 +66,7 @@ class PluginArtefactBlog extends PluginArtefact {
}
else if ($groupid) {
define('GROUP', $groupid);
define('MENUITEM', 'engage/mygroups');
define('MENUITEM', 'engage/index');
define('MENUITEM_SUBPAGE', 'blogs');
}
else {
......
......@@ -10,7 +10,7 @@
*/
define('INTERNAL', 1);
define('MENUITEM', 'engage/mygroups');
define('MENUITEM', 'engage/index');
define('MENUITEM_SUBPAGE', 'files');
define('SECTION_PLUGINTYPE', 'artefact');
define('SECTION_PLUGINNAME', 'file');
......
......@@ -409,7 +409,7 @@ class PluginArtefactInternal extends PluginArtefact {
return 'artefact/internal/index.php?fs=general';
break;
case 'joingroup':
return 'group/find.php';
return 'group/index.php?filter=notmember';
break;
case 'makefriend':
return 'user/find.php';
......
......@@ -27,7 +27,7 @@ $groupid = $collection->get('group');
$institutionname = $collection->get('institution');
$urlparams = array();
if (!empty($groupid)) {
define('MENUITEM', 'engage/mygroups');
define('MENUITEM', 'engage/index');
define('MENUITEM_SUBPAGE', 'views');
define('GROUP', $groupid);
$group = group_current_group();
......
......@@ -49,7 +49,7 @@ if ($collection->is_submitted()) {
$urlparams = array();
if (!empty($groupid)) {
require_once('group.php');
define('MENUITEM', 'engage/mygroups');
define('MENUITEM', 'engage/index');
define('MENUITEM_SUBPAGE', 'views');
define('GROUP', $groupid);
$group = group_current_group();
......
......@@ -57,7 +57,7 @@ $groupid = $collection->get('group');
$institutionname = $collection->get('institution');
$urlparams = array();
if (!empty($groupid)) {
define('MENUITEM', 'engage/mygroups');
define('MENUITEM', 'engage/index');
define('MENUITEM_SUBPAGE', 'views');
define('GROUP', $groupid);
$group = group_current_group();
......
......@@ -11,7 +11,7 @@
define('PUBLIC', 1);
define('INTERNAL', 1);
define('MENUITEM', 'engage/mygroups');
define('MENUITEM', 'engage/index');
define('MENUITEM_SUBPAGE', 'members');
require(dirname(dirname(__FILE__)) . '/init.php');
require_once('group.php');
......
......@@ -10,7 +10,7 @@
*/
define('INTERNAL', 1);
define('MENUITEM', 'engage/mygroups');
define('MENUITEM', 'engage/index');
define('MENUITEM_SUBPAGE', 'members');
require(dirname(dirname(__FILE__)) . '/init.php');
require_once('group.php');
......
......@@ -53,5 +53,5 @@ function deletegroup_submit(Pieform $form, $values) {
global $SESSION, $USER, $groupid;
group_delete($groupid);
$SESSION->add_ok_msg(get_string('deletegroup', 'group'));
redirect('/group/mygroups.php');
redirect('/group/index.php');
}
......@@ -10,7 +10,7 @@
*/
define('INTERNAL', 1);
define('MENUITEM', 'engage/mygroups');
define('MENUITEM', 'engage/index');
define('MENUITEM_SUBPAGE', 'info');
require(dirname(dirname(__FILE__)) . '/init.php');
require_once('group.php');
......@@ -23,7 +23,7 @@ if ($id = param_integer('id', null)) {
if (!group_user_can_configure($id)) {
$SESSION->add_error_msg(get_string('canteditdontown', 'group'));
redirect('/group/mygroups.php');
redirect('/group/index.php');
}
$group_data = group_get_groups_for_editing(array($id));
......@@ -128,7 +128,7 @@ $form = array(
'type' => 'submitcancel',
'class' => 'btn-primary',
'value' => array(get_string('savegroup', 'group'), get_string('cancel')),
'goto' => get_config('wwwroot') . 'group/mygroups.php',
'goto' => get_config('wwwroot') . 'group/index.php',
),
),
);
......@@ -295,7 +295,7 @@ if ($cancreatecontrolled) {
$elements['hidden'] = array(
'type' => 'switchbox',
'title' => get_string('hiddengroup', 'group'),
'description' => get_string('hiddengroupdescription1', 'group'),
'description' => get_string('hiddengroupdescription2', 'group'),
'defaultvalue' => $group_data->hidden,
);
$elements['hidemembers'] = array(
......@@ -493,7 +493,7 @@ function editgroup_validate(Pieform $form, $values) {
}
function editgroup_cancel_submit() {
redirect('/group/mygroups.php');
redirect('/group/index.php');
}
function editgroup_submit(Pieform $form, $values) {
......
......@@ -22,8 +22,17 @@ $groupcategory = param_signed_integer('groupcategory', 0);
$setlimit = param_boolean('setlimit', false);
$query = param_variable('query', '');
/* $searchmode will switch between 2 search funcs (with different queries)
* $searchmode = 'find' uses search_group
* $searchmode = 'mygroups' uses group_get_associated_groups
*/
$searchmode = 'find';
// check that the filter is valid, if not default to 'all'
if (in_array($filter, array('member', 'notmember', 'canjoin'))) {
if (in_array($filter, array('allmy', 'member', 'admin', 'invite', 'notmember', 'canjoin'))) {
if ($filter == 'allmy' || $filter == 'admin' || $filter == 'invite') {
$searchmode = 'mygroups';
}
$type = $filter;
}
else { // all or some other text
......@@ -31,55 +40,65 @@ else { // all or some other text
$type = 'all';
}
$groups = search_group($query, $groupsperpage, $offset, $type, $groupcategory);
$groups = array();
if ($searchmode == 'mygroups') {
$results = group_get_associated_groups($USER->get('id'), $type, $groupsperpage, $offset, $groupcategory, $query);
$groups['data'] = isset($results['groups']) ? $results['groups'] : array();
$groups['count'] = isset($results['count']) ? $results['count'] : 0;
}
else {
$groups = search_group($query, $groupsperpage, $offset, $type, $groupcategory);
}
// gets more data about the groups found by search_group
// including type if the user is associated with the group in some way
if ($groups['data']) {
$groupids = array();
foreach ($groups['data'] as $group) {
$groupids[] = $group->id;
}
$groups['data'] = get_records_sql_array("
SELECT g1.id, g1.name, g1.description, g1.public, g1.jointype, g1.request, g1.grouptype, g1.submittableto,
g1.hidemembers, g1.hidemembersfrommembers, g1.urlid, g1.role, g1.membershiptype, g1.membercount, COUNT(gmr.member) AS requests,
g1.editwindowstart, g1.editwindowend
FROM (
SELECT g.id, g.name, g.description, g.public, g.jointype, g.request, g.grouptype, g.submittableto,
g.hidemembers, g.hidemembersfrommembers, g.urlid, t.role, t.membershiptype, COUNT(gm.member) AS membercount,
g.editwindowstart, g.editwindowend
FROM {group} g
LEFT JOIN {group_member} gm ON (gm.group = g.id)
LEFT JOIN (
SELECT g.id, 'admin' AS membershiptype, gm.role AS role
if ($searchmode == 'find') {
if ($groups['data']) {
$groupids = array();
foreach ($groups['data'] as $group) {
$groupids[] = $group->id;
}
$groups['data'] = get_records_sql_array("
SELECT g1.id, g1.name, g1.description, g1.public, g1.jointype, g1.request, g1.grouptype, g1.submittableto,
g1.hidemembers, g1.hidemembersfrommembers, g1.urlid, g1.role, g1.membershiptype, g1.membercount, COUNT(gmr.member) AS requests,
g1.editwindowstart, g1.editwindowend
FROM (
SELECT g.id, g.name, g.description, g.public, g.jointype, g.request, g.grouptype, g.submittableto,
g.hidemembers, g.hidemembersfrommembers, g.urlid, t.role, t.membershiptype, COUNT(gm.member) AS membercount,
g.editwindowstart, g.editwindowend
FROM {group} g
INNER JOIN {group_member} gm ON (gm.group = g.id AND gm.member = ? AND gm.role = 'admin')
UNION
SELECT g.id, 'member' AS membershiptype, gm.role AS role
FROM {group} g
INNER JOIN {group_member} gm ON (g.id = gm.group AND gm.member = ? AND gm.role != 'admin')
UNION
SELECT g.id, 'invite' AS membershiptype, gmi.role
FROM {group} g
INNER JOIN {group_member_invite} gmi ON (gmi.group = g.id AND gmi.member = ?)
UNION
SELECT g.id, 'request' AS membershiptype, NULL as role
FROM {group} g
INNER JOIN {group_member_request} gmr ON (gmr.group = g.id AND gmr.member = ?)
) t ON t.id = g.id
WHERE g.id IN (" . implode($groupids, ',') . ')
GROUP BY g.id, g.name, g.description, g.public, g.jointype, g.request, g.grouptype, g.submittableto,
g.hidemembers, g.hidemembersfrommembers, g.urlid, t.role, t.membershiptype, g.editwindowstart, g.editwindowend
) g1
LEFT JOIN {group_member_request} gmr ON (gmr.group = g1.id)
GROUP BY g1.id, g1.name, g1.description, g1.public, g1.jointype, g1.request, g1.grouptype, g1.submittableto,
g1.hidemembers, g1.hidemembersfrommembers, g1.urlid, g1.role, g1.membershiptype, g1.membercount, g1.editwindowstart, g1.editwindowend
ORDER BY g1.name',
array($USER->get('id'), $USER->get('id'), $USER->get('id'), $USER->get('id'))
);
LEFT JOIN {group_member} gm ON (gm.group = g.id)
LEFT JOIN (
SELECT g.id, 'admin' AS membershiptype, gm.role AS role
FROM {group} g
INNER JOIN {group_member} gm ON (gm.group = g.id AND gm.member = ? AND gm.role = 'admin')
UNION
SELECT g.id, 'member' AS membershiptype, gm.role AS role
FROM {group} g
INNER JOIN {group_member} gm ON (g.id = gm.group AND gm.member = ? AND gm.role != 'admin')
UNION
SELECT g.id, 'invite' AS membershiptype, gmi.role
FROM {group} g
INNER JOIN {group_member_invite} gmi ON (gmi.group = g.id AND gmi.member = ?)
UNION
SELECT g.id, 'request' AS membershiptype, NULL as role
FROM {group} g
INNER JOIN {group_member_request} gmr ON (gmr.group = g.id AND gmr.member = ?)
) t ON t.id = g.id
WHERE g.id IN (" . implode($groupids, ',') . ')
GROUP BY g.id, g.name, g.description, g.public, g.jointype, g.request, g.grouptype, g.submittableto,
g.hidemembers, g.hidemembersfrommembers, g.urlid, t.role, t.membershiptype, g.editwindowstart, g.editwindowend
) g1
LEFT JOIN {group_member_request} gmr ON (gmr.group = g1.id)
GROUP BY g1.id, g1.name, g1.description, g1.public, g1.jointype, g1.request, g1.grouptype, g1.submittableto,
g1.hidemembers, g1.hidemembersfrommembers, g1.urlid, g1.role, g1.membershiptype, g1.membercount, g1.editwindowstart, g1.editwindowend
ORDER BY g1.name',
array($USER->get('id'), $USER->get('id'), $USER->get('id'), $USER->get('id'))
);
}
}
group_prepare_usergroups_for_display($groups['data'], 'find');
group_prepare_usergroups_for_display($groups['data']);
$params = array();
$params['filter'] = $filter;
......@@ -91,12 +110,12 @@ if ($query) {
}
$pagination = build_pagination(array(
'url' => get_config('wwwroot') . 'group/find.php' . ($params ? ('?' . http_build_query($params)) : ''),
'url' => get_config('wwwroot') . 'group/index.php' . ($params ? ('?' . http_build_query($params)) : ''),
'count' => $groups['count'],
'limit' => $groupsperpage,
'offset' => $offset,
'datatable' => 'findgroups',
'jsonscript' => 'group/find.json.php',
'jsonscript' => 'group/index.json.php',
'setlimit' => true,
'jumplinks' => 6,
'numbersincludeprevnext' => 2,
......@@ -119,4 +138,4 @@ json_reply(false, array(
'offset' => $offset,
'setlimit' => $setlimit,
)
));
\ No newline at end of file
));
......@@ -9,29 +9,40 @@
*
*/
define('INTERNAL', 1);
define('MENUITEM', 'engage/find');
define('MENUITEM', 'engage/index');
require(dirname(dirname(__FILE__)) . '/init.php');
define('TITLE', get_string('findgroups'));
define('TITLE', get_string('groups'));
require_once('group.php');
require_once('searchlib.php');
$filter = param_alpha('filter', 'canjoin');
$filter = param_alpha('filter', 'allmy');
$offset = param_integer('offset', 0);
$groupcategory = param_signed_integer('groupcategory', 0);
$groupsperpage = 10;
$query = param_variable('query', '');
define('SECTION_PLUGINTYPE', 'core');
define('SECTION_PLUGINNAME', 'group');
define('SECTION_PAGE', 'find');
define('SECTION_PAGE', 'index');
/* $searchmode will switch between 2 search funcs (with different queries)
* $searchmode = 'find' uses search_group
* $searchmode = 'mygroups' uses group_get_associated_groups
*/
$searchmode = 'find';
// check that the filter is valid, if not default to 'all'
if (in_array($filter, array('member', 'notmember', 'canjoin'))) {
if (in_array($filter, array('allmy', 'member', 'admin', 'invite', 'notmember', 'canjoin'))) {
if ($filter == 'allmy' || $filter == 'admin' || $filter == 'invite') {
$searchmode = 'mygroups';
}
$type = $filter;
}
else { // all or some other text
$filter = 'all';
$type = 'all';
}
$elements = array();
$queryfield = array(
'title' => get_string('search') . ': ',
......@@ -45,9 +56,12 @@ $filterfield = array(
'type' => 'select',
'class' => 'dropdown-connect js-dropdown-connect',
'options' => array(
'allmy' => get_string('allmygroups', 'group'),
'member' => get_string('groupsimin', 'group'),
'admin' => get_string('groupsiown', 'group'),
'invite' => get_string('groupsiminvitedto', 'group'),
'canjoin' => get_string('groupsicanjoin', 'group'),
'notmember' => get_string('groupsnotin', 'group'),
'member' => get_string('groupsimin', 'group'),
'all' => get_string('allgroups', 'group')
),
'defaultvalue' => $filter);
......@@ -93,7 +107,8 @@ if (get_config('allowgroupcategories')
)
);
} else {
}
else {
$elements['searchfield'] = array(
'type' => 'submit',
......@@ -113,23 +128,32 @@ $searchform = pieform(array(
)
);
$groups = search_group($query, $groupsperpage, $offset, $type, $groupcategory);
$groups = array();
if ($searchmode == 'mygroups') {
$results = group_get_associated_groups($USER->get('id'), $type, $groupsperpage, $offset, $groupcategory, $query);
$groups['data'] = isset($results['groups']) ? $results['groups'] : array();
$groups['count'] = isset($results['count']) ? $results['count'] : 0;
}
else {
$groups = search_group($query, $groupsperpage, $offset, $type, $groupcategory);
}
// gets more data about the groups found by search_group
// including type if the user is associated with the group in some way
if ($groups['data']) {
$groupids = array();
foreach ($groups['data'] as $group) {
$groupids[] = $group->id;
}
$groups['data'] = get_records_sql_array("
if ($searchmode == 'find') {
if ($groups['data']) {
$groupids = array();
foreach ($groups['data'] as $group) {
$groupids[] = $group->id;
}
$groups['data'] = get_records_sql_array("
SELECT g1.id, g1.name, g1.description, g1.public, g1.jointype, g1.request, g1.grouptype, g1.submittableto,
g1.hidemembers, g1.hidemembersfrommembers, g1.urlid, g1.role, g1.membershiptype, g1.membercount, COUNT(gmr.member) AS requests,
g1.editwindowstart, g1.editwindowend
g1.hidemembers, g1.hidemembersfrommembers, g1.urlid, g1.role, g1.membershiptype, g1.membercount, COUNT(gmr.member) AS requests,
g1.editwindowstart, g1.editwindowend
FROM (
SELECT g.id, g.name, g.description, g.public, g.jointype, g.request, g.grouptype, g.submittableto,
g.hidemembers, g.hidemembersfrommembers, g.urlid, t.role, t.membershiptype, COUNT(gm.member) AS membercount,
g.editwindowstart, g.editwindowend
g.hidemembers, g.hidemembersfrommembers, g.urlid, t.role, t.membershiptype, COUNT(gm.member) AS membercount,
g.editwindowstart, g.editwindowend
FROM {group} g
LEFT JOIN {group_member} gm ON (gm.group = g.id)
LEFT JOIN (
......@@ -148,23 +172,25 @@ if ($groups['data']) {
SELECT g.id, 'request' AS membershiptype, NULL as role
FROM {group} g
INNER JOIN {group_member_request} gmr ON (gmr.group = g.id AND gmr.member = ?)
) t ON t.id = g.id
WHERE g.id IN (" . implode($groupids, ',') . ')
GROUP BY g.id, g.name, g.description, g.public, g.jointype, g.request, g.grouptype, g.submittableto,
) t ON t.id = g.id
WHERE g.id IN (" . implode($groupids, ',') . ')
GROUP BY g.id, g.name, g.description, g.public, g.jointype, g.request, g.grouptype, g.submittableto,
g.hidemembers, g.hidemembersfrommembers, g.urlid, t.role, t.membershiptype, g.editwindowstart, g.editwindowend
) g1
LEFT JOIN {group_member_request} gmr ON (gmr.group = g1.id)
GROUP BY g1.id, g1.name, g1.description, g1.public, g1.jointype, g1.request, g1.grouptype, g1.submittableto,
g1.hidemembers, g1.hidemembersfrommembers, g1.urlid, g1.role, g1.membershiptype, g1.membercount, g1.editwindowstart, g1.editwindowend
ORDER BY g1.name',
array($USER->get('id'), $USER->get('id'), $USER->get('id'), $USER->get('id'))
);
) g1
LEFT JOIN {group_member_request} gmr ON (gmr.group = g1.id)
GROUP BY g1.id, g1.name, g1.description, g1.public, g1.jointype, g1.request, g1.grouptype, g1.submittableto,
g1.hidemembers, g1.hidemembersfrommembers, g1.urlid, g1.role, g1.membershiptype, g1.membercount, g1.editwindowstart, g1.editwindowend
ORDER BY g1.name',
array($USER->get('id'), $USER->get('id'), $USER->get('id'), $USER->get('id'))
);
}
}
group_prepare_usergroups_for_display($groups['data'], 'find');
group_prepare_usergroups_for_display($groups['data']);
$params = array();
$params['filter'] = $filter;
if ($groupcategory != 0) {
$params['groupcategory'] = $groupcategory;
}
......@@ -173,12 +199,12 @@ if ($query) {
}
$pagination = build_pagination(array(
'url' => get_config('wwwroot') . 'group/find.php' . ($params ? ('?' . http_build_query($params)) : ''),
'url' => get_config('wwwroot') . 'group/index.php' . ($params ? ('?' . http_build_query($params)) : ''),
'count' => $groups['count'],
'limit' => $groupsperpage,
'offset' => $offset,
'datatable' => 'findgroups',
'jsonscript' => 'group/find.json.php',
'jsonscript' => 'group/index.json.php',
'setlimit' => true,
'jumplinks' => 6,
'numbersincludeprevnext' => 2,
......@@ -187,15 +213,16 @@ $pagination = build_pagination(array(
));
function search_submit(Pieform $form, $values) {
redirect('/group/find.php?filter=' . $values['filter'] . ((isset($values['query']) && ($values['query'] != '')) ? '&query=' . urlencode($values['query']) : '') . (!empty($values['groupcategory']) ? '&groupcategory=' . intval($values['groupcategory']) : ''));
redirect('/group/index.php?filter=' . $values['filter'] . ((isset($values['query']) && ($values['query'] != '')) ? '&query=' . urlencode($values['query']) : '') . (!empty($values['groupcategory']) ? '&groupcategory=' . intval($values['groupcategory']) : ''));
}
$smarty = smarty(array('paginator'));
setpageicon($smarty, 'icon-comments-o');
$smarty->assign('groups', $groups['data']);
$smarty->assign('cancreate', group_can_create_groups());
$html = $smarty->fetch('group/mygroupresults.tpl');
$smarty->assign('groupresults', $html);
$smarty->assign('form', $searchform);
$smarty->assign('pagination', $pagination['html']);
$smarty->assign('pagination_js', $pagination['javascript']);
$smarty->display('group/find.tpl');
$smarty->display('group/index.tpl');
......@@ -11,7 +11,7 @@
define('PUBLIC', 1);
define('INTERNAL', 1);
define('MENUITEM', 'engage/mygroups');
define('MENUITEM', 'engage/index');
define('MENUITEM_SUBPAGE', 'members');
require(dirname(dirname(__FILE__)) . '/init.php');
require_once('group.php');
......
......@@ -14,7 +14,6 @@ define('MENUITEM', 'groups');
require(dirname(dirname(__FILE__)) . '/init.php');
require_once('group.php');
$groupid = param_integer('id');
$returnto = param_alpha('returnto', 'mygroups');
define('GROUP', $groupid);
$group = group_current_group();
......@@ -29,7 +28,7 @@ if (!group_user_can_leave($group)) {
throw new AccessDeniedException(get_string('cantleavegroup', 'group'));
}
$goto = get_config('wwwroot') . 'group/' . $returnto . '.php' . ($returnto == 'view' ? ('?id=' . $groupid) : '');
$goto = get_config('wwwroot') . 'group/index.php';
$form = pieform(array(
'name' => 'leavegroup',
......@@ -42,10 +41,6 @@ $form = pieform(array(
'type' => 'submitcancel',
'value' => array(get_string('yes'), get_string('no')),
'goto' => $goto
),
'returnto' => array(
'type' => 'hidden',
'value' => $returnto
)
),
));
......
......@@ -11,7 +11,7 @@
define('PUBLIC', 1);
define('INTERNAL', 1);
define('MENUITEM', 'engage/mygroups');
define('MENUITEM', 'engage/index');
define('MENUITEM_SUBPAGE', 'members');
require(dirname(dirname(__FILE__)) . '/init.php');
require_once('group.php');
......
<?php
/**
*
* @package mahara
* @subpackage core
* @author Catalyst IT Ltd
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL version 3 or later
* @copyright For copyright information on Mahara, please see the README file distributed with this software.
*
*/
define('INTERNAL', 1);
define('JSON', 1);
require(dirname(dirname(__FILE__)) . '/init.php');
require_once('group.php');
$filter = param_alpha('filter', 'all');
$offset = param_integer('offset', 'all');
$setlimit = param_boolean('setlimit', false);
$groupcategory = param_signed_integer('groupcategory', 0);
$groupsperpage = param_integer('limit', 10);
$offset = (int)($offset / $groupsperpage) * $groupsperpage;
$results = group_get_associated_groups($USER->get('id'), $filter, $groupsperpage, $offset, $groupcategory);
$params = array();
if ($filter != 'all') {
$params['filter'] = $filter;
}
if ($groupcategory != 0) {
$params['groupcategory'] = $groupcategory;
}
$pagination = build_pagination(array(
'url' => get_config('wwwroot') . 'group/mygroups.php' . (!empty($params) ? ('?' . http_build_query($params)) : ''),
'count' => $results['count'],
'limit' => $groupsperpage,
'offset' => $offset,
'setlimit' => true,
'datatable' => 'mygroups',
'jsonscript' => 'group/mygroups.json.php',
'jumplinks' => 6,
'numbersincludeprevnext' => 2,
'resultcounttextsingular' => get_string('group', 'group'),
'resultcounttextplural' => get_string('groups', 'group'),
));
group_prepare_usergroups_for_display($results['groups'], 'mygroups');
$smarty = smarty_core();
$smarty->assign('groups', $results['groups']);
$smarty->assign('filter', $filter);
$html = $smarty->fetch('group/mygroupresults.tpl');
json_reply(false, array(
'message' => null,
'data' => array(
'tablerows' => $html,
'pagination' => $pagination['html'],
'pagination_js' => $pagination['javascript'],
'count' => $results['count'],
'results' => $results['count'] . ' ' . ($results['count'] == 1 ? get_string('result') : get_string('results')),
'offset' => $offset,
'setlimit' => $setlimit,
)
));
<?php
/**
*
* @package mahara
* @subpackage core
* @author Catalyst IT Ltd
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL version 3 or later
* @copyright For copyright information on Mahara, please see the README file distributed with this software.
*
*/
define('INTERNAL', 1);
define('MENUITEM', 'engage/mygroups');
require(dirname(dirname(__FILE__)) . '/init.php');
define('TITLE', get_string('mygroups'));
define('SECTION_PLUGINTYPE', 'core');
define('SECTION_PLUGINNAME', 'group');
define('SECTION_PAGE', 'mygroups');
require_once('group.php');
$filter = param_alpha('filter', 'all');
$offset = param_integer('offset', 0);
$groupcategory = param_signed_integer('groupcategory', 0);
$groupsperpage = 10;
$offset = (int)($offset / $groupsperpage) * $groupsperpage;
$results = group_get_associated_groups($USER->get('id'), $filter, $groupsperpage, $offset, $groupcategory);
$elements = array();
$elements['options'] = array(
'title' => get_string('filter'),
'hiddenlabel' => true,
'type' => 'select',
'options' => array(
'all' => get_string('allmygroups', 'group'),
'admin' => get_string('groupsiown', 'group'),