kernel/classes/ezcontentobjecttreenode.php
function subtreeSoleNodeCount( $params = array() )
    {
        $nodeID = $this->attribute( 'node_id' );
        $node = $this;

        $depth = false;
        if ( isset( $params['Depth'] ) && is_numeric( $params['Depth'] ) )
        {
            $depth = $params['Depth'];

        }

        $fromNode = $nodeID;

        $nodePath = null;
        $nodeDepth = 0;
        if ( count( $node ) != 0 )
        {
            $nodePath = $node->attribute( 'path_string' );
            $nodeDepth = $node->attribute( 'depth' );
        }

        $childPath = $nodePath;

        $db = eZDB::instance();
        $pathString = " ezcot.path_string like '$childPath%' and ";

        $notEqParentString = "ezcot.node_id != $fromNode";
        $depthCond = '';
        if ( $depth )
        {

            $nodeDepth += $depth;
            if ( isset( $params[ 'DepthOperator' ] ) && $params[ 'DepthOperator' ] == 'eq' )
            {
                $depthCond = ' ezcot.depth = ' . $nodeDepth . '';
                $notEqParentString = '';
            }
            else
                $depthCond = ' ezcot.depth <= ' . $nodeDepth . ' and ';
        }

        $tmpTableName = $db->generateUniqueTempTableName( 'eznode_count_%' );
        $db->createTempTable( "CREATE TEMPORARY TABLE $tmpTableName ( count int )" );
        $query = "INSERT INTO $tmpTableName
                  SELECT
                          count( ezcot.main_node_id ) AS count
                    FROM
                          ezcontentobject_tree ezcot,
                          ezcontentobject_tree ezcot_all
                    WHERE
                           $pathString
                           $depthCond
                           $notEqParentString
                           and ezcot.contentobject_id = ezcot_all.contentobject_id
                    GROUP BY ezcot_all.main_node_id
                    HAVING count( ezcot.main_node_id ) <= 1";

        $db->query( $query, eZDBInterface::SERVER_SLAVE );
        $query = "SELECT count( * ) AS count
                  FROM $tmpTableName";

        $rows = $db->arrayQuery( $query, array(), eZDBInterface::SERVER_SLAVE );
        $db->dropTempTable( "DROP TABLE $tmpTableName" );
        return $rows[0]['count'];
    }
function subtreeSoleNodeCount( $params = array() )
    {
        $nodeID = $this->attribute( 'node_id' );
        $node = $this;

        $depth = false;
        if ( isset( $params['Depth'] ) && is_numeric( $params['Depth'] ) )
        {
            $depth = $params['Depth'];

        }

        $fromNode = $nodeID;

        $nodePath = null;
        $nodeDepth = 0;
        if ( count( $node ) != 0 )
        {
            $nodePath = $node->attribute( 'path_string' );
            $nodeDepth = $node->attribute( 'depth' );
        }

        $childPath = $nodePath;

        $db = eZDB::instance();
        $pathString = " ezcot.path_string like '$childPath%' and ";

        $notEqParentString = "ezcot.node_id != $fromNode";
        $depthCond = '';
        if ( $depth )
        {

            $nodeDepth += $depth;
            if ( isset( $params[ 'DepthOperator' ] ) && $params[ 'DepthOperator' ] == 'eq' )
            {
                $depthCond = ' ezcot.depth = ' . $nodeDepth . '';
                $notEqParentString = '';
            }
            else
                $depthCond = ' ezcot.depth <= ' . $nodeDepth . ' and ';
        }

        $tmpTableName = $db->generateUniqueTempTableName( 'eznode_count_%' );
        $db->createTempTable( "CREATE TEMPORARY TABLE $tmpTableName ( count int )" );
        $query = "INSERT INTO $tmpTableName
                  SELECT
                          count( ezcot.main_node_id ) AS count
                    FROM
                          ezcontentobject_tree ezcot,
                          ezcontentobject_tree ezcot_all
                    WHERE
                           $pathString
                           $depthCond
                           $notEqParentString
                           and ezcot.contentobject_id = ezcot_all.contentobject_id
                    GROUP BY ezcot_all.main_node_id
                    HAVING count( ezcot.main_node_id ) <= 1";

        $db->query( $query, eZDBInterface::SERVER_SLAVE );
        $query = "SELECT count( * ) AS count
                  FROM $tmpTableName";

        $rows = $db->arrayQuery( $query, array(), eZDBInterface::SERVER_SLAVE );
        $db->dropTempTable( "DROP TABLE $tmpTableName" );
        return $rows[0]['count'];
    }
function subtreeSoleNodeCount ( $ params = array ( ) ) { $ nodeID = $ this -> attribute ( 'node_id' ) ; $ node = $ this ; $ depth = false ; if ( isset ( $ params [ 'Depth' ] ) && is_numeric ( $ params [ 'Depth' ] ) ) { $ depth = $ params [ 'Depth' ] ; } $ fromNode = $ nodeID ; $ nodePath = null ; $ nodeDepth = 0 ; if ( count ( $ node ) != 0 ) { $ nodePath = $ node -> attribute ( 'path_string' ) ; $ nodeDepth = $ node -> attribute ( 'depth' ) ; } $ childPath = $ nodePath ; $ db = eZDB :: instance ( ) ; $ pathString = " ezcot.path_string like '$childPath%' and " ; $ notEqParentString = "ezcot.node_id != $fromNode" ; $ depthCond = '' ; if ( $ depth ) { $ nodeDepth += $ depth ; if ( isset ( $ params [ 'DepthOperator' ] ) && $ params [ 'DepthOperator' ] == 'eq' ) { $ depthCond = ' ezcot.depth = ' . $ nodeDepth . '' ; $ notEqParentString = '' ; } else $ depthCond = ' ezcot.depth <= ' . $ nodeDepth . ' and ' ; } $ tmpTableName = $ db -> generateUniqueTempTableName ( 'eznode_count_%' ) ; $ db -> createTempTable ( "CREATE TEMPORARY TABLE $tmpTableName ( count int )" ) ; $ query = "INSERT INTO $tmpTableName
                  SELECT
                          count( ezcot.main_node_id ) AS count
                    FROM
                          ezcontentobject_tree ezcot,
                          ezcontentobject_tree ezcot_all
                    WHERE
                           $pathString
                           $depthCond
                           $notEqParentString
                           and ezcot.contentobject_id = ezcot_all.contentobject_id
                    GROUP BY ezcot_all.main_node_id
                    HAVING count( ezcot.main_node_id ) <= 1" ; $ db -> query ( $ query , eZDBInterface :: SERVER_SLAVE ) ; $ query = "SELECT count( * ) AS count
                  FROM $tmpTableName" ; $ rows = $ db -> arrayQuery ( $ query , array ( ) , eZDBInterface :: SERVER_SLAVE ) ; $ db -> dropTempTable ( "DROP TABLE $tmpTableName" ) ; return $ rows [ 0 ] [ 'count' ] ; }
Returns the number of nodes in the current subtree that have no other placements.

@param array $params
@return int
Returns the number of nodes in the current subtree that have no other placements .