public function directoryAction($path)
    {
        try {
            $this->setPath($path);
        } catch (NotFoundException $e) {
            throw $e;
        }

        $dbfile = new WDBFile($this->getpath());
        if ($dbfile->isFile()) {
            return $this->fileAction($this->getPath());
        }

        $readme_content = $dir_content = '';

        $index = $dbfile->findIndex();
        if (file_exists($index)) {
            return $this->fileAction($index);
        }

        $tpl_params = array(
            'page'          => $dbfile->getWDBFullStack(),
            'dirscan'       => $dbfile->getWDBScanStack(),
            'breadcrumbs'   => TemplateHelper::getBreadcrumbs($this->getPath()),
            'title'         => TemplateHelper::buildPageTitle($this->getPath()),
        );
        if (empty($tpl_params['title'])) {
            if (!empty($tpl_params['breadcrumbs'])) {
                $tpl_params['title'] = TemplateHelper::buildPageTitle(end($tpl_params['breadcrumbs']));
            } else {
                $tpl_params['title'] = _T('Home');
            }
        }

        $readme = $dbfile->findReadme();
        if (file_exists($readme)) {
            $this->wdb->setInputFile($readme);
            $readme_dbfile  = new WDBFile($readme);
            $readme_content = $readme_dbfile->viewFileInfos();
        }
        $tpl_params['inpage_menu']  = !empty($readme_content) ? 'true' : 'false';

        $dir_content = $this->wdb
            ->display('', 'dirindex', $tpl_params);

        return array('default', $dir_content.$readme_content, $tpl_params);
    }
public function directoryAction($path)
    {
        try {
            $this->setPath($path);
        } catch (NotFoundException $e) {
            throw $e;
        }

        $dbfile = new WDBFile($this->getpath());
        if ($dbfile->isFile()) {
            return $this->fileAction($this->getPath());
        }

        $readme_content = $dir_content = '';

        $index = $dbfile->findIndex();
        if (file_exists($index)) {
            return $this->fileAction($index);
        }

        $tpl_params = array(
            'page'          => $dbfile->getWDBFullStack(),
            'dirscan'       => $dbfile->getWDBScanStack(),
            'breadcrumbs'   => TemplateHelper::getBreadcrumbs($this->getPath()),
            'title'         => TemplateHelper::buildPageTitle($this->getPath()),
        );
        if (empty($tpl_params['title'])) {
            if (!empty($tpl_params['breadcrumbs'])) {
                $tpl_params['title'] = TemplateHelper::buildPageTitle(end($tpl_params['breadcrumbs']));
            } else {
                $tpl_params['title'] = _T('Home');
            }
        }

        $readme = $dbfile->findReadme();
        if (file_exists($readme)) {
            $this->wdb->setInputFile($readme);
            $readme_dbfile  = new WDBFile($readme);
            $readme_content = $readme_dbfile->viewFileInfos();
        }
        $tpl_params['inpage_menu']  = !empty($readme_content) ? 'true' : 'false';

        $dir_content = $this->wdb
            ->display('', 'dirindex', $tpl_params);

        return array('default', $dir_content.$readme_content, $tpl_params);
    }
public function directoryAction ( $ path ) { try { $ this -> setPath ( $ path ) ; } catch ( NotFoundException $ e ) { throw $ e ; } $ dbfile = new WDBFile ( $ this -> getpath ( ) ) ; if ( $ dbfile -> isFile ( ) ) { return $ this -> fileAction ( $ this -> getPath ( ) ) ; } $ readme_content = $ dir_content = '' ; $ index = $ dbfile -> findIndex ( ) ; if ( file_exists ( $ index ) ) { return $ this -> fileAction ( $ index ) ; } $ tpl_params = array ( 'page' => $ dbfile -> getWDBFullStack ( ) , 'dirscan' => $ dbfile -> getWDBScanStack ( ) , 'breadcrumbs' => TemplateHelper :: getBreadcrumbs ( $ this -> getPath ( ) ) , 'title' => TemplateHelper :: buildPageTitle ( $ this -> getPath ( ) ) , ) ; if ( empty ( $ tpl_params [ 'title' ] ) ) { if ( ! empty ( $ tpl_params [ 'breadcrumbs' ] ) ) { $ tpl_params [ 'title' ] = TemplateHelper :: buildPageTitle ( end ( $ tpl_params [ 'breadcrumbs' ] ) ) ; } else { $ tpl_params [ 'title' ] = _T ( 'Home' ) ; } } $ readme = $ dbfile -> findReadme ( ) ; if ( file_exists ( $ readme ) ) { $ this -> wdb -> setInputFile ( $ readme ) ; $ readme_dbfile = new WDBFile ( $ readme ) ; $ readme_content = $ readme_dbfile -> viewFileInfos ( ) ; } $ tpl_params [ 'inpage_menu' ] = ! empty ( $ readme_content ) ? 'true' : 'false' ; $ dir_content = $ this -> wdb -> display ( '' , 'dirindex' , $ tpl_params ) ; return array ( 'default' , $ dir_content . $ readme_content , $ tpl_params ) ; }
Directory path action

@param string $path
@return array
@throws \WebDocBook\Exception\NotFoundException
Directory path action