Commit 80288da1 authored by Lisa Seeto's avatar Lisa Seeto Committed by Gerrit Code Review
Browse files

Merge "Bug 1903205: Only show migrate account link if it is possible to do"

parents 9fb22ac0 77b2a3e4
...@@ -227,13 +227,21 @@ function requestmembership_submit(Pieform $form, $values) { ...@@ -227,13 +227,21 @@ function requestmembership_submit(Pieform $form, $values) {
redirect(get_config('wwwroot') . 'account/institutions.php'); redirect(get_config('wwwroot') . 'account/institutions.php');
} }
try {
$migrateallowed = auth_configure_session_handlers("saml");
}
catch (ConfigSanityException $e) {
$migrateallowed = false;
}
$smarty = smarty(); $smarty = smarty();
setpageicon($smarty, 'icon-university'); setpageicon($smarty, 'icon-university');
$smarty->assign('migrateallowed', $migrateallowed);
$smarty->assign('memberform', $memberform); $smarty->assign('memberform', $memberform);
$smarty->assign('requestedform', $requestedform); $smarty->assign('requestedform', $requestedform);
$smarty->assign('invitedform', $invitedform); $smarty->assign('invitedform', $invitedform);
$smarty->assign('joinform', $joinform); $smarty->assign('joinform', $joinform);
$smarty->assign('migrateurl', get_config('wwwroot') . 'account/migrateinstitution.php'); $smarty->assign('migrateurl', get_config('wwwroot') . 'account/migrateinstitution.php');
$smarty->assign('sitename', get_config('sitename')); $smarty->assign('sitename', get_config('sitename'));
$smarty->assign('SUBPAGENAV', account_institution_get_menu_tabs()); $smarty->assign('SUBPAGENAV', account_institution_get_menu_tabs($migrateallowed));
$smarty->display('account/institutions.tpl'); $smarty->display('account/institutions.tpl');
...@@ -5035,21 +5035,23 @@ function is_valid_url($url) { ...@@ -5035,21 +5035,23 @@ function is_valid_url($url) {
return true; return true;
} }
function account_institution_get_menu_tabs() { function account_institution_get_menu_tabs($migrate=true) {
$menu = array( $menu = array(
'institutions' => array( 'institutions' => array(
'path' => 'settings/institutions', 'path' => 'settings/institutions',
'url' => 'account/institutions.php', 'url' => 'account/institutions.php',
'title' => get_string('currentinstitutionmembership'), 'title' => get_string('currentinstitutionmembership'),
'weight' => 10, 'weight' => 10,
), )
'migrateinstitution' => array( );
if ($migrate) {
$menu['migrateinstitution'] = array(
'path' => 'settings/institutions', 'path' => 'settings/institutions',
'url' => 'account/migrateinstitution.php', 'url' => 'account/migrateinstitution.php',
'title' => get_string('selfmigration'), 'title' => get_string('selfmigration'),
'weight' => 20, 'weight' => 20,
), );
); }
if (defined('SECTION_PAGE')) { if (defined('SECTION_PAGE')) {
$key = SECTION_PAGE; $key = SECTION_PAGE;
......
...@@ -7,12 +7,12 @@ ...@@ -7,12 +7,12 @@
{$memberform|safe} {$memberform|safe}
</div> </div>
{/if} {/if}
{if $migrateallowed}
<div class="view-container"> <div class="view-container">
<h2>{str tag=selfmigrate}</h2> <h2>{str tag=selfmigrate}</h2>
{str tag=migrateinstitutionpagelink section=mahara arg1=$migrateurl arg2=$sitename} {str tag=migrateinstitutionpagelink section=mahara arg1=$migrateurl arg2=$sitename}
</div> </div>
{/if}
{if $requestedform} {if $requestedform}
<div class="view-container"> <div class="view-container">
<h2>{str tag=Requests}</h2> <h2>{str tag=Requests}</h2>
......
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