Commit 960e10f8 authored by Cecilia Vela Gurovic's avatar Cecilia Vela Gurovic Committed by Gerrit Code Review

Merge "Bug 1855331: Adding lang chooser to nav"

parents 3f80a2c7 b31588dc
<?php
/**
*
* @package mahara
* @subpackage core
* @author Catalyst IT Ltd
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL version 3 or later
* @copyright For copyright information on Mahara, please see the README file distributed with this software.
*
*/
define('INTERNAL', 1);
define('PUBLIC', 1);
require('init.php');
$lang = param_alphanumext('lang');
$languages = get_languages();
if (!isset($languages[$lang])) {
throw new ParameterException('Unknown language');
}
if ($USER->is_logged_in()) {
$USER->set_account_preference('lang', $lang);
}
$SESSION->set('lang', $lang);
if (isset($_SERVER['HTTP_REFERER'])) {
redirect($_SERVER['HTTP_REFERER']);
}
redirect();
......@@ -1370,3 +1370,4 @@ $string['viewartefact'] = 'View ';
//Accessing an outdated url that will now redirect with session message
$string['viewartefactdatavuamodal'] = 'The data for %s artefact "%s" cannot be viewed this way anymore. Please go to page "%s" to view it.';
$string['chooselanguage'] = 'Choose language';
......@@ -798,6 +798,8 @@ EOF;
else {
$smarty->assign('SELECTEDSUBNAV', $SELECTEDSUBNAV);
}
$smarty->assign('LANGCHOICES', get_languages());
$smarty->assign('LANGCURRENT', current_language());
}
else {
$smarty->assign('languageform', $langselectform);
......
......@@ -6,12 +6,12 @@
position: absolute;
margin: 4px 0 4px 7px;
z-index: 3;
left: 90px;
left: 135px;
display: block;
width: 27px;
height: 27px;
@include media-breakpoint-up(md) {
left: 45px;
left: 90px;
}
&:hover,
&:focus {
......
......@@ -36,7 +36,7 @@
max-width: none;
visibility: visible;
top: 10px;
right: 230px;
right: 240px;
margin: 0 30px 0 0;
padding: 0;
box-shadow: none;
......@@ -119,3 +119,10 @@
font-size: 12px;
}
}
// Header language toggle
.navbar-toggle.lang-toggle {
span.icon-language {
font-size: 1.5em;
}
}
......@@ -108,6 +108,12 @@
</a>
{/foreach}
{/if}
{if $LANGCHOICES}
<button class="lang-toggle navbar-toggle" type="button" data-toggle="collapse" data-target=".nav-language" aria-expanded="false" aria-controls="main-language" title='{str tag="chooselanguage"}'>
<span class="sr-only">{str tag="chooselanguage"}</span>
<span class="icon icon-language icon-large" role="presentation" aria-hidden="true"></span>
</button>
{/if}
<!-- HIDE WHEN ON DESKTOP -->
{if !$nosearch && ($LOGGEDIN || $publicsearchallowed)}
<button class="search-toggle navbar-toggle collapsed" type="button" data-toggle="collapse" data-target=".navbar-form" aria-expanded="false" aria-controls="usf">
......@@ -119,6 +125,7 @@
{include file="header/topright.tpl"}
{include file="header/navigation.tpl"}
{include file="header/language.tpl"}
</div>
</div>
</header>
......
{if $LANGCHOICES}
<nav>
<div id="main-language" class="nav collapse navbar-collapse nav-language" role="tabcard">
<ul id="navadmin" class="nav navbar-nav">{strip}
{foreach from=$LANGCHOICES key=key item=item name=lang}
<li class="{if $LANGCURRENT == $key}active{/if}">
<a href="{$WWWROOT}changelanguage.php?lang={$key}">{$item}</a>
</li>
{/foreach}{/strip}
</ul>
</div>
</nav>
{/if}
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