N°2847 - Datatable modal dialogs

This commit is contained in:
Eric
2020-11-19 17:45:46 +01:00
parent 26d912f059
commit 32e0c8f9bf
24 changed files with 541 additions and 170 deletions

View File

@@ -63,7 +63,8 @@ trait tUIContentAreas {
*
* @return $this
*/
protected function SetContentAreaBlocks(string $sAreaId, array $aBlocks) {
protected function SetContentAreaBlocks(string $sAreaId, array $aBlocks)
{
if (!isset($this->aContentAreasBlocks[$sAreaId])) {
$this->aContentAreasBlocks[$sAreaId] = new UIContentBlock($sAreaId);
}
@@ -73,6 +74,25 @@ trait tUIContentAreas {
return $this;
}
/**
* Set all block for a content area at once, replacing all existing ones.
*
* @param string $sAreaId
* @param \Combodo\iTop\Application\UI\iUIBlock[] $aBlocks
*
* @return $this
*/
protected function SetContentAreaDeferredBlocks(string $sAreaId, array $aBlocks)
{
if (!isset($this->aContentAreasBlocks[$sAreaId])) {
$this->aContentAreasBlocks[$sAreaId] = new UIContentBlock($sAreaId);
}
$this->aContentAreasBlocks[$sAreaId]->SetDeferredBlocks($aBlocks);
return $this;
}
/**
* Return all blocks from the $sAreaId content area
*
@@ -81,7 +101,8 @@ trait tUIContentAreas {
* @return \Combodo\iTop\Application\UI\iUIBlock[]
* @throws \Combodo\iTop\Application\UI\UIException
*/
protected function GetContentAreaBlocks(string $sAreaId): array {
protected function GetContentAreaBlocks(string $sAreaId): array
{
if (!array_key_exists($sAreaId, $this->aContentAreasBlocks)) {
throw new UIException($this, Dict::Format('UIBlock:Error:CannotGetBlocks', $sAreaId, $this->GetId()));
}
@@ -98,7 +119,8 @@ trait tUIContentAreas {
*
* @return $this
*/
protected function AddBlockToContentArea(string $sAreaId, iUIBlock $oBlock) {
protected function AddBlockToContentArea(string $sAreaId, iUIBlock $oBlock)
{
if (!array_key_exists($sAreaId, $this->aContentAreasBlocks)) {
$this->aContentAreasBlocks[$sAreaId] = new UIContentBlock($sAreaId);
}
@@ -108,6 +130,26 @@ trait tUIContentAreas {
return $this;
}
/**
* Add $oBlock to the $sAreaId content area.
* Note that if the area doesn't exist yet, it is created. Also if a block with the same ID already exists, it will be replaced.
*
* @param string $sAreaId
* @param \Combodo\iTop\Application\UI\iUIBlock $oBlock
*
* @return $this
*/
protected function AddDeferredBlockToContentArea(string $sAreaId, iUIBlock $oBlock)
{
if (!array_key_exists($sAreaId, $this->aContentAreasBlocks)) {
$this->aContentAreasBlocks[$sAreaId] = new UIContentBlock($sAreaId);
}
$this->aContentAreasBlocks[$sAreaId]->AddDeferredBlock($oBlock);
return $this;
}
/**
* Remove the $sBlockId from the $sAreaId content area.
* Note that if the $sBlockId or the $sAreaId do not exist, it proceeds silently.