Commit 6bda6e58 authored by Richard Mansfield's avatar Richard Mansfield

Hide group tabs when editing group views & set share tab correctly on access/secret url pages

Signed-off-by: default avatarRichard Mansfield <richard.mansfield@catalyst.net.nz>
parent c520fbee
......@@ -2829,20 +2829,43 @@ class View {
}
}
public static function set_nav($group, $institution) {
public static function set_nav($group, $institution, $share=false) {
if ($group) {
define('MENUITEM', 'groups/views');
define('MENUITEM', $share ? 'groups/share' : 'groups/views');
define('GROUP', $group);
}
else if ($institution == 'mahara') {
define('ADMIN', 1);
define('MENUITEM', $share ? 'configsite/share' : 'configsite/siteviews');
}
else if ($institution) {
define('INSTITUTIONALADMIN', 1);
define('MENUITEM', $institution == 'mahara' ? 'configsite/siteviews' : 'manageinstitutions/institutionviews');
define('MENUITEM', $share ? 'manageinstitutions/share' : 'manageinstitutions/institutionviews');
}
else {
define('MENUITEM', 'myportfolio/views');
define('MENUITEM', $share ? 'myportfolio/share' : 'myportfolio/views');
}
}
public function set_edit_nav() {
if ($this->group) {
// Don't display the group nav; 5 levels of menu is too many
define('MENUITEM', 'groups');
define('GROUP', $this->group);
define('NOGROUPMENU', 1);
}
else if ($this->institution == 'mahara') {
define('ADMIN', 1);
define('MENUITEM', 'configsite/siteviews');
}
else if ($this->institution) {
define('INSTITUTIONALADMIN', 1);
define('MENUITEM', 'manageinstitutions/institutionviews');
}
else {
define('MENUITEM', 'myportfolio/views');
}
}
public function ownership() {
if ($this->group) {
......
......@@ -425,8 +425,10 @@ EOF;
require_once('group.php');
$group = group_current_group();
$smarty->assign('GROUP', $group);
$smarty->assign('SUBPAGENAV', group_get_menu_tabs());
$smarty->assign('PAGEHEADING', $group->name);
if (!defined('NOGROUPMENU')) {
$smarty->assign('SUBPAGENAV', group_get_menu_tabs());
$smarty->assign('PAGEHEADING', $group->name);
}
}
// ---------- sideblock stuff ----------
......
......@@ -62,13 +62,7 @@ define('TITLE', get_string('editaccess', 'view'));
$group = $view->get('group');
$institution = $view->get('institution');
if ($group || $institution) {
View::set_nav($group, $institution);
}
else {
define('MENUITEM', 'myportfolio/share');
}
View::set_nav($group, $institution, true);
if (!$USER->can_edit_view($view)) {
throw new AccessDeniedException();
......
......@@ -94,7 +94,7 @@ if ($blockid = param_integer('blockconfig', 0)) {
}
}
View::set_nav($group, $institution, ($view->get('type') == 'profile'));
$view->set_edit_nav();
if ($view->get('type') == 'profile') {
$profile = true;
......
......@@ -39,7 +39,7 @@ $view = new View($id);
$numcolumns = $view->get('numcolumns');
$group = $view->get('group');
$institution = $view->get('institution');
View::set_nav($group, $institution);
$view->set_edit_nav();
if (!$USER->can_edit_view($view)) {
throw new AccessDeniedException();
......
......@@ -49,7 +49,7 @@ if ($view->is_submitted()) {
$group = $view->get('group');
$institution = $view->get('institution');
View::set_nav($group, $institution);
$view->set_edit_nav();
$new = param_boolean('new', 0);
......
......@@ -43,7 +43,7 @@ $currentlayout = $view->get('layout');
$back = !$USER->get_account_preference('addremovecolumns');
$group = $view->get('group');
$institution = $view->get('institution');
View::set_nav($group, $institution);
$view->set_edit_nav();
if (!$USER->can_edit_view($view)) {
throw new AccessDeniedException();
......
......@@ -44,12 +44,7 @@ define('TITLE', get_string('secreturls', 'view') . ': ' . $title);
$group = $view->get('group');
$institution = $view->get('institution');
if ($group || $institution) {
View::set_nav($group, $institution);
}
else {
define('MENUITEM', 'myportfolio/share');
}
View::set_nav($group, $institution, true);
if (!$USER->can_edit_view($view)) {
throw new AccessDeniedException();
......
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