Example #1
0
 public function addAction()
 {
     if ($this->getRequest()->isPost()) {
         $data = $this->getRequest()->getPost();
         //print_r($data);exit();
         try {
             $db_model = new Vehicle_Model_DbTable_DbModel();
             if (isset($data['save_new'])) {
                 $db_model->addModel($data);
                 Application_Form_FrmMessage::Sucessfull($this->tr->translate("INSERT_SUCCESS"), self::REDIRECT_URL_ADD);
             } else {
                 if (isset($data['save_close'])) {
                     $db_model->addModel($data);
                     Application_Form_FrmMessage::Sucessfull($this->tr->translate("INSERT_SUCCESS"), self::REDIRECT_URL_CLOSE);
                 }
             }
         } catch (Exception $e) {
             Application_Form_FrmMessage::message($this->tr->translate("INSERT_FAIL"));
             $err = $e->getMessage();
             Application_Model_DbTable_DbUserLog::writeMessageError($err);
         }
     }
     $db = new Application_Model_DbTable_DbGlobal();
     $model = $db->getAllMake();
     array_unshift($model, array('id' => -1, 'name' => 'បន្ថែម​អ្នក​ទទួល​ថ្មី'));
     $this->view->all_make = $model;
     $status = $db->getViews();
     $this->view->status_view = $status;
 }