Two Different Search Functions

I have two search functions. One for public and one for admin search. They are exactly the same:


	public function search()

	{

		// @todo Please modify the following code to remove attributes that should not be searched.


		$criteria=new CDbCriteria;


		//$criteria->compare('ID',$this->ID);

		$criteria->compare('t.IDkorisnik',Yii::app()->user->getId());

		$criteria->compare('start_time',$this->start_time,true);

		$criteria->compare('end_time',$this->end_time,true);

		//$criteria->compare('information',$this->information,true);

		$criteria->compare('country',$this->country,true);

		$criteria->compare('city',$this->city,true);

		$criteria->compare('start_price',$this->start_price);

		$criteria->compare('min_bid',$this->min_bid);

		$criteria->compare('valuta',$this->valuta,true);

		$criteria->compare('title',$this->title,true);

		

		$criteria->with=array('relationIDuzgajivac','relationIDgolub');

		$criteria->compare('username',$this->uzgajivacSearch);

		$criteria->compare('brojgoluba',$this->golub_search, true);


		return new CActiveDataProvider($this, array(

			'criteria'=>$criteria,

			'pagination'=>array('pageSize'=>50),

		));

	}



except in search() I have this


$criteria->compare('t.IDkorisnik',Yii::app()->user->getId());

in publichsearch() I don’t.

As you may see there is relation search. when I open admin page it works in publicsearch page it doesn’t work, I don’t know why

I never realized that when I’m creating new action


public function actionPublicSearch()

{

	

	$model=new Auction('search');

	$model->unsetAttributes();  // clear any default values

	if(isset($_GET['Auction']))

		$model->attributes=$_GET['Auction'];


	$this->render('publicsearch',array(

		'model'=>$model,

	));

}



this


`$model=new Auction('search');`

within model always has to be ‘search’ not something like ‘public_search’

and then within view, where CGridView is created


<?php $this->widget('zii.widgets.grid.CGridView', array(

    'id'=>'auction-grid',

    'dataProvider'=>$model->public_search(),

dataProvider is a place where I put my search function, in this case public_search