stars
[ class tree: stars ] [ index: stars ] [ all elements ]

Source for file rate.php

Documentation is available at rate.php

  1. <?php
  2. /**
  3. * $Header$
  4. * date created 2006/02/10
  5. * @author xing <xing@synapse.plus.com>
  6. * @version $Revision$
  7. * @package stars
  8. */
  9.  
  10. /**
  11.  * Setup
  12.  */
  13. require_once( "../kernel/setup_inc.php" );
  14. $gBitSystem->verifyPackage( 'stars' );
  15. $starsfeed = array();
  16.  
  17. if( @BitBase::verifyId( $_REQUEST['content_id'] ) && @BitBase::verifyId( $_REQUEST['stars_rating'] ) ) {
  18.     if( $tmpObject = LibertyBase::getLibertyObject( $_REQUEST['content_id'] ) ) {
  19.         // check if this feature allows rating
  20.         if( $gBitSystem->isFeatureActive( 'stars_rate_'.$tmpObject->getContentType() ) ) {
  21.             $starsfeed = array();
  22.             $stars = new LibertyStars( $tmpObject->mContentId );
  23.  
  24.             if( !$gBitUser->isRegistered() ) {
  25.                 $starsfeed['error'] = tra( "You need to log in to rate." );
  26.             } else {
  27.                 if( $stars->store( $_REQUEST ) ) {
  28.                     //$starsfeed['success'] = tra( "Thank you for rating." );
  29.                 } else {
  30.                     $starsfeed['error'] = $stars->mErrors;
  31.                 }
  32.             }
  33.         }
  34.     }
  35.     // get up to date reading
  36.     $stars->load();
  37.     $serviceHash = array_merge( $tmpObject->mInfo, $stars->mInfo, $stars->getUserRating( $tmpObject->mContentId ) );
  38.     $gBitSmarty->assign( 'serviceHash', $serviceHash );
  39. } else {
  40.     $starsfeed['warning'] = tra( "There was a problem trying to apply your rating" );
  41. }
  42. $gBitSmarty->assign( "starsfeed", $starsfeed );
  43.  
  44. if( $gBitThemes->isAjaxRequest() ) {
  45.     if( !empty( $_REQUEST['type'] ) ) {
  46.         $gBitSmarty->assign( 'type', $_REQUEST['type'] );
  47.     }
  48.     print $gBitSmarty->fetch( 'bitpackage:stars/stars_inline_service.tpl' );
  49. } elseif( !empty( $tmpObject ) && method_exists( $tmpObject, 'getDisplayUrl' )) {
  50.     bit_redirect( $tmpObject->getDisplayUrl() );
  51. }
  52. ?>

Documentation generated on Wed, 29 Jul 2015 13:57:18 +0000 by phpDocumentor 1.5.0-lsces