Funktionen fett schreiben, die schon presets hinterlegt haben, demo aus views und Controller namen entfernen, preview hinzufuegen

This commit is contained in:
Harald Bamberger
2026-03-18 15:48:57 +01:00
parent a4f2502fe6
commit 14a8e2f001
7 changed files with 114 additions and 32 deletions
@@ -205,18 +205,63 @@ class DashboardAdmin extends FHCAPI_Controller
//Presets
public function funktionen()
{
$this->FunktionModel->addSelect('funktion_kurzbz, beschreibung');
$this->FunktionModel->addOrder('beschreibung', 'ASC');
$result = $this->FunktionModel->loadWhere(array('aktiv' => true));
$dashboard_kurzbz = $this->input->get('db');
if(!$dashboard_kurzbz)
{
$this->terminateWithError('missing query parameter db');
}
$sql = <<<EOSQL
with
dashboard_presets as (
select
*
from
dashboard.tbl_dashboard_preset dp
join
dashboard.tbl_dashboard d on d.dashboard_id = dp.dashboard_id
where
d.dashboard_kurzbz = {$this->db->escape($dashboard_kurzbz)}
),
general as (
select
'general' as funktion_kurzbz,
'Allgemein' as beschreibung
)
(
select
f.funktion_kurzbz,
f.beschreibung,
count(p.preset_id) as has_preset
from
general f
left join
dashboard_presets p on p.funktion_kurzbz is null
group by
f.funktion_kurzbz, f.beschreibung
)
union ALL
(
select
f.funktion_kurzbz,
f.beschreibung,
count(p.preset_id) as has_preset
from
public.tbl_funktion f
left join
dashboard_presets p on p.funktion_kurzbz = f.funktion_kurzbz
group by
f.funktion_kurzbz, f.beschreibung
order by
f.beschreibung asc
)
EOSQL;
$result = $this->FunktionModel->execReadOnlyQuery($sql);
if (isError($result))
$this->terminateWithError($result, self::ERROR_TYPE_GENERAL);
$funktionen = getData($result) ?: [];
array_unshift($funktionen, (object) array(
'funktion_kurzbz' => 'general',
'beschreibung' => 'Allgemein'
));
$this->terminateWithSuccess($funktionen);
}
@@ -4,7 +4,7 @@ if (! defined('BASEPATH')) exit('No direct script access allowed');
/**
*/
class DashboardDemo extends Auth_Controller
class DashboardAdmin extends Auth_Controller
{
private $_uid; // uid of the logged user
@@ -16,8 +16,8 @@ class DashboardDemo extends Auth_Controller
// Set required permissions
parent::__construct(
array(
'index' => 'dashboard/benutzer:r',
'admin' => 'dashboard/admin:rw'
'index' => 'dashboard/admin:rw',
'preview' => 'dashboard/admin:r',
)
);
@@ -33,15 +33,14 @@ class DashboardDemo extends Auth_Controller
// Public methods
public function index()
{
$this->load->view('dashboard/dashboard_demo.php', []);
$this->load->view('dashboard/dashboard_admin.php', []);
}
// -----------------------------------------------------------------------------------------------------------------
// Public methods
public function admin()
{
$this->load->view('dashboard/dashboard_demo_admin.php', []);
}
public function preview()
{
$dashboard_kurzbz = $this->input->get('db') ?? 'CIS';
$this->load->view('dashboard/dashboard_preview.php', ['dashboard_kurzbz' => $dashboard_kurzbz]);
}
// -----------------------------------------------------------------------------------------------------------------
// Private methods
@@ -9,6 +9,10 @@ $this->load->view(
'restclient' => true,
'vue3' => true,
'primevue3' => true,
'vuedatepicker11' => true,
'customJSs' => [
'vendor/moment/luxonjs/luxon.min.js'
],
'customJSModules' => ['public/js/apps/Dashboard/Admin.js'],
'customCSSs' => [
'public/css/components/dashboard.css',
@@ -8,7 +8,12 @@ $this->load->view(
'axios027' => true,
'restclient' => true,
'vue3' => true,
'customJSModules' => ['public/js/apps/Dashboard.js'],
'vuedatepicker11' => true,
'primevue3' => true,
'customJSs' => [
'vendor/moment/luxonjs/luxon.min.js'
],
'customJSModules' => ['public/js/apps/Dashboard/Preview.js'],
'customCSSs' => [
'public/css/components/dashboard.css'
],
@@ -23,9 +28,9 @@ $this->load->view(
<div id="content">
<div class="d-flex justify-content-between flex-wrap flex-md-nowrap align-items-center pt-3 pb-2 mb-3 border-bottom">
<h1 class="h2">Dashboard</h1>
<h1 class="h2">Dashboard <?= $dashboard_kurzbz ?></h1>
</div>
<core-dashboard dashboard="CIS" apiurl="<?= site_url('dashboard'); ?>"></core-dashboard>
<core-dashboard dashboard="<?= $dashboard_kurzbz ?>"></core-dashboard>
</div>
</div>