Ratings API

With ratings API you can generate links or buttons, depending on the classes that you are using, that will allow users to rate an item. It can be used only with the like button or it can be used with the dislike button.

rating

Left: Default rating style. Center: Item is liked, can be disliked or remove the like. Right: Item is disliked, can be liked or remove the dislike.

rating dislike disabled

Left: Default rating style, dislike disabled. Right: Item is liked, can be unliked.


API example

jimport('oniscore.rating'); //import ratings libraries

$ratingsHTML  = onisRating::rating((int)$petition->id, 'petition', 'btn btn-xs btn-default', CCOMPONENT);

Generate the HTML code:

onisRating::rating($itemid, $item, $class = NULL, $component);
  • $itemid - unique, numerical item id;
  • $item - unique item name;
  • $class - css classes for the button;
  • $component - component name;

You can change HTML code here:

libraries/oniscore/rating.php

To show the rating for an item you can use:

onisRating::ratingLabel($rating);
  • $rating - numerical rating count, can be negative;

Example:

$ratingCount     = onisRating::ratingCount((int)$petition->id, 'petition', CCOMPONENT);
$ratingLabelHTML = onisRating::ratingLabel($ratingCount);

Joomla! ® name is used under a limited license from Open Source Matters in the United States and other countries.
Onis is not affiliated with or endorsed by Open Source Matters or the Joomla! Project.

Onis does not sell it's products on 3rd party sites. Any website offering Onis products for sale are not licensed versions and should be considered a scam. Never download our products from file sharing websites like rapidshare, torrents or warez forums. We have received reports of malicious versions of our software containing viruses, extra code, and even once installed, delete your database, steal sensitive information such as passwords, and credit card information. There is only one place to get the full and safe licensed versions of our software and you're looking at it! Enjoy.