mirror of
https://github.com/Combodo/iTop.git
synced 2026-04-25 19:48:49 +02:00
N°2847 - Add page content layout feature
This commit is contained in:
@@ -0,0 +1,105 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright (C) 2013-2020 Combodo SARL
|
||||
*
|
||||
* This file is part of iTop.
|
||||
*
|
||||
* iTop is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* iTop 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 Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
*/
|
||||
|
||||
namespace Combodo\iTop\Application\UI\Layout\PageContent;
|
||||
|
||||
|
||||
use Combodo\iTop\Application\UI\iUIBlock;
|
||||
|
||||
/**
|
||||
* Class PageContentWithSideContent
|
||||
*
|
||||
* @author Guillaume Lajarige <guillaume.lajarige@combodo.com>
|
||||
* @package Combodo\iTop\Application\UI\Layout\PageContent
|
||||
* @internal
|
||||
* @since 2.8.0
|
||||
*/
|
||||
class PageContentWithSideContent extends PageContent
|
||||
{
|
||||
// Overloaded constants
|
||||
const BLOCK_CODE = 'ibo-page-content-with-side-content';
|
||||
const HTML_TEMPLATE_REL_PATH = 'layouts/page-content/with-side-content';
|
||||
|
||||
// Specific constants
|
||||
const ENUM_CONTENT_AREA_SIDE = 'side';
|
||||
|
||||
/**
|
||||
* PageContentWithSideContent constructor.
|
||||
*
|
||||
* @param string $sId
|
||||
*/
|
||||
public function __construct($sId = null)
|
||||
{
|
||||
parent::__construct($sId);
|
||||
|
||||
$this->SetSideBlocks([]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set all side blocks at once.
|
||||
*
|
||||
* @param \Combodo\iTop\Application\UI\iUIBlock[] $aBlocks
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function SetSideBlocks($aBlocks)
|
||||
{
|
||||
$this->SetContentAreaBlocks(static::ENUM_CONTENT_AREA_SIDE, $aBlocks);
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return all the side blocks
|
||||
*
|
||||
* @return \Combodo\iTop\Application\UI\iUIBlock[]
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function GetSideBlocks()
|
||||
{
|
||||
return $this->GetContentAreaBlocks(static::ENUM_CONTENT_AREA_SIDE);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add the $oBlock to the side blocks.
|
||||
* Note that if a block with the same ID already exists, it will be replaced.
|
||||
*
|
||||
* @param \Combodo\iTop\Application\UI\iUIBlock $oBlock
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function AddSideBlock(iUIBlock $oBlock)
|
||||
{
|
||||
$this->AddBlockToContentArea(static::ENUM_CONTENT_AREA_SIDE, $oBlock);
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the side block identified by $sBlockId.
|
||||
* Note that if no block with that ID exists, it will proceed silently.
|
||||
*
|
||||
* @param string $sBlockId
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function RemoveSideBlock($sBlockId)
|
||||
{
|
||||
$this->RemoveBlockFromContentArea(static::ENUM_CONTENT_AREA_SIDE, $sBlockId);
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user