Developers

License

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Using the Ajax rating system

This plugin provides an Ajax-based rating system, with pretty stars to click on.

To activate this feature, you must enable the sfRating module in the
config/settings.yml file of the app you want to use the helper in :

all:
.settings:
enabled_modules: [sfRating](default,)

If you are under Microsoft Windows, you also have to manually copy the ./web
directory of the plugin in the %SF_ROOT_DIR%/web directory of your project
and rename it to sfPropelActAsRatableBehaviorPlugin. Then you will have
this on the filesytem :

API Usage

You can rate your previously configured Article objects through the
new API which as been dynamically added to your object by the behavior.

Note that you can provide a user PK to determine if one of your user has already
rated the object. Here we imagine a User object instance $user which represent a
member, an author, a person or anything like this.

To set a rating for a given user ($unique_user_reference is a string representing a
unique reference to a user - eg. md5($_SERVER['REMOTE_ADDR']) or
md5($user->getEmail())) :

$article->setRating(10, $unique_user_reference);

To retrieve user rating for this object :

$article->getUserRating($unique_user_reference);

To get the average rating of the object :

$article->getRating();

To retrieve the maximum possible rating for an object (which you have defined in
the max_rating behavior optional parameter - default is 5) :

$article->getMaxRating();

To clear user rating :

$article->clearRating($unique_user_reference);

To clear all ratings for the object :

$article->clearRatings();

You can test if the object has already been rated :

$article->hasBeenRated();

You can also test if the object has already been rated by a particular user:

$article->hasBeenRatedByUser($unique_user_reference);

Unit testing

The plugin is provided with a test suite located in the ./test directory.
To run the tests, type this line from the root of your project :

sfRatings table has been renamed to sf_ratings: you have to
rebuild your SQL files and insert them in your DB if you upgrade from
0.5.0. Hopefully, one day we'll have a migration system in Symfony core...

Removed configuration file to set up Propel object to unit test in the test
suite

2006-09-05 | v0.5.0

Initial release

Credits

The eye-candy star-based Ajax system is based on the great work of
Komodomedia:
http://komodomedia.com/blog/samples/star_rating/example2.htm