PHP Classes

Star rating package: Process and show rating stars given by the user

Recommend this page to a friend!
     
  Info   Example   View files Files   Install with Composer Install with Composer   Download Download   Reputation   Support forum   Blog    
Ratings Unique User Downloads Download Rankings
StarStarStarStar 60%Total: 1,572 All time: 2,506 This week: 68Up
Version License PHP version Categories
rating-package 1.0.0GNU General Publi...5.1PHP 5, Databases, Content management, A...
Description 

Author

This class can be used to process and display rating stars given by the user to site content.

It can generate HTML and Javascript to let the user rate site content.

When the user rates content an AJAX request using Iframe is sent to the server to avoid page reloading.

The class updates the content ratings stored in a MySQL database and renders updated content ratings as response to the AJAX request.

Picture of akash
Name: akash <contact>
Classes: 3 packages by
Country: India India
Innovation award
Innovation award
Nominee: 1x

Winner: 1x

Recommendations

What is the best PHP star rating class?
I would like PHP star rating script

Example

<?php
$itemID
= $_POST['itemId'];
$rating = $_POST['rating'];
require_once(
'RatingManager.php');

$status = RatingManager::saveRating($itemID, $rating);

if (
$status === false) {
    exit;
}
?>
<html>
<head>
<script type="text/javascript">
function bodyLoaded() {
    if (!parent.document.getElementById('itemRating_<?php print $itemID; ?>')) {
        return;
    }
    parent.document.getElementById('itemRating_<?php print $itemID; ?>').innerHTML = document.getElementById('bodyContainer').innerHTML;
    document.getElementById('bodyContainer').innerHTML = '';
}
</script>

</head>
<body onLoad="return bodyLoaded();" id="bodyContainer">
<?php
RatingManager
::drawItemRating($itemID, false);
?>
</body>
</html>


  Files folder image Files (8)  
File Role Description
Files folder imageimages (3 files)
Accessible without login Plain text file javascript.php Aux. includes javascript to the code and downloads the images required
Plain text file RatingManager.php Class PHP class which handles all the code and the requests
Accessible without login Plain text file set-item-rating.php Example Page used to save the rating for item
Accessible without login Plain text file sql.txt Data Rating table used for the rating system. Create this table in any database and rename the table name. Make the respective changes in the RatingManager.php constants also
Accessible without login Plain text file test.php Example Example page, run this page to test the functionality

  Files folder image Files (8)  /  images  
File Role Description
  Accessible without login Image file star1.gif Icon Star image
  Accessible without login Image file star2.gif Icon Star image
  Accessible without login Image file star3.gif Icon Star image

The PHP Classes site has supported package installation using the Composer tool since 2013, as you may verify by reading this instructions page.
Install with Composer Install with Composer
 Version Control Unique User Downloads Download Rankings  
 0%
Total:1,572
This week:0
All time:2,506
This week:68Up
 User Ratings  
 
 All time
Utility:87%StarStarStarStarStar
Consistency:81%StarStarStarStarStar
Documentation:-
Examples:87%StarStarStarStarStar
Tests:-
Videos:-
Overall:60%StarStarStarStar
Rank:1154