Skip to content
Snippets Groups Projects
Select Git revision
  • d48b0ba0315d228037affa1a529a644a321b295f
  • master default protected
  • subtemplate
  • release_7.0.6
  • php84
  • 6.x
  • v5.x-test
  • 5x
  • 7.1.0
  • 7.0.6
  • 7.0.5
  • 7.0.4
  • 7.0.3
  • 7.0.2
  • 7.0.1
  • 7.0.0
  • 6.1.7
  • 6.1.6
  • 6.1.5
  • 6.1.4
  • 6.1.3
  • 6.1.2
  • 6.1.1
  • 6.1.0
  • 6.0.3
  • 6.0.2
  • 5.0.6
  • 6.0.1
28 results

Module.php

Blame
  • Code owners
    Assign users and groups as approvers for specific file changes. Learn more.
    ContactController.php 1.72 KiB
    <?php
    
    namespace Exemple\Controller;
    
    use Exemple\Form\ContactMultipageForm;
    use UnicaenApp\Controller\Plugin\MultipageFormPlugin;
    use UnicaenApp\Form\MultipageForm;
    use Zend\Http\PhpEnvironment\Response;
    use Zend\Mvc\Controller\AbstractActionController;
    
    /**
     * @method MultipageFormPlugin multipageForm(MultipageForm $form)
     *
     * @author Unicaen
     */
    class ContactController extends AbstractActionController
    {
        /**
         * @var ContactMultipageForm
         */
        protected $form;
    
        public function __construct()
        {
            $this->form = new ContactMultipageForm('contact');
            $this->form->setActionPrefix('ajouter-');
        }
    
        public function ajouterAction()
        {
            return $this->multipageForm($this->form)->start(); // réinit du plugin et redirection vers la 1ère étape
        }
    
        public function ajouterIdentiteAction()
        {
            return $this->multipageForm($this->form)->process();
        }
    
        public function ajouterAdresseAction()
        {
            return $this->multipageForm($this->form)->process();
        }
    
        public function ajouterMessageAction()
        {
            return $this->multipageForm($this->form)->process();
        }
    
        public function ajouterAnnulerAction()
        {
            return $this->redirect()->toRoute('exemple/contact');
        }
    
        public function ajouterConfirmerAction()
        {
            $response = $this->multipageForm($this->form)->process();
            if ($response instanceof Response) {
                return $response;
            }
            return array('form' => $this->form);
        }
    
        public function ajouterEnregistrerAction()
        {
            $data = $this->multipageForm($this->form)->getFormSessionData();
            var_dump($data);
    //        return $this->redirect()->toRoute('home');
            return false;
        }
    }