public function getcitiesAction()
 {
     /* include ('models/ajax.php');
        $id = trim($this->getRequest()->getParam('province_id'));
        $cities = new PAP_Model_CityMapper();
        $this->_view->result = $cities->getCitiesByProvinceId($id);
         */
     $cities = new PAP_Model_CityMapper();
     $this->_helper->layout()->disableLayout();
     $this->_helper->viewRenderer->setNoRender();
     if ($this->getRequest()->isXmlHttpRequest()) {
         $id = $this->_getParam('province_id');
         $citiesData = $cities->getCitiesByProvinceId($id);
         $this->_helper->json($citiesData);
     }
     /*
     if ($this->getRequest()->isXmlHttpRequest()) {
         $id = $this->_getParam('province_id');
         $citiesData = $cities->getCitiesByProvinceId($id);
         //$dojoData= new Zend_Dojo_Data('city_id',$citiesData);
         //echo $dojoData->toJson();
         echo json_encode($citiesData);
     }
     */
 }
 private function loadCities(Zend_Form_Element_Select $combo, $province_id, $city_id = 0)
 {
     $cityMapper = new PAP_Model_CityMapper();
     foreach ($cityMapper->getCitiesByProvinceId($province_id) as $c) {
         $combo->addMultiOption($c['city_id'], $c['name']);
     }
     if ($city_id != 0) {
         $this->view->form->setDefault('city', $city_id);
     }
 }
Beispiel #3
0
 public function getPromotionsByCity($city_id, $categories = '')
 {
     $city = new PAP_Model_City();
     $cityMapper = new PAP_Model_CityMapper();
     $cityMapper->find($city_id, $city);
     $promotions = $this->getPromotionsByCoords($city->getLatitude(), $city->getLongitude(), $categories);
     return $promotions;
 }