Overview

Packages

  • application
    • commands
    • components
      • actions
      • filters
      • leftWidget
      • permissions
      • sortableWidget
      • util
      • webupdater
      • x2flow
        • actions
        • triggers
      • X2GridView
      • X2Settings
    • controllers
    • models
      • embedded
    • modules
      • accounts
        • controllers
        • models
      • actions
        • controllers
        • models
      • calendar
        • controllers
        • models
      • charts
        • models
      • contacts
        • controllers
        • models
      • docs
        • components
        • controllers
        • models
      • groups
        • controllers
        • models
      • marketing
        • components
        • controllers
        • models
      • media
        • controllers
        • models
      • mobile
        • components
      • opportunities
        • controllers
        • models
      • products
        • controllers
        • models
      • quotes
        • controllers
        • models
      • services
        • controllers
        • models
      • template
        • models
      • users
        • controllers
        • models
      • workflow
        • controllers
        • models
      • x2Leads
        • controllers
        • models
  • Net
  • None
  • PHP
  • system
    • base
    • caching
      • dependencies
    • collections
    • console
    • db
      • ar
      • schema
        • cubrid
        • mssql
        • mysql
        • oci
        • pgsql
        • sqlite
    • i18n
      • gettext
    • logging
    • test
    • utils
    • validators
    • web
      • actions
      • auth
      • filters
      • form
      • helpers
      • renderers
      • services
      • widgets
        • captcha
        • pagers
  • Text
    • Highlighter
  • zii
    • behaviors
    • widgets
      • grid
      • jui

Classes

  • ActionActiveForm
  • ActionActiveFormBase
  • CActiveForm
  • CalendarEventActiveForm
  • CallActiveForm
  • CClipWidget
  • CContentDecorator
  • CFilterWidget
  • CFlexWidget
  • CHtmlPurifier
  • CInputWidget
  • CMarkdown
  • CMaskedTextField
  • CMultiFileUpload
  • COutputCache
  • COutputProcessor
  • CStarRating
  • CTabView
  • CTextHighlighter
  • CTreeView
  • CWidget
  • EventActiveForm
  • MobileActiveForm
  • NoteActiveForm
  • TimeActiveForm
  • X2ActiveForm
  • X2StarRating
  • Overview
  • Package
  • Class
  • Tree

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
Extended by CBaseController
Extended by CWidget
Extended by CInputWidget
Extended by CStarRating

Direct known subclasses

X2StarRating
Package: system\web\widgets
Copyright: 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
Methods summary
public
# run( )

Executes the widget. This method registers all needed client scripts and renders the text field.

Executes the widget. This method registers all needed client scripts and renders the text field.

Overrides

CWidget::run()
public
# registerClientScript( string $id )

Registers the necessary javascript and css scripts.

Registers the necessary javascript and css scripts.

Parameters

$id
string
$id the ID of the container
public static
# registerCssFile( string $url = null )

Registers the needed CSS file.

Registers the needed CSS file.

Parameters

$url
string
$url the CSS URL. If null, a default CSS URL will be used.
protected
# renderStars( string $id, string $name )

Renders the stars.

Renders the stars.

Parameters

$id
string
$id the ID of the container
$name
string
$name the name of the input
protected array
# getClientOptions( )

Returns

array
the javascript options for the star rating
Methods inherited from CInputWidget
hasModel(), resolveNameID()
Methods inherited from CWidget
__construct(), actions(), getController(), getId(), getOwner(), getViewFile(), getViewPath(), init(), render(), setId()
Methods inherited from CBaseController
beginCache(), beginClip(), beginContent(), beginWidget(), createWidget(), endCache(), endClip(), endContent(), endWidget(), renderFile(), renderInternal(), widget()
Methods inherited from CComponent
__call(), __get(), __isset(), __set(), __unset(), asa(), attachBehavior(), attachBehaviors(), attachEventHandler(), canGetProperty(), canSetProperty(), detachBehavior(), detachBehaviors(), detachEventHandler(), disableBehavior(), disableBehaviors(), enableBehavior(), enableBehaviors(), evaluateExpression(), getEventHandlers(), hasEvent(), hasEventHandler(), hasProperty(), raiseEvent()
Properties summary
public integer $starCount 5
#

the number of stars. Defaults to 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.

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.

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.

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.

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.

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').

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 '').

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.

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).

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.

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.

Callback when the stars are focused.

public string $blur
#

Callback when the stars are not focused.

Callback when the stars are not focused.

public string $callback
#

Callback when the stars are clicked.

Callback when the stars are clicked.

Properties inherited from CInputWidget
$attribute, $htmlOptions, $model, $name, $value
Properties inherited from CWidget
$actionPrefix, $skin
Magic properties inherited from CWidget
$controller, $id, $owner, $viewPath
API documentation generated by ApiGen 2.8.0