src/DlcUseCase/Controller/UseCaseController.php
public function editWikiTemplateAction()
    {
        $templateFile = $this->getOptions()->getUseCaseDokuWikiTemplate();

        if (!is_writeable($templateFile)) {
            throw new \RuntimeException(sprintf(
                    'Template file "%s" is not writeable. Please fix the file priviliges first!',
                    $templateFile
            ));
        }

        $request = $this->getRequest();
        $form    = $this->getServiceLocator()->get('dlcusecase_editwikitemplate_form');

        if ($request->getQuery()->get('redirect')) {
            $redirect = $request->getQuery()->get('redirect');
        } else {
            $redirect = false;
        }

        $redirectUrl = $this->url()->fromRoute($this->getRouteIdentifierPrefix() . '/edit-wiki-template')
                     . ($redirect ? '?redirect=' . $redirect : '');

        $prg = $this->prg($redirectUrl, true);

        if ($prg instanceof Response) {
            return $prg;
        } elseif ($prg === false) {
            return array(
                'form' => $form,
                'options'  => $this->getOptions(),
            );
        }

        $post     = $prg;
        $redirect = isset($prg['redirect']) ? $prg['redirect'] : null;

        $form->setData($post);

        if (!$form->isValid()) {
            return array(
                'options'  => $this->getOptions(),
                'form'     => $form,
                'redirect' => $redirect,
            );
        }

        $formData = $form->getData();

        file_put_contents($this->getOptions()->getUseCaseDokuWikiTemplate(), $formData['wiki-template']);

        // TODO: Add the redirect parameter here...
        return $this->redirect()->toUrl($this->url()->fromRoute($this->getRouteIdentifierPrefix() . '/show-wiki-template') . ($redirect ? '?redirect='.$redirect : ''));
    }
public function editWikiTemplateAction()
    {
        $templateFile = $this->getOptions()->getUseCaseDokuWikiTemplate();

        if (!is_writeable($templateFile)) {
            throw new \RuntimeException(sprintf(
                    'Template file "%s" is not writeable. Please fix the file priviliges first!',
                    $templateFile
            ));
        }

        $request = $this->getRequest();
        $form    = $this->getServiceLocator()->get('dlcusecase_editwikitemplate_form');

        if ($request->getQuery()->get('redirect')) {
            $redirect = $request->getQuery()->get('redirect');
        } else {
            $redirect = false;
        }

        $redirectUrl = $this->url()->fromRoute($this->getRouteIdentifierPrefix() . '/edit-wiki-template')
                     . ($redirect ? '?redirect=' . $redirect : '');

        $prg = $this->prg($redirectUrl, true);

        if ($prg instanceof Response) {
            return $prg;
        } elseif ($prg === false) {
            return array(
                'form' => $form,
                'options'  => $this->getOptions(),
            );
        }

        $post     = $prg;
        $redirect = isset($prg['redirect']) ? $prg['redirect'] : null;

        $form->setData($post);

        if (!$form->isValid()) {
            return array(
                'options'  => $this->getOptions(),
                'form'     => $form,
                'redirect' => $redirect,
            );
        }

        $formData = $form->getData();

        file_put_contents($this->getOptions()->getUseCaseDokuWikiTemplate(), $formData['wiki-template']);

        // TODO: Add the redirect parameter here...
        return $this->redirect()->toUrl($this->url()->fromRoute($this->getRouteIdentifierPrefix() . '/show-wiki-template') . ($redirect ? '?redirect='.$redirect : ''));
    }
public function editWikiTemplateAction ( ) { $ templateFile = $ this -> getOptions ( ) -> getUseCaseDokuWikiTemplate ( ) ; if ( ! is_writeable ( $ templateFile ) ) { throw new \ RuntimeException ( sprintf ( 'Template file "%s" is not writeable. Please fix the file priviliges first!' , $ templateFile ) ) ; } $ request = $ this -> getRequest ( ) ; $ form = $ this -> getServiceLocator ( ) -> get ( 'dlcusecase_editwikitemplate_form' ) ; if ( $ request -> getQuery ( ) -> get ( 'redirect' ) ) { $ redirect = $ request -> getQuery ( ) -> get ( 'redirect' ) ; } else { $ redirect = false ; } $ redirectUrl = $ this -> url ( ) -> fromRoute ( $ this -> getRouteIdentifierPrefix ( ) . '/edit-wiki-template' ) . ( $ redirect ? '?redirect=' . $ redirect : '' ) ; $ prg = $ this -> prg ( $ redirectUrl , true ) ; if ( $ prg instanceof Response ) { return $ prg ; } elseif ( $ prg === false ) { return array ( 'form' => $ form , 'options' => $ this -> getOptions ( ) , ) ; } $ post = $ prg ; $ redirect = isset ( $ prg [ 'redirect' ] ) ? $ prg [ 'redirect' ] : null ; $ form -> setData ( $ post ) ; if ( ! $ form -> isValid ( ) ) { return array ( 'options' => $ this -> getOptions ( ) , 'form' => $ form , 'redirect' => $ redirect , ) ; } $ formData = $ form -> getData ( ) ; file_put_contents ( $ this -> getOptions ( ) -> getUseCaseDokuWikiTemplate ( ) , $ formData [ 'wiki-template' ] ) ; // TODO: Add the redirect parameter here... return $ this -> redirect ( ) -> toUrl ( $ this -> url ( ) -> fromRoute ( $ this -> getRouteIdentifierPrefix ( ) . '/show-wiki-template' ) . ( $ redirect ? '?redirect=' . $ redirect : '' ) ) ; }
Edit wiki template action

@return \Zend\View\Model\ViewModel
Edit wiki template action