示例#1
0
 public function bukh_addAction()
 {
     $form = new Form_Barildaanbukhadd();
     $request = $this->getRequest();
     if ($request->isPost()) {
         if ($form->isValid($this->_request->getPost())) {
             $name = $this->_request->getParam('name');
             $date = $this->_request->getParam('date');
             $category = $this->_request->getParam('category');
             $bukh_num = $this->_request->getParam('bukh_num');
             $loc = $this->_request->getParam('loc');
             $active = 0;
             $aimags = new Model_DbTable_Aimag();
             $aimag = $aimags->fetchAll($aimags->select()->where('id = ' . $loc));
             foreach ($aimag as $key => $val) {
                 $location = $val['name'];
             }
             $barildaan = new Model_DbTable_Barildaan();
             $barildaan->insert(array('name' => $name, 'date' => $date, 'category' => $category, 'active' => $active, 'bukh_number' => $bukh_num, 'location' => $location));
             $this->_redirect('barildaan/index');
         }
     }
     $form->setAction('add');
     $this->view->form = $form;
 }