Example #1
0
 /**
  * @brief 주소 검색에 쓰이는 함수
  * @return JSON형태의 검색된 주소 리스트
  **/
 function dispQueryAddress()
 {
     $oModuleModel =& getModel('module');
     $module_config = $oModuleModel->getModuleConfig('aroundmap');
     $naver_api_key = $module_config->naver_api_key;
     $yahoo_api_key = $module_config->yahoo_api_key;
     $address = Context::Get("address");
     $address = urlencode($address);
     // build JSON result as following
     // $result = '{ "api_type":"yahoo" , "items":[ {"address":"address sample", "lat":36.5459,"lon":128.71},{"address":"address sample2", "lat":36.5459,"lon":128.75}  ]  } ';
     $type = "";
     // YAHOO API
     if ($yahoo_api_key != NULL && $yahoo_api_key != "") {
         $url = 'http://kr.open.gugi.yahoo.com/service/poi.php?appid=' . $yahoo_api_key . '&encoding=utf-8&q=' . $address . '&results=100';
         $type = "yahoo";
     } else {
         if ($naver_api_key != NULL && $naver_api_key != "") {
             // NAVER API if you cannot use yahoo api.
             $url = 'http://map.naver.com/api/geocode.php?key=' . $naver_api_key . '&encoding=utf-8&coord=latlng&query=' . $address;
             $type = "naver";
         }
     }
     if ($type != "") {
         $result = $this->getAddressByJSON($url, $type);
     }
     header("Content-type: application/json; charset=UTF-8");
     header("Pragma: no-cache");
     echo $result;
     exit;
 }
 /**
  * @brief triggerUpdateAroundmap에서 호출하는 함수. DB에 주변지도 정보를 입력한다.
  * @param $obj aroundmap이 적용되어 있는 게시판 정보  
  */
 function triggerInsertAroundmap(&$obj)
 {
     if (!$this->isModuleEnable($obj->module_srl)) {
         return new Object();
     }
     $args->document_srl = $obj->document_srl;
     $args->member_srl = $obj->member_srl;
     $args->module_srl = $obj->module_srl;
     $args->marker_title = Context::Get("marker_title");
     $args->lon = Context::Get("lon");
     $args->lat = Context::Get("lat");
     $args->map_size = Context::Get("map_size");
     $output = executeQuery('aroundmap.insertAroundmap', $args);
     if (!$output->toBool()) {
         return $output;
     }
     return new Object();
 }