mirror of
https://github.com/FH-Complete/FHC-Core.git
synced 2026-07-24 02:12:17 +00:00
Merge branch 'feature-24647/Konfigurierbare_Dashboards' into feature-25999/C4
This commit is contained in:
@@ -59,5 +59,4 @@ class Test extends Auth_Controller
|
||||
|
||||
if (!$this->_uid) show_error('User authentification failed');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -9,7 +9,7 @@ class Api extends Auth_Controller
|
||||
array(
|
||||
'index' => 'dashboard/admin:rw',
|
||||
'getNews' => 'dashboard/benutzer:r',
|
||||
'getAmpeln' => 'dashboard/benutzer:r',
|
||||
'getAmpeln' => 'dashboard/benutzer:r',
|
||||
)
|
||||
);
|
||||
|
||||
@@ -34,9 +34,8 @@ class Api extends Auth_Controller
|
||||
|
||||
$result = $this->NewsModel->getAll($limit);
|
||||
|
||||
if(hasData($result))
|
||||
if (hasData($result))
|
||||
{
|
||||
|
||||
$this->outputJson(getData($result), REST_Controller::HTTP_OK);
|
||||
}
|
||||
else
|
||||
@@ -49,21 +48,20 @@ class Api extends Auth_Controller
|
||||
/**
|
||||
* Get Ampeln.
|
||||
*/
|
||||
public function getAmpeln(){
|
||||
public function getAmpeln()
|
||||
{
|
||||
|
||||
$this->load->model('content/Ampel_model', 'AmpelModel');
|
||||
$result = $this->AmpelModel->getByUser($this->_uid);
|
||||
|
||||
if(hasData($result))
|
||||
if (hasData($result))
|
||||
{
|
||||
|
||||
$this->outputJson(getData($result), REST_Controller::HTTP_OK);
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->terminateWithJsonError('fehler entdeckt');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -18,9 +18,9 @@ class Config extends Auth_Controller
|
||||
'removeWidgetFromPreset' => 'dashboard/admin:rw',
|
||||
'addWidgetsToUserOverride' => 'dashboard/benutzer:rw',
|
||||
'removeWidgetFromUserOverride' => 'dashboard/benutzer:rw',
|
||||
'Funktionen' => 'dashboard/admin:r',
|
||||
'Preset' => 'dashboard/admin:r',
|
||||
'PresetBatch' => 'dashboard/admin:r'
|
||||
'funktionen' => 'dashboard/admin:r',
|
||||
'preset' => 'dashboard/admin:r',
|
||||
'presetBatch' => 'dashboard/admin:r'
|
||||
)
|
||||
);
|
||||
|
||||
@@ -29,7 +29,7 @@ class Config extends Auth_Controller
|
||||
$this->load->model('ressource/Funktion_model', 'FunktionModel');
|
||||
}
|
||||
|
||||
public function index()
|
||||
public function index()
|
||||
{
|
||||
$dashboard_kurzbz = $this->input->get('db');
|
||||
$uid = $this->AuthLib->getAuthObj()->username;
|
||||
@@ -46,7 +46,7 @@ class Config extends Auth_Controller
|
||||
$this->outputJsonSuccess($mergedconfig);
|
||||
}
|
||||
|
||||
public function genWidgetId()
|
||||
public function genWidgetId()
|
||||
{
|
||||
$dashboard_kurzbz = $this->input->get('db');
|
||||
$widgetid = $this->DashboardLib->generateWidgetId($dashboard_kurzbz);
|
||||
@@ -55,23 +55,22 @@ class Config extends Auth_Controller
|
||||
));
|
||||
}
|
||||
|
||||
public function addWidgetsToPreset()
|
||||
public function addWidgetsToPreset()
|
||||
{
|
||||
$input = json_decode($this->input->raw_input_stream);
|
||||
$dashboard_kurzbz = $input->db;
|
||||
$funktion_kurzbz = $input->funktion_kurzbz;
|
||||
|
||||
$preset = $this->DashboardLib->getPresetOrCreateEmptyPreset($dashboard_kurzbz, $funktion_kurzbz);
|
||||
$preset = $this->DashboardLib->getPresetOrCreateEmptyPreset($dashboard_kurzbz, $funktion_kurzbz);
|
||||
|
||||
$preset_decoded = json_decode($preset->preset, true);
|
||||
|
||||
$this->DashboardLib->addWidgetsToWidgets($preset_decoded['widgets'],
|
||||
$dashboard_kurzbz, $funktion_kurzbz, $input->widgets);
|
||||
$this->DashboardLib->addWidgetsToWidgets($preset_decoded['widgets'], $dashboard_kurzbz, $funktion_kurzbz, $input->widgets);
|
||||
|
||||
$preset->preset = json_encode($preset_decoded);
|
||||
|
||||
$result = $this->DashboardLib->insertOrUpdatePreset($preset);
|
||||
if( isError($result) ) {
|
||||
if (isError($result)) {
|
||||
http_response_code(500);
|
||||
$this->terminateWithJsonError('preset could not be saved');
|
||||
}
|
||||
@@ -87,16 +86,13 @@ class Config extends Auth_Controller
|
||||
$widgetid = $input->widgetid;
|
||||
|
||||
$preset = $this->DashboardLib->getPreset($dashboard_kurzbz, $funktion_kurzbz);
|
||||
if( $preset === null ) {
|
||||
if ($preset === null) {
|
||||
http_response_code(404);
|
||||
$this->terminateWithJsonError('preset for dashboard '
|
||||
. $dashboard_kurzbz . ' and funktion ' . $funktion_kurzbz
|
||||
. ' not found.');
|
||||
$this->terminateWithJsonError('preset for dashboard ' . $dashboard_kurzbz . ' and funktion ' . $funktion_kurzbz . ' not found.');
|
||||
}
|
||||
|
||||
$preset_decoded = json_decode($preset->preset, true);
|
||||
if (!$this->DashboardLib->removeWidgetFromWidgets($preset_decoded['widgets'],
|
||||
$funktion_kurzbz, $widgetid))
|
||||
if (!$this->DashboardLib->removeWidgetFromWidgets($preset_decoded['widgets'], $funktion_kurzbz, $widgetid))
|
||||
{
|
||||
http_response_code(404);
|
||||
$this->terminateWithJsonError('widgetid ' . $widgetid . ' not found');
|
||||
@@ -104,32 +100,31 @@ class Config extends Auth_Controller
|
||||
|
||||
$preset->preset = json_encode($preset_decoded);
|
||||
$result = $this->DashboardLib->insertOrUpdatePreset($preset);
|
||||
if( isError($result) )
|
||||
if (isError($result))
|
||||
{
|
||||
http_response_code(500);
|
||||
$this->terminateWithJsonError('failed to remove widget');
|
||||
$this->terminateWithJsonError('failed to remove widget');
|
||||
}
|
||||
$this->outputJsonSuccess(array('msg' => 'preset successfully updated.'));
|
||||
}
|
||||
|
||||
public function addWidgetsToUserOverride()
|
||||
public function addWidgetsToUserOverride()
|
||||
{
|
||||
$input = json_decode($this->input->raw_input_stream);
|
||||
$dashboard_kurzbz = $input->db;
|
||||
$funktion_kurzbz = $input->funktion_kurzbz;
|
||||
$uid = $this->AuthLib->getAuthObj()->username;
|
||||
|
||||
$override = $this->DashboardLib->getOverrideOrCreateEmptyOverride($dashboard_kurzbz, $uid);
|
||||
$override = $this->DashboardLib->getOverrideOrCreateEmptyOverride($dashboard_kurzbz, $uid);
|
||||
|
||||
$override_decoded = json_decode($override->override, true);
|
||||
|
||||
$this->DashboardLib->addWidgetsToWidgets($override_decoded['widgets'],
|
||||
$dashboard_kurzbz, $funktion_kurzbz, $input->widgets);
|
||||
$this->DashboardLib->addWidgetsToWidgets($override_decoded['widgets'], $dashboard_kurzbz, $funktion_kurzbz, $input->widgets);
|
||||
|
||||
$override->override = json_encode($override_decoded);
|
||||
|
||||
$result = $this->DashboardLib->insertOrUpdateOverride($override);
|
||||
if( isError($result) ) {
|
||||
if (isError($result)) {
|
||||
http_response_code(500);
|
||||
$this->terminateWithJsonError('override could not be saved');
|
||||
}
|
||||
@@ -146,16 +141,14 @@ class Config extends Auth_Controller
|
||||
$widgetid = $input->widgetid;
|
||||
|
||||
$override = $this->DashboardLib->getOverride($dashboard_kurzbz, $uid);
|
||||
if( empty($override) ) {
|
||||
if (empty($override)) {
|
||||
http_response_code(404);
|
||||
$this->terminateWithJsonError('userconfig for dashboard '
|
||||
. $dashboard_kurzbz . ' not found.');
|
||||
$this->terminateWithJsonError('userconfig for dashboard ' . $dashboard_kurzbz . ' not found.');
|
||||
}
|
||||
|
||||
$override_decoded = json_decode($override->override, true);
|
||||
|
||||
if( !$this->DashboardLib->removeWidgetFromWidgets($override_decoded['widgets'],
|
||||
$funktion_kurzbz, $widgetid) )
|
||||
if (!$this->DashboardLib->removeWidgetFromWidgets($override_decoded['widgets'], $funktion_kurzbz, $widgetid))
|
||||
{
|
||||
http_response_code(404);
|
||||
$this->terminateWithJsonError('widgetid ' . $widgetid . ' not found');
|
||||
@@ -163,15 +156,15 @@ class Config extends Auth_Controller
|
||||
|
||||
$override->override = json_encode($override_decoded);
|
||||
$result = $this->DashboardLib->insertOrUpdateOverride($override, $uid);
|
||||
if( isError($result) )
|
||||
if (isError($result))
|
||||
{
|
||||
http_response_code(500);
|
||||
$this->terminateWithJsonError('failed to remove widget');
|
||||
$this->terminateWithJsonError('failed to remove widget');
|
||||
}
|
||||
$this->outputJsonSuccess(array('msg' => 'override successfully updated.'));
|
||||
}
|
||||
|
||||
public function Funktionen()
|
||||
public function funktionen()
|
||||
{
|
||||
$funktionen = $this->FunktionModel->load();
|
||||
|
||||
@@ -185,7 +178,7 @@ class Config extends Auth_Controller
|
||||
return $this->outputJsonSuccess(getData($funktionen) ?: []);
|
||||
}
|
||||
|
||||
public function Preset()
|
||||
public function preset()
|
||||
{
|
||||
$db = $this->input->get('db');
|
||||
$funktion = $this->input->get('funktion');
|
||||
@@ -198,7 +191,7 @@ class Config extends Auth_Controller
|
||||
return $this->outputJsonSuccess(json_decode($conf->preset, true));
|
||||
}
|
||||
|
||||
public function PresetBatch()
|
||||
public function presetBatch()
|
||||
{
|
||||
$db = $this->input->get('db');
|
||||
$funktionen = $this->input->get('funktionen');
|
||||
@@ -220,5 +213,4 @@ class Config extends Auth_Controller
|
||||
|
||||
return $this->outputJsonSuccess($result);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -12,9 +12,9 @@ class Dashboard extends Auth_Controller
|
||||
parent::__construct(
|
||||
array(
|
||||
'index' => 'dashboard/admin:r',
|
||||
'Create' => 'dashboard/admin:rw',
|
||||
'Update' => 'dashboard/admin:rw',
|
||||
'Delete' => 'dashboard/admin:rw'
|
||||
'create' => 'dashboard/admin:rw',
|
||||
'update' => 'dashboard/admin:rw',
|
||||
'delete' => 'dashboard/admin:rw'
|
||||
)
|
||||
);
|
||||
|
||||
@@ -22,7 +22,7 @@ class Dashboard extends Auth_Controller
|
||||
$this->load->model('dashboard/Dashboard_model', 'DashboardModel');
|
||||
}
|
||||
|
||||
public function index()
|
||||
public function index()
|
||||
{
|
||||
$result = $this->DashboardModel->load();
|
||||
|
||||
@@ -36,7 +36,7 @@ class Dashboard extends Auth_Controller
|
||||
return $this->outputJsonSuccess(getData($result) ?: []);
|
||||
}
|
||||
|
||||
public function Create()
|
||||
public function create()
|
||||
{
|
||||
$input = $this->getPostJSON();
|
||||
|
||||
@@ -52,7 +52,7 @@ class Dashboard extends Auth_Controller
|
||||
return $this->outputJsonSuccess(getData($result) ?: []);
|
||||
}
|
||||
|
||||
public function Update()
|
||||
public function update()
|
||||
{
|
||||
$input = $this->getPostJSON();
|
||||
|
||||
@@ -68,7 +68,7 @@ class Dashboard extends Auth_Controller
|
||||
return $this->outputJsonSuccess(getData($result) ?: []);
|
||||
}
|
||||
|
||||
public function Delete()
|
||||
public function delete()
|
||||
{
|
||||
$input = $this->getPostJSON();
|
||||
|
||||
@@ -83,5 +83,4 @@ class Dashboard extends Auth_Controller
|
||||
|
||||
return $this->outputJsonSuccess(getData($result) ?: []);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -17,6 +17,7 @@ class DashboardDemo extends Auth_Controller
|
||||
parent::__construct(
|
||||
array(
|
||||
'index' => 'user:r',
|
||||
'admin' => 'dashboard/admin:rw'
|
||||
)
|
||||
);
|
||||
|
||||
@@ -35,6 +36,13 @@ class DashboardDemo extends Auth_Controller
|
||||
$this->load->view('dashboard/dashboard_demo.php', []);
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------------------------------------------
|
||||
// Public methods
|
||||
public function admin()
|
||||
{
|
||||
$this->load->view('dashboard/dashboard_demo_admin.php', []);
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------------------------------------------
|
||||
// Private methods
|
||||
|
||||
@@ -47,5 +55,4 @@ class DashboardDemo extends Auth_Controller
|
||||
|
||||
if (!$this->_uid) show_error('User authentification failed');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -23,7 +23,7 @@ class Widget extends Auth_Controller
|
||||
$this->load->model('dashboard/Dashboard_Widget_model', 'DashboardWidgetModel');
|
||||
}
|
||||
|
||||
public function index()
|
||||
public function index()
|
||||
{
|
||||
$widget_id = $this->input->get('id');
|
||||
|
||||
@@ -48,7 +48,7 @@ class Widget extends Auth_Controller
|
||||
return $this->outputJsonSuccess(current(getData($widget)));
|
||||
}
|
||||
|
||||
public function getAll()
|
||||
public function getAll()
|
||||
{
|
||||
$dashboard_id = $this->input->get('dashboard_id');
|
||||
$result = $this->WidgetModel->getWithAllowedForDashboard($dashboard_id);
|
||||
@@ -59,7 +59,7 @@ class Widget extends Auth_Controller
|
||||
$this->outputJsonSuccess(getData($result) ?: []);
|
||||
}
|
||||
|
||||
public function getWidgetsForDashboard()
|
||||
public function getWidgetsForDashboard()
|
||||
{
|
||||
$db = $this->input->get('db');
|
||||
$result = $this->WidgetModel->getForDashboard($db);
|
||||
@@ -74,7 +74,8 @@ class Widget extends Auth_Controller
|
||||
$this->outputJsonSuccess(getData($result) ?: []);
|
||||
}
|
||||
|
||||
public function setAllowed() {
|
||||
public function setAllowed()
|
||||
{
|
||||
$input = $this->getPostJSON();
|
||||
|
||||
$dashboard_id = $input->dashboard_id;
|
||||
@@ -83,12 +84,12 @@ class Widget extends Auth_Controller
|
||||
|
||||
if ($action == 'add') {
|
||||
$result = $this->DashboardWidgetModel->insert([
|
||||
'dashboard_id' => $dashboard_id,
|
||||
'dashboard_id' => $dashboard_id,
|
||||
'widget_id' => $widget_id
|
||||
]);
|
||||
} elseif ($action == 'delete') {
|
||||
$result = $this->DashboardWidgetModel->delete([
|
||||
'dashboard_id' => $dashboard_id,
|
||||
'dashboard_id' => $dashboard_id,
|
||||
'widget_id' => $widget_id
|
||||
]);
|
||||
} else {
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
<?php
|
||||
defined('BASEPATH') || exit('No direct script access allowed');
|
||||
|
||||
use \stdClass as stdClass;
|
||||
|
||||
/**
|
||||
* Description of DashboardLib
|
||||
*
|
||||
@@ -14,7 +17,7 @@ class DashboardLib
|
||||
|
||||
private $_ci; // CI instance
|
||||
|
||||
public function __construct($params=null)
|
||||
public function __construct()
|
||||
{
|
||||
// Loads CI instance
|
||||
$this->_ci =& get_instance();
|
||||
@@ -24,28 +27,27 @@ class DashboardLib
|
||||
$this->_ci->load->model('dashboard/Dashboard_Override_model', 'DashboardOverrideModel');
|
||||
}
|
||||
|
||||
public function generateWidgetId($dashboard_kurzbz='')
|
||||
public function generateWidgetId($dashboard_kurzbz = '')
|
||||
{
|
||||
$dashboard_kurzbz = (!empty($dashboard_kurzbz)) ? $dashboard_kurzbz
|
||||
: self::DEFAULT_DASHBOARD_KURZBZ;
|
||||
$widgetid_input = time() . '_' . $dashboard_kurzbz . '_'
|
||||
. bin2hex(random_bytes(self::WIDGET_ID_RANDOM_BYTES));
|
||||
$dashboard_kurzbz = (!empty($dashboard_kurzbz)) ? $dashboard_kurzbz : self::DEFAULT_DASHBOARD_KURZBZ;
|
||||
$widgetid_input = time() . '_' . $dashboard_kurzbz . '_' . bin2hex(random_bytes(self::WIDGET_ID_RANDOM_BYTES));
|
||||
$widgetid = md5($widgetid_input);
|
||||
return $widgetid;
|
||||
}
|
||||
|
||||
public function getDashboardByKurzbz($dashboard_kurzbz)
|
||||
public function getDashboardByKurzbz($dashboard_kurzbz)
|
||||
{
|
||||
$dashboard = null;
|
||||
$result = $this->_ci->DashboardModel->getDashboardByKurzbz($dashboard_kurzbz);
|
||||
if( isSuccess($result) && ($dashboards = getData($result)) )
|
||||
|
||||
if (hasData($result))
|
||||
{
|
||||
$dashboard = $dashboards[0];
|
||||
return current(getData($result));
|
||||
}
|
||||
return $dashboard;
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public function getMergedConfig($dashboard_id, $uid)
|
||||
public function getMergedConfig($dashboard_id, $uid)
|
||||
{
|
||||
$defaultconfig = $this->getDefaultConfig($dashboard_id, $uid);
|
||||
$userconfig = $this->getUserConfig($dashboard_id, $uid);
|
||||
@@ -60,15 +62,15 @@ class DashboardLib
|
||||
$res_presets = $this->_ci->DashboardPresetModel->getPresets($dashboard_id, $uid);
|
||||
$defaultconfig = array();
|
||||
|
||||
if( isSuccess($res_presets) && hasData($res_presets) )
|
||||
if (hasData($res_presets))
|
||||
{
|
||||
$presets = getData($res_presets);
|
||||
foreach ($presets as $presetobj)
|
||||
{
|
||||
if( null !== ($preset = json_decode($presetobj->preset, true)) )
|
||||
$preset = json_decode($presetobj->preset, true);
|
||||
if (null !== $preset)
|
||||
{
|
||||
$defaultconfig = array_replace_recursive($defaultconfig,
|
||||
$preset);
|
||||
$defaultconfig = array_replace_recursive($defaultconfig, $preset);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -79,25 +81,25 @@ class DashboardLib
|
||||
public function getUserConfig($dashboard_id, $uid)
|
||||
{
|
||||
$res_userconfig = $this->_ci->DashboardOverrideModel->getOverride($dashboard_id, $uid);
|
||||
$userconfig = array();
|
||||
|
||||
if( isSuccess($res_userconfig) && hasData($res_userconfig) )
|
||||
if (hasData($res_userconfig))
|
||||
{
|
||||
$data = getData($res_userconfig);
|
||||
if( null !== ($decodedconfig = json_decode($data[0]->override, true)) )
|
||||
$decodedconfig = json_decode(current($data)->override, true);
|
||||
if (null !== $decodedconfig)
|
||||
{
|
||||
$userconfig = $decodedconfig;
|
||||
return $decodedconfig;
|
||||
}
|
||||
}
|
||||
|
||||
return $userconfig;
|
||||
return [];
|
||||
}
|
||||
|
||||
public function getOverrideOrCreateEmptyOverride($dashboard_kurzbz, $uid)
|
||||
public function getOverrideOrCreateEmptyOverride($dashboard_kurzbz, $uid)
|
||||
{
|
||||
$override = $this->getOverride($dashboard_kurzbz, $uid);
|
||||
if( null !== $override ) {
|
||||
return $override;
|
||||
if (null !== $override) {
|
||||
return $override;
|
||||
}
|
||||
|
||||
$dashboard = $this->getDashboardByKurzbz($dashboard_kurzbz);
|
||||
@@ -110,11 +112,13 @@ class DashboardLib
|
||||
return $emptyoverride;
|
||||
}
|
||||
|
||||
public function getPresetOrCreateEmptyPreset($dashboard_kurzbz, $funktion_kurzbz)
|
||||
public function getPresetOrCreateEmptyPreset($dashboard_kurzbz, $funktion_kurzbz)
|
||||
{
|
||||
if ($funktion_kurzbz === self::SECTION_IF_FUNKTION_KURZBZ_IS_NULL)
|
||||
$funktion_kurzbz = null;
|
||||
$preset = $this->getPreset($dashboard_kurzbz, $funktion_kurzbz);
|
||||
if( null !== $preset ) {
|
||||
return $preset;
|
||||
if (null !== $preset) {
|
||||
return $preset;
|
||||
}
|
||||
|
||||
$dashboard = $this->getDashboardByKurzbz($dashboard_kurzbz);
|
||||
@@ -123,50 +127,49 @@ class DashboardLib
|
||||
$emptypreset->dashboard_id = $dashboard->dashboard_id;
|
||||
$emptypreset->funktion_kurzbz = $funktion_kurzbz;
|
||||
$section = ($funktion_kurzbz !== null) ? $funktion_kurzbz : self::SECTION_IF_FUNKTION_KURZBZ_IS_NULL;
|
||||
$emptypreset->preset = '{"widgets": {"' . $funktion_kurzbz . '": {}}}';
|
||||
$emptypreset->preset = '{"widgets": {"' . $section . '": {}}}';
|
||||
|
||||
return $emptypreset;
|
||||
}
|
||||
|
||||
public function getPreset($dashboard_kurzbz, $section)
|
||||
public function getPreset($dashboard_kurzbz, $section)
|
||||
{
|
||||
$dashboard = $this->getDashboardByKurzbz($dashboard_kurzbz);
|
||||
$preset = null;
|
||||
|
||||
$funktion_kurzbz = ($section === self::SECTION_IF_FUNKTION_KURZBZ_IS_NULL) ? null : $section;
|
||||
$result = $this->_ci->DashboardPresetModel
|
||||
->getPresetByDashboardAndFunktion($dashboard->dashboard_id, $funktion_kurzbz);
|
||||
|
||||
if( isSuccess($result) && hasData($result) && ($presets = getData($result)) )
|
||||
if (hasData($result))
|
||||
{
|
||||
$preset = $presets[0];
|
||||
return current(getData($result));
|
||||
}
|
||||
|
||||
return $preset;
|
||||
return null;
|
||||
}
|
||||
|
||||
public function getOverride($dashboard_kurzbz, $uid)
|
||||
public function getOverride($dashboard_kurzbz, $uid)
|
||||
{
|
||||
$dashboard = $this->getDashboardByKurzbz($dashboard_kurzbz);
|
||||
$override = null;
|
||||
|
||||
$result = $this->_ci->DashboardOverrideModel
|
||||
->getOverride($dashboard->dashboard_id, $uid);
|
||||
|
||||
if( isSuccess($result) && hasData($result) && ($overrides = getData($result)) )
|
||||
if (hasData($result))
|
||||
{
|
||||
$override = $overrides[0];
|
||||
return current(getData($result));
|
||||
}
|
||||
|
||||
return $override;
|
||||
return null;
|
||||
}
|
||||
|
||||
public function insertOrUpdatePreset($preset)
|
||||
public function insertOrUpdatePreset($preset)
|
||||
{
|
||||
if( isset($preset->preset_id) && $preset->preset_id > 0 )
|
||||
if (isset($preset->preset_id) && $preset->preset_id > 0)
|
||||
{
|
||||
$result = $this->_ci->DashboardPresetModel->update($preset->preset_id, $preset);
|
||||
} else
|
||||
}
|
||||
else
|
||||
{
|
||||
$result = $this->_ci->DashboardPresetModel->insert($preset);
|
||||
}
|
||||
@@ -174,12 +177,13 @@ class DashboardLib
|
||||
return $result;
|
||||
}
|
||||
|
||||
public function insertOrUpdateOverride($override)
|
||||
public function insertOrUpdateOverride($override)
|
||||
{
|
||||
if( isset($override->override_id) && $override->override_id > 0 )
|
||||
if (isset($override->override_id) && $override->override_id > 0)
|
||||
{
|
||||
$result = $this->_ci->DashboardOverrideModel->update($override->override_id, $override);
|
||||
} else
|
||||
}
|
||||
else
|
||||
{
|
||||
$result = $this->_ci->DashboardOverrideModel->insert($override);
|
||||
}
|
||||
@@ -199,10 +203,10 @@ class DashboardLib
|
||||
}
|
||||
}
|
||||
|
||||
public function addWidgetToWidgets(&$widgets, $section, $widget, $widgetid)
|
||||
public function addWidgetToWidgets(&$widgets, $section, $widget, $widgetid)
|
||||
{
|
||||
$section = ($section !== null) ? $section : self::SECTION_IF_FUNKTION_KURZBZ_IS_NULL;
|
||||
if( !isset($widgets[$section]) || !is_array($widgets[$section]) )
|
||||
if (!isset($widgets[$section]) || !is_array($widgets[$section]))
|
||||
{
|
||||
$widgets[$section] = array();
|
||||
}
|
||||
@@ -210,10 +214,10 @@ class DashboardLib
|
||||
$widgets[$section][$widgetid] = $widget;
|
||||
}
|
||||
|
||||
public function removeWidgetFromWidgets(&$widgets, $section, $widgetid)
|
||||
public function removeWidgetFromWidgets(&$widgets, $section, $widgetid)
|
||||
{
|
||||
$section = ($section !== null) ? $section : self::SECTION_IF_FUNKTION_KURZBZ_IS_NULL;
|
||||
if(isset($widgets[$section]) && isset($widgets[$section][$widgetid]) )
|
||||
$section = ($section !== null) ? $section : self::SECTION_IF_FUNKTION_KURZBZ_IS_NULL;
|
||||
if (isset($widgets[$section]) && isset($widgets[$section][$widgetid]))
|
||||
{
|
||||
unset($widgets[$section][$widgetid]);
|
||||
if(empty($widgets[$section]) && $section !== self::USEROVERRIDE_SECTION) {
|
||||
|
||||
@@ -60,7 +60,7 @@ EOSQL;
|
||||
* @param string funktion_kurzbz
|
||||
* @return array
|
||||
*/
|
||||
public function getPresetByDashboardAndFunktion($dashboard_id, $funktion_kurzbz)
|
||||
public function getPresetByDashboardAndFunktion($dashboard_id, $funktion_kurzbz)
|
||||
{
|
||||
return $this->loadWhere(array('dashboard_id' => $dashboard_id, 'funktion_kurzbz' => $funktion_kurzbz));
|
||||
}
|
||||
|
||||
@@ -12,5 +12,4 @@ class Dashboard_Widget_model extends DB_Model
|
||||
$this->pk = ['dashboard_id', 'widget_id'];
|
||||
$this->hasSequence = false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -29,5 +29,4 @@ class Widget_model extends DB_Model
|
||||
|
||||
return $this->loadWhere(['dashboard_kurzbz' => $db]);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
<?php
|
||||
$this->load->view('templates/FHC-Header',
|
||||
$this->load->view(
|
||||
'templates/FHC-Header',
|
||||
array(
|
||||
'title' => 'FH-Complete',
|
||||
'bootstrap5' => true,
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
$this->load->view(
|
||||
'templates/FHC-Header',
|
||||
array(
|
||||
'title' => 'FH-Complete',
|
||||
'bootstrap5' => true,
|
||||
'fontawesome6' => true,
|
||||
'axios027' => true,
|
||||
'restclient' => true,
|
||||
'vue3' => true,
|
||||
'customJSModules' => ['public/js/apps/DashboardAdmin.js'],
|
||||
'customCSSs' => [
|
||||
'public/css/components/dashboard.css'
|
||||
],
|
||||
'navigationcomponent' => true
|
||||
)
|
||||
);
|
||||
?>
|
||||
|
||||
<div id="main">
|
||||
|
||||
<core-navigation-cmpt :add-side-menu-entries="appSideMenuEntries"></core-navigation-cmpt>
|
||||
|
||||
<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>
|
||||
</div>
|
||||
<dashboard-admin dashboard="CIS" apiurl="<?= site_url('dashboard'); ?>"></dashboard-admin>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php $this->load->view('templates/FHC-Footer'); ?>
|
||||
@@ -1,5 +1,6 @@
|
||||
<?php
|
||||
$this->load->view('templates/FHC-Header',
|
||||
$this->load->view(
|
||||
'templates/FHC-Header',
|
||||
array(
|
||||
'title' => 'FH-Complete',
|
||||
'bootstrap5' => true,
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
<?php
|
||||
$this->load->view('templates/FHC-Header',
|
||||
$this->load->view(
|
||||
'templates/FHC-Header',
|
||||
array(
|
||||
'title' => 'FH-Complete',
|
||||
'bootstrap5' => true,
|
||||
|
||||
Reference in New Issue
Block a user