mirror of
https://git.code.sf.net/p/seeddms/code
synced 2025-10-17 14:30:58 +00:00
add SeedDMS_Core_Attribute::getParsedValue() and use it in SeedDMS_Core_Object:: getAttributeValue()
This commit is contained in:
parent
3571d97f2f
commit
5438d95eb5
|
@ -120,6 +120,27 @@ class SeedDMS_Core_Attribute { /* {{{ */
|
||||||
*/
|
*/
|
||||||
function getValue() { return $this->_value; }
|
function getValue() { return $this->_value; }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return attribute value parsed into a php type or object
|
||||||
|
*
|
||||||
|
* This function will return the value of multi value attributes
|
||||||
|
* including the separator char.
|
||||||
|
*
|
||||||
|
* @return string the attribute value as it is stored in the database.
|
||||||
|
*/
|
||||||
|
function getParsedValue() { /* {{{ */
|
||||||
|
switch($this->_attrdef->getType()) {
|
||||||
|
case SeedDMS_Core_AttributeDefinition::type_float:
|
||||||
|
return (float) $this->_value;
|
||||||
|
case SeedDMS_Core_AttributeDefinition::type_boolean:
|
||||||
|
return (bool) $this->_value;
|
||||||
|
case SeedDMS_Core_AttributeDefinition::type_int:
|
||||||
|
return (int) $this->_value;
|
||||||
|
default:
|
||||||
|
return $this->_value;
|
||||||
|
}
|
||||||
|
} /* }}} */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return attribute values as an array
|
* Return attribute values as an array
|
||||||
*
|
*
|
||||||
|
|
|
@ -152,7 +152,7 @@ class SeedDMS_Core_Object { /* {{{ */
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset($this->_attributes[$attrdef->getId()])) {
|
if (isset($this->_attributes[$attrdef->getId()])) {
|
||||||
$value = $this->_attributes[$attrdef->getId()]->getValue();
|
$value = $this->_attributes[$attrdef->getId()]->getValue();
|
||||||
if($attrdef->getMultipleValues()) {
|
if($attrdef->getMultipleValues()) {
|
||||||
$sep = substr($value, 0, 1);
|
$sep = substr($value, 0, 1);
|
||||||
$vsep = $attrdef->getValueSetSeparator();
|
$vsep = $attrdef->getValueSetSeparator();
|
||||||
|
@ -166,7 +166,7 @@ class SeedDMS_Core_Object { /* {{{ */
|
||||||
else
|
else
|
||||||
return(array($value));
|
return(array($value));
|
||||||
} else {
|
} else {
|
||||||
return $value;
|
return $this->_attributes[$attrdef->getId()]->getParsedValue();
|
||||||
}
|
}
|
||||||
} else
|
} else
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -28,6 +28,7 @@
|
||||||
- fix SeedDMS_Core_File::fileExtension()
|
- fix SeedDMS_Core_File::fileExtension()
|
||||||
- SeedDMS_Core_DMS::createPasswordRequest() creates a cryptographically secure hash
|
- SeedDMS_Core_DMS::createPasswordRequest() creates a cryptographically secure hash
|
||||||
- fix sql error when deleting a folder attribute
|
- fix sql error when deleting a folder attribute
|
||||||
|
- add SeedDMS_Core_Attribute::getParsedValue() and use it in SeedDMS_Core_Object::getAttributeValue()
|
||||||
</notes>
|
</notes>
|
||||||
<contents>
|
<contents>
|
||||||
<dir baseinstalldir="SeedDMS" name="/">
|
<dir baseinstalldir="SeedDMS" name="/">
|
||||||
|
|
Loading…
Reference in New Issue
Block a user