本文整理汇总了PHP中eZContentObjectAttribute::content方法的典型用法代码示例。如果您正苦于以下问题:PHP eZContentObjectAttribute::content方法的具体用法?PHP eZContentObjectAttribute::content怎么用?PHP eZContentObjectAttribute::content使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类eZContentObjectAttribute
的用法示例。
在下文中一共展示了eZContentObjectAttribute::content方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getAttributeContent
/**
* @param eZContentObjectAttribute $contentObjectAttribute the attribute to serialize
* @param eZContentClassAttribute $contentClassAttribute the content class of the attribute to serialize
* @return array
*/
public static function getAttributeContent(eZContentObjectAttribute $contentObjectAttribute, eZContentClassAttribute $contentClassAttribute)
{
$availableEnumerations = array();
foreach ($contentObjectAttribute->content()->ObjectEnumerations as $enumeration) {
$availableEnumerations[] = array('id' => $enumeration->EnumID, 'element' => $enumeration->EnumElement, 'value' => $enumeration->EnumValue);
}
return array('content' => $availableEnumerations, 'has_rendered_content' => false, 'rendered' => null);
}
示例2: getAttributeContent
/**
* @param eZContentObjectAttribute $contentObjectAttribute the attribute to serialize
* @param eZContentClassAttribute $contentClassAttribute the content class of the attribute to serialize
* @return array
*/
public static function getAttributeContent( eZContentObjectAttribute $contentObjectAttribute, eZContentClassAttribute $contentClassAttribute )
{
return array(
'content' => $contentObjectAttribute->content()->KeywordArray,
'has_rendered_content' => false,
'rendered' => null,
);
}
示例3: getAttributeContent
/**
* Returns the content of the matrix to be stored in Solr
*
* @param eZContentObjectAttribute $contentObjectAttribute the attribute to serialize
* @param eZContentClassAttribute $contentClassAttribute the content class of the attribute to serialize
* @return array
*/
public static function getAttributeContent(eZContentObjectAttribute $contentObjectAttribute, eZContentClassAttribute $contentClassAttribute)
{
$rows = $contentObjectAttribute->content()->attribute('rows');
$target = array('has_rendered_content' => false, 'rendered' => null, 'content' => array());
foreach ($rows['sequential'] as $elt) {
$target['content'][] = $elt['columns'];
}
return $target;
}
示例4: getAttributeContent
/**
* @param eZContentObjectAttribute $contentObjectAttribute the attribute to serialize
* @param eZContentClassAttribute $contentClassAttribute the content class of the attribute to serialize
* @return json encoded string for further processing
* required first level elements 'method', 'version_format', 'data_type_identifier', 'content'
* optional first level element is 'rendered' which should store (template) rendered xhtml snippets
*/
public static function getAttributeContent(eZContentObjectAttribute $contentObjectAttribute, eZContentClassAttribute $contentClassAttribute)
{
$dataTypeIdentifier = $contentObjectAttribute->attribute('data_type_string');
$attributeContents = $contentObjectAttribute->content();
$doc = new DOMDocument('1.0');
$doc->loadXML($attributeContents->attribute('xml_data'));
$xpath = new DOMXPath($doc);
$content = $doc->saveXML($xpath->query('/*')->item(0));
$target = array('content' => $content, 'has_rendered_content' => $contentObjectAttribute->hasContent(), 'rendered' => $attributeContents->attribute('output')->attribute('output_text'));
return $target;
}
示例5: getAttributeContent
/**
* @param eZContentObjectAttribute $contentObjectAttribute the attribute to serialize
* @param eZContentClassAttribute $contentClassAttribute the content class of the attribute to serialize
* @return array with keys 'content', 'has_rendered_content', 'rendered'
* required first level elements 'method', 'version_format', 'data_type_identifier', 'content'
* optional first level element is 'rendered' which should store (template) rendered xhtml snippets
*/
public static function getAttributeContent( eZContentObjectAttribute $contentObjectAttribute, eZContentClassAttribute $contentClassAttribute )
{
$target = array(
'content' => $contentObjectAttribute->content(),
'has_rendered_content' =>false,
'rendered' => null
);
return $target ;
}
示例6: getAttributeContent
/**
* @param eZContentObjectAttribute $contentObjectAttribute the attribute to serialize
* @param eZContentClassAttribute $contentClassAttribute the content class of the attribute to serialize
* @return array
*/
public static function getAttributeContent(eZContentObjectAttribute $contentObjectAttribute, eZContentClassAttribute $contentClassAttribute)
{
$selectedOptionsList = array_fill_keys($contentObjectAttribute->content(), true);
$availableOptionsArray = $contentObjectAttribute->attribute('class_content');
$finalAvailableOptions = array();
foreach ($availableOptionsArray['options'] as $availableOption) {
if (isset($selectedOptionsList[$availableOption['id']])) {
$finalAvailableOptions[] = array('name' => $availableOption['name'], 'id' => $availableOption['id']);
}
}
return array('content' => $finalAvailableOptions, 'has_rendered_content' => false, 'rendered' => null);
}
示例7: toString
/**
* Returns string representation of a content object attribute
*
* @param eZContentObjectAttribute $contentObjectAttribute
*
* @return string
*/
public function toString($contentObjectAttribute)
{
/** @var $eZTags eZTags */
$eZTags = $contentObjectAttribute->content();
if (!$eZTags instanceof eZTags) {
return '';
}
$returnArray = array();
$returnArray[] = $eZTags->attribute('id_string');
$returnArray[] = $eZTags->attribute('keyword_string');
$returnArray[] = $eZTags->attribute('parent_string');
$returnArray[] = $eZTags->attribute('locale_string');
return implode('|#', $returnArray);
}
示例8: testContent
/**
* Tests the attribute's content
*/
public function testContent()
{
$this->createObject($this->dataSet());
self::assertEquals($this->attribute->content(), $this->dataSet()->content);
$this->destroyObject();
}
示例9: onPublish
/**
* Performs necessary actions with attribute data after object is published,
* it means that you have access to published nodes.
*
* @param eZContentObjectAttribute $contentObjectAttribute
* @param eZContentObject $contentObject
* @param array(eZContentObjectTreeNode) $publishedNodes
* @return bool
*/
function onPublish($contentObjectAttribute, $contentObject, $publishedNodes)
{
$db = eZDB::instance();
$page = $contentObjectAttribute->content();
foreach ($publishedNodes as $node) {
$nodeID = $node->attribute('node_id');
if ($page->getZoneCount() != 0) {
foreach ($page->attribute('zones') as $zone) {
if ($zone->getBlockCount() != 0) {
if ($zone->toBeRemoved()) {
foreach ($zone->attribute('blocks') as $index => $block) {
$block->setAttribute('action', 'remove');
}
}
foreach ($zone->attribute('blocks') as $block) {
$blockID = $block->attribute('id');
$blockType = $block->attribute('type');
$escapedBlockType = $db->escapeString($blockType);
$action = $block->attribute('action');
$fetchParams = $block->attribute('fetch_params');
$zoneID = $block->attribute('zone_id');
$blockName = $block->attribute('name');
$escapedBlockName = $db->escapeString($blockName);
switch ($action) {
case 'remove':
$db->query("UPDATE ezm_block SET is_removed='1' WHERE id='" . $blockID . "'");
break;
case 'add':
$blockCount = $db->arrayQuery("SELECT COUNT( id ) as count FROM ezm_block WHERE id='" . $blockID . "'");
if ($blockCount[0]['count'] == 0) {
$rotationType = 0;
$rotationInterval = 0;
$overflowID = null;
if ($block->hasAttribute('rotation')) {
$rotation = $block->attribute('rotation');
$rotationType = $rotation['type'];
$rotationInterval = $rotation['interval'];
}
if ($block->hasAttribute('overflow_id')) {
$overflowID = $block->attribute('overflow_id');
}
$db->query("INSERT INTO ezm_block ( id, zone_id, name, node_id, overflow_id, block_type, fetch_params, rotation_type, rotation_interval )\n VALUES ( '" . $blockID . "',\n '" . $zoneID . "',\n '" . $escapedBlockName . "',\n '" . $nodeID . "',\n '" . $overflowID . "',\n '" . $escapedBlockType . "',\n '" . $fetchParams . "',\n '" . $rotationType . "',\n '" . $rotationInterval . "' )");
}
break;
default:
$rotationType = 0;
$rotationInterval = 0;
$overflowID = null;
if ($block->hasAttribute('rotation')) {
$rotation = $block->attribute('rotation');
$rotationType = $rotation['type'];
$rotationInterval = $rotation['interval'];
}
if ($block->hasAttribute('overflow_id')) {
$overflowID = $block->attribute('overflow_id');
}
$db->query("UPDATE ezm_block SET name='" . $escapedBlockName . "',\n overflow_id='" . $overflowID . "',\n fetch_params='" . $fetchParams . "',\n rotation_type='" . $rotationType . "',\n rotation_interval='" . $rotationInterval . "'\n WHERE id='" . $blockID . "'");
break;
}
if ($block->getItemCount() != 0) {
foreach ($block->attribute('items') as $item) {
$action = $item->attribute('action');
switch ($action) {
case 'remove':
$db->query("DELETE FROM ezm_pool\n WHERE object_id='" . $item->attribute('object_id') . "'\n AND block_id='" . $blockID . "'");
break;
case 'add':
$itemCount = $db->arrayQuery("SELECT COUNT( * ) as count FROM ezm_pool\n WHERE block_id='" . $blockID . "'\n AND object_id='" . $item->attribute('object_id') . "'");
if ($itemCount[0]['count'] == 0) {
$db->query("INSERT INTO ezm_pool ( block_id, object_id, node_id, priority, ts_publication )\n VALUES ( '" . $blockID . "',\n '" . $item->attribute('object_id') . "',\n '" . $item->attribute('node_id') . "',\n '" . $item->attribute('priority') . "',\n '" . $item->attribute('ts_publication') . "' )");
}
break;
case 'modify':
if ($item->hasAttribute('ts_publication')) {
$db->query("UPDATE ezm_pool SET ts_publication='" . $item->attribute('ts_publication') . "'\n WHERE object_id='" . $item->attribute('object_id') . "'\n AND block_id='" . $blockID . "'");
}
if ($item->hasAttribute('priority')) {
$db->query("UPDATE ezm_pool SET priority='" . $item->attribute('priority') . "'\n WHERE object_id='" . $item->attribute('object_id') . "'\n AND block_id='" . $blockID . "'");
}
//if there is ts_hidden and ts_visible, update the two fields. This is the case when add items from history
if ($item->hasAttribute('ts_hidden') && $item->hasAttribute('ts_visible')) {
$db->query("UPDATE ezm_pool SET ts_hidden='" . $item->attribute('ts_hidden') . "',\n ts_visible='" . $item->attribute('ts_visible') . "' \n WHERE object_id='" . $item->attribute('object_id') . "'\n AND block_id='" . $blockID . "'");
}
break;
}
}
}
}
}
}
}
//.........这里部分代码省略.........
示例10: diff
/**
* Returns an eZDiffContent object with the detected changes
*
* @param eZContentObjectAttribute $old
* @param eZContentObjectAttribute $new
* @param array|bool $options
*
* @return eZDiffContent
*/
function diff($old, $new, $options = false)
{
$diff = new eZDiff();
$diff->setDiffEngineType($diff->engineType("text"));
$diff->initDiffEngine();
return $diff->diff($old->content(), $new->content());
}
示例11: onPublish
/**
* Performs necessary actions with attribute data after object is published,
* it means that you have access to published nodes.
*
* @param eZContentObjectAttribute $contentObjectAttribute
* @param eZContentObject $contentObject
* @param array(eZContentObjectTreeNode) $publishedNodes
* @return bool
*/
function onPublish( $contentObjectAttribute, $contentObject, $publishedNodes )
{
$db = eZDB::instance();
$page = $contentObjectAttribute->content();
foreach ( $publishedNodes as $publishedNode )
{
if ( $publishedNode->isMain() )
$mainNode = $publishedNode;
}
foreach ( $publishedNodes as $node )
{
$nodeID = $node->attribute( 'node_id' );
if ( $page->getZoneCount() != 0 )
{
foreach ( $page->attribute( 'zones' ) as $zone )
{
if ( $zone->getBlockCount() != 0 )
{
if ( $zone->toBeRemoved() )
{
foreach ( $zone->attribute( 'blocks' ) as $index => $block )
{
$block->setAttribute( 'action', 'remove' );
}
}
$newItems = array();
foreach ( $zone->attribute( 'blocks' ) as $block )
{
$blockID = $block->attribute( 'id' );
$fetchParams = $block->attribute( 'fetch_params' );
$escapedBlockName = $db->escapeString( $block->attribute( 'name' ) );
switch ( $block->attribute( 'action' ) )
{
case 'remove':
$db->query( "UPDATE ezm_block SET is_removed='1' WHERE id='" . $blockID . "'" );
break;
case 'add':
$blockCount = $db->arrayQuery( "SELECT COUNT( id ) as count FROM ezm_block WHERE id='" . $blockID ."'" );
if ( $blockCount[0]['count'] == 0 )
{
$rotationType = 0;
$rotationInterval = 0;
$overflowID = null;
if ( $block->hasAttribute( 'rotation' ) )
{
$rotation = $block->attribute( 'rotation' );
$rotationType = $rotation['type'];
$rotationInterval = $rotation['interval'];
}
if ( $block->hasAttribute( 'overflow_id' ) )
$overflowID = $block->attribute( 'overflow_id' );
$db->query( "INSERT INTO ezm_block ( id, zone_id, name, node_id, overflow_id, block_type, fetch_params, rotation_type, rotation_interval )
VALUES ( '" . $blockID . "',
'" . $block->attribute( 'zone_id' ) . "',
'" . $escapedBlockName . "',
'" . $nodeID . "',
'" . $overflowID . "',
'" . $db->escapeString( $block->attribute( 'type' ) ) . "',
'" . $fetchParams . "',
'" . $rotationType . "',
'" . $rotationInterval . "' )" );
}
break;
default:
$rotationType = 0;
$rotationInterval = 0;
$overflowID = null;
if ( $block->hasAttribute( 'rotation' ) )
{
$rotation = $block->attribute( 'rotation' );
$rotationType = $rotation['type'];
$rotationInterval = $rotation['interval'];
}
if ( $block->hasAttribute( 'overflow_id' ) )
//.........这里部分代码省略.........
示例12: toString
/**
* Returns string representation of a content object attribute data for simplified export
*
* @param eZContentObjectAttribute $objectAttribute
*
* @return string
*/
public function toString($objectAttribute)
{
$content = $objectAttribute->content();
if (count($content) == 1) {
return $content[0];
}
return serialize($content);
}
示例13: storeObjectAttribute
/**
* Stores the object attribute
*
* @param eZContentObjectAttribute $attribute
*/
function storeObjectAttribute($attribute)
{
$eztags = $attribute->content();
if ($eztags instanceof eZTags) {
$eztags->store($attribute);
}
}
示例14: title
/**
* Generate title of attribute
*
* @param eZContentObjectAttribute $contentObjectAttribute
* @param string|null $name
*
* @return string
*/
function title($contentObjectAttribute, $name = null)
{
unset($name);
//CodeSniffer tricks..
return (string) $contentObjectAttribute->content();
}