dzRaty is a wrapper for jQuery Raty, a plugin developed by Washington Botelho that generates a customizable star rating.
To get started, check http://yii.dezero.es/dzraty
v1.1
v1.0
Requirements: jQuery and Yii framework 1.0 or above (tested on 1.1.12).
Extract downloaded file to your Yii application extensions folder (default: protected/extensions).
Using with an attribute model. weight is a sample attribute name
$this->widget('ext.DzRaty.DzRaty', array( 'model' => $model, 'attribute' => 'weight', ));
Using with a single input element
$this->widget('ext.DzRaty.DzRaty', array( 'name' => 'my_rating_field', 'value' => 3, ));
$this->widget('ext.DzRaty.DzRaty', array( 'name' => 'my_rating_field', 'value' => 3, 'options' => array( 'readOnly' => TRUE, ), ));
dzRaty translates all translatable elements of jQuery Star plugin. You can place your own translation file under DzRaty/messages.
Current version contains translation files for spanish. You could simply duplicate and edit one of them.
Total 10 comments
@skworden,
Please how did you resolve the dzRaty jquery confilct. I could not get it work.
I've never checked dzRaty in CListView.
Thanks for reporting. I'll fix it soon.
break in pagination in clistview :(
My js was conflicting with raty's js making the js line where it hides the field not a valid statement...got it solved thanks.
That's why jQuery Raty plugin isn't running for this field. I don't know the reason... maybe jQuery Raty library is not loading in HTML document. Have you checked you have write permissions in assets folder? Do you have any Javascript error in your browser console? This can give you a clue.
Hello,
I tried to use this but it just show a text field with star rating number in it instead of stars. Any ideas why?
You have several ways to save the rating in database: using an attribute model or in a custom CForm (see examples above). If your dzRaty returns a numeric value, you should save it on a FLOAT or INT database column. Or if you configure it to return a string value, so you must use a VARCHAR or similar.
This plugin works like a normal text field. In fact, it saves the value in a hidden input text element.
Hello, Thank you for this extension. My question is how to save user ratings to database?
Thanks for your comments > @Raoul.
I'm thinking now about integrating it with CgridView as filter and data column.
impressive homepage (I wish all extension would have such dedicated homepage).. I'll definitly try this extension !
Good job
Leave a comment
Please login to leave your comment.