You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
39 lines
1.1 KiB
39 lines
1.1 KiB
![]()
19 years ago
|
<?php
|
||
![]()
14 years ago
|
/* For licensing terms, see /license.txt */
|
||
![]()
16 years ago
|
|
||
![]()
19 years ago
|
/**
|
||
![]()
10 years ago
|
* Class SelectLanguage
|
||
![]()
8 years ago
|
* A dropdown list with all languages to use with QuickForm.
|
||
![]()
10 years ago
|
*/
|
||
![]()
11 years ago
|
class SelectLanguage extends HTML_QuickForm_select
|
||
![]()
19 years ago
|
{
|
||
![]()
9 years ago
|
/**
|
||
![]()
8 years ago
|
* Class constructor.
|
||
![]()
9 years ago
|
*/
|
||
![]()
9 years ago
|
public function __construct(
|
||
|
$elementName = null,
|
||
|
$elementLabel = null,
|
||
|
$options = [],
|
||
|
$attributes = []
|
||
|
) {
|
||
![]()
9 years ago
|
parent::__construct($elementName, $elementLabel, $options, $attributes);
|
||
![]()
9 years ago
|
|
||
|
$default = isset($attributes['set_custom_default']) ? $attributes['set_custom_default'] : false;
|
||
|
|
||
![]()
9 years ago
|
// Get all languages
|
||
|
$languages = api_get_languages();
|
||
![]()
8 years ago
|
foreach ($languages as $index => $name) {
|
||
![]()
9 years ago
|
if (!empty($default)) {
|
||
|
$defaultValue = $default;
|
||
|
} else {
|
||
|
$defaultValue = api_get_setting('platformLanguage');
|
||
|
}
|
||
![]()
8 years ago
|
if ($languages[$index] == $defaultValue) {
|
||
![]()
8 years ago
|
$this->addOption($name, $index, ['selected' => 'selected']);
|
||
![]()
9 years ago
|
} else {
|
||
![]()
8 years ago
|
$this->addOption($name, $index);
|
||
![]()
9 years ago
|
}
|
||
|
}
|
||
|
}
|
||
![]()
11 years ago
|
}
|