update(Sprachen.js): shows the sprachen in the component always using their bezeichnung

This commit is contained in:
SimonGschnell
2024-12-12 14:46:32 +01:00
parent 7bd9129056
commit 8f07bd6b4d
2 changed files with 21 additions and 4 deletions
@@ -73,11 +73,22 @@ class Phrasen extends FHCAPI_Controller
// gets all languages that are set as active in the database
public function getAllLanguages()
{
$langs = getDBActiveLanguages();
$this->load->model('system/Sprache_model', 'SprachenModel');
// Add order clause by index and select the sprache,bezeichnung and index column
$this->SprachenModel->addOrder('index');
$this->SprachenModel->addSelect('sprache, bezeichnung, index');
// Retrieves from public.tbl_sprache
$langs = $this->SprachenModel->loadWhere(array('content' => true));
$langs = $this->getDataOrTerminateWithError($langs);
$langs = array_map(function($lang){
return $lang->sprache;
$data = new stdClass();
$data->sprache = $lang->sprache;
$data->bezeichnung = $lang->bezeichnung[($lang->index-1)];
return $data;
}, $langs);
$this->terminateWithSuccess($langs);
}