One model multiple views? Or filters?

Hi everyone,

I’m pretty new to Yii and have been raching my brain over this problem. Any help would be greatly appreciated. I have a customer database which is the main model my application is focused around. The customer has multiple status’ that I need to change the view for. When you log in to the application you select which “Queue” to go to. What I have been trying to do is manipulate the variable in the search function in the controller to change which customers are displayed. So basicly I have a menu, you select the “Active Customer Queue” which loads the admin page (at which point i tried setting the variable in the controller to ‘active’) and would only display the customers from the DB with ‘active’ as their status. The same goes for the other queues. Im not sure if this approach is the best or if theres an easier way to do this. I havent been able to get the varibale to set before the function uses the variable, and have run out of idea. Like I said, any help would be greatly appreciated.

For teachy purposes: Check out how the gii/crud calls the _view.php file, It sends an ‘id’ value to the actionView method in the controller. The following is all off the top of my head, but I had a minute a lunch :D

A menu item:

array('label'=>'Active Customers','url'=>array('main/admin', 'status'=>'Active'));


public function actionAdmin($_status=null) {

   ... //setup your generic $criteria

   //check $_status (!null) set your condition


   ... //the rest of your code to call the render() method


The above is very rough, but it might give you an idea of a direction to go.