How to create and pass model to the grid

Hi,

I am new, so maybe my question is trivial.

I have a several report to do, so I would like to keep it in Report model and controller.

How Report model should be defined and how to pass it to the view?

When Report is not based on the database table.

I have tried something like this:

model:

class Report extends CForm

{

public $year;

 public function init()


{ 


	parent::init();





	$this->year = date('Y');


	$model->quarter = $this->currentQuarter();


}

controller:

public function actionEnrolmentReport()


{


	$authManager = Yii::app()->authManager;


	$model = new Report(null);


	$model->userId = Yii::app()->user->id;


	


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


		'model'=>$model,


		'role'=>'Staff',


	));


}

when rendering, it complains about missing methods getAttributeLable, hasError, …all these methods for model which extends CActiveRecord.

I hope you mean CFormModel rather than CForm, right?

If it complains about missing functions, then you probably know what to do: implement those functions in your model…

If you don’t need a model, then you can probably use an array dataprovider - I haven’t tried - but the grid does take an IDataprovider.

Worth a try.

Nope, it was my mistake. Thank you very much.