public function editAction() { $db_model = new Driverguide_Model_DbTable_DbDriver(); if ($this->getRequest()->isPost()) { $data = $this->getRequest()->getPost(); try { $id = $db_model->updateDriver($data); Application_Form_FrmMessage::Sucessfull("EDIT_SUCCESSS", "/driverguide"); } catch (Exception $e) { Application_Form_FrmMessage::message("Application Error"); Application_Model_DbTable_DbUserLog::writeMessageError($e->getMessage()); } } $db = new Application_Model_DbTable_DbGlobal(); $client_type = $db->getclientdtype(); array_unshift($client_type, array('id' => -1, 'name' => '---Add New ---')); $this->view->clienttype = $client_type; $dbpop = new Application_Form_FrmPopupGlobal(); $this->view->frm_popup_clienttype = $dbpop->frmPopupclienttype(); $id = $this->getRequest()->getParam("id"); $row = $db_model->getDriverById($id); $this->view->rs = $row; $fm = new Group_Form_FrmClient(); $frm = $fm->FrmaddGuide($row); Application_Model_Decorator::removeAllDecorator($frm); $this->view->frm_client = $frm; }
public function editAction(){ $db = new Group_Model_DbTable_DbClient(); if($this->getRequest()->isPost()){ try{ $data = $this->getRequest()->getPost(); //print_r($data);exit(); $id= $db->addClient($data); if($data['chackcall']==1){ Application_Form_FrmMessage::message("វានឹងបន្ថែមទ្រព្យបញ្ចាំរបស់អតិថិជនដោយស្វ័យប្រវត្តិ!"); Application_Form_FrmMessage::redirectUrl("/group/callteral/add/id/".$id); } Application_Form_FrmMessage::Sucessfull('EDIT_SUCCESS',"/group/index"); }catch (Exception $e){ Application_Form_FrmMessage::message("EDIT_FAILE"); echo $e->getMessage(); Application_Model_DbTable_DbUserLog::writeMessageError($e->getMessage()); } } $id = $this->getRequest()->getParam("id"); $row = $db->getClientById($id); $this->view->row=$row; $this->view->photo = $row['photo_name']; if(empty($row)){ $this->_redirect("/group/client"); } $fm = new Group_Form_FrmClient(); $frm = $fm->FrmAddClient($row); Application_Model_Decorator::removeAllDecorator($frm); $this->view->frm_client = $frm; $dbpop = new Application_Form_FrmPopupGlobal(); $this->view->frm_popup_village = $dbpop->frmPopupVillage(); $this->view->frm_popup_comm = $dbpop->frmPopupCommune(); $this->view->frm_popup_district = $dbpop->frmPopupDistrict(); $this->view->frm_popup_clienttype = $dbpop->frmPopupclienttype(); $db = new Application_Model_DbTable_DbGlobal(); $client_type = $db->getclientdtype(); array_unshift($client_type,array( 'id' => -1, 'name' => '---Add New ---', ) ); $this->view->clienttype = $client_type; }
public function addAction(){ if($this->getRequest()->isPost()){ $data = $this->getRequest()->getPost(); //print_r($data);exit(); $db = new Group_Model_DbTable_DbClient(); try{ if(isset($data['save_new'])){ $id= $db->addClient($data); Application_Form_FrmMessage::message("ការបញ្ចូលជោគជ័យ !"); if($data['chackcall']==1){ Application_Form_FrmMessage::message("វានឹងបន្ថែមទ្រព្យបញ្ចាំរបស់អតិថិជនដោយស្វ័យប្រវត្តិ!"); Application_Form_FrmMessage::redirectUrl("/group/Callteral/add/id/".$id); } } else if (isset($data['save_close'])){ $id= $db->addClient($data); Application_Form_FrmMessage::message("ការបញ្ចូលជោគជ័យ !"); if($data['chackcall']==1){ Application_Form_FrmMessage::message("វានឹងបន្ថែមទ្រព្យបញ្ចាំរបស់អតិថិជនដោយស្វ័យប្រវត្តិ!"); Application_Form_FrmMessage::redirectUrl("/group/Callteral/add/id/".$id); } Application_Form_FrmMessage::redirectUrl("/group/index"); } }catch (Exception $e){ Application_Form_FrmMessage::message("Application Error"); Application_Model_DbTable_DbUserLog::writeMessageError($e->getMessage()); } } $db = new Application_Model_DbTable_DbGlobal(); $this->view->allclient = $db->getAllClient();// for filter $this->view->allclient_number = $db->getAllClientNumber();//for filter $client_type = $db->getclientdtype(); array_unshift($client_type,array( 'id' => -1, 'name' => '---Add New ---', ) ); $this->view->clienttype = $client_type; $districts = $db->getAllDistricts(); array_unshift($districts,array( 'id' => -1, 'name' => '---Add New ---', 'pro_id' => -1 ) ); $this->view->district = $districts; $commune = $db->getCommune(); array_unshift($commune,array( 'id' => -1, 'name' => '---Add New ---', 'district_id' => -1 ) ); $this->view->commune_name = $commune; $village = $db->getVillage(); array_unshift($village,array( 'id' => -1, 'name' => '---Add New Village Name---', 'commune_id' => -1 ) ); $this->view->village_name =$village; $fm = new Group_Form_FrmClient(); $frm = $fm->FrmAddClient(); Application_Model_Decorator::removeAllDecorator($frm); $this->view->frm_client = $frm; $dbpop = new Application_Form_FrmPopupGlobal(); $this->view->frm_popup_village = $dbpop->frmPopupVillage(); $this->view->frm_popup_comm = $dbpop->frmPopupCommune(); $this->view->frm_popup_district = $dbpop->frmPopupDistrict(); $this->view->frm_popup_clienttype = $dbpop->frmPopupclienttype(); }