Commit d518bc1c authored by Richard Mansfield's avatar Richard Mansfield
Browse files

Incorporate group tabs into the header menu

parent 40f09854
......@@ -25,7 +25,7 @@
*/
define('INTERNAL', 1);
define('MENUITEM', 'groups');
define('MENUITEM', 'groups/files');
require(dirname(dirname(dirname(__FILE__))) . '/init.php');
require_once(get_config('libroot') . 'group.php');
......@@ -62,6 +62,7 @@ $smarty = smarty(
'sideblocks' => array(
interaction_sideblock($groupid),
),
'group' => $group,
)
);
$smarty->assign('heading', $group->name);
......
......@@ -57,9 +57,11 @@ class PluginArtefactFile extends PluginArtefact {
public static function group_tabs($groupid) {
return array(
'files' => array(
array(
'path' => 'groups/files',
'url' => 'artefact/file/groupfiles.php?group='.$groupid,
'title' => get_string('Files', 'artefact.file'),
'weight' => 50,
),
);
}
......
......@@ -4,7 +4,6 @@
{include file="columnleftstart.tpl"}
{if $groupid}
<h2>{$heading}</h2>
{include file="group/tabstart.tpl" current="files"}
{elseif $institution}
<h2>{$heading}</h2>
{$institutionselector}
......@@ -24,6 +23,5 @@
<tbody><tr><th></th></tr></tbody>
</table>
</div>
{if $groupid}{include file="group/tabend.tpl"}{/if}
{include file="columnleftend.tpl"}
{include file="footer.tpl"}
......@@ -25,7 +25,7 @@
*/
define('INTERNAL', 1);
define('MENUITEM', 'groups');
define('MENUITEM', 'groups/members');
require(dirname(dirname(__FILE__)) . '/init.php');
require_once('group.php');
require_once(get_config('docroot') . 'interaction/lib.php');
......@@ -101,7 +101,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($groupid, $role))));
$smarty = smarty(array(), array(), array(), array('sideblocks' => array(interaction_sideblock($groupid, $role)), 'group' => $group));
$smarty->assign('group', $group);
$smarty->assign('groupid', $groupid);
$smarty->assign('grouptabs', group_get_menu_tabs($group));
......
......@@ -25,7 +25,7 @@
*/
define('INTERNAL', 1);
define('MENUITEM', 'groups');
define('MENUITEM', 'groups/members');
require(dirname(dirname(__FILE__)) . '/init.php');
require_once('group.php');
require_once('searchlib.php');
......@@ -37,6 +37,7 @@ $membershiptype = param_alpha('membershiptype', null);
if (!$group = get_record('group', 'id', $id, 'deleted', 0)) {
throw new GroupNotFoundException("Couldn't find group with id $id");
}
define('GROUPNAME', str_shorten($group->name, 20, true));
define('TITLE', $group->name . ' - ' . get_string('Members', 'group'));
$role = group_user_access($id);
......@@ -51,7 +52,10 @@ $offset = param_integer('offset', 0);
$limit = param_integer('limit', 10);
list($html, $pagination, $count, $offset, $membershiptype) = group_get_membersearch_data($id, $query, $offset, $limit, $membershiptype);
$smarty = smarty(array('groupmembersearch'), array(), array(), array('sideblocks' => array(interaction_sideblock($id, $role))));
$smarty = smarty(array('groupmembersearch'), array(), array(), array(
'sideblocks' => array(interaction_sideblock($id, $role)),
'group' => $group,
));
$smarty->assign('group', $group);
$smarty->assign('groupid', $id);
$smarty->assign('grouptabs', group_get_menu_tabs($group));
......
......@@ -25,7 +25,7 @@
*/
define('INTERNAL', 1);
define('MENUITEM', 'groups');
define('MENUITEM', 'groups/info');
require(dirname(dirname(__FILE__)) . '/init.php');
require_once('group.php');
require_once('searchlib.php');
......@@ -96,7 +96,7 @@ $foruminfo = get_records_sql_array('
p.ctime DESC
LIMIT 5;
', array($id));
$smarty = smarty(array(), array(), array(), array('sideblocks' => array(interaction_sideblock($id, $role))));
$smarty = smarty(array(), array(), array(), array('sideblocks' => array(interaction_sideblock($id, $role)), 'group' => $group));
$smarty->assign('group', $group);
$smarty->assign('groupid', $id);
$smarty->assign('grouptabs', group_get_menu_tabs($group));
......
......@@ -771,17 +771,29 @@ function group_get_grouptype_options() {
*/
function group_get_menu_tabs($group) {
$menu = array(
'info' => array(
array(
'path' => 'groups',
'url' => 'group/view.php?id='.$group->id,
'title' => get_string('groups'),
'weight' => 40
),
array(
'path' => 'groups/info',
'url' => 'group/view.php?id='.$group->id,
'title' => get_string('About', 'group'),
'weight' => 20
),
'members' => array(
array(
'path' => 'groups/members',
'url' => 'group/members.php?id='.$group->id,
'title' => get_string('Members', 'group'),
'weight' => 30
),
'views' => array(
array(
'path' => 'groups/views',
'url' => 'view/groupviews.php?group='.$group->id,
'title' => get_string('Views', 'group'),
'weight' => 40
),
);
if (!group_user_access($group->id)) {
......
......@@ -355,7 +355,7 @@ EOF;
$smarty->assign('LOGGEDIN', $USER->is_logged_in());
if ($USER->is_logged_in()) {
$smarty->assign('MAINNAV', main_nav());
$smarty->assign('MAINNAV', main_nav(isset($extraconfig['group']) ? $extraconfig['group'] : null));
}
else {
$smarty->assign('sitedefaultlang', get_string('sitedefault', 'admin') . ' (' .
......@@ -374,6 +374,9 @@ EOF;
$smarty->assign('PAGEHELPNAME', $help[0]);
$smarty->assign('PAGEHELPICON', $help[1]);
}
if (isset($extraconfig['group'])) {
$smarty->assign('GROUPNAME', str_shorten($extraconfig['group']->name, 20, true));
}
// ---------- sideblock stuff ----------
if (!defined('INSTALLER') && (!defined('MENUITEM') || substr(MENUITEM, 0, 5) != 'admin')) {
......@@ -1612,7 +1615,7 @@ function institutional_admin_nav() {
/**
* Builds a data structure representing the menu for Mahara.
*/
function main_nav() {
function main_nav($group=null) {
if (defined('ADMIN') || defined('INSTITUTIONALADMIN')) {
global $USER;
$menu = $USER->get('admin') ? admin_nav() : institutional_admin_nav();
......@@ -1644,36 +1647,6 @@ function main_nav() {
'title' => get_string('myviews'),
'weight' => 10
),
array(
'path' => 'groups',
'url' => 'group/mygroups.php',
'title' => get_string('groups'),
'weight' => 40,
),
array(
'path' => 'groups/mygroups',
'url' => 'group/mygroups.php',
'title' => get_string('mygroups'),
'weight' => 10
),
array(
'path' => 'groups/find',
'url' => 'group/find.php',
'title' => get_string('findgroups'),
'weight' => 20
),
array(
'path' => 'groups/myfriends',
'url' => 'user/myfriends.php',
'title' => get_string('myfriends'),
'weight' => 30
),
array(
'path' => 'groups/findfriends',
'url' => 'user/find.php',
'title' => get_string('findfriends'),
'weight' => 40
),
array(
'path' => 'settings',
'url' => 'account/',
......@@ -1706,6 +1679,44 @@ function main_nav() {
),
);
if ($group) {
foreach (group_get_menu_tabs($group) as $k => $v) {
$menu[] = $v;
}
}
else {
$menu[] = array(
'path' => 'groups',
'url' => 'group/mygroups.php',
'title' => get_string('groups'),
'weight' => 40,
);
$menu[] = array(
'path' => 'groups/mygroups',
'url' => 'group/mygroups.php',
'title' => get_string('mygroups'),
'weight' => 10
);
$menu[] = array(
'path' => 'groups/find',
'url' => 'group/find.php',
'title' => get_string('findgroups'),
'weight' => 20
);
$menu[] = array(
'path' => 'groups/myfriends',
'url' => 'user/myfriends.php',
'title' => get_string('myfriends'),
'weight' => 30
);
$menu[] = array(
'path' => 'groups/findfriends',
'url' => 'user/find.php',
'title' => get_string('findfriends'),
'weight' => 40
);
}
if ($plugins = get_records_array('artefact_installed', 'active', 1)) {
foreach ($plugins as &$plugin) {
safe_require('artefact', $plugin->name);
......
......@@ -660,6 +660,9 @@ tr.required th,
background: url(../images/submenu-bg.gif) repeat-x;
height: 25px;
}
#subnav.group {
padding: 0;
}
#subnav ul {
height: 15px;
padding: 5px 0;
......@@ -695,8 +698,9 @@ tr.required th,
#subnav li.selected a:active {
color: #4c711d;
}
#subnav li.groupname {
color: #000;
}
/* RIGHT SIDE COLUMN */
div.sidebar {
......
......@@ -3,17 +3,8 @@
{include file="columnleftstart.tpl"}
<h2>{$group->name|escape}</h2>
{include file="group/tabstart.tpl" current="members"}
<div class="group-info-para"><h3>{$subtitle}</h3><div>
<div class="group-info-para">
{$changeform}
</div>
<br />
{include file="group/tabend.tpl"}
<h3>{$subtitle|escape}</h3>
{$changeform}
{include file="columnleftend.tpl"}
{include file="footer.tpl"}
......
......@@ -4,8 +4,6 @@
{include file="columnleftstart.tpl"}
<h2>{$group->name|escape}</h2>
{include file="group/tabstart.tpl" current="members"}
<form action="{$WWWROOT}group/members.php" method="post">
<input type="hidden" id="groupid" name="id" value="{$group->id|escape}">
<div class="searchform center" style="margin-bottom: .5em;">
......@@ -28,7 +26,5 @@
<script type="text/javascript">{$pagination_js}</script>
{include file="group/tabend.tpl"}
{include file="columnleftend.tpl"}
{include file="footer.tpl"}
......@@ -4,8 +4,6 @@
{include file="columnleftstart.tpl"}
<h2>{$group->name|escape}</h2>
{include file="group/tabstart.tpl" current="info"}
{if $group->description}<p id="group-description">{$group->description}</p> {/if}
<ul id="group-info">
......@@ -99,7 +97,5 @@
</div>
{/if}
{include file="group/tabend.tpl"}
{include file="columnleftend.tpl"}
{include file="footer.tpl"}
......@@ -82,10 +82,11 @@
</ul>
</div>
</div>
<div id="subnav">
<div id="subnav"{if $GROUPNAME} class="group"{/if}>
{if $MAINNAVSELECTED.submenu}
<ul>
{foreach from=$MAINNAVSELECTED.submenu item=item}<li{if $item.selected} class="selected"{/if}><a href="{$WWWROOT}{$item.url|escape}">{$item.title|escape}</a>{/foreach}
{if $GROUPNAME}<li class="groupname">{$GROUPNAME} &raquo; </li>{/if}
{foreach from=$MAINNAVSELECTED.submenu item=item}<li{if $item.selected} class="selected"{/if}><a href="{$WWWROOT}{$item.url|escape}">{$item.title|escape}</a></li>{/foreach}
</ul>
{/if}
{/if}
......
......@@ -15,9 +15,7 @@
</span>
<h2>{$heading}</h2>
{if $groupid}
{include file="group/tabstart.tpl" current="views"}
{elseif $institution}
{if $institution}
{$institutionselector}
{/if}
{if $views}
......@@ -95,7 +93,6 @@
</tr>
</table>
{/if}
{if $groupid}{include file="group/tabend.tpl"}{/if}
{include file="columnleftend.tpl"}
{include file="footer.tpl"}
......
......@@ -4,7 +4,6 @@
<h2>{$heading}</h2>
{include file="group/tabstart.tpl" current="views"}
{if $views}
<table id="myviewstable" class="groupviews">
{foreach from=$views item=view}
......@@ -40,8 +39,6 @@
{/if}
{include file="group/tabend.tpl"}
{include file="columnleftend.tpl"}
{include file="footer.tpl"}
......@@ -25,7 +25,7 @@
*/
define('INTERNAL', 1);
define('MENUITEM', 'groups');
define('MENUITEM', 'groups/views');
define('SECTION_PLUGINTYPE', 'core');
define('SECTION_PLUGINNAME', 'view');
......@@ -50,7 +50,7 @@ $member = group_user_access($groupid);
$shared = param_boolean('shared', 0) && $member;
$can_edit = group_user_can_edit_views($groupid);
$smarty = smarty();
$smarty = smarty(array(), array(), array(), array('group' => $group));
$smarty->assign('heading', $group->name);
if ($can_edit) {
......
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