mirror of
https://github.com/Combodo/iTop.git
synced 2026-02-13 07:24:13 +01:00
Class icon defined in the data model, use either the static method GetClassIcon, or GetIcon (this one could be overloaded for an icon depending on the object state)
SVN:trunk[462]
This commit is contained in:
@@ -492,6 +492,11 @@ abstract class DBObject
|
||||
$this->m_iKey = $iNewKey;
|
||||
}
|
||||
|
||||
public function GetIcon()
|
||||
{
|
||||
return MetaModel::GetClassIcon(get_class($this));
|
||||
}
|
||||
|
||||
public function GetName()
|
||||
{
|
||||
$sNameAttCode = MetaModel::GetNameAttributeCode(get_class($this));
|
||||
|
||||
@@ -280,6 +280,25 @@ abstract class MetaModel
|
||||
return self::GetClassDescription($sClass);
|
||||
}
|
||||
}
|
||||
final static public function GetClassIcon($sClass)
|
||||
{
|
||||
self::_check_subclass($sClass);
|
||||
|
||||
$sIcon = '';
|
||||
if (array_key_exists('icon', self::$m_aClassParams[$sClass]))
|
||||
{
|
||||
$sIcon = self::$m_aClassParams[$sClass]['icon'];
|
||||
}
|
||||
if (strlen($sIcon) == 0)
|
||||
{
|
||||
$sParentClass = self::GetParentPersistentClass($sClass);
|
||||
if (strlen($sParentClass) > 0)
|
||||
{
|
||||
return self::GetClassIcon($sParentClass);
|
||||
}
|
||||
}
|
||||
return $sIcon;
|
||||
}
|
||||
final static public function IsAutoIncrementKey($sClass)
|
||||
{
|
||||
self::_check_subclass($sClass);
|
||||
|
||||
Reference in New Issue
Block a user