Cstarrating is mainly used for grading, showing a group of stars (5) for scoring.
The basic usage is as follows
<center class= "Form" >
<?php $form = $this->beginwidget (' cactiveform ');?> <?php
$this-> Widget (' cstarrating ', Array (
' model ' => $model,
' attribute ' => ' rating ',
' name ' => ' rating ',
' value ' =>3,
)); ?>
<center class= "row Submit" >
<?php echo Chtml::submitbutton (' submit ');?>
</center >
<?php $this->endwidget ();?>
</center><!--form-->
Star values can be accessed through $_post[' rating ' in controller, such as:
Public Function Actionindex ()
{
$model =new datamodel ();
$model->rating=3;
if (!emptyempty ($_post[' rating '))
{
$model->rating=$_post[' rating '];
if ($model->validate ()) {
$this->render (' response ', array (
' model ' => $model,
));
return;
}
$this->render (' index ', array (
' model ' => $model
);
}
Cstarrating can also be set to read-only, when starrating is used to display the score and the user cannot modify the score. This is accomplished by the ' readOnly ' =>true.
This example downloads: Http://www.imobilebbs.com/download/yii/MaskedTextFieldDemo.zip
See a full set of tutorials: http://www.bianceng.cn/webkf/PHP/201301/35265.htm