kernel/classes/ezcontentobjecttreenode.php
static function availableClassListJsArray( $parameters = false )
    {
        $iniMenu = eZINI::instance( 'contentstructuremenu.ini' );
        $falseValue = "''";

        if ( $iniMenu->hasVariable( 'TreeMenu', 'CreateHereMenu' ) )
        {
            $createHereMenu = $iniMenu->variable( 'TreeMenu', 'CreateHereMenu' );
        }
        else
        {
            $createHereMenu = 'simplified';
        }

        if ( $createHereMenu != 'simplified' and $createHereMenu != 'full' )
            return $falseValue;

        $ini = eZINI::instance( 'content.ini' );
        list( $usersClassGroupID, $setupClassGroupID ) = $ini->variableMulti( 'ClassGroupIDs', array( 'Users', 'Setup' ) );
        $userRootNode = $ini->variable( 'NodeSettings', 'UserRootNode' );
        $groupIDs = false;
        $filterType = 'include';

        if ( !is_array( $parameters ) )
            return $falseValue;

        $node = isset( $parameters['node'] ) ? $parameters['node'] : false;
        if ( is_object( $node ) )
        {
            if ( $createHereMenu == 'full' and !$node->canCreate() )
                return $falseValue;

            $obj = $node->object();
            $contentClass = $obj->attribute( 'content_class' );
            if ( !$contentClass->attribute( 'is_container' ) )
            {
                return $falseValue;
            }

            $pathArray = $node->pathArray();
        }
        else
        {
            // If current object is not container we should not return class list, should not display "create here" menu.
            if ( isset( $parameters['is_container'] ) and !$parameters['is_container'] )
                return $falseValue;

            // Check if current user can create under this node
            if ( $createHereMenu == 'full' and isset( $parameters['node_id'] ) )
            {
                $node = eZContentObjectTreeNode::fetch( $parameters['node_id'] );
                if ( is_object( $node ) and !$node->canCreate() )
                    return $falseValue;
            }
            $pathString = isset( $parameters['path_string'] ) ? $parameters['path_string'] : false;
            if ( !$pathString )
                return $falseValue;

            $pathItems = explode( '/', $pathString );
            $pathArray = array();
            foreach ( $pathItems as $pathItem )
            {
                if ( $pathItem != '' )
                    $pathArray[] = (int) $pathItem;
            }
        }

        if ( in_array( $userRootNode, $pathArray ) )
        {
            $groupIDs = array( $usersClassGroupID );
        }
        else
        {
            $groupIDs = array( $usersClassGroupID, $setupClassGroupID );
            $filterType = 'exclude';
        }

        if ( $createHereMenu == 'simplified' )
        {
            $classes = eZContentClass::fetchAllClasses( false, $filterType == 'include', $groupIDs );
            return eZContentObjectTreeNode::getClassesJsArray( false, $filterType == 'include', $groupIDs, false, $classes );
        }

        return eZContentObjectTreeNode::getClassesJsArray( $node, $filterType == 'include', $groupIDs );
    }
static function availableClassListJsArray( $parameters = false )
    {
        $iniMenu = eZINI::instance( 'contentstructuremenu.ini' );
        $falseValue = "''";

        if ( $iniMenu->hasVariable( 'TreeMenu', 'CreateHereMenu' ) )
        {
            $createHereMenu = $iniMenu->variable( 'TreeMenu', 'CreateHereMenu' );
        }
        else
        {
            $createHereMenu = 'simplified';
        }

        if ( $createHereMenu != 'simplified' and $createHereMenu != 'full' )
            return $falseValue;

        $ini = eZINI::instance( 'content.ini' );
        list( $usersClassGroupID, $setupClassGroupID ) = $ini->variableMulti( 'ClassGroupIDs', array( 'Users', 'Setup' ) );
        $userRootNode = $ini->variable( 'NodeSettings', 'UserRootNode' );
        $groupIDs = false;
        $filterType = 'include';

        if ( !is_array( $parameters ) )
            return $falseValue;

        $node = isset( $parameters['node'] ) ? $parameters['node'] : false;
        if ( is_object( $node ) )
        {
            if ( $createHereMenu == 'full' and !$node->canCreate() )
                return $falseValue;

            $obj = $node->object();
            $contentClass = $obj->attribute( 'content_class' );
            if ( !$contentClass->attribute( 'is_container' ) )
            {
                return $falseValue;
            }

            $pathArray = $node->pathArray();
        }
        else
        {
            // If current object is not container we should not return class list, should not display "create here" menu.
            if ( isset( $parameters['is_container'] ) and !$parameters['is_container'] )
                return $falseValue;

            // Check if current user can create under this node
            if ( $createHereMenu == 'full' and isset( $parameters['node_id'] ) )
            {
                $node = eZContentObjectTreeNode::fetch( $parameters['node_id'] );
                if ( is_object( $node ) and !$node->canCreate() )
                    return $falseValue;
            }
            $pathString = isset( $parameters['path_string'] ) ? $parameters['path_string'] : false;
            if ( !$pathString )
                return $falseValue;

            $pathItems = explode( '/', $pathString );
            $pathArray = array();
            foreach ( $pathItems as $pathItem )
            {
                if ( $pathItem != '' )
                    $pathArray[] = (int) $pathItem;
            }
        }

        if ( in_array( $userRootNode, $pathArray ) )
        {
            $groupIDs = array( $usersClassGroupID );
        }
        else
        {
            $groupIDs = array( $usersClassGroupID, $setupClassGroupID );
            $filterType = 'exclude';
        }

        if ( $createHereMenu == 'simplified' )
        {
            $classes = eZContentClass::fetchAllClasses( false, $filterType == 'include', $groupIDs );
            return eZContentObjectTreeNode::getClassesJsArray( false, $filterType == 'include', $groupIDs, false, $classes );
        }

        return eZContentObjectTreeNode::getClassesJsArray( $node, $filterType == 'include', $groupIDs );
    }
