mirror of
https://github.com/Combodo/iTop.git
synced 2026-04-23 10:38:45 +02:00
N°3573 - Migrate backoffice pages to new UIBlock system : System Information
This commit is contained in:
@@ -367,8 +367,7 @@ abstract class Controller
|
||||
*/
|
||||
public function DisplayPage($aParams = array(), $sTemplateName = null, $sPageType = 'html')
|
||||
{
|
||||
if (empty($sTemplateName))
|
||||
{
|
||||
if (empty($sTemplateName)) {
|
||||
$sTemplateName = $this->m_sOperation;
|
||||
}
|
||||
$aParams = array_merge($this->GetDefaultParameters(), $aParams);
|
||||
@@ -376,25 +375,21 @@ abstract class Controller
|
||||
$this->AddToPage($this->RenderTemplate($aParams, $sTemplateName, 'html'));
|
||||
$this->AddScriptToPage($this->RenderTemplate($aParams, $sTemplateName, 'js'));
|
||||
$this->AddReadyScriptToPage($this->RenderTemplate($aParams, $sTemplateName, 'ready.js'));
|
||||
if (!empty($this->m_aAjaxTabs))
|
||||
{
|
||||
$this->AddStyleToPage($this->RenderTemplate($aParams, $sTemplateName, 'css'));
|
||||
if (!empty($this->m_aAjaxTabs)) {
|
||||
$this->m_oPage->AddTabContainer('');
|
||||
$this->m_oPage->SetCurrentTabContainer('');
|
||||
}
|
||||
foreach ($this->m_aAjaxTabs as $sTabCode => $aTabData)
|
||||
{
|
||||
foreach ($this->m_aAjaxTabs as $sTabCode => $aTabData) {
|
||||
$this->AddAjaxTabToPage($sTabCode, $aTabData['label'], $aTabData['url'], $aTabData['cache']);
|
||||
}
|
||||
foreach ($this->m_aLinkedScripts as $sLinkedScript)
|
||||
{
|
||||
foreach ($this->m_aLinkedScripts as $sLinkedScript) {
|
||||
$this->AddLinkedScriptToPage($sLinkedScript);
|
||||
}
|
||||
foreach ($this->m_aLinkedStylesheets as $sLinkedStylesheet)
|
||||
{
|
||||
foreach ($this->m_aLinkedStylesheets as $sLinkedStylesheet) {
|
||||
$this->AddLinkedStylesheetToPage($sLinkedStylesheet);
|
||||
}
|
||||
foreach ($this->m_aSaas as $sSaasRelPath)
|
||||
{
|
||||
foreach ($this->m_aSaas as $sSaasRelPath) {
|
||||
$this->AddSaasToPage($sSaasRelPath);
|
||||
}
|
||||
$this->OutputPage();
|
||||
@@ -432,8 +427,7 @@ abstract class Controller
|
||||
*/
|
||||
public function DownloadZippedPage($aParams = array(), $sTemplateName = null)
|
||||
{
|
||||
if (empty($sTemplateName))
|
||||
{
|
||||
if (empty($sTemplateName)) {
|
||||
$sTemplateName = $this->m_sOperation;
|
||||
}
|
||||
$sReportFolder = str_replace("\\", '/', APPROOT.'log/');
|
||||
@@ -441,7 +435,10 @@ abstract class Controller
|
||||
$sHTMLReport = $sReportFolder.$sReportFile.'.html';
|
||||
$sZIPReportFile = $sReportFile;
|
||||
|
||||
file_put_contents($sHTMLReport, $this->RenderTemplate($aParams, $sTemplateName, 'html'));
|
||||
ob_start();
|
||||
$this->DisplayPage($aParams, $sTemplateName, self::ENUM_PAGE_TYPE_BASIC_HTML);
|
||||
file_put_contents($sHTMLReport, ob_get_contents());
|
||||
ob_end_clean();
|
||||
|
||||
$this->ZipDownloadRemoveFile(array($sHTMLReport), $sZIPReportFile, true);
|
||||
}
|
||||
@@ -658,6 +655,11 @@ abstract class Controller
|
||||
$this->m_oPage->add_linked_stylesheet($sLinkedStylesheet);
|
||||
}
|
||||
|
||||
private function AddStyleToPage($sStyle)
|
||||
{
|
||||
$this->m_oPage->add_style($sStyle);
|
||||
}
|
||||
|
||||
private function AddSaasToPage($sSaasRelPath)
|
||||
{
|
||||
$this->m_oPage->add_saas($sSaasRelPath);
|
||||
|
||||
@@ -35,7 +35,7 @@ class Alert extends UIContentBlock
|
||||
// Overloaded constants
|
||||
public const BLOCK_CODE = 'ibo-alert';
|
||||
public const DEFAULT_HTML_TEMPLATE_REL_PATH = 'base/components/alert/layout';
|
||||
public const DEFAULT_JS_TEMPLATE_REL_PATH = 'base/components/alert/layout';
|
||||
public const DEFAULT_JS_ON_READY_TEMPLATE_REL_PATH = 'base/components/alert/layout';
|
||||
public const DEFAULT_JS_FILES_REL_PATH = [
|
||||
'js/components/alert.js',
|
||||
];
|
||||
|
||||
@@ -42,12 +42,16 @@ class PanelUIBlockFactory extends AbstractUIBlockFactory
|
||||
* Make a basis Panel component
|
||||
*
|
||||
* @param string $sTitle
|
||||
* @param string|null $sSubTitle
|
||||
*
|
||||
* @return \Combodo\iTop\Application\UI\Base\Component\Panel\Panel
|
||||
*/
|
||||
public static function MakeNeutral(string $sTitle)
|
||||
public static function MakeNeutral(string $sTitle, string $sSubTitle = null)
|
||||
{
|
||||
$oPanel = new Panel($sTitle);
|
||||
if (!is_null($sSubTitle)) {
|
||||
$oPanel->SetSubTitle($sSubTitle);
|
||||
}
|
||||
$oPanel->SetColor(Panel::ENUM_COLOR_NEUTRAL);
|
||||
|
||||
return $oPanel;
|
||||
@@ -57,12 +61,16 @@ class PanelUIBlockFactory extends AbstractUIBlockFactory
|
||||
* Make a Panel component for informational messages
|
||||
*
|
||||
* @param string $sTitle
|
||||
* @param string|null $sSubTitle
|
||||
*
|
||||
* @return \Combodo\iTop\Application\UI\Base\Component\Panel\Panel
|
||||
*/
|
||||
public static function MakeForInformation(string $sTitle)
|
||||
public static function MakeForInformation(string $sTitle, string $sSubTitle = null)
|
||||
{
|
||||
$oPanel = new Panel($sTitle);
|
||||
if (!is_null($sSubTitle)) {
|
||||
$oPanel->SetSubTitle($sSubTitle);
|
||||
}
|
||||
$oPanel->SetColor(Panel::ENUM_COLOR_INFORMATION);
|
||||
|
||||
return $oPanel;
|
||||
@@ -72,12 +80,16 @@ class PanelUIBlockFactory extends AbstractUIBlockFactory
|
||||
* Make a Panel component for successful messages
|
||||
*
|
||||
* @param string $sTitle
|
||||
* @param string|null $sSubTitle
|
||||
*
|
||||
* @return \Combodo\iTop\Application\UI\Base\Component\Panel\Panel
|
||||
*/
|
||||
public static function MakeForSuccess(string $sTitle)
|
||||
public static function MakeForSuccess(string $sTitle, string $sSubTitle = null)
|
||||
{
|
||||
$oPanel = new Panel($sTitle);
|
||||
if (!is_null($sSubTitle)) {
|
||||
$oPanel->SetSubTitle($sSubTitle);
|
||||
}
|
||||
$oPanel->SetColor(Panel::ENUM_COLOR_SUCCESS);
|
||||
|
||||
return $oPanel;
|
||||
@@ -87,12 +99,16 @@ class PanelUIBlockFactory extends AbstractUIBlockFactory
|
||||
* Make a Panel component for warning messages
|
||||
*
|
||||
* @param string $sTitle
|
||||
* @param string|null $sSubTitle
|
||||
*
|
||||
* @return \Combodo\iTop\Application\UI\Base\Component\Panel\Panel
|
||||
*/
|
||||
public static function MakeForWarning(string $sTitle)
|
||||
public static function MakeForWarning(string $sTitle, string $sSubTitle = null)
|
||||
{
|
||||
$oPanel = new Panel($sTitle);
|
||||
if (!is_null($sSubTitle)) {
|
||||
$oPanel->SetSubTitle($sSubTitle);
|
||||
}
|
||||
$oPanel->SetColor(Panel::ENUM_COLOR_WARNING);
|
||||
|
||||
return $oPanel;
|
||||
@@ -102,12 +118,16 @@ class PanelUIBlockFactory extends AbstractUIBlockFactory
|
||||
* Make a Panel component for danger messages
|
||||
*
|
||||
* @param string $sTitle
|
||||
* @param string|null $sSubTitle
|
||||
*
|
||||
* @return \Combodo\iTop\Application\UI\Base\Component\Panel\Panel
|
||||
*/
|
||||
public static function MakeForDanger(string $sTitle)
|
||||
public static function MakeForDanger(string $sTitle, string $sSubTitle = null)
|
||||
{
|
||||
$oPanel = new Panel($sTitle);
|
||||
if (!is_null($sSubTitle)) {
|
||||
$oPanel->SetSubTitle($sSubTitle);
|
||||
}
|
||||
$oPanel->SetColor(Panel::ENUM_COLOR_DANGER);
|
||||
|
||||
return $oPanel;
|
||||
@@ -117,12 +137,16 @@ class PanelUIBlockFactory extends AbstractUIBlockFactory
|
||||
* Make a Panel component for failure messages
|
||||
*
|
||||
* @param string $sTitle
|
||||
* @param string|null $sSubTitle
|
||||
*
|
||||
* @return \Combodo\iTop\Application\UI\Base\Component\Panel\Panel
|
||||
*/
|
||||
public static function MakeForFailure(string $sTitle)
|
||||
public static function MakeForFailure(string $sTitle, string $sSubTitle = null)
|
||||
{
|
||||
$oPanel = new Panel($sTitle);
|
||||
if (!is_null($sSubTitle)) {
|
||||
$oPanel->SetSubTitle($sSubTitle);
|
||||
}
|
||||
$oPanel->SetColor(Panel::ENUM_COLOR_FAILURE);
|
||||
|
||||
return $oPanel;
|
||||
@@ -132,12 +156,16 @@ class PanelUIBlockFactory extends AbstractUIBlockFactory
|
||||
* Make a Panel component with primary color scheme
|
||||
*
|
||||
* @param string $sTitle
|
||||
* @param string|null $sSubTitle
|
||||
*
|
||||
* @return \Combodo\iTop\Application\UI\Base\Component\Panel\Panel
|
||||
*/
|
||||
public static function MakeWithBrandingPrimaryColor(string $sTitle)
|
||||
public static function MakeWithBrandingPrimaryColor(string $sTitle, string $sSubTitle = null)
|
||||
{
|
||||
$oPanel = new Panel($sTitle);
|
||||
if (!is_null($sSubTitle)) {
|
||||
$oPanel->SetSubTitle($sSubTitle);
|
||||
}
|
||||
$oPanel->SetColor(Panel::ENUM_COLOR_PRIMARY);
|
||||
|
||||
return $oPanel;
|
||||
@@ -147,12 +175,16 @@ class PanelUIBlockFactory extends AbstractUIBlockFactory
|
||||
* Make a Panel component with secondary color scheme
|
||||
*
|
||||
* @param string $sTitle
|
||||
* @param string|null $sSubTitle
|
||||
*
|
||||
* @return \Combodo\iTop\Application\UI\Base\Component\Panel\Panel
|
||||
*/
|
||||
public static function MakeWithBrandingSecondaryColor(string $sTitle)
|
||||
public static function MakeWithBrandingSecondaryColor(string $sTitle, string $sSubTitle = null)
|
||||
{
|
||||
$oPanel = new Panel($sTitle);
|
||||
if (!is_null($sSubTitle)) {
|
||||
$oPanel->SetSubTitle($sSubTitle);
|
||||
}
|
||||
$oPanel->SetColor(Panel::ENUM_COLOR_SECONDARY);
|
||||
|
||||
return $oPanel;
|
||||
@@ -163,12 +195,16 @@ class PanelUIBlockFactory extends AbstractUIBlockFactory
|
||||
*
|
||||
* @param string $sClass Class of the object the panel is for
|
||||
* @param string $sTitle
|
||||
* @param string|null $sSubTitle
|
||||
*
|
||||
* @return \Combodo\iTop\Application\UI\Base\Component\Panel\Panel
|
||||
*/
|
||||
public static function MakeForClass(string $sClass, string $sTitle)
|
||||
public static function MakeForClass(string $sClass, string $sTitle, string $sSubTitle = null)
|
||||
{
|
||||
$oPanel = new Panel($sTitle);
|
||||
if (!is_null($sSubTitle)) {
|
||||
$oPanel->SetSubTitle($sSubTitle);
|
||||
}
|
||||
$oPanel->SetColorFromClass($sClass);
|
||||
|
||||
return $oPanel;
|
||||
|
||||
@@ -8,7 +8,7 @@ namespace Combodo\iTop\Application\UI\Base\Layout\MultiColumn;
|
||||
|
||||
|
||||
use Combodo\iTop\Application\UI\Base\Layout\MultiColumn\Column\Column;
|
||||
use Combodo\iTop\Application\UI\Base\UIBlock;
|
||||
use Combodo\iTop\Application\UI\Base\Layout\UIContentBlock;
|
||||
|
||||
/**
|
||||
* Class MultiColumn
|
||||
@@ -17,20 +17,18 @@ use Combodo\iTop\Application\UI\Base\UIBlock;
|
||||
* @internal
|
||||
* @since 3.0.0
|
||||
*/
|
||||
class MultiColumn extends UIBlock {
|
||||
class MultiColumn extends UIContentBlock
|
||||
{
|
||||
// Overloaded constants
|
||||
public const BLOCK_CODE = 'ibo-multi-column';
|
||||
public const DEFAULT_HTML_TEMPLATE_REL_PATH = 'base/layouts/multi-column/layout';
|
||||
|
||||
/** @var \Combodo\iTop\Application\UI\Base\Layout\MultiColumn\Column\Column[] */
|
||||
protected $aColumns;
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public function __construct(?string $sId = null) {
|
||||
public function __construct(?string $sId = null)
|
||||
{
|
||||
parent::__construct($sId);
|
||||
$this->aColumns = [];
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -38,32 +36,10 @@ class MultiColumn extends UIBlock {
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function AddColumn(Column $oColumn) {
|
||||
$this->aColumns[] = $oColumn;
|
||||
public function AddColumn(Column $oColumn)
|
||||
{
|
||||
$this->AddSubBlock($oColumn);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the column of $iIndex index.
|
||||
* Note that if the column does not exists, it proceeds silently.
|
||||
*
|
||||
* @param int $iIndex
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function RemoveColumn(int $iIndex) {
|
||||
if (isset($this->aColumns[$iIndex])) {
|
||||
unset($this->aColumns[$iIndex]);
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public function GetSubBlocks() {
|
||||
return $this->aColumns;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user