Hello, my goal is to create the same style list that is on the admin view on the index page, which I have done. Basically, I got rid of the admin (manage) page and am just using an index page. However, what I want to do is have a version that has the edit/delete buttons in the right hand column and one that doesn’t. If you are not logged in, you can see the list of items and view each one in full by clicking the magnifying glass. If you are logged in, you can also delete or edit each item. How would I go about doing this? Here is the code that creates the list:
I can of course get rid of the array(‘class’=>’…’), but that also gets rid of the magnifying glass. I also don’t really know how to check if a user is logged in. Sorry, I’m a Yii noob.
Thanks guys, this helps, but I’m still not sure how to exclude certain buttons from the cbuttonview in the case that a user is logged in vs. the user is an admin.
So here is there some option to do this?
'columns'=>array(
'x','y,'z',
array(
'class'=>'CButtonColumn',
'visible' => !Yii::app()->user->isGuest, //with this option only a logged in user sees the buttons
),
So 1.) Is there a visibility option (or some other isXXXX method) that checks if a user is an admin as opposed to just logged in? and 2.) is there an option I can use in the CButtonColumn array that excludes certain buttons (e.g. delete)? THANKS!
Thanks but I’m getting the error [color="#8B0000"]call_user_func_array() [<a href=‘function.call-user-func-array’>function.call-user-func-array</a>]: First argument is expected to be a valid callback, ‘’ was given[/color] with the following: