kernel/classes/ezcontentobjecttreenode.php
static function hideSubTree( eZContentObjectTreeNode $node, $modifyRootNode = true )
    {
        $nodeID = $node->attribute( 'node_id' );
        $time = time();
        $db = eZDB::instance();

        if ( eZAudit::isAuditEnabled() )
        {
            // Set audit params.
            $objectID = $node->attribute( 'contentobject_id' );
            $objectName = $node->attribute( 'name' );
            eZAudit::writeAudit( 'content-hide', array( 'Node ID' => $nodeID,
                                                        'Object ID' => $objectID,
                                                        'Content Name' => $objectName,
                                                        'Time' => $time,
                                                        'Comment' => 'Node has been hidden: eZContentObjectTreeNode::hideSubTree()' ) );
        }

        $db->begin();

        if ( !$node->attribute( 'is_invisible' ) ) // if root node is visible
        {
            // 1) Mark root node as hidden and invisible.
            if ( $modifyRootNode )
                $db->query( "UPDATE ezcontentobject_tree SET is_hidden=1, is_invisible=1, modified_subnode=$time WHERE node_id=$nodeID" );

            // 2) Recursively mark child nodes as invisible, except for ones which have been previously marked as invisible.
            $nodePath = $node->attribute( 'path_string' );
            $db->query( "UPDATE ezcontentobject_tree SET is_invisible=1, modified_subnode=$time WHERE is_invisible=0 AND path_string LIKE '$nodePath%'" );
        }
        else
        {
            // Mark root node as hidden
            if ( $modifyRootNode )
                $db->query( "UPDATE ezcontentobject_tree SET is_hidden=1, modified_subnode=$time WHERE node_id=$nodeID" );
        }

        $node->updateAndStoreModified();

        $db->commit();

        eZContentObjectTreeNode::clearViewCacheForSubtree( $node, $modifyRootNode );
    }
static function hideSubTree( eZContentObjectTreeNode $node, $modifyRootNode = true )
    {
        $nodeID = $node->attribute( 'node_id' );
        $time = time();
        $db = eZDB::instance();

        if ( eZAudit::isAuditEnabled() )
        {
            // Set audit params.
            $objectID = $node->attribute( 'contentobject_id' );
            $objectName = $node->attribute( 'name' );
            eZAudit::writeAudit( 'content-hide', array( 'Node ID' => $nodeID,
                                                        'Object ID' => $objectID,
                                                        'Content Name' => $objectName,
                                                        'Time' => $time,
                                                        'Comment' => 'Node has been hidden: eZContentObjectTreeNode::hideSubTree()' ) );
        }

        $db->begin();

        if ( !$node->attribute( 'is_invisible' ) ) // if root node is visible
        {
            // 1) Mark root node as hidden and invisible.
            if ( $modifyRootNode )
                $db->query( "UPDATE ezcontentobject_tree SET is_hidden=1, is_invisible=1, modified_subnode=$time WHERE node_id=$nodeID" );

            // 2) Recursively mark child nodes as invisible, except for ones which have been previously marked as invisible.
            $nodePath = $node->attribute( 'path_string' );
            $db->query( "UPDATE ezcontentobject_tree SET is_invisible=1, modified_subnode=$time WHERE is_invisible=0 AND path_string LIKE '$nodePath%'" );
        }
        else
        {
            // Mark root node as hidden
            if ( $modifyRootNode )
                $db->query( "UPDATE ezcontentobject_tree SET is_hidden=1, modified_subnode=$time WHERE node_id=$nodeID" );
        }

        $node->updateAndStoreModified();

        $db->commit();

        eZContentObjectTreeNode::clearViewCacheForSubtree( $node, $modifyRootNode );
    }
static function hideSubTree ( eZContentObjectTreeNode $ node , $ modifyRootNode = true ) { $ nodeID = $ node -> attribute ( 'node_id' ) ; $ time = time ( ) ; $ db = eZDB :: instance ( ) ; if ( eZAudit :: isAuditEnabled ( ) ) { // Set audit params. $ objectID = $ node -> attribute ( 'contentobject_id' ) ; $ objectName = $ node -> attribute ( 'name' ) ; eZAudit :: writeAudit ( 'content-hide' , array ( 'Node ID' => $ nodeID , 'Object ID' => $ objectID , 'Content Name' => $ objectName , 'Time' => $ time , 'Comment' => 'Node has been hidden: eZContentObjectTreeNode::hideSubTree()' ) ) ; } $ db -> begin ( ) ; if ( ! $ node -> attribute ( 'is_invisible' ) ) // if root node is visible { // 1) Mark root node as hidden and invisible. if ( $ modifyRootNode ) $ db -> query ( "UPDATE ezcontentobject_tree SET is_hidden=1, is_invisible=1, modified_subnode=$time WHERE node_id=$nodeID" ) ; // 2) Recursively mark child nodes as invisible, except for ones which have been previously marked as invisible. $ nodePath = $ node -> attribute ( 'path_string' ) ; $ db -> query ( "UPDATE ezcontentobject_tree SET is_invisible=1, modified_subnode=$time WHERE is_invisible=0 AND path_string LIKE '$nodePath%'" ) ; } else { // Mark root node as hidden if ( $ modifyRootNode ) $ db -> query ( "UPDATE ezcontentobject_tree SET is_hidden=1, modified_subnode=$time WHERE node_id=$nodeID" ) ; } $ node -> updateAndStoreModified ( ) ; $ db -> commit ( ) ; eZContentObjectTreeNode :: clearViewCacheForSubtree ( $ node , $ modifyRootNode ) ; }
Hide a subtree

Hide algorithm:
if ( root node of the subtree is visible )
{
1) Mark root node as hidden and invisible
2) Recursively mark child nodes as invisible except for ones which have been previously marked as invisible
}
else
{
Mark root node as hidden
}

In some cases we don't want to touch the root node when (un)hiding a subtree, for example
after content/move or content/copy.
That's why $modifyRootNode argument is used.

Transaction unsafe. If you call several transaction unsafe methods you must enclose the calls within
a db transaction; thus within db->begin and db->commit.

@param eZContentObjectTreeNode $node Root node of the subtree
@param bool $modifyRootNode Whether to modify the root node (true/false)
Hide a subtree