- New implementation of the n-n link edition widget... in progress.

SVN:trunk[654]
This commit is contained in:
Denis Flaven
2010-08-04 19:30:36 +00:00
parent 835d54b22b
commit b0b3330c13
2 changed files with 34 additions and 4 deletions

View File

@@ -350,6 +350,28 @@ abstract class DBObject
return $this->m_aOrigValues[$sAttCode];
}
/**
* Updates the value of an external field by (re)loading the object
* corresponding to the external key and getting the value from it
* @param string $sAttCode Attribute code of the external field to update
* @return void
*/
protected function UpdateExternalField($sAttCode)
{
$oAttDef = MetaModel::GetAttributeDef(get_class($this), $sAttCode);
if ($oAttDef->IsExternalField())
{
$sTargetClass = $oAttDef->GetTargetClass();
$objkey = $this->Get($oAttDef->GetKeyAttCode());
$oObj = MetaModel::GetObject($sTargetClass, $objkey);
if (is_object($oObj))
{
$value = $oObj->Get($oAttDef->GetExtAttCode());
$this->Set($sAttCode, $value);
}
}
}
// Compute scalar attributes that depend on any other type of attribute
public function DoComputeValues()
{
@@ -495,10 +517,14 @@ abstract class DBObject
}
$this->m_iKey = $iNewKey;
}
public function GetIcon()
/**
* Get the icon representing this object
* @param boolean $bImgTag If true the result is a full IMG tag (or an emtpy string if no icon is defined)
* @return string Either the full IMG tag ($bImgTag == true) or just the path to the icon file
*/
public function GetIcon($bImgTag = true)
{
return MetaModel::GetClassIcon(get_class($this));
return MetaModel::GetClassIcon(get_class($this), $bImgTag);
}
public function GetName()

View File

@@ -288,7 +288,7 @@ abstract class MetaModel
return self::GetClassDescription($sClass);
}
}
final static public function GetClassIcon($sClass)
final static public function GetClassIcon($sClass, $bImgTag = true)
{
self::_check_subclass($sClass);
@@ -305,6 +305,10 @@ abstract class MetaModel
return self::GetClassIcon($sParentClass);
}
}
if ($bImgTag && ($sIcon != ''))
{
$sIcon = "<img src=\"$sIcon\" style=\"vertical-align:middle;\"/>";
}
return $sIcon;
}
final static public function IsAutoIncrementKey($sClass)