mirror of
https://git.code.sf.net/p/seeddms/code
synced 2025-03-12 08:55:54 +00:00
add new method getAttribute()
This commit is contained in:
parent
49afb6cfd6
commit
444d3a8b01
|
@ -108,6 +108,25 @@ class SeedDMS_Core_Object { /* {{{ */
|
||||||
* @return array|string value of attritbute or false. The value is an array
|
* @return array|string value of attritbute or false. The value is an array
|
||||||
* if the attribute is defined as multi value
|
* if the attribute is defined as multi value
|
||||||
*/
|
*/
|
||||||
|
function getAttribute($attrdef) { /* {{{ */
|
||||||
|
if (!$this->_attributes) {
|
||||||
|
$this->getAttributes();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isset($this->_attributes[$attrdef->getId()])) {
|
||||||
|
return $this->_attributes[$attrdef->getId()];
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
} /* }}} */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns an attribute value of the object for the given attribute definition
|
||||||
|
*
|
||||||
|
* @return array|string value of attritbute or false. The value is an array
|
||||||
|
* if the attribute is defined as multi value
|
||||||
|
*/
|
||||||
function getAttributeValue($attrdef) { /* {{{ */
|
function getAttributeValue($attrdef) { /* {{{ */
|
||||||
if (!$this->_attributes) {
|
if (!$this->_attributes) {
|
||||||
$this->getAttributes();
|
$this->getAttributes();
|
||||||
|
@ -126,6 +145,50 @@ class SeedDMS_Core_Object { /* {{{ */
|
||||||
|
|
||||||
} /* }}} */
|
} /* }}} */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns an attribute value of the object for the given attribute definition
|
||||||
|
*
|
||||||
|
* This is a short cut for getAttribute($attrdef)->getValueAsArray() but
|
||||||
|
* first checks if the object has an attribute for the given attribute
|
||||||
|
* definition.
|
||||||
|
*
|
||||||
|
* @return array value of attritbute or false. The value is always an array
|
||||||
|
* even if the attribute is not defined as multi value
|
||||||
|
*/
|
||||||
|
function getAttributeValueAsArray($attrdef) { /* {{{ */
|
||||||
|
if (!$this->_attributes) {
|
||||||
|
$this->getAttributes();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isset($this->_attributes[$attrdef->getId()])) {
|
||||||
|
return $this->_attributes[$attrdef->getId()]->getValueAsArray();
|
||||||
|
} else
|
||||||
|
return false;
|
||||||
|
|
||||||
|
} /* }}} */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns an attribute value of the object for the given attribute definition
|
||||||
|
*
|
||||||
|
* This is a short cut for getAttribute($attrdef)->getValueAsString() but
|
||||||
|
* first checks if the object has an attribute for the given attribute
|
||||||
|
* definition.
|
||||||
|
*
|
||||||
|
* @return string value of attritbute or false. The value is always a string
|
||||||
|
* even if the attribute is defined as multi value
|
||||||
|
*/
|
||||||
|
function getAttributeValueAsString($attrdef) { /* {{{ */
|
||||||
|
if (!$this->_attributes) {
|
||||||
|
$this->getAttributes();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isset($this->_attributes[$attrdef->getId()])) {
|
||||||
|
return $this->_attributes[$attrdef->getId()]->getValue();
|
||||||
|
} else
|
||||||
|
return false;
|
||||||
|
|
||||||
|
} /* }}} */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set an attribute of the object for the given attribute definition
|
* Set an attribute of the object for the given attribute definition
|
||||||
*
|
*
|
||||||
|
|
Loading…
Reference in New Issue
Block a user