本文整理汇总了PHP中eZContentObjectTreeNode::attribute方法的典型用法代码示例。如果您正苦于以下问题:PHP eZContentObjectTreeNode::attribute方法的具体用法?PHP eZContentObjectTreeNode::attribute怎么用?PHP eZContentObjectTreeNode::attribute使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类eZContentObjectTreeNode
的用法示例。
在下文中一共展示了eZContentObjectTreeNode::attribute方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __get
/**
* Getter
* Returns given attribute for current content node if it exists (ie. path_string).
* Will throw an exception otherwise.
* All "classic" attributes can be used (See {@link eZContentObjectTreeNode::definition()}).
* @param $name
* @throws ezcBasePropertyNotFoundException
* @return mixed
*/
public function __get($name)
{
$this->getNode();
$ret = null;
switch ($name) {
default:
if ($this->node->hasAttribute($name)) {
$ret = $this->node->attribute($name);
} else {
throw new ezcBasePropertyNotFoundException($name);
}
}
return $ret;
}
示例2: attribute
function attribute($attr, $noFunction = false)
{
$retVal = null;
switch ($attr) {
case 'object':
if ($this->attribute('is_local_installation')) {
$retVal = eZContentObjectTreeNode::attribute($attr, $noFunction);
} else {
if (empty($this->ResultObject)) {
$this->ResultObject = new eZFindResultObject(array('published' => $this->attribute('published')));
}
$retVal = $this->ResultObject;
}
break;
case 'language_code':
$retVal = $this->CurrentLanguage;
break;
default:
if (in_array($attr, $this->LocalAttributeNameList)) {
$retVal = isset($this->LocalAttributeValueList[$attr]) ? $this->LocalAttributeValueList[$attr] : null;
// Timestamps are stored as strings for remote objects, so it must be converted.
if ($attr == 'published') {
$retVal = strtotime($retVal);
}
} else {
if ($this->attribute('is_local_installation')) {
$retVal = eZContentObjectTreeNode::attribute($attr, $noFunction);
}
}
break;
}
return $retVal;
}
示例3: getTimeTableFromNode
public static function getTimeTableFromNode(eZContentObjectTreeNode $node)
{
$dataMap = $node->attribute('data_map');
if (isset($dataMap['timetable']) && $dataMap['timetable'] instanceof eZContentObjectAttribute && $dataMap['timetable']->attribute('has_content')) {
$timeTableContent = $dataMap['timetable']->attribute('content')->attribute('matrix');
$timeTable = array();
foreach ($timeTableContent['columns']['sequential'] as $column) {
foreach ($column['rows'] as $row) {
$parts = explode('-', $row);
if (count($parts) == 2) {
$fromParts = explode(':', $parts[0]);
if (count($fromParts) != 2) {
$fromParts = explode('.', $parts[0]);
}
$toParts = explode(':', $parts[1]);
if (count($toParts) != 2) {
$toParts = explode('.', $parts[1]);
}
if (count($fromParts) == 2 && count($toParts) == 2) {
if (!isset($timeTable[$column['identifier']])) {
$timeTable[$column['identifier']] = array();
}
$timeTable[$column['identifier']][] = array('from_time' => array('hour' => trim($fromParts[0]), 'minute' => trim($fromParts[1])), 'to_time' => array('hour' => trim($toParts[0]), 'minute' => trim($toParts[1])));
}
}
}
}
return $timeTable;
}
return array();
}
示例4: fetchByNode
static function fetchByNode(eZContentObjectTreeNode $node)
{
$attributes = $node->attribute('data_map');
foreach ($attributes as $attribute) {
if ($attribute->DataTypeString == 'xrowmetadata' and $attribute->hasContent()) {
return $attribute->content();
}
}
return false;
}
示例5: getSocialInfos
/**
* @return array
*/
public function getSocialInfos()
{
if( !($this->node instanceof eZContentObjectTreeNode)
|| $this->node->attribute('class_identifier') != 'article' )
return array();
/* @type eZContentObjectAttribute[] $dataMap */
$dataMap = $this->node->dataMap();
$headline = $dataMap["headline"]->content();
$urlParams = array();
$description = "";
$imageUrl = "";
$urlGet = "";
if ( ClusterTool::isTwoLangCluster() )
{
$urlParams['ll'] = SystemLocale::fetchByClusterAndSystem( ClusterTool::clusterIdentifier(), 'exact_target' );
}
if($dataMap["promo_description"]->hasContent())
{
$description = strip_tags($dataMap["promo_description"]->content());
}
if ( count($urlParams) > 0 )
{
$urlGet = '?' . http_build_query($urlParams);
}
if ( NodeOperatorHelper::hasImageArticle($this->node, ImageArticleTool::SLIDE_APPLICATION_CASE ) )
{
$imageUrl = SolrSafeOperatorHelper::getImageArticleUrl(
ImageArticleTool::SLIDE_APPLICATION_CASE,
$this->node->attribute('contentobject_id'),
$this->node->currentLanguage(),
'dt_full'
);
$imageUrl .= $urlGet;
}
return array(
"title" => $headline,
"description" => $description,
"url" => $this->applicationName()."/".$this->node->remoteID().$urlGet,
"imageUrl" => $imageUrl
);
}
示例6: getPublisherNodeIdFromArticleNode
/**
*
* @param eZContentObjectTreeNode $childNode
* @return integer
*/
public static function getPublisherNodeIdFromArticleNode ( $childNode )
{
if ( !( $childNode instanceof eZContentObjectTreeNode ) )
return false;
$mainNode = $childNode;
if ( !$mainNode->isMain() )
$mainNode = eZContentObjectTreeNode::fetch( $childNode->attribute('main_node_id'), $childNode->currentLanguage() );
$pathString = $mainNode->attribute('path_string');
$match = array();
if ( !preg_match('#^/1/2/\d+/(\d+)/.*$#', $pathString, $match) )
return null;
return (int)$match[1];
}
示例7: addImage
function addImage(eZContentObjectTreeNode $node)
{
$images = false;
$ini = eZINI::instance('xrowsitemap.ini');
$dm = $node->attribute('data_map');
foreach ($dm as $attribute) {
switch ($attribute->DataTypeString) {
case 'ezimage':
if ($attribute->hasContent()) {
if ($images === false) {
$images = array();
}
$imagedata = $attribute->content();
$image = new xrowSitemapItemImage();
if ($ini->hasVariable('SitemapSettings', 'ImageAlias')) {
$aliasdata = $imagedata->attribute($ini->variable('SitemapSettings', 'ImageAlias'));
$image->url = 'http://' . xrowSitemapTools::domain() . '/' . $aliasdata['url'];
} else {
$aliasdata = $imagedata->attribute('original');
$image->url = 'http://' . xrowSitemapTools::domain() . '/' . $aliasdata['url'];
}
if ($imagedata->attribute('alternative_text')) {
$image->caption = $imagedata->attribute('alternative_text');
}
$image->title = $node->attribute('name');
$images[] = $image;
}
break;
}
}
return $images;
}
示例8: createAccessDOMElement
/**
* Create Access element.
*
* @param DOMDocument Owner DOMDocument
* @param eZContentObjectTreeNode eZContentObjectTreeNode object.
*
* @return DOMElement AccessRights DOMDocument, example:
* <AccessRights canRead="1" canCreate="1" canEdit="0" />
*/
protected function createAccessDOMElement(DOMDocument $domDocument, eZContentObjectTreeNode $node)
{
$accessElement = $domDocument->createElement('AccessRights');
$accessElement->setAttribute('canRead', $node->attribute('can_read') ? '1' : '0');
$accessElement->setAttribute('canEdit', $node->attribute('can_edit') ? '1' : '0');
$accessElement->setAttribute('canCreate', $node->attribute('can_create') ? '1' : '0');
return $accessElement;
}
示例9: deleteNode
/**
* Deletes a node and all of its locations
*
* @param eZContentObjectTreeNode $node Node to delete
**/
protected function deleteNode( $node )
{
$object = $node->attribute( 'object' );
$object->purge();
}
示例10: array
eZSiteAccess::load($access);
eZDebug::checkDebugByUser();
// Change content object default language
$GLOBALS['eZContentObjectDefaultLanguage'] = $LanguageCode;
eZTranslatorManager::resetTranslations();
ezpI18n::reset();
eZContentObject::clearCache();
eZContentLanguage::expireCache();
$Module->setTitle('View ' . $class->attribute('name') . ' - ' . $contentObject->attribute('name'));
$ini = eZINI::instance();
$res = eZTemplateDesignResource::instance();
$res->setDesignSetting($ini->variable('DesignSettings', 'SiteDesign'), 'site');
$res->setOverrideAccess($siteAccess);
$tpl = eZTemplate::factory();
if ($http->hasSessionVariable('LastAccessesVersionURI')) {
$tpl->setVariable('redirect_uri', $http->sessionVariable('LastAccessesVersionURI'));
}
$designKeys = array(array('object', $contentObject->attribute('id')), array('node', $virtualNodeID), array('remote_id', $contentObject->attribute('remote_id')), array('class', $class->attribute('id')), array('class_identifier', $class->attribute('identifier')), array('viewmode', 'full'));
// View mode
if ($assignment) {
$designKeys[] = array('parent_node', $assignment->attribute('parent_node'));
if ($parentNodeObject instanceof eZContentObjectTreeNode) {
$designKeys[] = array('depth', $parentNodeObject->attribute('depth') + 1);
}
}
$res->setKeys($designKeys);
unset($contentObject);
$contentObject = $node->attribute('object');
$Result = eZNodeviewfunctions::generateNodeViewData($tpl, $node, $contentObject, $LanguageCode, 'full', 0, $viewParameters);
$Result['requested_uri_string'] = $requestedURIString;
$Result['ui_context'] = 'view';
示例11: getMerckManualNodeUrl
/**
* @param string $applicationName Compatibility with other getNodeUrl operators
* @param eZContentObjectTreeNode $node
* @param boolean $languageCode
* @return string
*/
public static function getMerckManualNodeUrl($applicationName, $node, $languageCode = false)
{
if( $languageCode )
$node->setCurrentLanguage($languageCode);
/* @type $dataMap eZContentObjectAttribute[] */
$chapterNode = ( $node->attribute( 'depth' ) > 4 ) ? $node->fetchParent() : $node;
$topicNode = ( $node->attribute( 'depth' ) > 4 ) ? $node : null;
$linkType = is_null( $topicNode ) ? 'chapter' : 'topic';
$dataMap = $chapterNode->dataMap();
if ( !$dataMap || !isset($dataMap['serialized_taxonomies']) || !$dataMap['serialized_taxonomies']->hasContent() )
return "";
$serial = $dataMap['serialized_taxonomies']->content();
$sectionRemote = null;
if( isset($serial['section']) && is_array($serial['section']) )
$sectionRemote = $serial['section'][0];
$fetchResult = MerckManualFunctionCollection::fetchUnifiedUrl($sectionRemote, $chapterNode, $topicNode, $linkType);
return $fetchResult['result'];
}
示例12: hasImageArticle
/**
* @param eZContentObjectTreeNode $node
* @param integer $mediaCase
* @return boolean
*/
public static function hasImageArticle($node, $mediaCase)
{
// Way to know if an image exists for the article via solr
if ($node == null) {
return false;
}
$params = array(
'MediaCase' => $mediaCase,
'ArticleObjectId' => $node->attribute('contentobject_id'),
'ArticleLanguage' => $node->currentLanguage(),
'Alias' => false,
);
try
{
$imageHandler = new ImageArticleTool($params);
}
catch ( Exception $e )
{
return false;
}
return $imageHandler->hasImage();
}
示例13: createFromNode
/**
* Creates a new eZContentObjectTrashNode based on an eZContentObjectTreeNode
*
* @param eZContentObjectTreeNode $node
* @return eZContentObjectTrashNode
*/
static function createFromNode($node)
{
$row = array('node_id' => $node->attribute('node_id'), 'parent_node_id' => $node->attribute('parent_node_id'), 'main_node_id' => $node->attribute('main_node_id'), 'contentobject_id' => $node->attribute('contentobject_id'), 'contentobject_version' => $node->attribute('contentobject_version'), 'contentobject_is_published' => $node->attribute('contentobject_is_published'), 'depth' => $node->attribute('depth'), 'sort_field' => $node->attribute('sort_field'), 'sort_order' => $node->attribute('sort_order'), 'priority' => $node->attribute('priority'), 'modified_subnode' => $node->attribute('modified_subnode'), 'path_string' => $node->attribute('path_string'), 'path_identification_string' => $node->attribute('path_identification_string'), 'remote_id' => $node->attribute('remote_id'), 'is_hidden' => $node->attribute('is_hidden'), 'is_invisible' => $node->attribute('is_invisible'));
$trashNode = new eZContentObjectTrashNode($row);
return $trashNode;
}
示例14: createWithNodeAssignment
/**
* Creates object with nodeAssignment from given parent Node, class ID and language code.
*
* @param eZContentObjectTreeNode $parentNode
* @param int $contentClassID
* @param string $languageCode
* @param string|bool $remoteID
*
* @return eZContentObject|null
*/
static function createWithNodeAssignment( $parentNode, $contentClassID, $languageCode, $remoteID = false )
{
$class = eZContentClass::fetch( $contentClassID );
$parentObject = $parentNode->attribute( 'object' );
// Check if the user has access to create a folder here
if ( $class instanceof eZContentClass and
$parentObject->checkAccess( 'create', $contentClassID, false, false, $languageCode ) == '1' )
{
// Set section of the newly created object to the section's value of it's parent object
$sectionID = $parentObject->attribute( 'section_id' );
$db = eZDB::instance();
$db->begin();
$contentObject = $class->instantiateIn( $languageCode, false, $sectionID, false, eZContentObjectVersion::STATUS_INTERNAL_DRAFT );
$nodeAssignment = $contentObject->createNodeAssignment( $parentNode->attribute( 'node_id' ),
true, $remoteID,
$class->attribute( 'sort_field' ),
$class->attribute( 'sort_order' ) );
$db->commit();
return $contentObject;
}
return null;
}
示例15: hasContentObjectAttribute
/**
* @param eZContentObjectTreeNode|eZContentObject $object
* @param string $identifier
*
* @return bool|eZContentObjectAttribute
*/
public function hasContentObjectAttribute($object, $identifier)
{
if ($object instanceof eZContentObjectTreeNode || $object instanceof eZContentObject) {
/** @var eZContentObjectTreeNode|eZContentObject $object */
/** @var eZContentObjectAttribute[] $dataMap */
$dataMap = $object->attribute('data_map');
if (isset($dataMap[$identifier])) {
if ($dataMap[$identifier] instanceof eZContentObjectAttribute) {
//eZDebug::writeError( $object->attribute( 'class_identifier' ) . ' ' . $dataMap[$identifier]->attribute( 'data_type_string' ) . ' ' . $identifier, __METHOD__ );
if ($identifier == 'image' && $dataMap[$identifier]->attribute('data_type_string') == 'ezobjectrelationlist' && $dataMap[$identifier]->attribute('has_content')) {
$content = explode('-', $dataMap[$identifier]->toString());
$firstImage = array_shift($content);
$imageObject = eZContentObject::fetch($firstImage);
return $this->hasContentObjectAttribute($imageObject, 'image');
}
if ($identifier == 'image' && $dataMap[$identifier]->attribute('data_type_string') == 'ezobjectrelation' && $dataMap[$identifier]->attribute('has_content')) {
$imageObject = $dataMap[$identifier]->content();
return $this->hasContentObjectAttribute($imageObject, 'image');
}
switch ($dataMap[$identifier]->attribute('data_type_string')) {
case 'ezcomcomments':
return $dataMap[$identifier];
break;
case 'ezboolean':
if ($dataMap[$identifier]->attribute('data_int') == 1) {
return $dataMap[$identifier];
}
break;
default:
if ($dataMap[$identifier]->attribute('has_content')) {
return $dataMap[$identifier];
}
}
}
}
}
return false;
}