Commit 10bc0473 authored by Richard Mansfield's avatar Richard Mansfield
Browse files

Merge branch 'grouptyperework' of git+ssh://git.mahara.org/git/mahara into grouptyperework

Conflicts:

	htdocs/lib/view.php
	htdocs/view/groupviews.php
parents 648b5607 29602087
......@@ -31,20 +31,19 @@ define('SECTION_PLUGINNAME', 'file');
define('SECTION_PAGE', 'groupfiles');
require(dirname(dirname(dirname(__FILE__))) . '/init.php');
define('TITLE', get_string('groupfiles', 'artefact.file'));
require_once(get_config('libroot') . 'group.php');
safe_require('artefact', 'file');
$javascript = ArtefactTypeFileBase::get_my_files_js(param_integer('folder', null));
$groupid = param_integer('group');
$group = get_record_sql('
SELECT g.id, g.name, g.grouptype, m.role AS userrole
FROM {group} g INNER JOIN {group_member} m ON g.id = m.group
WHERE g.id = ' . $groupid . ' AND m.member = ' . $USER->get('id'));
if (!$group) {
if (!$group = get_record('group', 'id', $groupid, 'deleted', 0)) {
throw new GroupNotFoundException("Couldn't find group with id $groupid");
}
if (!group_user_access($groupid)) {
throw new AccessDeniedException();
}
define('TITLE', $group->name . ' - ' . get_string('groupfiles', 'artefact.file'));
require_once(get_config('docroot') . 'interaction/lib.php');
require_once(get_config('docroot') . 'lib/grouptype/' . $group->grouptype . '.php');
......
......@@ -27,7 +27,6 @@
define('INTERNAL', 1);
define('MENUITEM', 'groups');
require(dirname(dirname(__FILE__)) . '/init.php');
define('TITLE', get_string('groups'));
require_once('group.php');
require_once('searchlib.php');
require_once(get_config('docroot') . 'interaction/lib.php');
......@@ -37,6 +36,7 @@ $id = param_integer('id');
if (!$group = get_record('group', 'id', $id, 'deleted', 0)) {
throw new GroupNotFoundException("Couldn't find group with id $id");
}
define('TITLE', $group->name . ' - ' . get_string('Members', 'group'));
$group->admins = get_column_sql("SELECT member
FROM {group_member}
......
......@@ -27,7 +27,6 @@
define('INTERNAL', 1);
define('MENUITEM', 'groups');
require(dirname(dirname(__FILE__)) . '/init.php');
define('TITLE', get_string('groups'));
require_once('group.php');
require_once('searchlib.php');
require_once(get_config('docroot') . 'interaction/lib.php');
......@@ -37,6 +36,7 @@ $id = param_integer('id');
if (!$group = get_record_select('group', 'id = ? AND deleted = 0', array($id), '*, ' . db_format_tsfield('ctime'))) {
throw new GroupNotFoundException("Couldn't find group with id $id");
}
define('TITLE', $group->name);
$group->ctime = strftime(get_string('strftimedate'), $group->ctime);
$group->admins = get_column_sql("SELECT member
......
......@@ -70,6 +70,8 @@ $string['nobodycanseethisview'] = 'Nobody can see this View';
$string['noviews'] = 'You have no Views.';
$string['viewsownedbygroup'] = 'Views owned by this group';
$string['viewssharedtogroup'] = 'Views shared to this group';
$string['viewsownedby'] = 'Views owned by %s';
$string['viewssharedto'] = 'Views shared to %s';
// access levels
$string['public'] = 'Public';
......
......@@ -35,21 +35,29 @@ require(dirname(dirname(__FILE__)) . '/init.php');
require_once(get_config('libroot') . 'view.php');
require_once(get_config('libroot') . 'group.php');
require_once('pieforms/pieform.php');
define('TITLE', get_string('groupviews', 'view'));
//@todo: group menu; group sideblock
$limit = param_integer('limit', 5);
$offset = param_integer('offset', 0);
$group = param_integer('group');
$limit = param_integer('limit', 5);
$offset = param_integer('offset', 0);
$groupid = param_integer('group');
if (!$group = get_record('group', 'id', $groupid, 'deleted', 0)) {
throw new GroupNotFoundException("Couldn't find group with id $groupid");
}
define('TITLE', $group->name . ' - ' . get_string('groupviews', 'view'));
$member = group_user_access($group);
$member = group_user_access($groupid);
$shared = param_boolean('shared', 0) && $member;
$smarty = smarty();
if ($shared) {
$data = View::get_sharedviews_data($limit, $offset, $group);
$data = View::get_sharedviews_data($limit, $offset, $groupid);
$smarty->assign('shared', true);
$smarty->assign('heading', get_string('viewssharedto', 'view', $group->name));
} else {
$data = View::get_myviews_data($limit, $offset, $group);
$data = View::get_myviews_data($limit, $offset, $groupid);
$smarty->assign('heading', get_string('viewsownedby', 'view', $group->name));
}
$userid = $USER->get('id');
......@@ -63,17 +71,13 @@ $pagination = build_pagination(array(
'resultcounttextplural' => get_string('views', 'view')
));
$groupname = get_field('group', 'name', 'id', $group);
$smarty = smarty();
$smarty->assign('groupid', $group);
$smarty->assign('groupname', $groupname);
$smarty->assign('shared', $shared);
$smarty->assign('groupid', $groupid);
$smarty->assign('groupname', $group->name);
$smarty->assign('member', $member);
$smarty->assign('views', $data->data);
$smarty->assign('pagination', $pagination['html']);
$smarty->assign('heading', get_string('groupviews', 'view'));
if (group_user_can_edit_views($group) && !$shared) {
if (group_user_can_edit_views($groupid) && !$shared) {
$smarty->display('view/index.tpl');
} else {
$smarty->display('view/sharedviews.tpl');
......
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