Exemplo n.º 1
0
	public function actionList()
	{
		$model=new Business('search');
		$model->unsetAttributes(); 
		if(isset($_GET['Business']))
			$model->attributes=$_GET['Business'];
		Yii::app()->session['myurl'] = $this->createUrl('list');
		$this->render('list',array(
			'model'=>$model,
		));
	}
 /**
  * Manages all models.
  */
 public function actionAdmin()
 {
     $model = new Business('search');
     $model->unsetAttributes();
     // clear any default values
     if (isset($_GET['Business'])) {
         $model->attributes = $_GET['Business'];
     }
     $this->render('admin', array('model' => $model));
 }
Exemplo n.º 3
0
 public function actionManage()
 {
     $model = new Business('search');
     $model->unsetAttributes();
     if (isset($_GET['Business'])) {
         $model->setAttributes($_GET['Business']);
     }
     $this->render('manage', array('model' => $model));
 }
 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.');
 }