Commit a9859077840dca17175921ed71165f21abf1bce3

Authored by Administrator
1 parent 50f0e821

change request to massage

src/app/frontend/controllers/SeriesOfLettersController.php
... ... @@ -21,7 +21,27 @@ class SeriesOfLettersController extends \Phalcon\Mvc\Controller
21 21 }
22 22  
23 23 public function addAction(){
24   -
  24 + if( $this->request->isPost() )
  25 + {
  26 + $data['project_id'] = $this->session->get('project-id');
  27 + $data['name'] = $this->request->getPost('name', 'string', NULL );
  28 + $data['status'] = $this->request->getPost('status')?$this->request->getPost('status'):0 ;
  29 + $data['event'] = $this->request->getPost('event' );
  30 + die(print_r($data));
  31 + $model = new \SeriesOfLetters();
  32 + if( !empty( $data['name'] ) && !empty( $data['text']))
  33 + {
  34 + if( $model->save( $data ) )
  35 + {
  36 + $this->flash->success( 'Сохранение прошло успешно' );
  37 + return $this->response->redirect([ 'for' => 'email_templates_index' ]);
  38 + }
  39 + else
  40 + {
  41 + $this->flash->error( 'Произошла ошибка во время добавления.' );
  42 + }
  43 + }
  44 + }
25 45 $this->view->pick( 'series_of_letters/addEdit' );
26 46 $this->view->setVars([
27 47  
... ...