Пример #1
0
 public function search($location, $limit, $offset = 0, $query = null, $cat1 = null, $cat2 = null, $cat3 = null, $cat4 = null, $cat5 = null, $addtionalData = null)
 {
     logfire('restaurant cat2', $cat2);
     if (empty($cat2) || $cat2 == 'Any' || $cat2 == 'ALL') {
         $cat2 = null;
     }
     // temp fix for the router
     $cat1 = $cat3;
     $cat3 = null;
     if (empty($cat1) || $cat1 == 'Any' || $cat1 == 'ALL' || $cat1 == 25) {
         $cat1 = null;
     }
     $select = parent::search($location, $limit, $offset, $query, $cat1, $cat2, $cat3, $cat4, $cat5, $addtionalData);
     if ($cat1 == null) {
         $keys = '';
         foreach ($this->getCat1Array() as $key => $value) {
             if (empty($keys)) {
                 $keys = $key;
             } else {
                 $keys .= ',' . $key;
             }
         }
         $select->where('cat1 in (' . $keys . ')');
     }
     //echo $select;
     return $select;
 }
Пример #2
0
 public function search($location, $limit, $offset = 0, $query = null, $cat1 = null, $cat2 = null, $cat3 = null, $cat4 = null, $cat5 = null, $addtionalData = null)
 {
     $orginalCat1 = $cat1;
     if ($cat1 == $this->_cat1All) {
         $cat1 = null;
     }
     $select = parent::search($location, $limit, $offset, $query, $cat1, $cat2, $cat3, $cat4, $cat5, $addtionalData);
     if ($orginalCat1 == $this->_cat1All) {
         logfire('sdfsdfsdfdsfdsfs', sizeof($this->getCat1Array()));
         $keys = '';
         foreach ($this->getCat1Array() as $key => $value) {
             if (empty($keys)) {
                 $keys = $key;
             } else {
                 $keys .= ',' . $key;
             }
         }
         $select->where('cat1 in (' . $keys . ')');
     }
     logfire('job select', $select);
     return $select;
 }
Пример #3
0
 public function search($location, $limit, $offset = 0, $query = null, $cat1 = null, $cat2 = null, $cat3 = null, $cat4 = null, $cat5 = null, $addtionalData = null)
 {
     if ($cat1 == 22) {
         $cat1 = null;
     }
     logfire('realstatesearch cat2', $cat2);
     if (empty($cat2) || $cat2 == 'Any' || $cat2 == 'ALL') {
         $cat2 = null;
     }
     if (empty($cat3) || $cat3 == 'Any' || $cat3 == 'ALL') {
         $cat3 = null;
     }
     $select = parent::search($location, $limit, $offset, $query, $cat1, $cat2, $cat3, $cat4, $cat5, $addtionalData);
     // TODO price;
     foreach ($addtionalData as $key => $value) {
         logfire($key, $value);
     }
     if (!empty($addtionalData['min']) && $addtionalData['min'] != 'Any' && $addtionalData['min'] != 'ALL') {
         $select->where('a.priceCalculate >= ?', $addtionalData['min']);
     }
     if (!empty($addtionalData['max']) && $addtionalData['max'] != 'Any' && $addtionalData['max'] != 'ALL') {
         $select->where('a.priceCalculate <= ?', $addtionalData['max']);
     }
     if (empty($cat1)) {
         $keys = '';
         foreach ($this->getCat1Array() as $key => $value) {
             if (empty($keys)) {
                 $keys = $key;
             } else {
                 $keys .= ',' . $key;
             }
         }
         $select->where('cat1 in (' . $keys . ')');
     }
     //echo $select;
     return $select;
 }
