added set language feature; phrasen plugin with optional reload if non responsive phrasen are used; stundenplan header mode & buttons reworked

This commit is contained in:
Johann Hoffmann
2024-10-24 17:46:42 +02:00
parent 805ed20a18
commit e387671e09
20 changed files with 166 additions and 42 deletions
+9 -4
View File
@@ -1,6 +1,12 @@
<?php
// Header menu
if(defined('CIS4') && CIS4) {
$root = APP_ROOT;
} else {
$root = CIS_ROOT;
}
$config['navigation_header'] = array(
'*' => array(
'fhcomplete' => array(
@@ -50,7 +56,7 @@ $config['navigation_header'] = array(
'requiredPermissions' => 'basis/vilesci:r',
'children' => array(
'cis' => array(
'link' => CIS_ROOT,
'link' => $root,
'icon' => '',
'description' => 'CIS',
'sort' => 10
@@ -223,7 +229,7 @@ $config['navigation_menu']['organisation/Reihungstest/index'] = array(
'target' => '_blank'
),
'auswertung' => array(
'link' => CIS_ROOT.'/cis/testtool/admin/auswertung.php',
'link' => $root.'/cis/testtool/admin/auswertung.php',
'description' => 'Auswertung',
'icon' => 'list-alt',
'sort' => 1,
@@ -319,5 +325,4 @@ $config['navigation_menu']['system/issues/Issues/*'] = array(
'target' => '_blank',
'requiredPermissions' => array('admin:rw')
),
);
);
+2 -1
View File
@@ -34,6 +34,7 @@ class Cis4 extends FHC_Controller
show_error("name couldn't be loaded for username ".getAuthUID());
}
$begruesung = getData($begruesung);
$this->load->view('CisVue/Dashboard.php',["name"=> $begruesung]);
}
}
}
+11 -2
View File
@@ -27,6 +27,15 @@ class Dashboard extends Auth_Controller
*/
public function index()
{
$this->load->view('CisVue/Dashboard.php');
$this->load->model('person/Person_model','PersonModel');
$begruesung = $this->PersonModel->getFirstName(getAuthUID());
if(isError($begruesung))
{
show_error("name couldn't be loaded for username ".getAuthUID());
}
$begruesung = getData($begruesung);
$this->load->view('CisVue/Dashboard.php',["name"=> $begruesung]);
}
}
}
@@ -28,8 +28,11 @@ class Phrasen extends FHCAPI_Controller
public function __construct()
{
parent::__construct([
'loadModule' => self::PERM_ANONYMOUS
'loadModule' => self::PERM_ANONYMOUS,
'setLanguage' => self::PERM_ANONYMOUS
]);
$this->load->helper('hlp_language');
}
//------------------------------------------------------------------------------------------------------------------
@@ -43,4 +46,18 @@ class Phrasen extends FHCAPI_Controller
$this->load->library('PhrasesLib', [$module], 'pj');
$this->terminateWithSuccess(json_decode($this->pj->getJSON()));
}
}
public function setLanguage()
{
$postParams = $this->getPostJSON();
$language = $postParams->language;
$categories = $postParams->categories;
setUserLanguage($language);
$this->load->library('PhrasesLib', array($categories, $language), 'p');
$phrases = $this->p->setPhrases($categories, $language);
$this->terminateWithSuccess($phrases);
}
}
+13 -1
View File
@@ -200,6 +200,17 @@ class PhrasesLib
return '<< PHRASE '.$phrase.' >>';
}
/**
* Workaround to reload the phrases array on an already constructed library.
* @parameters -> look for _setPhrases docs
*/
public function setPhrases($categories, $language)
{
if (count($categories) > 0) $this->_setPhrases($categories, $language);
return $this->_phrases;
}
// -----------------------------------------------------------------------------------------------------------------
// Private methods
@@ -319,6 +330,7 @@ class PhrasesLib
{
$this->_phrases = $phrases->retval;
}
}
/**
@@ -329,4 +341,4 @@ class PhrasesLib
{
return json_encode($this->_phrases);
}
}
}
@@ -36,11 +36,13 @@ if (!isset($menu)) {
logo-url="<?= base_url('/public/images/logo-300x160.png'); ?>"
avatar-url="<?= site_url('Cis/Pub/bild/person/' . getAuthPersonId()); ?>"
logout-url="<?= site_url('Cis/Auth/logout'); ?>"
:selectedtypes="selectedtypes"
at-flag-url="<?= base_url('/public/images/icons/at.png'); ?>"
uk-flag-url="<?= base_url('/public/images/icons/uk.png'); ?>"
:selectedtypes="selectedtypes"
:searchbaroptions="searchbaroptions"
:searchfunction="searchfunction"
:menu="<?= htmlspecialchars(json_encode(array_values($menu)), ENT_QUOTES, 'UTF-8') ?>"
></cis-menu>
</header>
<main id="cis-main" class="flex-grow-1 overflow-scroll p-4">
<main id="cis-main" class="flex-grow-1 p-4">