static function availableClassListJsArray ( $ parameters = false ) { $ iniMenu = eZINI :: instance ( 'contentstructuremenu.ini' ) ; $ falseValue = "''" ; if ( $ iniMenu -> hasVariable ( 'TreeMenu' , 'CreateHereMenu' ) ) { $ createHereMenu = $ iniMenu -> variable ( 'TreeMenu' , 'CreateHereMenu' ) ; } else { $ createHereMenu = 'simplified' ; } if ( $ createHereMenu != 'simplified' and $ createHereMenu != 'full' ) return $ falseValue ; $ ini = eZINI :: instance ( 'content.ini' ) ; list ( $ usersClassGroupID , $ setupClassGroupID ) = $ ini -> variableMulti ( 'ClassGroupIDs' , array ( 'Users' , 'Setup' ) ) ; $ userRootNode = $ ini -> variable ( 'NodeSettings' , 'UserRootNode' ) ; $ groupIDs = false ; $ filterType = 'include' ; if ( ! is_array ( $ parameters ) ) return $ falseValue ; $ node = isset ( $ parameters [ 'node' ] ) ? $ parameters [ 'node' ] : false ; if ( is_object ( $ node ) ) { if ( $ createHereMenu == 'full' and ! $ node -> canCreate ( ) ) return $ falseValue ; $ obj = $ node -> object ( ) ; $ contentClass = $ obj -> attribute ( 'content_class' ) ; if ( ! $ contentClass -> attribute ( 'is_container' ) ) { return $ falseValue ; } $ pathArray = $ node -> pathArray ( ) ; } else { // If current object is not container we should not return class list, should not display "create here" menu. if ( isset ( $ parameters [ 'is_container' ] ) and ! $ parameters [ 'is_container' ] ) return $ falseValue ; // Check if current user can create under this node if ( $ createHereMenu == 'full' and isset ( $ parameters [ 'node_id' ] ) ) { $ node = eZContentObjectTreeNode :: fetch ( $ parameters [ 'node_id' ] ) ; if ( is_object ( $ node ) and ! $ node -> canCreate ( ) ) return $ falseValue ; } $ pathString = isset ( $ parameters [ 'path_string' ] ) ? $ parameters [ 'path_string' ] : false ; if ( ! $ pathString ) return $ falseValue ; $ pathItems = explode ( '/' , $ pathString ) ; $ pathArray = array ( ) ; foreach ( $ pathItems as $ pathItem ) { if ( $ pathItem != '' ) $ pathArray [ ] = ( int ) $ pathItem ; } } if ( in_array ( $ userRootNode , $ pathArray ) ) { $ groupIDs = array ( $ usersClassGroupID ) ; } else { $ groupIDs = array ( $ usersClassGroupID , $ setupClassGroupID ) ; $ filterType = 'exclude' ; } if ( $ createHereMenu == 'simplified' ) { $ classes = eZContentClass :: fetchAllClasses ( false , $ filterType == 'include' , $ groupIDs ) ; return eZContentObjectTreeNode :: getClassesJsArray ( false , $ filterType == 'include' , $ groupIDs , false , $ classes ) ; } return eZContentObjectTreeNode :: getClassesJsArray ( $ node , $ filterType == 'include' , $ groupIDs ) ; }
Returns available classes as Js array.
Checks for ini settings.

@param array|bool $parameters
@return string
Returns available classes as Js array . Checks for ini settings .