opensupports/server/models/Language.php

51 lines
1.1 KiB
PHP
Raw Normal View History

<?php
use RedBeanPHP\Facade as RedBean;
class Language extends DataStore {
const TABLE = 'language';
const LANGUAGES = [
'en',
'es',
'de',
'fr',
'pt',
'jp',
'ru',
'cn',
'in',
'tr',
2018-06-29 16:57:02 +02:00
'it',
2018-06-29 18:19:52 +02:00
'br',
'gr',
'nl',
'pl'
];
2018-06-29 16:57:02 +02:00
public static function getProps() {
return [
'code',
'allowed',
'supported'
];
}
public static function getSupportedLanguages() {
$array = [];
foreach(Language::LANGUAGES as $languageCode) {
if (self::getDataStore($languageCode,'code')->supported) {
array_push($array, $languageCode);
}
}
return $array;
}
public static function getAllowedLanguages() {
$array = [];
foreach(Language::LANGUAGES as $languageCode) {
if (self::getDataStore($languageCode,'code')->allowed) {
array_push($array, $languageCode);
}
}
return $array;
}
2018-06-29 16:57:02 +02:00
}