Beispiel #1
0
 function action_add()
 {
     $data['form'] = $this->radix_coll->structure();
     if ($this->getPost() && !$this->checkCsrfToken()) {
         $this->notices->set('warning', _i('The security token wasn\'t found. Try resubmitting.'));
     } elseif ($this->getPost()) {
         $result = Validator::formValidate($data['form'], $this->getPost());
         if (isset($result['error'])) {
             $this->notices->set('warning', $result['error']);
         } else {
             // it's actually fully checked, we just have to throw it in DB
             $this->radix_coll->save($result['success']);
             $this->notices->setFlash('success', _i('New board created!'));
             return $this->redirect('admin/boards/board/' . $result['success']['shortname']);
         }
     }
     // the actual POST is in the board() function
     $data['form']['open']['action'] = $this->uri->create('admin/boards/add_new');
     // panel for creating a new board
     $this->param_manager->setParam('method_title', [_i('Manage'), _i('Add')]);
     $this->builder->createPartial('body', 'form_creator')->getParamManager()->setParams($data);
     return new Response($this->builder->build());
 }