Implementing CRUD Operations

I am looking to create a form that will interface with a database table. I discovered that Yii includes built-in capability to auto-generate this form. My question is, how will Yii determine the field types on the form, for example radio buttons, checkboxes. I assume it defaults all inputs to text fields - is there an easy way to change this to another type?

the yiic crud command only generates basic forms

you have to customize these forms manually or write your own generator

OK thanks.

I’m just setting up some accessRules().

If I only allow admin users to update/delete records, it does not hide the ‘update’ and ‘delete’ link for normal users. How can I enable this?

Also, what is defined in ‘admin’ action?

That is right, but yii can detect most of the Data types, for example an MySQL Boolean field will translate into an CBooleanValidator.

I think, the Generator (“Scaffolding”) gets more and more intelligent with every release of yii :)

The Admin view is a template for an administration interface of your table you might want to deploy in your backend application.

Yii 1.1 will include a CGridView for the admin interface, and here it will be possible to set right for users/admins.

The Admin interface should only be accesible by the admin - guests and users of your web application will most likely use the "list" view generated by the yiic shell.



in the view



          if (Yii::app()->user->checkAccess('admin') {


            echo CHtml::link('Update',array('update','id'=>$model->id)); 

            echo CHtml::linkButton('Delete',array(



            'confirm'=>"Delete #{$model->id}?")); 




Cheers Horacia.

Do you know what is defined in ‘admin’ action?:

array('allow', // allow admin user to perform 'admin' and 'delete' actions




I not understand the question, the action is defined in public function actionAdmin() inside the controller

( I apologize if I’m wrong or obvious answer, my preferred language is Spanish, ha ha ha. and I confess that use google translate)

the code above is related to Access Control Filter and i speak about RBAC

your idea is to keep a single page/action(admin) instead of two (list and admin)?

the action is defined in public function actionAdmin() inside the controller

Thanks! I seem to have missed that.