Exemplo n.º 1
0
 public function createAction()
 {
     $this->view->Title = 'Trainer';
     $this->view->headTitle($this->view->Title);
     $params = $this->getRequest()->getParams();
     if ($this->getRequest()->isPost()) {
         $error = $this->_checkForm($params);
         if (count($error) == 0) {
             $latLon = $this->getRequest()->getParam('latLon');
             if ($latLon) {
                 $locale = explode(',', $latLon);
             } else {
                 // show address not found error
             }
             $trainersObj = new Trainer();
             $trainersObj->merge($params);
             $trainersObj->lat = $locale[0];
             $trainersObj->lon = $locale[1];
             $trainersObj->save();
             $this->_redirect($this->_helper->url('index', 'trainers', 'admin'));
         } else {
             $this->view->error = $error;
         }
     }
 }