mpStarRatingPlugin - 1.0.0

Use Stars in your rating forms.

You are currently browsing
the website for symfony 1

Visit the Symfony2 website


« Back to the Plugins Home

Signin


Forgot your password?
Create an account

Tools

Stats

advanced search
Information Readme Releases Changelog Contribute
Show source

mpWidgetFormChoiceRatingPlugin

The mpWidgetFormChoiceRatingPlugin is a widget created to show radio butons of rating like stars.

This collection starts with only a widget and have external dependencies of jquery.

Installation

  • Install the plugin

    $ symfony plugin:install mpWidgetFormChoiceRatingPlugin
    
  • Clear the cache

    $ symfony cache:clear
    $ symfony plugin:publish-assets
    
  • Use the widget overriting your form widget generated by doctrine or your custom form


  $options = array(0 => 'Não sei', 1 => 'Péssimo', 2 => 'Aceitável', 3 => 'Mediano', 4 => 'Muito bom', 5 => 'Excelente');
  $widgets = $this->getWidgetSchema();
  $widgets['rating_comfort'] = new mpWidgetFormChoiceRating( array('choices' => $options ) );
  $widgets['rating_room'] = new mpWidgetFormChoiceRating( array('choices' => $options ) );
  $widgets['rating_service'] = new mpWidgetFormChoiceRating( array('choices' => $options ) );
  
  • make sure you already have the jquery js in the page, so download the ui files from jquery website and put in web/jquery/jquery.ui/ui/ui.core.js web/jquery/jquery.ui/ui/jquery.ui.widget.js

  • that's all folks.

Documentation

All classes have full API and usage documentation. The best way to learn each widget or validator is to read the API.

Widgets

  • mpWidgetFormChoiceRating: Change the default radio options by starts using javascript (extends sfWidgetFormChoice)

As no third party libraries is bundled in the plugin, you need to install and load the required dependencies like JQuery and JQuery UI.

It's based on Star Rating widget ( http://plugins.jquery.com/project/Star_Rating_widget )