本文整理汇总了PHP中eZContentObject::fetchByNodeID方法的典型用法代码示例。如果您正苦于以下问题:PHP eZContentObject::fetchByNodeID方法的具体用法?PHP eZContentObject::fetchByNodeID怎么用?PHP eZContentObject::fetchByNodeID使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类eZContentObject
的用法示例。
在下文中一共展示了eZContentObject::fetchByNodeID方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setUp
public function setUp()
{
parent::setUp();
eZINI::instance('ezfind.ini')->loadCache(true);
eZINI::instance('solr.ini')->loadCache(true);
ezpINIHelper::setINISetting('site.ini', 'SearchSettings', 'AllowEmptySearch', 'enabled');
ezpINIHelper::setINISetting('site.ini', 'RegionalSettings', 'SiteLanguageList', array('eng-GB'));
$this->solrSearch = new eZSolr();
$this->testObj = eZContentObject::fetchByNodeID(2);
$this->solrSearch->addObject($this->testObj);
$this->fetchParams = array('SearchOffset' => 0, 'SearchLimit' => 10, 'Facet' => null, 'SortBy' => null, 'Filter' => null, 'SearchContentClassID' => null, 'SearchSectionID' => null, 'SearchSubTreeArray' => null, 'AsObjects' => null, 'SpellCheck' => null, 'IgnoreVisibility' => null, 'Limitation' => null, 'BoostFunctions' => null, 'QueryHandler' => 'ezpublish', 'EnableElevation' => null, 'ForceElevation' => null, 'SearchDate' => null, 'DistributedSearch' => null, 'FieldsToReturn' => null);
}
示例2: array
<?php
$Module = $Params['Module'];
$tpl = eZTemplate::factory();
$newsletter_ini = eZINI::instance('jaj_newsletter.ini');
$newsletter_root_node_id = $newsletter_ini->variable('NewsletterSettings', 'RootFolderNodeId');
$node = eZContentObject::fetchByNodeID($newsletter_root_node_id);
if (!$node || !$node->canRead()) {
return $Module->handleError(eZError::KERNEL_NOT_AVAILABLE, 'kernel');
}
switch (eZPreferences::value('admin_jaj_newsletter_newsletters_limit')) {
case '25':
$limit = 25;
break;
case '50':
$limit = 50;
break;
default:
$limit = 10;
break;
}
$newsletter_content_class = eZContentClass::fetchByIdentifier('jaj_newsletter');
if ($newsletter_content_class) {
$tpl->setVariable('newsletter_content_class_id', $newsletter_content_class->ID);
}
$viewParameters = array('offset' => $Params['Offset']);
$tpl->setVariable('node', $node);
$tpl->setVariable('set_limit', $limit);
$tpl->setVariable('view_parameters', $viewParameters);
$Result = array('content' => $tpl->fetch('design:jaj_newsletter/newsletters/index.tpl'), 'path' => array(array('url' => 'jaj_newsletter/index', 'text' => ezpI18n::tr('jaj_newsletter/navigation', 'Newsletter')), array('url' => false, 'text' => ezpI18n::tr('jaj_newsletter/navigation', 'Newsletters'))));
示例3: getRelatedObjectList
/**
* Extracts ids of embedded/linked objects in an eZXML DOMNodeList
* @param DOMNodeList $domNodeList
* @return array
*/
private function getRelatedObjectList(DOMNodeList $domNodeList)
{
$embeddedObjectIdArray = array();
foreach ($domNodeList as $embed) {
if ($embed->hasAttribute('object_id')) {
$embeddedObjectIdArray[] = $embed->getAttribute('object_id');
} elseif ($embed->hasAttribute('node_id')) {
if ($object = eZContentObject::fetchByNodeID($embed->getAttribute('node_id'))) {
$embeddedObjectIdArray[] = $object->attribute('id');
}
}
}
return $embeddedObjectIdArray;
}
示例4: DISTINCT
$rowsCount = 0;
if (isset($countOfItems[0])) {
$rowsCount = $countOfItems[0]['count'];
}
if ($rowsCount > 0) {
// Select all elements having reverse relations. And ignore those items that don't relate to objects other than being removed.
$rows = $db->arrayQuery("SELECT DISTINCT( tree.node_id )\n FROM ezcontentobject_tree tree, ezcontentobject obj,\n ezcontentobject_link link LEFT JOIN ezcontentobject_tree tree2\n ON link.from_contentobject_id = tree2.contentobject_id\n WHERE {$path_strings}\n and link.to_contentobject_id = tree.contentobject_id\n and obj.id = link.from_contentobject_id\n and obj.current_version = link.from_contentobject_version\n and not ( {$path_strings_where} )\n\n ", array('limit' => $pageLimit, 'offset' => $Offset));
} else {
$rows = array();
}
$childrenList = array();
// Contains children of Nodes from $deleteIDArray
// Fetch number of reverse related objects for each of the items being removed.
$reverselistCountChildrenArray = array();
foreach ($rows as $child) {
$contentObject = eZContentObject::fetchByNodeID($child['node_id']);
$contentObject_ID = $contentObject->attribute('id');
$reverseObjectCount = $contentObject->reverseRelatedObjectCount(false, false, 1);
$reverselistCountChildrenArray[$contentObject_ID] = $reverseObjectCount;
$childrenList[] = eZContentObjectTreeNode::fetch($child['node_id']);
}
$contentObjectName = $contentObjectTreeNode->attribute('name');
$viewParameters = array('offset' => $Offset);
$tpl = eZTemplate::factory();
$tpl->setVariable('children_list', $childrenList);
$tpl->setVariable('view_parameters', $viewParameters);
$tpl->setVariable('children_count', $rowsCount);
$tpl->setVariable('content_object_name', $contentObjectName);
$tpl->setVariable('reverse_list_count_children_array', $reverselistCountChildrenArray);
$tpl->setVariable('reverse_list_children_count', count($reverselistCountChildrenArray));
$tpl->setVariable('node_id', $NodeID);
示例5: testFetchByNodeIDArrayAsRow
/**
* Unit test for {@link eZContentObject::fetchByNodeID()}
*
* @see http://issues.ez.no/17946
* @group issue17946
*/
public function testFetchByNodeIDArrayAsRow()
{
$fetchedObjects = eZContentObject::fetchByNodeID(array(2), false);
self::assertInternalType(PHPUnit_Framework_Constraint_IsType::TYPE_ARRAY, $fetchedObjects, "eZContentObject::fetchByNodeID() must return an array of eZContentObject instances if an array of nodeIds is passed as param");
self::assertInternalType(PHPUnit_Framework_Constraint_IsType::TYPE_ARRAY, $fetchedObjects[2], "eZContentObject::fetchByNodeID() must return an array indexed by nodeIds of eZContentObject array representation if an array of nodeIds is passed as param");
}
示例6: fetchTagsByNodeID
/**
* Return the tags for a given node id or null if it fails
*
* @param integer $nodeID
* @return
*/
static function fetchTagsByNodeID($iNodeID, $view_parameters = array())
{
return is_numeric($iNodeID) ? MetatagFunctionCollection::fetchTagsByContentObject(eZContentObject::fetchByNodeID($iNodeID), $view_parameters) : null;
}
示例7: if
$tpl->setVariable( 'elevatedObject', $elevatedObject );
$tpl->setVariable( 'elevateSearchQuery', '' );
}
// back from browse
else if (
$http->hasPostVariable( 'BrowseActionName' ) and
( $http->postVariable( 'BrowseActionName' ) == ( 'ezfind-elevate-browseforobject' ) or $http->postVariable( 'BrowseActionName' ) == ( 'ezfind-searchelevateconfigurations-browse' ) ) and
$http->hasPostVariable( "SelectedNodeIDArray" )
)
{
if ( !$http->hasPostVariable( 'BrowseCancelButton' ) )
{
$selectedNodeID = $http->postVariable( "SelectedNodeIDArray" );
$selectedNodeID = $selectedNodeID[0];
$elevatedObject = eZContentObject::fetchByNodeID( $selectedNodeID );
// Browse was triggered to pick an object for elevation
if ( $http->postVariable( 'BrowseActionName' ) == ( 'ezfind-elevate-browseforobject' ) )
{
$tpl->setVariable( 'back_from_browse', true );
$tpl->setVariable( 'elevatedObject', $elevatedObject );
$tpl->setVariable( 'elevateSearchQuery', $http->postVariable( 'elevateSearchQuery' ) );
}
else
{
// Browsing for an object, the elevate configuration of which we would like to inspect.
$objectID = $elevatedObject->attribute( 'id' );
// Redirect the to detail page for the object's elevation configuration
$module->redirectToView( 'elevation_detail', array( $objectID ) );
}
示例8: load
/**
* Returns a node data for given object / node id
*
* Following parameters are supported:
* ezjscnode::load::embed_id[::attribute[::load_image_size]]
*
* eg: ezjscnode::load::ezobject_46::image::large
* eg: ezjscnode::load::eznode_44::summary
*eg: ezjscnode::load::44::summary (44 is in this case node id)
*
* @since 1.2
* @param mixed $args
* @throws InvalidArgumentException
* @return array
*/
public static function load($args)
{
$embedObject = false;
if (isset($args[0]) && $args[0]) {
$embedType = 'eznode';
if (is_numeric($args[0])) {
$embedId = $args[0];
} else {
list($embedType, $embedId) = explode('_', $args[0]);
}
if ($embedType === 'eznode' || strcasecmp($embedType, 'eznode') === 0) {
$embedObject = eZContentObject::fetchByNodeID($embedId);
} else {
$embedObject = eZContentObject::fetch($embedId);
}
}
if (!$embedObject instanceof eZContentObject) {
throw new InvalidArgumentException("Argument 1: '{$embedType}\\_{$embedId}' does not map to a valid content object");
} else {
if (!$embedObject->canRead()) {
throw new InvalidArgumentException("Argument 1: '{$embedType}\\_{$embedId}' is not available");
}
}
// Params for node to json encoder
$params = array('loadImages' => true);
$params['imagePreGenerateSizes'] = array('small', 'original');
// look for attribute parameter ( what attribute we should load )
if (isset($args[1]) && $args[1]) {
$params['dataMap'] = array($args[1]);
}
// what image sizes we want returned with full data ( url++ )
if (isset($args[2]) && $args[2]) {
$params['imagePreGenerateSizes'][] = $args[2];
}
// Simplify and load data in accordance to $params
return ezjscAjaxContent::simplify($embedObject, $params);
}
示例9: updateFromParent
/**
* Update current empty paex fields with values get from paex object of
* parent of current main node.
*
* @param bool $forceUpdate
* @return true
*/
function updateFromParent($forceUpdate = false)
{
$mainNode = eZContentObjectTreeNode::findMainNode($this->attribute('contentobject_id'), true);
if (!is_object($mainNode)) {
eZDebug::writeDebug('mainNode not found', 'eZPaEx::updateFromParent');
} elseif ($mainNode->attribute('depth') > 1) {
$parentMainNodeID = $mainNode->attribute('parent_node_id');
$parentContentObject = eZContentObject::fetchByNodeID($parentMainNodeID);
$parentPaex = eZPaEx::getPaEx($parentContentObject->attribute('id'));
if ($parentPaex instanceof eZPaEx) {
$paexUpdated = false;
if (!$this->hasRegexp() || $forceUpdate) {
$this->setAttribute('passwordvalidationregexp', $parentPaex->attribute('passwordvalidationregexp'));
$paexUpdated = true;
}
if (!$this->hasLifeTime() || $forceUpdate) {
$this->setAttribute('passwordlifetime', $parentPaex->attribute('passwordlifetime'));
$paexUpdated = true;
}
if (!$this->hasNotification() || $forceUpdate) {
$this->setAttribute('expirationnotification', $parentPaex->attribute('expirationnotification'));
$paexUpdated = true;
}
if ($paexUpdated) {
eZDebug::writeDebug('Paex updated from parent', 'eZPaEx::updateFromParent');
$this->store();
}
}
}
return true;
}
示例10: execute
function execute($process, $event)
{
$processParameters = $process->attribute('parameter_list');
$storeProcessParameters = false;
$classID = false;
$object = false;
$sectionID = false;
$languageID = 0;
if (isset($processParameters['object_id'])) {
$object = eZContentObject::fetch($processParameters['object_id']);
} else {
if (isset($processParameters['node_id'])) {
$object = eZContentObject::fetchByNodeID($processParameters['node_id']);
}
}
if ($object instanceof eZContentObject) {
// Examine if the published version contains one of the languages we
// match for.
if (isset($processParameters['version'])) {
$versionID = $processParameters['version'];
$version = $object->version($versionID);
if (is_object($version)) {
$version_option = $event->attribute('version_option');
if ($version_option == eZMultiplexerType::VERSION_OPTION_FIRST_ONLY and $processParameters['version'] > 1 or $version_option == eZMultiplexerType::VERSION_OPTION_EXCEPT_FIRST and $processParameters['version'] == 1) {
return eZWorkflowType::STATUS_ACCEPTED;
}
// If the language ID is part of the mask the result is non-zero.
$languageID = (int) $version->attribute('initial_language_id');
}
}
$sectionID = $object->attribute('section_id');
$class = $object->attribute('content_class');
if ($class) {
$classID = $class->attribute('id');
}
}
$userArray = explode(',', $event->attribute('data_text2'));
$classArray = explode(',', $event->attribute('data_text5'));
$languageMask = $event->attribute('data_int2');
if (!isset($processParameters['user_id'])) {
$user = eZUser::currentUser();
$userID = $user->id();
$processParameters['user_id'] = $userID;
$storeProcessParameters = true;
} else {
$userID = $processParameters['user_id'];
$user = eZUser::fetch($userID);
if (!$user instanceof eZUser) {
$user = eZUser::currentUser();
$userID = $user->id();
$processParameters['user_id'] = $userID;
$storeProcessParameters = true;
}
}
$userGroups = $user->attribute('groups');
$inExcludeGroups = count(array_intersect($userGroups, $userArray)) != 0;
if ($storeProcessParameters) {
$process->setParameters($processParameters);
$process->store();
}
// All languages match by default
$hasLanguageMatch = true;
if ($languageMask != 0) {
// Match ID with mask.
$hasLanguageMatch = (bool) ($languageMask & $languageID);
}
if ($hasLanguageMatch && !$inExcludeGroups && (in_array(-1, $classArray) || in_array($classID, $classArray))) {
$sectionArray = explode(',', $event->attribute('data_text1'));
if (in_array($sectionID, $sectionArray) || in_array(-1, $sectionArray)) {
$workflowToRun = $event->attribute('data_int1');
$childParameters = array_merge($processParameters, array('workflow_id' => $workflowToRun, 'user_id' => $userID, 'parent_process_id' => $process->attribute('id')));
$childProcessKey = eZWorkflowProcess::createKey($childParameters);
$childProcessArray = eZWorkflowProcess::fetchListByKey($childProcessKey);
$childProcess =& $childProcessArray[0];
if ($childProcess == null) {
$childProcess = eZWorkflowProcess::create($childProcessKey, $childParameters);
$childProcess->store();
}
$workflow = eZWorkflow::fetch($childProcess->attribute("workflow_id"));
$workflowEvent = null;
if ($childProcess->attribute("event_id") != 0) {
$workflowEvent = eZWorkflowEvent::fetch($childProcess->attribute("event_id"));
}
$childStatus = $childProcess->run($workflow, $workflowEvent, $eventLog);
$childProcess->store();
if ($childStatus == eZWorkflow::STATUS_DEFERRED_TO_CRON) {
$this->setActivationDate($childProcess->attribute('activation_date'));
$childProcess->setAttribute("status", eZWorkflow::STATUS_WAITING_PARENT);
$childProcess->store();
return eZWorkflowType::STATUS_DEFERRED_TO_CRON_REPEAT;
} else {
if ($childStatus == eZWorkflow::STATUS_FETCH_TEMPLATE or $childStatus == eZWorkflow::STATUS_FETCH_TEMPLATE_REPEAT) {
$process->Template =& $childProcess->Template;
return eZWorkflowType::STATUS_FETCH_TEMPLATE_REPEAT;
} else {
if ($childStatus == eZWorkflow::STATUS_REDIRECT) {
$process->RedirectUrl =& $childProcess->RedirectUrl;
return eZWorkflowType::STATUS_REDIRECT_REPEAT;
} else {
if ($childStatus == eZWorkflow::STATUS_DONE) {
//.........这里部分代码省略.........
示例11: addNodeAssignment
function addNodeAssignment($content_object, $parent_node_id, $set_as_main_node = false)
{
$main_node_id = $content_object->attribute('main_node_id');
$insertedNode = $content_object->addLocation($parent_node_id, true);
// Now set it as published and fix main_node_id
$insertedNode->setAttribute('contentobject_is_published', 1);
$parentContentObject = eZContentObject::fetchByNodeID($parent_node_id);
if ($set_as_main_node) {
$main_node_id = $insertedNode->attribute('node_id');
$insertedNode->updateMainNodeID($main_node_id, $content_object->attribute('id'), false, $parent_node_id);
}
$insertedNode->setAttribute('main_node_id', $main_node_id);
$insertedNode->setAttribute('contentobject_version', $content_object->attribute('current_version'));
// Make sure the path_identification_string is set correctly.
$insertedNode->updateSubTreePath();
$insertedNode->sync();
return $insertedNode->attribute('node_id');
}
示例12: swapNode
/**
* Called when two nodes are swapped.
* Simply re-index for now.
*
* @todo when Solr supports it: update fields only
*
* @param $nodeID
* @param $selectedNodeID
* @param $nodeIdList
* @return void
*/
public function swapNode( $nodeID, $selectedNodeID, $nodeIdList = array() )
{
$contentObject1 = eZContentObject::fetchByNodeID( $nodeID );
$contentObject2 = eZContentObject::fetchByNodeID( $selectedNodeID );
$this->addObject( $contentObject1 );
$this->addObject( $contentObject2 );
}
示例13: file_get_contents
/**
* Visualizza l'immagine contenuta nell'attirbuto header_image
* della classe frotpage posizionata come RootNode
*/
$module = $Params['Module'];
// Root Node ID
$ini = eZINI::instance('content.ini');
$root_node_id = $ini->variable('NodeSettings', 'RootNode');
// Cluster
$file_ini = eZINI::instance('file.ini');
$mount_point = $file_ini->variable('eZDFSClusteringSettings', 'MountPointPath');
// Default imagepath
$imagepath = 'extension/pat_base/design/itbase/images/header-ittemplate.jpg';
// Immagine personalizzata
$frontpage = eZContentObject::fetchByNodeID($root_node_id);
if ($frontpage instanceof eZContentObject) {
if (strcmp($frontpage->className(), 'Frontpage') == 0) {
$dataMap =& $frontpage->attribute('data_map');
if (array_key_exists('header_image', $dataMap)) {
$image =& $dataMap['header_image']->content();
$list =& $image->aliasList();
if (!empty($list['original']['url'])) {
$imagepath = $mount_point . '/' . $list['original']['url'];
}
}
}
}
header("Content-Type: image/jpeg");
echo file_get_contents($imagepath);
eZExecution::cleanExit();
示例14: findNodeFromPath
/**
* @param string $path
* @param MerckManualShowcase $app
* @return bool|eZContentObjectTreeNode
*/
public static function findNodeFromPath( $path, &$app )
{
/* We remove the publisher folder id at the beginning of the url as we already have it */
$path = preg_replace('#^/\d+/#', '/', $path );
$manualAppNode = eZContentObjectTreeNode::fetch( self::rootNodeId() );
$manualAppNodePathName = $manualAppNode->pathWithNames();
$tabNodePath = explode('/', substr($path, 1));
$remoteId = end($tabNodePath);
if(preg_match('/^[a-f0-9]{32}$/', $remoteId))
{
$nodeRemote = eZContentObjectTreeNode::fetchByRemoteID($remoteId);
if($nodeRemote instanceof eZContentObjectTreeNode)
{
$app->fullContext = 'topic';
return $nodeRemote;
}
}
$pathParts = explode('/', substr($path, 1));
if ( $pathParts[0] == 'table' )
{
$app->fullContext = 'table';
return eZContentObjectTreeNode::fetch($pathParts[1]);
}
// Url with topic
list($sectionName, $chapterName, $topicName, $mediaType, $mediaName, $other) = $pathParts;
// Url without topic
$matches = array();
if ( preg_match('/media-([a-z]+)/', $topicName, $matches) )
{
list($sectionName, $chapterName, $mediaType, $mediaName, $other) = $pathParts;
$topicName = null;
}
// Full section
if ( $sectionName != null && is_null( $chapterName ) && is_null( $topicName ) )
{
$app->fullContext = 'section';
$app->section = MerckManualFunctionCollection::fetchSection('url', $sectionName);
return eZContentObjectTreeNode::fetch(MerckManualShowcase::rootNodeId());
}
if ( $sectionName == 'about-us' )
{
list($chapterName, $topicName, $mediaType, $mediaName, $other) = $pathParts;
}
$path = $manualAppNodePathName;
// Full of chapter
if ( $chapterName )
{
$app->fullContext = 'chapter';
$path .= '/' . $chapterName;
}
// Full of topic
if ( $topicName )
{
$app->fullContext = 'topic';
$path .= '/' . $topicName;
}
$nodeId = eZURLAliasML::fetchNodeIDByPath($path);
if ( $nodeId )
{
if ( $mediaName )
{
$mediaType = str_replace('media-', '', $mediaType);
// Get media node
// Full of html table image
// /topic_name/(media-image-file)/oscar2/filename
if ( $mediaType == 'image-file' )
{
$app->fullContext = $mediaType;
$app->oscarFolder = $mediaName;
$app->mediaName = $other;
}
// Full of inline audio, video, image
elseif ( $mediaType )
{
// Construct the remote_id of the media folder
/* @type $dataMap eZContentObjectAttribute[] */
$contentObject = eZContentObject::fetchByNodeID($nodeId);
$dataMap = $contentObject->dataMap();
$publisherAttrContent = $dataMap['publisher']->content();
//.........这里部分代码省略.........
示例15: updateMainNodeID
static function updateMainNodeID($mainNodeID, $objectID, $version = false, $parentMainNodeID, $updateSection = true)
{
$mainNodeID = (int) $mainNodeID;
$parentMainNodeID = (int) $parentMainNodeID;
$objectID = (int) $objectID;
$version = (int) $version;
$db = eZDB::instance();
$db->begin();
$db->query("UPDATE ezcontentobject_tree SET main_node_id={$mainNodeID} WHERE contentobject_id={$objectID}");
if (!$version) {
$rows = $db->arrayQuery("SELECT current_version FROM ezcontentobject WHERE id={$objectID}");
$version = $rows[0]['current_version'];
}
$db->query("UPDATE eznode_assignment SET is_main=1 WHERE contentobject_id={$objectID} AND contentobject_version={$version} AND parent_node={$parentMainNodeID}");
$db->query("UPDATE eznode_assignment SET is_main=0 WHERE contentobject_id={$objectID} AND contentobject_version={$version} AND parent_node!={$parentMainNodeID}");
$contentObject = eZContentObject::fetch($objectID);
$parentContentObject = eZContentObject::fetchByNodeID($parentMainNodeID);
if ($updateSection && $contentObject->attribute('section_id') != $parentContentObject->attribute('section_id')) {
$newSectionID = $parentContentObject->attribute('section_id');
eZContentObjectTreeNode::assignSectionToSubTree($mainNodeID, $newSectionID);
}
$db->commit();
}