Commit 79c87954 authored by Richard Mansfield's avatar Richard Mansfield
Browse files

Group sideblock

parent d35207dc
......@@ -53,16 +53,7 @@ browser.setgroup({$group->id});
uploader.setgroup({$group->id});
GROUPJS;
$smarty = smarty(
array('tablerenderer', 'artefact/file/js/file.js'),
array(),
array(),
array(
'sideblocks' => array(
interaction_sideblock($group->id),
),
)
);
$smarty = smarty(array('tablerenderer', 'artefact/file/js/file.js'));
$smarty->assign('heading', $group->name . ' - ' . get_string('Files', 'artefact.file'));
$smarty->assign('INLINEJAVASCRIPT', $javascript);
$smarty->display('artefact:file:index.tpl');
......
......@@ -100,7 +100,7 @@ function changerole_submit(Pieform $form, $values) {
define('TITLE', $group->name . ' - ' . get_string('changerole', 'group'));
$smarty = smarty(array(), array(), array(), array('sideblocks' => array(interaction_sideblock($group->id, $role))));
$smarty = smarty();
$smarty->assign('subtitle', get_string('changeroleofuseringroup', 'group', display_name($user), $group->name));
$smarty->assign('changeform', $changeform);
......
......@@ -50,9 +50,7 @@ $offset = param_integer('offset', 0);
$limit = param_integer('limit', 10);
list($html, $pagination, $count, $offset, $membershiptype) = group_get_membersearch_data($group->id, $query, $offset, $limit, $membershiptype);
$smarty = smarty(array('groupmembersearch'), array(), array(), array(
'sideblocks' => array(interaction_sideblock($group->id, $role)),
));
$smarty = smarty(array('groupmembersearch'));
$smarty->assign('query', $query);
$smarty->assign('results', $html);
$smarty->assign('pagination', $pagination['html']);
......
......@@ -94,7 +94,7 @@ $foruminfo = get_records_sql_array('
p.ctime DESC
LIMIT 5;
', array($group->id));
$smarty = smarty(array(), array(), array(), array('sideblocks' => array(interaction_sideblock($group->id, $role))));
$smarty = smarty();
$smarty->assign('group', $group);
$smarty->assign('groupid', $group->id);
$smarty->assign('foruminfo', $foruminfo);
......
......@@ -66,7 +66,7 @@ $form = pieform(array(
)
));
$smarty = smarty(array('tablerenderer'), array(), array(), array('sideblocks' => array(interaction_sideblock($group->id))));
$smarty = smarty(array('tablerenderer'));
$smarty->assign('form', $form);
$smarty->assign('heading', TITLE);
$smarty->assign('message', get_string('deleteinteractionsure', 'group'));
......
......@@ -80,7 +80,7 @@ $form = pieform(array(
)
);
$smarty = smarty(array('tablerenderer'), array(), array(), array('sideblocks' => array(interaction_sideblock($groupid))));
$smarty = smarty(array('tablerenderer'));
$smarty->assign('form', $form);
$smarty->assign('heading', TITLE);
$smarty->display('interaction/edit.tpl');
......
......@@ -137,7 +137,7 @@ function deletepost_submit(Pieform $form, $values) {
redirect('/interaction/forum/topic.php?id=' . $values['topic'] . '#post' . $values['parent']);
}
$smarty = smarty(array(), array(), array(), array('sideblocks' => array(interaction_sideblock($post->group))));
$smarty = smarty();
$smarty->assign('breadcrumbs', $breadcrumbs);
$smarty->assign('heading', TITLE);
$smarty->assign('post', $post);
......
......@@ -126,7 +126,7 @@ function deletetopic_submit(Pieform $form, $values) {
redirect('/interaction/forum/view.php?id=' . $values['forum']);
}
$smarty = smarty(array(), array(), array(), array('sideblocks' => array(interaction_sideblock($topic->group))));
$smarty = smarty();
$smarty->assign('breadcrumbs', $breadcrumbs);
$smarty->assign('forum', $topic->title);
$smarty->assign('heading', TITLE);
......
......@@ -241,9 +241,7 @@ function addpost_submit(Pieform $form, $values) {
redirect('/interaction/forum/topic.php?id=' . $values['topic'] . '#post' . $postid);
}
$smarty = smarty(array(), array(), array(), array(
'sideblocks' => array(interaction_sideblock($parent->group)),
));
$smarty = smarty();
$smarty->assign('breadcrumbs', $breadcrumbs);
$smarty->assign('heading', TITLE);
$smarty->assign('editform', $editform);
......
......@@ -253,10 +253,7 @@ function edittopic_submit(Pieform $form, $values) {
}
}
$smarty = smarty(array(), array(), array(), array(
'sideblocks' => array(interaction_sideblock($forum->groupid)),
'group' => (object) array('id' => $forum->groupid, 'name' => $forum->groupname, 'grouptype' => $forum->grouptype),
));
$smarty = smarty();
$smarty->assign('breadcrumbs', $breadcrumbs);
$smarty->assign('heading', TITLE);
$smarty->assign('editform', $editform);
......
......@@ -128,7 +128,7 @@ if ($forums) {
}
}
$smarty = smarty(array(), array(), array(), array('sideblocks' => array(interaction_sideblock($groupid))));
$smarty = smarty();
$smarty->assign('breadcrumbs', $breadcrumbs);
$smarty->assign('groupid', $groupid);
$smarty->assign('heading', TITLE);
......
......@@ -159,9 +159,7 @@ for ($i = 0; $i < $count; $i++) {
// builds the first post (with index 0) which has as children all the posts in the topic
$posts = buildpost(0, '', $posts);
$smarty = smarty(array(), array(), array(), array(
'sideblocks' => array(interaction_sideblock($topic->groupid)),
));
$smarty = smarty();
$smarty->assign('breadcrumbs', $breadcrumbs);
$smarty->assign('heading', TITLE);
$smarty->assign('topic', $topic);
......
......@@ -247,9 +247,7 @@ addLoadEvent(function() {
});
EOF;
$smarty = smarty(array(), array(), array(), array(
'sideblocks' => array(interaction_sideblock($forum->groupid)),
));
$smarty = smarty();
$smarty->assign('breadcrumbs', $breadcrumbs);
$smarty->assign('heading', TITLE);
$smarty->assign('forum', $forum);
......
......@@ -770,6 +770,8 @@ function group_get_grouptype_options() {
* @return array
*/
function group_get_menu_tabs() {
static $menu;
$group = group_current_group();
$menu = array(
array(
......@@ -818,6 +820,7 @@ function group_get_menu_tabs() {
$menu = array_merge($menu, $plugin_menu);
}
}
return $menu;
}
......@@ -879,4 +882,32 @@ function group_current_group() {
}
/**
* creates the group sideblock
*/
function group_sideblock() {
require_once('group.php');
$data['group'] = group_current_group();
$data['menu'] = group_get_menu_tabs();
// @todo either: remove this if interactions become group
// artefacts, or: do this in interaction/lib.php if we leave them
// as interactions
$data['forums'] = get_records_select_array(
'interaction_instance',
'"group" = ? AND deleted = ? AND plugin = ?',
array(GROUP, 0, 'forum'),
'ctime',
'id, plugin, title'
);
if (!$data['forums']) {
$data['forums'] = array();
}
else {
safe_require('interaction', 'forum');
$data['forums'] = PluginInteractionForum::sideblock_sort($data['forums']);
}
return $data;
}
?>
......@@ -408,7 +408,15 @@ EOF;
);
}
if (!$USER->is_logged_in()) {
if(defined('GROUP')) {
$SIDEBLOCKS[] = array(
'name' => 'group',
'weight' => -10,
'data' => group_sideblock()
);
}
if (!$USER->is_logged_in()) {
$SIDEBLOCKS[] = array(
'name' => 'login',
'weight' => -10,
......
<h3>{$data.group->name}</h3>
<ul>
{foreach from=$data.menu item=item}
{if $item.path != 'groups'}
<li><a href="{$WWWROOT}{$item.url}">{$item.title}</a>
{if $item.path == 'groups/forums' && !empty($data.forums)}
<ul>
{foreach from=$data.forums item=forum}
<li><a href="{$WWWROOT}interaction/forum/view.php?id={$forum->id}">{$forum->title}</a>
{/foreach}
</ul>
{/if}
</li>
{/if}
{/foreach}
</ul>
Supports Markdown
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