{#
    This file is part of LimeSurvey
    Copyright (C) 2018 The LimeSurvey Project Team

    This file renders language changer inside the main container when multiple survey languages are available.

    It uses the Yii helper CHtml::dropDownList().
    @see: http://www.yiiframework.com/wiki/48/by-example-chtml/#hh5

#}

{% if aSurveyInfo.alanguageChanger.show == true %}

    {# set a shortcut for aSurveyInfo.alanguageChanger.datas #}
    {% set aLCD  = aSurveyInfo.alanguageChanger.datas %}

    {#
        array of attributes of the Drop Down list.
        To add a new attribute, just add an entry:
        'attribute' : 'value',
    #}
    {% set htmlOptions = {
            'class'          : 'form-control',
            'data-targeturl' : aLCD.targetUrl,
        }
    %}
    <!-- Language Changer -->
    <div class=" {{ aSurveyInfo.class.formgroup }} form-change-lang form-inline" {{ aSurveyInfo.attr.formgroup }} >
        <label class="{{ aSurveyInfo.class.controllabel }}" {{ aSurveyInfo.attr.controllabel }} for="lang">
            <span class="control-label" {{ aSurveyInfo.attr.languagechanger }}>{{ gT("Language:") }}</span>
            {{
                C.Html.dropDownList(
                    'lang',
                    aLCD.sSelected,
                    aLCD.aListLang,
                    htmlOptions
                )
            }}
        </label>
        <!-- for no js functionality (need form) -->
        {% set buttonhtmlOptions = {
                'type'          : 'submit',
                'value'         : 'changelang',
                'name'          : 'move',
                'class'         : 'btn btn-info ls-language-changer-item ',
            }
        %}
        {{
            C.Html.htmlButton(
                gT("Change the language"),
                buttonhtmlOptions
            )
        }}
    </div>

    {# Activate the language changer  #}
    {{ registerScript("activateLanguageChanger", "activateLanguageChanger(); ", "POS_END") }}

{% endif %}
