clientScript->registerScript('gii.crud'," $('#{$class}_controller').change(function(){ $(this).data('changed',$(this).val()!=''); }); $('#{$class}_model').bind('keyup change', function(){ var controller=$('#{$class}_controller'); if(!controller.data('changed')) { var id=new String($(this).val().match(/\\w*$/)); if(id.length>0) id=id.substring(0,1).toLowerCase()+id.substring(1); controller.val(id); } }); "); ?>
This generator generates a controller and views that implement CRUD operations for the specified data model.
beginWidget('CCodeForm', array('model'=>$model)); ?>Post
)
or the path alias of the class file (e.g. application.models.Post
).
Note that if the former, the class must be auto-loadable.
post
generates PostController.php
postTag
generates PostTagController.php
admin/user
generates admin/UserController.php
.
If the application has an admin
module enabled,
it will generate UserController
(and other CRUD code)
within the module instead.