/** *JSON DATA FUNCTION TO LOAD LOCATIONS DATA ON PAGE LOAD */ public function locationsBdm($request) { try { $action = $request->perform; $data = array(); $postData = $request->data; if (isset($postData)) { foreach ($postData as $value) { $data[$value['name']] = $value['value']; } } $locationMapper = new Application_Model_LocationboundariesMapper(); switch ($action) { case 'getData': $result['data'] = array(); $result['data'] = $locationMapper->getLocationsBdm(); $country_bdMapper = new Application_Model_CountrybdMapper(); $country_data = $country_bdMapper->getCountries(); $result['country_data'] = $country_data; return $result; break; case "update": $status = $locationMapper->updateLocation($data); return $status; break; case "append": $code = $data['code']; $isloc = $locationMapper->verifyCode($code, 0); if ($isloc) { $status = $locationMapper->addLocation($data); return $status; } else { return 'f'; } break; } } catch (Exception $ex) { Rdine_Logger_FileLogger::info($ex->getMessage()); throw new Exception($ex->getMessage()); } }