Exemple #1
0
 public function action_create()
 {
     if (Input::method() == 'POST') {
         $val = Model_Survey_Question::validate('create');
         if ($val->run()) {
             $survey_question = Model_Survey_Question::forge(array('survey_id' => Input::post('survey_id'), 'question' => Input::post('question'), 'order' => Input::post('order')));
             if ($survey_question and $survey_question->save()) {
                 Session::set_flash('success', 'Added survey_question #' . $survey_question->id . '.');
                 Response::redirect('survey/question');
             } else {
                 Session::set_flash('error', 'Could not save survey_question.');
             }
         } else {
             Session::set_flash('error', $val->error());
         }
     }
     $this->template->title = "Survey_Questions";
     $this->template->content = View::forge('survey/question/create');
 }