mirror of
https://github.com/Combodo/iTop.git
synced 2026-02-13 15:34:12 +01:00
186 lines
4.3 KiB
PHP
186 lines
4.3 KiB
PHP
<?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\Component\Panel;
|
|
|
|
/**
|
|
* Class PanelFactory
|
|
*
|
|
* @internal
|
|
* @author Guillaume Lajarige <guillaume.lajarige@combodo.com>
|
|
* @package Combodo\iTop\Application\UI\Component\Panel
|
|
* @since 3.0.0
|
|
*/
|
|
class PanelFactory
|
|
{
|
|
/**
|
|
* Make a basis Panel component
|
|
*
|
|
* @param string $sTitle
|
|
*
|
|
* @return \Combodo\iTop\Application\UI\Component\Panel\Panel
|
|
*/
|
|
public static function MakeNeutral(string $sTitle)
|
|
{
|
|
$oPanel = new Panel($sTitle);
|
|
// TODO 3.0.0: Set this back to neutral when object details are done
|
|
$oPanel->SetColor(Panel::ENUM_COLOR_BLUE);
|
|
|
|
return $oPanel;
|
|
}
|
|
|
|
/**
|
|
* Make a Panel component for informational messages
|
|
*
|
|
* @param string $sTitle
|
|
*
|
|
* @return \Combodo\iTop\Application\UI\Component\Panel\Panel
|
|
*/
|
|
public static function MakeForInformation(string $sTitle)
|
|
{
|
|
$oPanel = new Panel($sTitle);
|
|
$oPanel->SetColor(Panel::ENUM_COLOR_INFORMATION);
|
|
|
|
return $oPanel;
|
|
}
|
|
|
|
/**
|
|
* Make a Panel component for successful messages
|
|
*
|
|
* @param string $sTitle
|
|
*
|
|
* @return \Combodo\iTop\Application\UI\Component\Panel\Panel
|
|
*/
|
|
public static function MakeForSuccess(string $sTitle)
|
|
{
|
|
$oPanel = new Panel($sTitle);
|
|
$oPanel->SetColor(Panel::ENUM_COLOR_SUCCESS);
|
|
|
|
return $oPanel;
|
|
}
|
|
|
|
/**
|
|
* Make a Panel component for warning messages
|
|
*
|
|
* @param string $sTitle
|
|
*
|
|
* @return \Combodo\iTop\Application\UI\Component\Panel\Panel
|
|
*/
|
|
public static function MakeForWarning(string $sTitle)
|
|
{
|
|
$oPanel = new Panel($sTitle);
|
|
$oPanel->SetColor(Panel::ENUM_COLOR_WARNING);
|
|
|
|
return $oPanel;
|
|
}
|
|
|
|
/**
|
|
* Make a Panel component for danger messages
|
|
*
|
|
* @param string $sTitle
|
|
*
|
|
* @return \Combodo\iTop\Application\UI\Component\Panel\Panel
|
|
*/
|
|
public static function MakeForDanger(string $sTitle)
|
|
{
|
|
$oPanel = new Panel($sTitle);
|
|
$oPanel->SetColor(Panel::ENUM_COLOR_DANGER);
|
|
|
|
return $oPanel;
|
|
}
|
|
|
|
/**
|
|
* Make a Panel component for failure messages
|
|
*
|
|
* @param string $sTitle
|
|
*
|
|
* @return \Combodo\iTop\Application\UI\Component\Panel\Panel
|
|
*/
|
|
public static function MakeForFailure(string $sTitle)
|
|
{
|
|
$oPanel = new Panel($sTitle);
|
|
$oPanel->SetColor(Panel::ENUM_COLOR_FAILURE);
|
|
|
|
return $oPanel;
|
|
}
|
|
|
|
/**
|
|
* Make a Panel component with primary color scheme
|
|
*
|
|
* @param string $sTitle
|
|
*
|
|
* @return \Combodo\iTop\Application\UI\Component\Panel\Panel
|
|
*/
|
|
public static function MakeWithBrandingPrimaryColor(string $sTitle)
|
|
{
|
|
$oPanel = new Panel($sTitle);
|
|
$oPanel->SetColor(Panel::ENUM_COLOR_PRIMARY);
|
|
|
|
return $oPanel;
|
|
}
|
|
|
|
/**
|
|
* Make a Panel component with secondary color scheme
|
|
*
|
|
* @param string $sTitle
|
|
*
|
|
* @return \Combodo\iTop\Application\UI\Component\Panel\Panel
|
|
*/
|
|
public static function MakeWithBrandingSecondaryColor(string $sTitle)
|
|
{
|
|
$oPanel = new Panel($sTitle);
|
|
$oPanel->SetColor(Panel::ENUM_COLOR_SECONDARY);
|
|
|
|
return $oPanel;
|
|
}
|
|
|
|
/**
|
|
* Make a Panel component with the specific $sClass color scheme
|
|
*
|
|
* @param string $sClass Class of the object the panel is for
|
|
* @param string $sTitle
|
|
*
|
|
* @return \Combodo\iTop\Application\UI\Component\Panel\Panel
|
|
*/
|
|
public static function MakeForClass(string $sClass, string $sTitle)
|
|
{
|
|
$oPanel = new Panel($sTitle);
|
|
// TODO 3.0.0: Change this to class color when done
|
|
$oPanel->SetColor(Panel::ENUM_COLOR_BLUE);
|
|
|
|
return $oPanel;
|
|
}
|
|
|
|
/**
|
|
* Make a basis Panel component
|
|
*
|
|
* @param string $sTitle
|
|
* @param String $sIconUrl
|
|
*
|
|
* @return \Combodo\iTop\Application\UI\Component\Panel\Panel
|
|
*/
|
|
public static function MakeEnhancedNeutral(string $sTitle, string $sIconUrl)
|
|
{
|
|
$oPanel = new PanelEnhanced($sTitle, $sIconUrl);
|
|
// TODO 3.0.0: Change this to class color when done
|
|
$oPanel->SetColor(Panel::ENUM_COLOR_BLUE);
|
|
|
|
return $oPanel;
|
|
}
|
|
} |