本文整理汇总了PHP中eZContentObjectTreeNode::assignSectionToSubTree方法的典型用法代码示例。如果您正苦于以下问题:PHP eZContentObjectTreeNode::assignSectionToSubTree方法的具体用法?PHP eZContentObjectTreeNode::assignSectionToSubTree怎么用?PHP eZContentObjectTreeNode::assignSectionToSubTree使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类eZContentObjectTreeNode
的用法示例。
在下文中一共展示了eZContentObjectTreeNode::assignSectionToSubTree方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: move
static function move($nodeID, $newParentNodeID)
{
$result = false;
if (!is_numeric($nodeID) || !is_numeric($newParentNodeID)) {
return false;
}
$node = eZContentObjectTreeNode::fetch($nodeID);
if (!$node) {
return false;
}
$object = $node->object();
if (!$object) {
return false;
}
$objectID = $object->attribute('id');
$oldParentNode = $node->fetchParent();
$oldParentObject = $oldParentNode->object();
// clear user policy cache if this is a user object
if (in_array($object->attribute('contentclass_id'), eZUser::contentClassIDs())) {
eZUser::purgeUserCacheByUserId($object->attribute('id'));
}
// clear cache for old placement.
eZContentCacheManager::clearContentCacheIfNeeded($objectID);
$db = eZDB::instance();
$db->begin();
$node->move($newParentNodeID);
$newNode = eZContentObjectTreeNode::fetchNode($objectID, $newParentNodeID);
if ($newNode) {
$newNode->updateSubTreePath(true, true);
if ($newNode->attribute('main_node_id') == $newNode->attribute('node_id')) {
// If the main node is moved we need to check if the section ID must change
$newParentNode = $newNode->fetchParent();
$newParentObject = $newParentNode->object();
if ($object->attribute('section_id') != $newParentObject->attribute('section_id')) {
eZContentObjectTreeNode::assignSectionToSubTree($newNode->attribute('main_node_id'), $newParentObject->attribute('section_id'), $oldParentObject->attribute('section_id'));
}
}
// modify assignment
$curVersion = $object->attribute('current_version');
$nodeAssignment = eZNodeAssignment::fetch($objectID, $curVersion, $oldParentNode->attribute('node_id'));
if ($nodeAssignment) {
$nodeAssignment->setAttribute('parent_node', $newParentNodeID);
$nodeAssignment->setAttribute('op_code', eZNodeAssignment::OP_CODE_MOVE);
$nodeAssignment->store();
// update search index
$nodeIDList = array($nodeID);
eZSearch::removeNodeAssignment($node->attribute('main_node_id'), $newNode->attribute('main_node_id'), $object->attribute('id'), $nodeIDList);
eZSearch::addNodeAssignment($newNode->attribute('main_node_id'), $object->attribute('id'), $nodeIDList);
}
$result = true;
} else {
eZDebug::writeError("Node {$nodeID} was moved to {$newParentNodeID} but fetching the new node failed");
}
$db->commit();
// clear cache for new placement.
eZContentCacheManager::clearContentCacheIfNeeded($objectID);
return $result;
}
示例2: updateSection
/**
* Assigns a node to a section
*
* @param int $nodeID
* @param int $selectedSectionID
*
* @return array An array with operation status, always true
*/
public static function updateSection($nodeID, $selectedSectionID)
{
eZContentObjectTreeNode::assignSectionToSubTree($nodeID, $selectedSectionID);
}
示例3: foreach
{
$allowedNodeIDList[] = $nodeID;
}
else
{
$deniedNodeIDList[] = $nodeID;
}
}
if ( count( $allowedNodeIDList ) > 0 )
{
$db = eZDB::instance();
$db->begin();
foreach ( $allowedNodeIDList as $nodeID )
{
eZContentObjectTreeNode::assignSectionToSubTree( $nodeID, $SectionID );
}
$db->commit();
// clear content caches
eZContentCacheManager::clearAllContentCache();
}
if ( count( $deniedNodeIDList ) > 0 )
{
$tpl = eZTemplate::factory();
$tpl->setVariable( 'section_name', $section->attribute( 'name' ) );
$tpl->setVariable( 'error_number', 1 );
$deniedNodes = eZContentObjectTreeNode::fetch( $deniedNodeIDList );
$tpl->setVariable( 'denied_node_list', $deniedNodes );
$Result = array();
示例4: 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();
}
示例5: setSection
function setSection( $params )
{
$location = $params['location'];
$sectionName = $params['section_name'];
$sectionID = $this->sectionIDbyName( $params );
if( $sectionID )
{
$rootNode = $this->nodeByUrl( $params );
if( is_object( $rootNode ) )
{
eZContentObjectTreeNode::assignSectionToSubTree( $rootNode->attribute( 'node_id' ), $sectionID );
}
}
}
示例6: updateSection
/**
* Assigns a node to a section
*
* @param int $nodeID
* @param int $selectedSectionID
*
* @return array An array with operation status, always true
*/
public static function updateSection($nodeID, $selectedSectionID)
{
eZContentObjectTreeNode::assignSectionToSubTree($nodeID, $selectedSectionID);
//call appropriate method from search engine
eZSearch::updateNodeSection($nodeID, $selectedSectionID);
}