Class CStarRating
CStarRating displays a star rating control that can collect user rating input.
CStarRating is based on jQuery Star Rating Plugin. It displays a list of stars indicating the rating values. Users can toggle these stars to indicate their rating input. On the server side, when the rating input is submitted, the value can be retrieved in the same way as working with a normal HTML input. For example, using
$this->widget('CStarRating',array('name'=>'rating'));
we can retrieve the rating value via <span
class="php-var">$_POST</span>[<span
class="php-quote">'rating'</span>]
.
CStarRating allows customization of its appearance. It also supports empty rating as well as read-only rating.
- CComponent
- CBaseController
- CWidget
- CInputWidget
- CStarRating
Direct known subclasses
X2StarRatingCopyright: 2008-2013 Yii Software LLC
License: http://www.yiiframework.com/license/
Author: Qiang Xue <qiang.xue@gmail.com>
Since: 1.0
Located at x2engine/framework/web/widgets/CStarRating.php
public
|
|
public
|
|
public static
|
|
protected
|
|
protected
array
|
hasModel(),
resolveNameID()
|
__construct(),
actions(),
getController(),
getId(),
getOwner(),
getViewFile(),
getViewPath(),
init(),
render(),
setId()
|
beginCache(),
beginClip(),
beginContent(),
beginWidget(),
createWidget(),
endCache(),
endClip(),
endContent(),
endWidget(),
renderFile(),
renderInternal(),
widget()
|
public
integer
|
$starCount | 5 |
#
the number of stars. Defaults to 5. |
public
mixed
|
$minRating | 1 |
#
the minimum rating allowed. This can be either an integer or a float value. Defaults to 1. |
public
mixed
|
$maxRating | 10 |
#
the maximum rating allowed. This can be either an integer or a float value. Defaults to 10. |
public
mixed
|
$ratingStepSize | 1 |
#
the step size of rating. This is the minimum difference between two rating values. Defaults to 1. |
public
mixed
|
$cssFile |
|
#
the CSS file used for the widget. Defaults to null, meaning using the default CSS file included together with the widget. If false, no CSS file will be used. Otherwise, the specified CSS file will be included when using this widget. |
public
array
|
$titles |
|
#
the titles associated with the rating options. The keys are ratings and the values are the corresponding titles. Defaults to null, meaning using the rating value as the title. |
public
string
|
$resetText |
|
#
the hint text for the reset button. Defaults to null, meaning using the system-defined text (which is 'Cancel Rating'). |
public
string
|
$resetValue |
|
#
the value taken when the rating is cleared. Defaults to null, meaning using the system-defined value (which is ''). |
public
boolean
|
$allowEmpty |
|
#
whether the rating value can be empty (not set). Defaults to true. When this is true, a reset button will be displayed in front of stars. |
public
integer
|
$starWidth |
|
#
the width of star image. Defaults to null, meaning using the system-defined value (which is 16). |
public
boolean
|
$readOnly |
|
#
whether the rating value is read-only or not. Defaults to false. When this is true, the rating cannot be changed. |
public
string
|
$focus |
|
#
Callback when the stars are focused. |
public
string
|
$blur |
|
#
Callback when the stars are not focused. |
public
string
|
$callback |
|
#
Callback when the stars are clicked. |
$attribute,
$htmlOptions,
$model,
$name,
$value
|
$actionPrefix,
$skin
|
$controller,
$id,
$owner,
$viewPath
|