public static function updateblockorder( $args )
    {
        $http = eZHTTPTool::instance();

        $contentObjectAttributeID = (int)$http->postVariable( 'contentobject_attribute_id', 0 );
        $version =(int)$http->postVariable( 'version', 0 );
        $zoneID = $http->postVariable( 'zone', '' );
        $blockOrder = $http->postVariable( 'block_order', array() );

        $contentObjectAttribute = eZContentObjectAttribute::fetch( $contentObjectAttributeID, $version );
        if ( !$contentObjectAttribute instanceof eZContentObjectAttribute )
        {
            return array();
        }
        $contentObject = $contentObjectAttribute->attribute( 'object' );
        if ( !$contentObject->attribute( 'can_edit' ) )
        {
            return array();
        }

        // checking that the version is a draft and belongs to the current user
        $contentVersion = $contentObjectAttribute->attribute( 'object_version' );
        if ( $contentVersion->attribute( 'status' ) != eZContentObjectVersion::STATUS_DRAFT &&
                $contentVersion->attribute( 'status' ) != eZContentObjectVersion::STATUS_INTERNAL_DRAFT
           )
        {
            return array();
        }
        if ( $contentVersion->attribute( 'creator_id' ) != eZUser::currentUserID() )
        {
            return array();
        }

        $sortArray = array();
        foreach ( $blockOrder as $blockID )
        {
            $idArray = explode('_', $blockID);

            if ( isset( $idArray[1]) )
                $sortArray[] = $idArray[1];
        }

        if ( $contentObjectAttribute )
            $page = $contentObjectAttribute->content();
        if ( $page )
            $zone = $page->getZone( $zoneID );
        if ( $zone )
            $zone->sortBlocks( $sortArray );

        $contentObjectAttribute->setContent( $page );
        $contentObjectAttribute->store();

        return array();
    }
public static function updateblockorder( $args )
    {
        $http = eZHTTPTool::instance();

        $contentObjectAttributeID = (int)$http->postVariable( 'contentobject_attribute_id', 0 );
        $version =(int)$http->postVariable( 'version', 0 );
        $zoneID = $http->postVariable( 'zone', '' );
        $blockOrder = $http->postVariable( 'block_order', array() );

        $contentObjectAttribute = eZContentObjectAttribute::fetch( $contentObjectAttributeID, $version );
        if ( !$contentObjectAttribute instanceof eZContentObjectAttribute )
        {
            return array();
        }
        $contentObject = $contentObjectAttribute->attribute( 'object' );
        if ( !$contentObject->attribute( 'can_edit' ) )
        {
            return array();
        }

        // checking that the version is a draft and belongs to the current user
        $contentVersion = $contentObjectAttribute->attribute( 'object_version' );
        if ( $contentVersion->attribute( 'status' ) != eZContentObjectVersion::STATUS_DRAFT &&
                $contentVersion->attribute( 'status' ) != eZContentObjectVersion::STATUS_INTERNAL_DRAFT
           )
        {
            return array();
        }
        if ( $contentVersion->attribute( 'creator_id' ) != eZUser::currentUserID() )
        {
            return array();
        }

        $sortArray = array();
        foreach ( $blockOrder as $blockID )
        {
            $idArray = explode('_', $blockID);

            if ( isset( $idArray[1]) )
                $sortArray[] = $idArray[1];
        }

        if ( $contentObjectAttribute )
            $page = $contentObjectAttribute->content();
        if ( $page )
            $zone = $page->getZone( $zoneID );
        if ( $zone )
            $zone->sortBlocks( $sortArray );

        $contentObjectAttribute->setContent( $page );
        $contentObjectAttribute->store();

        return array();
    }
public static function updateblockorder ( $ args ) { $ http = eZHTTPTool :: instance ( ) ; $ contentObjectAttributeID = ( int ) $ http -> postVariable ( 'contentobject_attribute_id' , 0 ) ; $ version = ( int ) $ http -> postVariable ( 'version' , 0 ) ; $ zoneID = $ http -> postVariable ( 'zone' , '' ) ; $ blockOrder = $ http -> postVariable ( 'block_order' , array ( ) ) ; $ contentObjectAttribute = eZContentObjectAttribute :: fetch ( $ contentObjectAttributeID , $ version ) ; if ( ! $ contentObjectAttribute instanceof eZContentObjectAttribute ) { return array ( ) ; } $ contentObject = $ contentObjectAttribute -> attribute ( 'object' ) ; if ( ! $ contentObject -> attribute ( 'can_edit' ) ) { return array ( ) ; } // checking that the version is a draft and belongs to the current user $ contentVersion = $ contentObjectAttribute -> attribute ( 'object_version' ) ; if ( $ contentVersion -> attribute ( 'status' ) != eZContentObjectVersion :: STATUS_DRAFT && $ contentVersion -> attribute ( 'status' ) != eZContentObjectVersion :: STATUS_INTERNAL_DRAFT ) { return array ( ) ; } if ( $ contentVersion -> attribute ( 'creator_id' ) != eZUser :: currentUserID ( ) ) { return array ( ) ; } $ sortArray = array ( ) ; foreach ( $ blockOrder as $ blockID ) { $ idArray = explode ( '_' , $ blockID ) ; if ( isset ( $ idArray [ 1 ] ) ) $ sortArray [ ] = $ idArray [ 1 ] ; } if ( $ contentObjectAttribute ) $ page = $ contentObjectAttribute -> content ( ) ; if ( $ page ) $ zone = $ page -> getZone ( $ zoneID ) ; if ( $ zone ) $ zone -> sortBlocks ( $ sortArray ) ; $ contentObjectAttribute -> setContent ( $ page ) ; $ contentObjectAttribute -> store ( ) ; return array ( ) ; }
Update blocks order based on AJAX data send after D&D operation is finished

@param mixed $args
@return array
Update blocks order based on AJAX data send after D&D operation is finished