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