Dashlet form in new dashboard layout (suite)

This commit is contained in:
Benjamin DALSASS
2026-01-08 15:30:51 +01:00
parent b014b9f638
commit 4a8804b8ac
9 changed files with 218 additions and 148 deletions

View File

@@ -2,27 +2,32 @@
namespace Combodo\iTop\Application\UI\Base\Component\Dashlet;
use Combodo\iTop\Application\UI\Base\UIBlock;
use Dashlet;
class DashletWrapper extends UIBlock {
public const BLOCK_CODE = 'ibo-dashlet-wrapper';
class DashletWrapper extends UIBlock
{
public const BLOCK_CODE = 'ibo-dashlet-wrapper';
public const DEFAULT_HTML_TEMPLATE_REL_PATH = 'base/components/dashlet/dashlet-wrapper';
protected $oDashlet;
protected DashletContainer $oDashletContainer;
protected $sDashletClass;
protected $sDashletId;
private array $aFormViewData;
public function __construct($oDashlet, ?string $sDashletId = null, ?string $sDashletClass = null) {
public function __construct($oDashlet, string $sDashletClass, ?string $sDashletId = null, array $aFormViewData = [])
{
parent::__construct(null);
$this->oDashlet = $oDashlet;
$this->oDashletContainer = $oDashlet;
$this->sDashletId = $sDashletId;
$this->sDashletClass = $sDashletClass;
$this->aFormViewData = $aFormViewData;
}
public function GetDashlet() {
return $this->oDashlet;
public function GetDashlet()
{
return $this->oDashletContainer;
}
public function GetDashletId(): ?string
@@ -48,4 +53,9 @@ class DashletWrapper extends UIBlock {
return $this;
}
public function GetFormViewData()
{
return $this->aFormViewData;
}
}

View File

@@ -18,7 +18,7 @@ class DashboardGrid extends UIBlock
public const BLOCK_CODE = 'ibo-dashboard-grid';
public const DEFAULT_HTML_TEMPLATE_REL_PATH = 'base/layouts/dashboard/grid/layout';
public const DEFAULT_JS_FILES_REL_PATH = [
public const DEFAULT_JS_FILES_REL_PATH = [
'js/layouts/dashboard/dashboard-grid.js',
];
@@ -53,8 +53,9 @@ class DashboardGrid extends UIBlock
return $this;
}
public function AddDashlet(UIBlock $oDashlet, ?string $sDashletId = null, ?string $sDashletClass = null): DashboardGrid {
$oWrapper = new DashletWrapper($oDashlet, $sDashletId, $sDashletClass);
public function AddDashlet(UIBlock $oDashlet, string $sDashletId, string $sDashletClass, array $aFormViewData): DashboardGrid
{
$oWrapper = new DashletWrapper($oDashlet, $sDashletClass, $sDashletId, $aFormViewData);
$oSlot = new DashboardGridSlot(null, $oWrapper);
$this->AddSlot($oSlot);