mirror of
https://github.com/FH-Complete/FHC-Core.git
synced 2026-06-01 12:19:28 +00:00
Funktionen fett schreiben, die schon presets hinterlegt haben, demo aus views und Controller namen entfernen, preview hinzufuegen
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
+9
-10
@@ -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
|
||||
Reference in New Issue
Block a user