예제 #1
0
 public function getpromolistAction()
 {
     $this->_helper->layout->setLayout('json');
     $callback = $this->getRequest()->getParam('jsoncallback');
     if ($callback != "") {
         // strip all non alphanumeric elements from callback
         $callback = preg_replace('/[^a-zA-Z0-9_]/', '', $callback);
     }
     $this->view->callback = $callback;
     $lat = $this->_getParam('lat');
     //$_GET['lat'];
     $lng = $this->_getParam('lng');
     //$_GET['lng'];
     $promotion = new PAP_Model_Promotion();
     $data = $promotion->getPromotionsByCoords($lat, $lng, '');
     $i = 0;
     foreach ($data as $item) {
         $data[$i]["path"] = $this->getDataURI("./images" . $this->getThumb($item["path"]));
         $i = $i + 1;
     }
     //header('Content-Type: application/json');
     /*$data = array();
       $data['latitud'] = $lat;
       $data['longitud'] = $lng;
       */
     $response = $this->getFrontController()->getResponse();
     $response->appendBody($callback . '(' . json_encode($data) . ')');
     $this->getFrontController()->setResponse($response);
 }