本文整理汇总了PHP中eZContentObjectTreeNode::object方法的典型用法代码示例。如果您正苦于以下问题:PHP eZContentObjectTreeNode::object方法的具体用法?PHP eZContentObjectTreeNode::object怎么用?PHP eZContentObjectTreeNode::object使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类eZContentObjectTreeNode
的用法示例。
在下文中一共展示了eZContentObjectTreeNode::object方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: fromNode
/**
* Instanciates an ezpContent from an eZContentObjectTreeNode
* @param eZContentObjectTreeNode $node
* @return ezpContent
*/
public static function fromNode(eZContentObjectTreeNode $node, $checkAccess = true)
{
$object = $node->object();
if ($checkAccess && !$object->attribute('can_read')) {
throw new ezpContentAccessDeniedException($object->attribute('id'));
}
$content = new ezpContent();
$content->fields = ezpContentFieldSet::fromContentObject($object);
$content->object = $object;
$content->locations = ezpContentLocation::fromNode($node);
return $content;
}
示例2: sortByPrority
/**
* @param eZContentObjectTreeNode $a
* @param eZContentObjectTreeNode $b
* @return int
*/
public static function sortByPrority(eZContentObjectTreeNode $a, eZContentObjectTreeNode $b)
{
$ma = $a->isMain() ? $a : $a->object()->mainNode();
$mb = $b->isMain() ? $b : $b->object()->mainNode();
if ( $ma->object()->mainNode()->attribute('priority') == $mb->attribute('priority') )
{
return 0;
}
return ( $ma->attribute('priority') > $mb->attribute('priority') ) ? 1 : -1;
}
示例3: fromNode
/**
* Initializes an object from a node
* @param eZContentObjectTreeNode $node
*
* @return SQLIContent
*/
public static function fromNode(eZContentObjectTreeNode $node)
{
$object = $node->object();
$content = self::fromContentObject($object);
$content->locations->addLocation(SQLILocation::fromNode($node));
return $content;
}
示例4: createHTMLObject
/**
* create HTML eZ Publish object
* @param eZContentObjectTreeNode $parentNode
* @param SimpleXMLElement $_item
*/
function createHTMLObject($parentNode, $_item)
{
try
{
//get actual user
$user = eZUser::currentUser();
//object parameters
$params = array();
$params ['class_identifier'] = 'html';
$params['creator_id'] = $user->attribute('contentobject_id');
$params['parent_node_id'] = $parentNode->attribute('node_id');
$params['section_id'] = $parentNode->object()->attribute('section_id');
//set template attributes
include_once('kernel/common/template.php');
$htmlTpl = eZTemplate::factory();
$htmlTpl->setVariable('title', $_item->title);
$htmlTpl->setVariable('link', '/congressos-e-eventos?deeplink=' . urlencode($_item->link));
$htmlTpl->setVariable('description', $_item->description);
$htmlTpl->setVariable('category', $_item->category);
$text = $htmlTpl->fetch('design:html/cronview.tpl');
//attributes to insert
$attributesData = array();
$attributesData['title'] = $_item->title;
$attributesData['text'] = $text;
$params['attributes'] = $attributesData;
//object creation
eZContentFunctions::createAndPublishObject($params);
}
catch (Exception $e)
{
$cli = eZCLI::instance();
$cli->output($e->getMessage());
}
}
示例5: getGTMTags
/**
* @param eZContentObjectTreeNode $node
* @return array
*/
public function getGTMTags( $node )
{
if( !($node instanceof eZContentObjectTreeNode) )
return array();
/* @type eZContentObjectAttribute[] $dataMap */
$dataMap = $node->dataMap();
/* @type eZContentObjectAttribute[] $englishDM */
$englishDM = $node->object()->fetchDataMap( false, 'eng-GB' );
$gtmVariables = array();
if ($englishDM['headline'] || $dataMap['headline'])
{
$headline = count( $englishDM ) > 0 ? $englishDM['headline']->content() : $dataMap['headline']->content();
$gtmVariables['contentName'] = addslashes(preg_replace("/[\\n\\r]+/"," ",$headline));
}
$remoteId = $node->object()->remoteID();
$clusterIdentifier = ClusterTool::clusterIdentifier();
if($remoteId && $clusterIdentifier)
{
$rating = SolrSafeOperatorHelper::getRatings( $remoteId, $clusterIdentifier );
if ($rating)
{
$gtmVariables['contentScore'] = $rating;
}
}
if($dataMap['tags'] && $dataMap['tags']->content())
{
$gtmVariables['tags'] = implode(",", explode("|", $dataMap['tags']->content()));
}
if($this->channel){
$gtmVariables['sponsorName'] = '';
$gtmVariables['sponsorPage'] = false;
$sponsorName = $this->channel->attribute("sponsor");
if ($sponsorName)
{
$gtmVariables['sponsorName'] = $sponsorName;
$gtmVariables['sponsorPage'] = true;
}
$promoTaxonomy = $this->applicationLocalized()->getCustomParameter( 'PromoTaxonomy' );
$promoTaxonomy = $promoTaxonomy ? $promoTaxonomy : $this->applicationObject()->getCustomParameter( 'PromoTaxonomy' );
if($promoTaxonomy){
$taxonomies = $dataMap['serialized_taxonomies']->content();
if(is_array($taxonomies) && count($taxonomies[$promoTaxonomy]) > 0)
{
$contentAreaTags = '';
foreach($taxonomies[$promoTaxonomy] as $taxonomy)
{
$contentAreaTags .= SolrSafeOperatorHelper::translateTaxonomy($taxonomy).",";
}
$gtmVariables['contentAreaTags'] = $contentAreaTags;
}
}
}
return $gtmVariables;
}
示例6: addVideo
function addVideo(eZContentObjectTreeNode $node)
{
$ini = eZINI::instance('xrowsitemap.ini');
$video = new xrowSitemapItemVideo();
$video->title = $node->attribute('name');
$video->categories = array($node->attribute('parent')->attribute('name'));
$object = $node->object();
$video->view_count = eZViewCounter::fetch($node->attribute('node_id'))->Count;
$video->publication_date = new DateTime('@' . $object->attribute('published'));
$dm = $node->attribute('data_map');
foreach ($dm as $attribute) {
switch ($attribute->DataTypeString) {
case 'xrowmetadata':
if ($attribute->hasContent()) {
$keywordattribute = $attribute->content();
$video->tags = array_merge($video->tags, $keywordattribute->keywords);
}
break;
case 'ezkeyword':
if ($attribute->hasContent()) {
$keywordattribute = $attribute->content();
$video->tags = array_merge($video->tags, $keywordattribute->KeywordArray);
}
break;
case 'ezimage':
if ($attribute->hasContent()) {
$imagedata = $attribute->content();
if ($ini->hasVariable('SitemapSettings', 'ImageAlias')) {
$aliasdata = $imagedata->attribute($ini->variable('SitemapSettings', 'ImageAlias'));
$video->thumbnail_loc = 'http://' . xrowSitemapTools::domain() . '/' . $aliasdata['url'];
} else {
$aliasdata = $imagedata->attribute('original');
$video->thumbnail_loc = 'http://' . xrowSitemapTools::domain() . '/' . $aliasdata['url'];
}
}
break;
case 'ezmedia':
if ($attribute->hasContent()) {
$content = $attribute->content();
$uri = "content/download/" . $attribute->attribute('contentobject_id') . '/' . $content->attribute('contentobject_attribute_id') . '/' . $content->attribute('original_filename');
$video->content_loc = 'http://' . xrowSitemapTools::domain() . '/' . $uri;
}
break;
case 'xrowvideo':
if ($attribute->hasContent()) {
$content = $attribute->content();
$uri = "content/download/" . $content["media"]->attribute->ContentObjectID . '/' . $content["media"]->attribute->ID . '/' . $content["binary"]->OriginalFilename;
$video->content_loc = 'http://' . xrowSitemapTools::domain() . '/' . $uri;
$video->duration = (int) $content["video"]["duration"];
}
break;
}
switch ($attribute->ContentClassAttributeIdentifier) {
case 'description':
if ($attribute->hasContent()) {
$content = $attribute->content();
$descriptions = substr(strip_tags($content->ContentObjectAttribute->DataText), 0, 2048);
$video->description = $descriptions;
}
break;
}
}
return $video;
}
示例7: getPublisherFolderPath
/**
*
* @param eZContentObjectTreeNode $publisherFolderNode
* @return string
*/
public static function getPublisherFolderPath ( $publisherFolderNode )
{
$publisherFolderObject = $publisherFolderNode->object();
$matchPath = array();
if ( !preg_match('#^publisher_folder-(.*)$#', $publisherFolderObject->attribute('remote_id'), $matchPath) )
return null;
return $matchPath[1];
}
示例8: processSpecificMerckManual
/**
* @param eZSolrDoc[] $docList
* @param eZContentObjectTreeNode $node
* @param $publisherFolderRelations
*/
protected function processSpecificMerckManual(&$docList, $node, $dataMap, $publisherFolderRelations)
{
/* @var eZContentObjectAttribute[] $datamapDefault */
$datamapDefault = $dataMap;
$taxonomiesAttribute = $datamapDefault['serialized_taxonomies'];
$merckManualClusters = array();
foreach ( $publisherFolderRelations['clusters'] as $cluster => $applications )
foreach ( $applications as $application )
if( $application == MerckManualShowcase::mainApplicationIdentifier() )
$merckManualClusters[] = $cluster;
if( $taxonomiesAttribute instanceof eZContentObjectAttribute && $taxonomiesAttribute->hasContent() )
{
$taxonomies = $taxonomiesAttribute->content();
if( isset( $taxonomies['section']) )
{
$sections = $taxonomies['section'];
foreach( $docList as $languageCode => $doc )
{
$datamap = $node->object()->fetchDataMap(false, $languageCode);
if( !$datamap )
$datamap = $datamapDefault;
$customSectionChaptersParts = array(
$sections[0],
$node->attribute( 'node_id' ),
$datamap['headline']->content()
);
foreach( $merckManualClusters as $cluster )
{
$doc->addField('attr_custom_section_chapter_' . $cluster . '_s', implode('##', $customSectionChaptersParts));
}
}
$this->addValueToDoc( $docList, 'subattr_section___source_id____s', $sections, true, true );
}
}
elseif ( !($taxonomiesAttribute instanceof eZContentObjectAttribute) )
{
eZLog::write( "Indexation : Article with nodeId {$node->NodeID} doesn't have serialized_taxonomies attribute", 'error.log' );
}
}