See SelectionBox at Top-right.
function changer() {
require_once QA_INCLUDE_DIR.'qa-app-admin.php';
// Lang: Get and Set URL parameter OR System settings
$qa_lang=qa_get('qa_lang');
if (!isset($qa_lang))
$qa_lang=qa_opt('site_language');
$langParam='&qa_lang='.$qa_lang;
$langOptions = qa_admin_language_options();
foreach($langOptions as $key => $val)
$langArray[] = array('name'=>$val, 'value'=>$key, 'selected'=>'');
$found = false;
$index = 0;
foreach($langArray as $langItem){
foreach($langItem as $key => $val){
if ($key=='value' && $val==$qa_lang){
$langArray[$index]['selected']='selected="selected"';
$found = true;
break 2;
}
}
$index++;
}
if(!$found) $langArray[0]['selected']='selected="selected"';
// Theme: Get and Set URL parameter OR System settings
$qa_theme=qa_get('qa_theme');
if (!isset($qa_theme))
$qa_theme=qa_opt('site_theme');
$themeParam='&qa_theme='.$qa_theme;
$themeOptions = qa_admin_theme_options();
foreach($themeOptions as $key => $val)
$themeArray[] = array('name'=>$val, 'value'=>$key, 'selected'=>'');
$found = false;
$index = 0;
foreach($themeArray as $themeItem){
foreach($themeItem as $key => $val){
if ($key=='value' && $val==$qa_theme){
$themeArray[$index]['selected']='selected="selected"';
$found = true;
break 2;
}
}
$index++;
}
if(!$found) $themeArray[0]['selected']='selected="selected"';
// Output option bar
$this->output('<DIV class="qa-changer" style="padding:0;margin:0 auto;text-align:right;width:980px;height:32px;">');
$this->output('<DIV class="qa-changer-block" style="display:inline;">
<SPAN class="qa-changer-title" style="">Language:</SPAN>
<SELECT class="qa-changer-selector" style="" name="qa-changer-select-lang" onchange="location.href=\'?&qa_lang=\'+this.options[this.selectedIndex].value+\''.$themeParam.'\'">');
foreach($langArray as $langItem)
$this->output('<OPTION class="qa-changer-selector-option" value="'. $langItem['value'] .'" '. $langItem['selected'] .'>'.$langItem['name'].'</OPTION>');
$this->output('</SELECT>');
$this->output('</DIV>');
$this->output('<DIV class="qa-changer-block" style="display:inline;">
<SPAN class="qa-changer-title" style="">Theme:</SPAN>
<SELECT class="qa-changer-selector" style="" name="qa-ts-selector-theme" onchange="location.href=\'?'.$langParam.'&qa_theme=\'+this.options[this.selectedIndex].value">');
foreach($themeArray as $themeItem)
$this->output('<OPTION class="qa-changer-selector-option" value="'. $themeItem['value'] .'" '. $themeItem['selected'] .'>'.$themeItem['name'].'</OPTION>');
$this->output('</SELECT>');
$this->output('</DIV>');
$this->output('</DIV>');
}