public function findAction() { if ($value_id = $this->getRequest()->getParam('value_id')) { try { $maps = new Maps_Model_Maps(); $maps->find($value_id, "value_id"); $data = array("collection" => array(), "page_title" => $this->_("Maps navigation"), "icon_url" => $this->_getImage("maps/")); $data["collection"] = $maps->getData(); } catch (Exception $e) { $data = array('error' => 1, 'message' => $e->getMessage()); } } else { $data = array('error' => 1, 'message' => 'An error occurred during process. Please try again later.'); } $this->_sendHtml($data); }
public function editpostAction() { if ($data = $this->getRequest()->getParams()) { try { $maps = new Maps_Model_Maps(); $maps->find($data["value_id"], "value_id"); if (!$data["address"]) { throw new Exception($this->_("Address is mandatory.")); } $data["latitude"] = $data["cms_latitude_0"]; $data["longitude"] = $data["cms_longitude_0"]; $maps->setData($data)->save(); $html = array('success' => '1', 'success_message' => $this->_('Info successfully saved'), 'message_timeout' => 2, 'message_button' => 0, 'message_loader' => 0); } catch (Exception $e) { $html = array("message" => $e->getMessage(), "error" => 1); } } else { $html = array("message" => $this->_("An error occurred during the process. Please try again later."), "error" => 1); } $this->getLayout()->setHtml(Zend_Json::encode($html)); }