Cdbcriteria Not Displaying Any Results

Hi,

this is what I’m trying to pass the search results to ActiveDataProvider, but it doesn’t seem to change anything at all. If I use $dataProvider->model, the search results doesn’t display, however, if I use ‘dataProvider’=>$model->search(), I get blank results

The controller function is




	public function actionSearch()

	{	

		$itemsPerPage = Yii::app()->request->getQuery('ipp','10');

		$model=new Flowbook('search');

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

		$dataProvider = new CActiveDataProvider('Flowbook');                

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

                {

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

                     $dataProvider->model = $model;

                }

        

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

            'model'=>$model,

            'dataProvider'=>$dataProvider,

        	'itemsPerPage'=>$itemsPerPage,

        ));

	}



Update:

it appears that the search is the one causing the problems, particularly date_received(date from and date until fields), author_id(drop down) and contributor(list box).

What am I doing wrong?

The Form




<div class="row">

		<?php echo $form->label($model,'date_from'); ?>

		<?php $this->widget('zii.widgets.jui.CJuiDatePicker', array(

			    'model'=>$model,

				'attribute'=>'date_from',

				// additional javascript options for the date picker plugin

				'options'=>array(					

					'showAnim'=>'fold',

					'showButtonPanel'=>true,

				    'autoSize'=>true,

				    'dateFormat'=>'yy-mm-dd',

				   ),

			));; ?>

	</div>


	<div class="row">

		<?php echo $form->label($model,'date_until'); ?>

		<?php $this->widget('zii.widgets.jui.CJuiDatePicker', array(

			    'model'=>$model,

				'attribute'=>'date_until',

				// additional javascript options for the date picker plugin

				'options'=>array(					

					'showAnim'=>'fold',

					'showButtonPanel'=>true,

				    'autoSize'=>true,

				    'dateFormat'=>'yy-mm-dd',

				   ),

			));	?>

		

	</div>


	<div class="row">

		<?php echo $form->label($model,'author_id'); ?>

		<?php echo $form->dropDownList($model,'author_id',User::getAuthors()); ?>

	</div>

	

	<div class="row">

		<?php echo $form->label($model,'contributor'); ?>

		<?php echo $form->listBox($model,'contributor',Flowbook::getContributors(), array('multiple' => 'multiple')); ?>

	</div>



the compare code for model->search()




public function search()

{


		$criteria=new CDbCriteria;

		

		$arTitle = explode(' ', $this->title);

		$count = count($arTitle);	

		for ($i=0; $i < $count; $i++)

			$criteria->addSearchCondition('title', $arTitle[$i], true, 'OR');

			

		if (isset($this->category))

			if ($this->category > 0)

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

				

				

		if (isset($this->date_from))

		   $criteria->compare('date_received','>=:'.strtotime($this->date_from));


		if (isset($this->date_until))

		   $criteria->compare('date_received','<=:'.strtotime($this->date_until));

		

		$arDescription = explode(' ', $this->description);

		$count = count($arDescription);

		for ($i=0; $i < $count; $i++)

			$criteria->addSearchCondition('description', $arDescription[$i], true, 'OR');

			

		$arKeyword = explode(' ', $this->keyword);

		$count = count($arKeyword);

		for ($i=0; $i < $count; $i++)

			$criteria->addSearchCondition('keyword', $arKeyword[$i], true, 'OR');

		

		if (isset($this->author_id))

			if ($this->author_id > 0)

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

		

		$arContributor = $this->contributor;

		$criteria->addInCondition('contributor', $arContributor);

				

		return new CActiveDataProvider($this, array(

			'criteria'=>$criteria,

		));

}






nevermind, I discovered that the search must not have ":"