Пример #1
0
 public function addAction()
 {
     SxCms_Acl::requireAcl('sheets', 'sheets.add');
     $type = new SxModule_Sheets_Type();
     if ($this->getRequest()->isPost()) {
         $type = new SxModule_Sheets_Type();
         $proxyAll = new SxModule_Sheets_Type_Proxy();
         $pos = count($proxyAll->getAll());
         $pos++;
         $mapper = new SxModule_Sheets_Type_Mapper();
         $fields = $mapper->fromInput($this->_getAllParams(), $this->_editablefields());
         $data = $mapper->toObject($fields);
         $validator = new SxModule_Sheets_Type_Validator();
         if ($validator->validate($data)) {
             $data->save();
             $cache = Zend_Registry::get('cache');
             $cache->clean(Zend_Cache::CLEANING_MODE_MATCHING_ANY_TAG, array('SxModule_Sheets_Type'));
             $flashMessenger = $this->_helper->getHelper('FlashMessenger');
             $flashMessenger->addMessage('Type werd succesvol aangemaakt!');
             $this->_helper->redirector->gotoSimple('index', 'sheets_type');
         }
         $type = $data;
     }
     $this->view->messages = Sanmax_MessageStack::getInstance('SxModule_Sheets_Type');
     $this->view->type = $this->_type;
 }