本文整理汇总了PHP中eZContentObjectAttribute::setAttribute方法的典型用法代码示例。如果您正苦于以下问题:PHP eZContentObjectAttribute::setAttribute方法的具体用法?PHP eZContentObjectAttribute::setAttribute怎么用?PHP eZContentObjectAttribute::setAttribute使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类eZContentObjectAttribute
的用法示例。
在下文中一共展示了eZContentObjectAttribute::setAttribute方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: fromString
/**
* Generic method wrapping datatype's fromString() method if implemented
* Checks if fromString() is implemented in the field's datatype
* If not, data_text will be used by default
* @see http://projects.ez.no/sqliimport/forum/issues/two_little_thing
* @param string $data String representation of data to inject
* @return void
*/
public function fromString($data)
{
$datatype = $this->attribute->attribute('data_type_string');
$fromStringImplemented = null;
// First check if datatype is already known as implementing fromString() or not
// (Better performance as the check is made through Reflection API)
if (in_array($datatype, self::$datatypesFromStringImpl)) {
$fromStringImplemented = true;
} else {
if (in_array($datatype, self::$datatypesFromStringNotImpl)) {
$fromStringImplemented = false;
} else {
$reflector = new ReflectionObject($this->attribute->dataType());
$callerClass = $reflector->getMethod('fromString')->class;
if ($callerClass == 'eZDataType') {
self::$datatypesFromStringNotImpl[] = $datatype;
$fromStringImplemented = false;
} else {
self::$datatypesFromStringImpl[] = $datatype;
$fromStringImplemented = true;
}
}
}
// Now insert data through the appropriate way
if ($fromStringImplemented) {
$this->attribute->fromString($data);
} else {
$this->attribute->setAttribute('data_text', $data);
}
}
示例2: initializeObjectAttribute
/**
* Initializes the object attribute with some data.
* @param eZContentObjectAttribute $objectAttribute
* @param int $currentVersion
* @param eZContentObjectAttribute $originalContentObjectAttribute
*/
function initializeObjectAttribute($objectAttribute, $currentVersion, $originalContentObjectAttribute)
{
if (NULL === $currentVersion) {
$data = '';
} else {
$data = $originalContentObjectAttribute->attribute("data_text");
}
$objectAttribute->setAttribute("data_text", $data);
}
示例3: fromString
/**
* Store data from string format as created in {@link eZGmapLocationType::toString()}
*
* @param eZContentObjectAttribute $contentObjectAttribute
* @param string $string
*/
function fromString( $contentObjectAttribute, $string )
{
$data = $string !== '' && strpos( $string, '|#' ) !== false ? explode( '|#', $string ) : array( 0 );
if ( $data[0] != 0 )
{
$location = new eZGmapLocation( array(
'contentobject_attribute_id' => $contentObjectAttribute->attribute('id'),
'contentobject_version' => $contentObjectAttribute->attribute('version'),
'latitude' => $data[1],
'longitude' => $data[2],
'address' => $data[3]
));
$contentObjectAttribute->setContent( $location );
}
$contentObjectAttribute->setAttribute( 'data_int', $data[0] );
}
示例4: fetchObjectAttributeHTTPInput
/**
* Fetches all variables from the object and handles them
* Data store can be done here
* @param eZHTTPTool $http
* @param string $base POST variable name prefix (Always "ContentObjectAttribute")
* @param eZContentObjectAttribute $contentObjectAttribute
* @return true if fetching of class attributes are successfull, false if not
*/
public function fetchObjectAttributeHTTPInput($http, $base, $contentObjectAttribute)
{
if ($http->hasPostVariable($base . '_accolorpicker_data_text_' . $contentObjectAttribute->attribute('id'))) {
$data = $http->postVariable($base . '_accolorpicker_data_text_' . $contentObjectAttribute->attribute('id'));
$contentObjectAttribute->setAttribute('data_text', $data);
}
return true;
}
示例5: fetchObjectAttributeHTTPInput
/**
* Fetches all variables from the object and handles them
* Data store can be done here
*
* @param eZHTTPTool $http
* @param string $base POST variable name prefix (Always "ContentObjectAttribute")
* @param eZContentObjectAttribute $contentObjectAttribute
* @return true if fetching of object attributes is successful, false if not
*/
public function fetchObjectAttributeHTTPInput($http, $base, $contentObjectAttribute)
{
$fieldName = $base . self::COMMENTS_ENABLED_VARIABLE . $contentObjectAttribute->attribute('id');
$value = $http->hasPostVariable($fieldName) ? 1 : 0;
$contentObjectAttribute->setAttribute('data_int', $value);
return true;
}
示例6: unserializeContentObjectAttribute
/**
* Unserailize contentobject attribute
*
* @param eZPackage $package
* @param eZContentObjectAttribute $objectAttribute
* @param DOMElement $attributeNode
*/
function unserializeContentObjectAttribute($package, $objectAttribute, $attributeNode)
{
$rootNode = $attributeNode->childNodes->item(0);
$xmlString = $rootNode ? $rootNode->ownerDocument->saveXML($rootNode) : '';
$objectAttribute->setAttribute('data_text', $xmlString);
}
示例7: fromString
/**
* Imports the data to the attribute
*
* @param eZContentObjectAttribute $contentObjectAttribute
* @param string $string
*
* @return string
*/
function fromString($contentObjectAttribute, $string)
{
$contentObjectAttribute->setAttribute(self::OIB_FIELD, trim($string));
}
示例8: fromString
/**
* @param eZContentObjectAttribute $contentObjectAttribute
* @param string $string
*/
function fromString( $contentObjectAttribute, $string )
{
$contentObjectAttribute->setAttribute( 'data_text', $string );
}
示例9: unserializeContentClassAttribute
/**
* Extracts values from the attribute parameters and sets it in the class attribute.
*
* @param eZContentObjectAttribute $classAttribute
* @param DOMElement $attributeNode
* @param DOMElement $attributeParametersNode
*/
public function unserializeContentClassAttribute($classAttribute, $attributeNode, $attributeParametersNode)
{
$content = array();
$delimiter = $attributeParametersNode->getElementsByTagName('delimiter')->item(0)->nodeValue;
$multiselect = $attributeParametersNode->getElementsByTagName('multiselect')->item(0)->textContent;
$query = $attributeParametersNode->getElementsByTagName('query')->item(0)->nodeValue;
$content['delimiter'] = $delimiter !== false ? $delimiter : '';
$content['is_multiselect'] = $multiselect !== false ? intval($multiselect) : 0;
$content['query'] = $query !== false ? $query : '';
$content['options'] = array();
$optionsNode = $attributeParametersNode->getElementsByTagName('options')->item(0);
if ($optionsNode instanceof DOMElement && $optionsNode->hasChildNodes()) {
$children = $optionsNode->childNodes;
foreach ($children as $key => $child) {
if ($child instanceof DOMElement) {
$content['options'][] = array('id' => $child->getAttribute('id'), 'name' => $child->getAttribute('name'), 'identifier' => $child->getAttribute('identifier'), 'priority' => $child->getAttribute('priority'));
}
}
}
unset($optionsNode);
$xmlString = $this->classContentToXml($content);
$classAttribute->setAttribute(self::CLASS_STORAGE_XML, $xmlString);
}
示例10: initializeObjectAttribute
/**
* This function is called when a new version is created or an object is copied
* @param eZContentObjectAttribute $objectAttribute
* @param integer $currentVersion
* @param eZContentObjectAttribute $originalContentObjectAttribute
*/
function initializeObjectAttribute($objectAttribute, $currentVersion, $originalContentObjectAttribute)
{
if ($objectAttribute->attribute('contentobject_id') != $originalContentObjectAttribute->attribute('contentobject_id')) {
}
// this is a copy of an original object
// we should remove datas from data_text
$objectAttribute->setAttribute('data_text', '');
}
示例11: fetchObjectAttributeHTTPInput
/**
* Set parameters from post data
*
* @param eZHTTPTool $http
* @param string $base
* @param eZContentObjectAttribute $contentObjectAttribute
*/
function fetchObjectAttributeHTTPInput($http, $base, $contentObjectAttribute)
{
$data = $_REQUEST[$base . '_' . $contentObjectAttribute->attribute('id') . '_related_nodes'];
$contentObjectAttribute->setAttribute('data_text', serialize($data));
return true;
}