本文整理汇总了PHP中eZContentObjectTreeNode类的典型用法代码示例。如果您正苦于以下问题:PHP eZContentObjectTreeNode类的具体用法?PHP eZContentObjectTreeNode怎么用?PHP eZContentObjectTreeNode使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了eZContentObjectTreeNode类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getNodeUrl
/**
* @param eZContentObjectTreeNode $node
* @return string
*/
public function getNodeUrl(&$node = null)
{
$token = $this->getToken();
$dataMap = $node->dataMap();
$mediaContentAttribute = $dataMap['media_content'];
$mediaContentAttributeContent = $mediaContentAttribute->content();
$linkObjectID = $mediaContentAttributeContent['relation_list'][0]['contentobject_id'];
$linkObject = eZContentObject::fetch( $linkObjectID );
$linkDatamap = $linkObject->dataMap();
$url = $linkDatamap['url']->content();
$queryStringPosition = strpos($url, '?');
$queryString = substr($url, $queryStringPosition + 1);
$url = substr($url, 0, $queryStringPosition);
$queryStringParts = array();
parse_str($queryString, $queryStringParts);
$queryStringParts[self::SESSION_ID_FIELD] = $token;
$queryString = http_build_query($queryStringParts);
$url .= '?' . $queryString;
return $url;
}
示例2: 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();
}
示例3: 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;
}
示例4: getNodeUrl
/**
* @param eZContentObjectTreeNode $node
* @return string
*/
public function getNodeUrl(&$node = null)
{
$dataMap = $node->dataMap();
$mediaContentAttribute = $dataMap['media_content'];
$mediaContentAttributeContent = $mediaContentAttribute->content();
$linkObjectID = $mediaContentAttributeContent['relation_list'][0]['contentobject_id'];
$linkObject = eZContentObject::fetch( $linkObjectID );
$linkDatamap = $linkObject->dataMap();
$url = $linkDatamap['url']->content();
$delimiter = ( strpos($url, '?') === false ) ? '?' : '&';
$url .= $delimiter.'ID=mmed45652&PASSWORD=medicus&NEWS=n';
return $url;
}
示例5: getNextItems
/**
* Returns block item XHTML
*
* @param mixed $args
* @return array
*/
public static function getNextItems($args)
{
$http = eZHTTPTool::instance();
$tpl = eZTemplate::factory();
$result = array();
$galleryID = $http->postVariable('gallery_id');
$offset = $http->postVariable('offset');
$limit = $http->postVariable('limit');
$galleryNode = eZContentObjectTreeNode::fetch($galleryID);
if ($galleryNode instanceof eZContentObjectTreeNode) {
$params = array('Depth' => 1, 'Offset' => $offset, 'Limit' => $limit);
$pictureNodes = $galleryNode->subtree($params);
foreach ($pictureNodes as $validNode) {
$tpl->setVariable('node', $validNode);
$tpl->setVariable('view', 'block_item');
$tpl->setVariable('image_class', 'blockgallery1');
$content = $tpl->fetch('design:node/view/view.tpl');
$result[] = $content;
if ($counter === $limit) {
break;
}
}
}
return $result;
}
示例6: getRelatedPublishers
/**
* This method returns list of related publisher folders if custom parameter ShowPublisherLogos is != null
* @return null|PublisherFolder[]
*/
protected function getRelatedPublishers()
{
$publisherFolders = null;
if ($this->getCustomParameter('ShowPublisherLogos') == null)
{
return $publisherFolders;
}
if ($this->node instanceof eZContentObjectTreeNode)
{
$dataMap = $this->node->dataMap();
$taxonomies = $dataMap["serialized_taxonomies"]->content();
$publisherPaths = $taxonomies["publisher_folder"];
foreach ($publisherPaths as $publisherPath)
{
$publisherFolders[] = $this->applicationLocalized()->getPublisherFolderFromPath( $publisherPath );
}
}
else
{
$publisherFolders = $this->applicationLocalized()->publisherFolders;
}
return $publisherFolders;
}
示例7: fetchIndexTargets
private static function fetchIndexTargets($indexTarget, $classIdentifiers, $contentObjectAttribute)
{
if (!is_array($classIdentifiers)) {
return array();
}
if ($indexTarget == 'parent_line') {
$path = $contentObjectAttribute->object()->mainNode()->fetchPath();
if (!empty($classIdentifiers)) {
$targets = array();
foreach ($path as $pathNode) {
if (in_array($pathNode->classIdentifier(), $classIdentifiers)) {
$targets[] = $pathNode;
}
}
return $targets;
}
return $path;
} else {
if ($indexTarget == 'parent') {
$parentNode = $contentObjectAttribute->object()->mainNode()->fetchParent();
if (empty($classIdentifiers) || in_array($parentNode->classIdentifier(), $classIdentifiers)) {
return array($parentNode);
}
} else {
if ($indexTarget == 'children' || $indexTarget == 'subtree') {
$children = eZContentObjectTreeNode::subTreeByNodeID(array('ClassFilterType' => !empty($classIdentifiers) ? 'include' : false, 'ClassFilterArray' => !empty($classIdentifiers) ? $classIdentifiers : false, 'Depth' => $indexTarget == 'children' ? 1 : false), $contentObjectAttribute->object()->mainNode()->attribute('node_id'));
if (is_array($children)) {
return $children;
}
}
}
}
return array();
}
示例8: modify
function modify($tpl, $operatorName, $operatorParameters, &$rootNamespace, &$currentNamespace, &$operatorValue, &$namedParameters)
{
$parentNodeID = $namedParameters['parent_node_id'];
switch ($operatorName) {
case 'ezkeywordlist':
include_once 'lib/ezdb/classes/ezdb.php';
$db = eZDB::instance();
if ($parentNodeID) {
$node = eZContentObjectTreeNode::fetch($parentNodeID);
if ($node) {
$pathString = "AND ezcontentobject_tree.path_string like '" . $node->attribute('path_string') . "%'";
}
$parentNodeIDSQL = "AND ezcontentobject_tree.node_id != " . (int) $parentNodeID;
}
$showInvisibleNodesCond = eZContentObjectTreeNode::createShowInvisibleSQLString(true, false);
$limitation = false;
$limitationList = eZContentObjectTreeNode::getLimitationList($limitation);
$sqlPermissionChecking = eZContentObjectTreeNode::createPermissionCheckingSQL($limitationList);
$versionNameJoins = " AND ezcontentobject_tree.contentobject_id = ezcontentobject_name.contentobject_id AND\n ezcontentobject_tree.contentobject_version = ezcontentobject_name.content_version AND ";
$languageFilter = " AND " . eZContentLanguage::languagesSQLFilter('ezcontentobject');
$versionNameJoins .= eZContentLanguage::sqlFilter('ezcontentobject_name', 'ezcontentobject');
$quotedClassIdentifiers = array();
foreach ((array) $namedParameters['class_identifier'] as $classIdentifier) {
$quotedClassIdentifiers[] = "'" . $db->escapeString($classIdentifier) . "'";
}
$rs = $db->arrayQuery("SELECT DISTINCT ezkeyword.keyword\n FROM ezkeyword_attribute_link,\n ezkeyword,\n ezcontentobject,\n ezcontentobject_name,\n ezcontentobject_attribute,\n ezcontentobject_tree,\n ezcontentclass\n {$sqlPermissionChecking['from']}\n WHERE ezkeyword.id = ezkeyword_attribute_link.keyword_id\n AND ezkeyword_attribute_link.objectattribute_id = ezcontentobject_attribute.id\n AND ezcontentobject_tree.contentobject_id = ezcontentobject_attribute.contentobject_id\n AND ezkeyword.class_id = ezcontentclass.id\n AND " . $db->generateSQLINStatement($quotedClassIdentifiers, 'ezcontentclass.identifier') . "\n {$pathString}\n {$parentNodeIDSQL} " . ($namedParameters['depth'] > 0 ? "AND ezcontentobject_tree.depth=" . (int) $namedParameters['depth'] : '') . "\n {$showInvisibleNodesCond}\n {$sqlPermissionChecking['where']}\n {$languageFilter}\n {$versionNameJoins}\n ORDER BY ezkeyword.keyword ASC");
$operatorValue = $rs;
break;
}
}
示例9: getMetaTitle
public static function getMetaTitle( $pathArray )
{
$metaINI = eZINI::instance( 'ezmetadata.ini' );
$allowedClasses = $metaINI->variable( 'TitleSettings', 'ParentClasses' );
$maxDepth = $metaINI->variable( 'TitleSettings', 'MaxDepth' );
$separator = ' '.$metaINI->variable( 'TitleSettings', 'PathSeparator' ).' ';
$contentINI = eZINI::instance( 'content.ini' );
$rootNodeID = $contentINI->variable( 'NodeSettings', 'RootNode' );
$titleArray = array();
$depth = -1;
$currentItem = array_pop( $pathArray );
foreach ( $pathArray as $item )
{
if ( $item['node_id'] == $rootNodeID ) $depth = 0;
if ( $depth < 0 ) continue;
$itemNode = eZContentObjectTreeNode::fetch( $item['node_id'] );
$itemClass = $itemNode->attribute( 'class_identifier' );
if ( in_array( $itemClass, $allowedClasses ) )
{
$titleArray[] = self::getMetaTitleItem( $itemNode );
$depth++;
if ( $depth >= $maxDepth ) break;
}
}
$itemNode = eZContentObjectTreeNode::fetch( $currentItem['node_id'] );
if ( $itemNode ) $titleArray[] = self::getMetaTitleItem( $itemNode );
$titleArray = array_reverse( $titleArray );
return implode( $separator, $titleArray );
}
示例10: fetch
public function fetch($parameters, $publishedAfter, $publishedBeforeOrAt)
{
if (isset($parameters['Source'])) {
$nodeID = $parameters['Source'];
$node = eZContentObjectTreeNode::fetch($nodeID, false, false);
// not as an object
if ($node && $node['modified_subnode'] <= $publishedAfter) {
return array();
}
} else {
$nodeID = 0;
}
$subTreeParameters = array();
$subTreeParameters['AsObject'] = false;
$subTreeParameters['SortBy'] = array('published', false);
// first the latest
$subTreeParameters['AttributeFilter'] = array('and', array('published', '>', $publishedAfter), array('published', '<=', $publishedBeforeOrAt), array('visibility', '=', true));
if (isset($parameters['Class'])) {
$subTreeParameters['ClassFilterType'] = 'include';
$subTreeParameters['ClassFilterArray'] = explode(';', $parameters['Class']);
}
if (isset($parameters['Limit'])) {
$subTreeParameters['Limit'] = (int) $parameters['Limit'];
}
$result = eZContentObjectTreeNode::subTreeByNodeID($subTreeParameters, $nodeID);
if ($result === null) {
return array();
}
$fetchResult = array();
foreach ($result as $item) {
$fetchResult[] = array('object_id' => $item['id'], 'node_id' => $item['node_id'], 'ts_publication' => $item['published']);
}
return $fetchResult;
}
示例11: getNodeUrl
/**
* @param eZContentObjectTreeNode $node
* @return string
*/
public function getNodeUrl(&$node = null)
{
$url = '';
if ( $node )
{
$dataMap = $node->dataMap();
$mediaContentAttribute = $dataMap['media_content'];
$mediaContentAttributeContent = $mediaContentAttribute->content();
$linkObjectID = $mediaContentAttributeContent['relation_list'][0]['contentobject_id'];
$linkObject = eZContentObject::fetch( $linkObjectID );
$linkDatamap = $linkObject->dataMap();
$url = $linkDatamap['url']->content();
}
return $url;
}
示例12: testDisplayVariableWithObject
/**
* Tests that the output process works with objects.
*
* There should be no crash from casting errors.
* @group templateOperators
* @group attributeOperator
*/
public function testDisplayVariableWithObject()
{
$db = eZDB::instance();
// STEP 1: Add test folder
$folder = new ezpObject( "folder", 2 );
$folder->name = __METHOD__;
$folder->publish();
$nodeId = $folder->mainNode->node_id;
$node = eZContentObjectTreeNode::fetch( $nodeId );
$attrOp = new eZTemplateAttributeOperator();
$outputTxt = '';
$formatterMock = $this->getMock( 'ezpAttributeOperatorFormatterInterface' );
$formatterMock->expects( $this->any() )
->method( 'line' )
->will( $this->returnValue( __METHOD__ ) );
try
{
$attrOp->displayVariable( $node, $formatterMock, true, 2, 0, $outputTxt );
}
catch ( PHPUnit_Framework_Error $e )
{
self::fail( "eZTemplateAttributeOperator raises an error when working with objects." );
}
self::assertNotNull( $outputTxt, "Output text is empty." );
// this is an approxmiate test. The output shoudl contain the name of the object it has been generated correctly.
self::assertContains( __METHOD__, $outputTxt, "There is something wrong with the output of the attribute operator. Object name not found." );
}
示例13: remove
static function remove($objectID, $removeSubtrees = true)
{
eZContentCacheManager::clearContentCacheIfNeeded($objectID);
$object = eZContentObject::fetch($objectID);
if (!is_object($object)) {
return false;
}
// TODO: Is content cache cleared for all objects in subtree ??
if ($removeSubtrees) {
$assignedNodes = $object->attribute('assigned_nodes');
if (count($assignedNodes) == 0) {
$object->purge();
eZContentObject::expireAllViewCache();
return true;
}
$assignedNodeIDArray = array();
foreach ($assignedNodes as $node) {
$assignedNodeIDArray[] = $node->attribute('node_id');
}
eZContentObjectTreeNode::removeSubtrees($assignedNodeIDArray, false);
} else {
$object->purge();
}
return true;
}
示例14: fetch
public function fetch($parameters, $publishedAfter, $publishedBeforeOrAt)
{
if (isset($parameters['Source'])) {
$nodeID = $parameters['Source'];
$node = eZContentObjectTreeNode::fetch($nodeID, false, false);
// not as an object
if ($node && $node['modified_subnode'] <= $publishedAfter) {
return array();
}
} else {
$nodeID = 0;
}
$subTreeParameters = array();
$subTreeParameters['AsObject'] = false;
$subTreeParameters['SortBy'] = array('published', true);
// first the oldest
$subTreeParameters['AttributeFilter'] = array('and', array('published', '>', $publishedAfter), array('published', '<=', $publishedBeforeOrAt));
if (isset($parameters['Classes'])) {
$subTreeParameters['ClassFilterType'] = 'include';
$subTreeParameters['ClassFilterArray'] = explode(',', $parameters['Classes']);
}
// Do not fetch hidden nodes even when ShowHiddenNodes=true
$subTreeParameters['AttributeFilter'] = array('and', array('visibility', '=', true));
$nodes = eZContentObjectTreeNode::subTreeByNodeID($subTreeParameters, $nodeID);
if ($nodes === null) {
return array();
}
$fetchResult = array();
foreach ($nodes as $node) {
$fetchResult[] = array('object_id' => $node['contentobject_id'], 'node_id' => $node['node_id'], 'ts_publication' => $node['published']);
}
return $fetchResult;
}
示例15: testIssue23528
/**
* eZContentObjectTreeNode::createAttributeFilterSQLStrings() returns
* invalid 'in'/'not in' SQL statements
*
* @link http://issues.ez.no/23528
* @dataProvider providerForTestIssue23528
*/
public function testIssue23528($name, $expected)
{
$params = array(1, '3', 'foo', '1foo', 'foo_1');
$attributeFilterParams = array(array($name, 'in', $params));
$attributeFilter = eZContentObjectTreeNode::createAttributeFilterSQLStrings($attributeFilterParams);
$this->assertEquals($expected, $attributeFilter['where']);
}