mirror of
https://github.com/FH-Complete/FHC-Core.git
synced 2026-06-01 12:19:28 +00:00
rename dashboard admin controller and views
This commit is contained in:
@@ -0,0 +1,52 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* Copyright (C) 2026 fhcomplete.org
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
if (! defined('BASEPATH')) exit('No direct script access allowed');
|
||||||
|
|
||||||
|
/**
|
||||||
|
*/
|
||||||
|
class Admin extends Auth_Controller
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Constructor
|
||||||
|
*/
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
// Set required permissions
|
||||||
|
parent::__construct(
|
||||||
|
array(
|
||||||
|
'index' => 'dashboard/admin:rw',
|
||||||
|
'preview' => 'dashboard/admin:r',
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
// -----------------------------------------------------------------------------------------------------------------
|
||||||
|
// Public methods
|
||||||
|
public function index()
|
||||||
|
{
|
||||||
|
$this->load->view('dashboard/admin.php', []);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function preview($dashboard_kurzbz = 'CIS')
|
||||||
|
{
|
||||||
|
$this->load->view('dashboard/preview.php', [
|
||||||
|
'dashboard_kurzbz' => $dashboard_kurzbz
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,57 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
if (! defined('BASEPATH')) exit('No direct script access allowed');
|
|
||||||
|
|
||||||
/**
|
|
||||||
*/
|
|
||||||
class DashboardAdmin extends Auth_Controller
|
|
||||||
{
|
|
||||||
private $_uid; // uid of the logged user
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Constructor
|
|
||||||
*/
|
|
||||||
public function __construct()
|
|
||||||
{
|
|
||||||
// Set required permissions
|
|
||||||
parent::__construct(
|
|
||||||
array(
|
|
||||||
'index' => 'dashboard/admin:rw',
|
|
||||||
'preview' => 'dashboard/admin:r',
|
|
||||||
)
|
|
||||||
);
|
|
||||||
|
|
||||||
$this->load->library('AuthLib');
|
|
||||||
$this->load->library('WidgetLib');
|
|
||||||
|
|
||||||
$this->_setAuthUID(); // sets property uid
|
|
||||||
|
|
||||||
$this->setControllerId(); // sets the controller id
|
|
||||||
}
|
|
||||||
|
|
||||||
// -----------------------------------------------------------------------------------------------------------------
|
|
||||||
// Public methods
|
|
||||||
public function index()
|
|
||||||
{
|
|
||||||
$this->load->view('dashboard/dashboard_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
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Retrieve the UID of the logged user and checks if it is valid
|
|
||||||
*/
|
|
||||||
private function _setAuthUID()
|
|
||||||
{
|
|
||||||
$this->_uid = getAuthUID();
|
|
||||||
|
|
||||||
if (!$this->_uid) show_error('User authentification failed');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
+1
-1
@@ -31,7 +31,7 @@ $this->load->view(
|
|||||||
<div class="d-flex justify-content-between flex-wrap flex-md-nowrap align-items-center pt-3 pb-2 mb-3 border-bottom">
|
<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</h1>
|
||||||
</div>
|
</div>
|
||||||
<dashboard-admin dashboard="CIS" apiurl="<?= site_url('dashboard'); ?>"></dashboard-admin>
|
<dashboard-admin></dashboard-admin>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
Reference in New Issue
Block a user