Esempio n. 1
0
 public function ajoutAction()
 {
     $formAjoutQuestion = new Application_Form_Questionreponse();
     $this->view->formajoutquestion = $formAjoutQuestion;
     if ($this->getRequest()->isPost()) {
         $data = $this->getRequest()->getPost();
         if ($formAjoutQuestion->isValid($data)) {
             $question = new Questionreponse();
             $max = $question->getIdMax();
             $newQuestion = $question->createRow();
             $newQuestion->id = $max["MAX(id)"] + 1;
             $newQuestion->question = $formAjoutQuestion->getValue('question');
             $newQuestion->reponse = $formAjoutQuestion->getValue('reponse');
             $newQuestion->save();
             $this->_redirect('question/index');
         } else {
             $this->view->formajoutquestion = $formAjoutQuestion;
         }
     }
 }