public function actionRatePriceAutoComplete()
 {
     if (Yii::app()->request->isAjaxRequest && isset($_GET['term'])) {
         $list_all = array();
         $list_district = District::getListDistrict($_GET['term']);
         foreach ($list_district as $item) {
             $list_all[] = array('value' => $item['value'], 'label' => $item['label'], 'mode' => 'district', 'did' => $item['id']);
         }
         $list_zone = Zone::getListZone($_GET['term']);
         foreach ($list_zone as $item) {
             $list_all[] = array('value' => $item['value'], 'label' => $item['label'], 'mode' => 'zone', 'did' => $item['did'], 'zid' => $item['zid']);
         }
         $this->setJsonHeader();
         echo CJSON::encode($list_all);
         Yii::app()->end();
     }
 }
Ejemplo n.º 2
0
 public function actionSuggestCity()
 {
     if (Yii::app()->request->isAjaxRequest && isset($_GET['term'])) {
         $list_all = array();
         $GETpid = 0;
         if (isset($_GET['pid'])) {
             $GETpid = $_GET['pid'];
         }
         $list_district = District::getListDistrict($_GET['term'], $GETpid, TRUE);
         foreach ($list_district as $item) {
             $list_all[] = array('value' => $item['value'], 'label' => $item['label'], 'did' => $item['id'], 'zid' => 0);
         }
         $list_zone = Zone::getListZone($_GET['term'], $GETpid, TRUE);
         foreach ($list_zone as $item) {
             $list_all[] = array('value' => $item['value'], 'label' => $item['label'], 'did' => $item['did'], 'zid' => $item['zid']);
         }
         $this->setJsonHeader();
         echo CJSON::encode($list_all);
         Yii::app()->end();
     }
 }