Пример #4
0
 public function search($location, $limit, $offset = 0, $query = null, $cat1 = null, $cat2 = null, $cat3 = null, $cat4 = null, $cat5 = null, $addtionalData = null)
 {
     logfire('realstatesearch cat2', $cat2);
     if (empty($cat2)) {
         $cat2 = 630;
     }
     if ($cat3 == 631 || $cat3 == 639) {
         $cat3 = null;
     }
     $select = parent::search($location, $limit, $offset, $query, $cat1, $cat2, $cat3, $cat4, $cat5, $addtionalData);
     // TODO price;
     foreach ($addtionalData as $key => $value) {
         logfire($key, $value);
     }
     if ($addtionalData['bed'] != '' && $addtionalData['bed'] != 'Any' && $addtionalData['bed'] != 'ALL') {
         if ($addtionalData['bed'] == 100) {
             $select->where('i.rooms >= 6');
         } else {
             $select->where('i.rooms = ?', $addtionalData['bed']);
         }
     }
     if ($addtionalData['cars'] != '' && $addtionalData['cars'] != 'Any' && $addtionalData['cars'] != 'ALL') {
         if ($addtionalData['cars'] == 100) {
             $select->where('i.parking >= 6');
         } else {
             $select->where('i.parking = ?', $addtionalData['cars']);
         }
     }
     if ($addtionalData['bath'] != '' && $addtionalData['bath'] != 'Any' && $addtionalData['bath'] != 'ALL') {
         if ($addtionalData['bath'] == 100) {
             $select->where('i.baths >= 6');
         } else {
             $select->where('i.baths = ?', $addtionalData['bath']);
         }
     }
     if (!empty($addtionalData['min']) && $addtionalData['min'] != 'Any' && $addtionalData['min'] != 'ALL') {
         $select->where('a.priceCalculate >= ?', $addtionalData['min']);
     }
     if (!empty($addtionalData['max']) && $addtionalData['max'] != 'Any' && $addtionalData['max'] != 'ALL') {
         $select->where('a.priceCalculate <= ?', $addtionalData['max']);
     }
     /*
     if ($cat3 == 631||$cat3 == 639)
     {
     	$keys = '';
     	foreach($this->getCat3Array($cat2, false) as $key=>$value)
     	{
     		if (empty($keys))
     		{
     			$keys = $key;
     		}
     		else
     		{
     			$keys .= ','.$key;
     		}
     	}
     	$select->where('cat3 in ('.$keys.')');
     }
     */
     //echo $select;
     return $select;
 }
 public function actionLocation()
 {
     $cat = Yii::app()->getRequest()->getQuery('cat');
     $bname = Yii::app()->getRequest()->getQuery('keyword');
     $catname = Category::model()->getCategoryName($cat);
     if ($cat == 'all' || empty($catname)) {
         $query = "SELECT *  \n\t\t\t\t\t\tFROM  `mm_business` \n\t\t\t\t\t\tWHERE  `business_name` LIKE  '%" . $bname . "%' \n\t\t\t\t\t\tORDER BY `business_name` LIMIT 10";
     } else {
         $query = "SELECT *  \n\t\t\t\t\tFROM  `mm_business` \n\t\t\t\t\tWHERE  `business_name` LIKE  '%" . $bname . "%'\n\t\t\t\t\tAND\t`business_category` LIKE  '" . $catname . "'";
     }
     $command = Yii::app()->db->createCommand($query);
     $result = $command->queryAll();
     $model = new Business('search');
     $model->unsetAttributes();
     // clear any
     $model->business_name = $bname;
     $model->business_category = $catname;
     //send model object for search
     $this->render('index', array('dataProvider' => $model->search(), 'model' => $model));
     /*
     		$dataProvider=new CArrayDataProvider($result, array(
     					'sort'=>false,
     					'keyField'=>'id', //this is what will be considered your key field
     					'pagination'=>array(
     					'pageSize'=>30, //eureka! you can configure your pagination from here
                     ),
     				
                 ));
     
     		//echo '<pre>'; var_dump($pp); die();
     	
     		$this->render('index',array(
     			'dataProvider'=>$dataProvider,
     		));*/
     //throw new CHttpException(404,'The requested page does not exist.');
 }