Example #1
0
 public function indexAction()
 {
     $tsols = new Model_DbTable_Tsol();
     $this->view->tsol = $tsols->fetchAll($tsols->select());
     $sums = new Model_DbTable_Sum();
     $this->view->sum = $sums->fetchAll($sums->select());
     $aimags = new Model_DbTable_Aimag();
     $this->view->aimag = $aimags->fetchAll($aimags->select());
     $bukhs = new Model_DbTable_Bukh();
     $this->view->bukh = $bukhs->fetchAll($bukhs->select()->order('tsolid ASC'));
 }
Example #2
0
 public function addAction()
 {
     $form = new Form_Sum();
     $request = $this->getRequest();
     if ($request->isPost()) {
         if ($form->isValid($this->_request->getPost())) {
             $sumname = $this->_request->getParam('name');
             $aimagname = $this->_request->getParam('aimag');
             $aimags = new Model_DbTable_Aimag();
             $aimag = $aimags->fetchAll($aimags->select()->where('name = ?', $aimagname));
             foreach ($aimag as $val) {
                 $aimagid = $val["id"];
             }
             $news = new Model_DbTable_Sum();
             $news->insert(array('aimagid' => $aimagid, 'name' => $sumname));
             $this->_redirect('sum/index');
         }
     }
     $form->setAction('add');
     $this->view->form = $form;
 }
Example #3
0
 public function editAction()
 {
     $id = $this->_request->getParam('id');
     $form = new Form_Aimag();
     $request = $this->getRequest();
     if ($request->isPost()) {
         if ($form->isValid($this->_request->getPost())) {
             $name = $this->_request->getParam('name');
             $aimag = new Model_DbTable_Aimag();
             $aimag->update(array('name' => $name), 'id = ' . $id);
             $this->_redirect('aimag/index');
         }
     }
     $aimag = new Model_DbTable_Aimag();
     $res = $aimag->fetchAll($aimag->select()->where('id = ' . $id));
     foreach ($res as $val) {
         $form->name->setValue($val["name"]);
     }
     $form->add->setLabel("Засварлах");
     $form->setAction('../../edit/id/' . $id);
     $this->view->form = $form;
 }
Example #4
0
 public function editAction()
 {
     $id = $this->_request->getParam('id');
     $form = new Form_Barildaan();
     $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');
             $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->update(array('name' => $name, 'date' => $date, 'category' => $category, 'bukh_number' => $bukh_num, 'location' => $location), 'id =' . $id);
             $this->_redirect('barildaan/index');
         }
     }
     $barildaan = new Model_DbTable_Barildaan();
     $br = $barildaan->fetchAll($barildaan->select()->where('id =' . $id));
     foreach ($br as $key => $val) {
         $form->name->setValue($val["name"]);
         $form->category->setValue($val["category"]);
         $form->date->setValue($val["date"]);
         $form->bukh_num->setValue($val["bukh_number"]);
         $form->loc->setValue($val["location"]);
     }
     $form->add->setLabel("Засварлах");
     $form->setAction('../../edit/id/' . $id);
     $this->view->form = $form;
 }