CActiveDataProvider is not defined

I confused with CActiveDataProvider, I try to make user list with this model script

public function listUser(){

	$items = $this->findAll();	

        foreach ($items as $item)

        $items = array('id_user'=>$item->id_user, 'username'=>$item->username, 'passwd'=>$item->passwd, 'email'=>$item->email, 'level'=>$item->level, 'status'=>$item->status);

    	return new CActiveDataProvider($this, $items);



and I got error message

please help me to know the wrong code

sorry with my english

Hi yiistudent,

I’d like to ask you to explain your design a little more clearly:

What do you want to do with the returned data provider in your program?

Do you want to show a list of users in your view?

And do you want to use a CGridView or a CListView in your view?

Or, do you want just an array of users and you are going to loop through it in your view?

Thx for u’r response

I want call listUser method on my view with this code


	 'type'=>'striped bordered condensed',






		array('name'=>'id_user', 'header'=>'id'),

        array('name'=>'username', 'header'=>'Username'),

        array('name'=>'passwd', 'header'=>'Password'),

        array('name'=>'email', 'header'=>'Email'),

		array('name'=>'level', 'header'=>'Level'),

		array('name'=>'status', 'header'=>'Status'),



			'htmlOptions'=>array('style'=>'width: 50px'),




I see.

You could have used gii-generated ‘search’ method in your model code.


	'type'=>'striped bordered condensed',





I think the default ‘search’ method is best suited for general purpose when you want to use CGridView or its extensions.

thx, a lot