N°2677 - Add style definition for classes

This commit is contained in:
Eric
2021-01-06 13:57:46 +01:00
parent fca123e127
commit d4aeb4b157
31 changed files with 1105 additions and 372 deletions

View File

@@ -19,6 +19,9 @@
namespace Combodo\iTop\Application\UI\Base\Component\Panel;
use MetaModel;
use ormStyle;
/**
* Class PanelFactory
*
@@ -163,8 +166,7 @@ class PanelFactory
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);
self::SetClassColor($sClass, $oPanel);
return $oPanel;
}
@@ -185,4 +187,24 @@ class PanelFactory
return $oPanel;
}
/**
* @param string $sClass
* @param \Combodo\iTop\Application\UI\Base\Component\Panel\Panel $oPanel
*
* @throws \CoreException
*/
public static function SetClassColor(string $sClass, Panel $oPanel): void
{
/** @var ormStyle $oStyle */
$sColor = null;
$oStyle = MetaModel::GetClassStyle($sClass);
if ($oStyle) {
$sColor = $oStyle->GetMainColor();
}
if (strlen($sColor) == 0) {
$sColor = Panel::ENUM_COLOR_BLUE;
}
$oPanel->SetColor($sColor);
}
}