public function files()
    {
        if (!$this->hasRequestParameter('uri')) {
            throw new common_exception_MissingParameter('uri', __METHOD__);
        }
        $itemUri = $this->getRequestParameter('uri');
        $item = $this->getResource($itemUri);

        if (!$this->hasRequestParameter('lang')) {
            throw new common_exception_MissingParameter('lang', __METHOD__);
        }
        $itemLang = $this->getRequestParameter('lang');

        //build filters
        $filters = array();
        if($this->hasRequestParameter('filters')){
            $filterParameter = $this->getRequestParameter('filters');
            if(is_array($filterParameter)){
                foreach($filterParameter as $filter){
                    if(preg_match('/\/\*/', $filter['mime'])){
                        $this->logWarning('Stars mime type are not yet supported, filter "'. $filter['mime'] . '" will fail');
                    }
                    $filters[] = $filter['mime'];
                }
            }
            else{
                if(preg_match('/\/\*/', $filterParameter)){
                    $this->logWarning('Stars mime type are not yet supported, filter "'. $filterParameter . '" will fail');
                }
                $filters = array_map('trim', explode(',', $filterParameter));
            }
        }
        $depth = $this->hasRequestParameter('depth') ? $this->getRequestParameter('depth') : 1;
        $resolver = new ItemMediaResolver($item, $itemLang);
        $asset = $resolver->resolve($this->getRequestParameter('path'));
        $data = $asset->getMediaSource()->getDirectory($asset->getMediaIdentifier(), $filters, $depth);
        foreach($data['children'] as &$child){
            if(isset($child['parent'])){
                $child['url'] = \tao_helpers_Uri::url(
                    'files',
                    'ItemContent',
                    'taoItems',
                    array('uri' => $itemUri,'lang' => $itemLang, '1' => $child['parent']));
                unset($child['parent']);
            }
        }
        $this->returnJson($data);
    }
public function files()
    {
        if (!$this->hasRequestParameter('uri')) {
            throw new common_exception_MissingParameter('uri', __METHOD__);
        }
        $itemUri = $this->getRequestParameter('uri');
        $item = $this->getResource($itemUri);

        if (!$this->hasRequestParameter('lang')) {
            throw new common_exception_MissingParameter('lang', __METHOD__);
        }
        $itemLang = $this->getRequestParameter('lang');

        //build filters
        $filters = array();
        if($this->hasRequestParameter('filters')){
            $filterParameter = $this->getRequestParameter('filters');
            if(is_array($filterParameter)){
                foreach($filterParameter as $filter){
                    if(preg_match('/\/\*/', $filter['mime'])){
                        $this->logWarning('Stars mime type are not yet supported, filter "'. $filter['mime'] . '" will fail');
                    }
                    $filters[] = $filter['mime'];
                }
            }
            else{
                if(preg_match('/\/\*/', $filterParameter)){
                    $this->logWarning('Stars mime type are not yet supported, filter "'. $filterParameter . '" will fail');
                }
                $filters = array_map('trim', explode(',', $filterParameter));
            }
        }
        $depth = $this->hasRequestParameter('depth') ? $this->getRequestParameter('depth') : 1;
        $resolver = new ItemMediaResolver($item, $itemLang);
        $asset = $resolver->resolve($this->getRequestParameter('path'));
        $data = $asset->getMediaSource()->getDirectory($asset->getMediaIdentifier(), $filters, $depth);
        foreach($data['children'] as &$child){
            if(isset($child['parent'])){
                $child['url'] = \tao_helpers_Uri::url(
                    'files',
                    'ItemContent',
                    'taoItems',
                    array('uri' => $itemUri,'lang' => $itemLang, '1' => $child['parent']));
                unset($child['parent']);
            }
        }
        $this->returnJson($data);
    }
public function files ( ) { if ( ! $ this -> hasRequestParameter ( 'uri' ) ) { throw new common_exception_MissingParameter ( 'uri' , __METHOD__ ) ; } $ itemUri = $ this -> getRequestParameter ( 'uri' ) ; $ item = $ this -> getResource ( $ itemUri ) ; if ( ! $ this -> hasRequestParameter ( 'lang' ) ) { throw new common_exception_MissingParameter ( 'lang' , __METHOD__ ) ; } $ itemLang = $ this -> getRequestParameter ( 'lang' ) ; //build filters $ filters = array ( ) ; if ( $ this -> hasRequestParameter ( 'filters' ) ) { $ filterParameter = $ this -> getRequestParameter ( 'filters' ) ; if ( is_array ( $ filterParameter ) ) { foreach ( $ filterParameter as $ filter ) { if ( preg_match ( '/\/\*/' , $ filter [ 'mime' ] ) ) { $ this -> logWarning ( 'Stars mime type are not yet supported, filter "' . $ filter [ 'mime' ] . '" will fail' ) ; } $ filters [ ] = $ filter [ 'mime' ] ; } } else { if ( preg_match ( '/\/\*/' , $ filterParameter ) ) { $ this -> logWarning ( 'Stars mime type are not yet supported, filter "' . $ filterParameter . '" will fail' ) ; } $ filters = array_map ( 'trim' , explode ( ',' , $ filterParameter ) ) ; } } $ depth = $ this -> hasRequestParameter ( 'depth' ) ? $ this -> getRequestParameter ( 'depth' ) : 1 ; $ resolver = new ItemMediaResolver ( $ item , $ itemLang ) ; $ asset = $ resolver -> resolve ( $ this -> getRequestParameter ( 'path' ) ) ; $ data = $ asset -> getMediaSource ( ) -> getDirectory ( $ asset -> getMediaIdentifier ( ) , $ filters , $ depth ) ; foreach ( $ data [ 'children' ] as & $ child ) { if ( isset ( $ child [ 'parent' ] ) ) { $ child [ 'url' ] = \ tao_helpers_Uri :: url ( 'files' , 'ItemContent' , 'taoItems' , array ( 'uri' => $ itemUri , 'lang' => $ itemLang , '1' => $ child [ 'parent' ] ) ) ; unset ( $ child [ 'parent' ] ) ; } } $ this -> returnJson ( $ data ) ; }
Returns a json encoded array describign a directory

@throws common_exception_MissingParameter
@return string
Returns a json encoded array describign a directory