Example #1
0
<?php

$s = new LibertyStars();
$user_stars = $s->getOverallUserRating($gQueryUserId);
$gBitSmarty->assign('loadStars', true);
$gBitSmarty->assign_by_ref('user_stars', $user_stars);
Example #2
0
function stars_content_set_rating($pContentId, $pRating)
{
    global $gBitUser;
    $stars = new LibertyStars($pContentId);
    $paramHash = array();
    $paramHash['stars_rating'] = $pRating;
    if ($gBitUser->isRegistered()) {
        $stars->store($paramHash);
    }
}
Example #3
0
 * Setup
 */
require_once "../kernel/setup_inc.php";
require_once STARS_PKG_PATH . "LibertyStars.php";
$gBitSystem->verifyPackage('stars');
if (!@BitBase::verifyId($_REQUEST['content_id']) && !@BitBase::verifyId($_REQUEST['user_id'])) {
    header("Location: " . BIT_ROOT_URL);
}
if (@BitBase::verifyId($_REQUEST['content_id'])) {
    // content details
    $stars = new LibertyStars($_REQUEST['content_id']);
    $stars->loadRatingDetails();
    $gBitSmarty->assign('starsDetails', $stars->mInfo);
} elseif (@BitBase::verifyId($_REQUEST['user_id'])) {
    // user details
    $stars = new LibertyStars();
    $listHash = array('user_id' => $_REQUEST['user_id']);
    $userRatings = $stars->getList($listHash);
    // calculate this users average ratings
    $sum = 0;
    foreach ($userRatings as $rating) {
        $sum += $rating['user_rating'];
    }
    $average = round($sum / count($userRatings));
    $stars = $gBitSystem->getConfig('stars_used_in_display', 5);
    $pixels = $stars * $gBitSystem->getConfig('stars_icon_width', 22);
    $average_pixels = $average * $pixels / 100;
    $gBitSmarty->assign('average_pixels', $average_pixels);
    $gBitSmarty->assign('userRatings', $userRatings);
}
$gBitSystem->display('bitpackage:stars/details.tpl', tra('Details of Rated Content'), array('display_mode' => 'display'));
Example #4
0
<?php

/**
 * $Header$
 * date created 2006/02/10
 * @author xing <*****@*****.**>
 * @version $Revision$
 * @package superstars
 * @subpackage functions
 */
/**
 * Initialization
 */
require_once "../kernel/setup_inc.php";
require_once STARS_PKG_PATH . "LibertyStars.php";
$gBitSystem->verifyPackage('stars');
if (!@BitBase::verifyId($_REQUEST['content_id'])) {
    header("Location: " . BIT_ROOT_URL);
}
$stars = new LibertyStars($_REQUEST['content_id']);
$stars->getRatingDetails(!empty($_REQUEST['show_raters']));
$gBitSmarty->assign('starsDetails', $stars->mInfo);
$gBitSystem->display('bitpackage:stars/details.tpl', tra('Details of Rated Content'), array('display_mode' => 'display'));
Example #5
0
    foreach ($stars as $item => $data) {
        if ($data['type'] == 'numeric') {
            simple_set_int($item, STARS_PKG_NAME);
        } elseif ($data['type'] == 'toggle') {
            simple_set_toggle($item, STARS_PKG_NAME);
        } elseif ($data['type'] == 'input') {
            simple_set_value($item, STARS_PKG_NAME);
        }
        simple_set_int('stars_icon_width', STARS_PKG_NAME);
        simple_set_int('stars_icon_height', STARS_PKG_NAME);
        simple_set_value('stars_rating_names', STARS_PKG_NAME);
    }
    foreach (array_keys($formRatable['guids']) as $ratable) {
        $gBitSystem->storeConfig($ratable, !empty($_REQUEST['ratable_content']) && in_array($ratable, $_REQUEST['ratable_content']) ? 'y' : NULL, STARS_PKG_NAME);
    }
}
if (!empty($_REQUEST['recalculate'])) {
    $stars = new LibertyStars();
    if ($stars->reCalculateRating()) {
        $feedback['success'] = tra('All ratings have been brought up to speed.');
    } else {
        $feedback['error'] = tra('There was a problem updating all the ratings in your database.');
    }
}
// check the correct packages in the package selection
foreach ($gLibertySystem->mContentTypes as $cType) {
    if ($gBitSystem->getConfig('stars_rate_' . $cType['content_type_guid'])) {
        $formRatable['checked'][] = 'stars_rate_' . $cType['content_type_guid'];
    }
}
$gBitSmarty->assign('formRatable', $formRatable);
Example #6
0
* @author xing <*****@*****.**>
* @version $Revision$
* @package stars
*/
/**
 * Setup
 */
require_once "../kernel/setup_inc.php";
$gBitSystem->verifyPackage('stars');
$starsfeed = array();
if (@BitBase::verifyId($_REQUEST['content_id']) && @BitBase::verifyId($_REQUEST['stars_rating'])) {
    if ($tmpObject = LibertyBase::getLibertyObject($_REQUEST['content_id'])) {
        // check if this feature allows rating
        if ($gBitSystem->isFeatureActive('stars_rate_' . $tmpObject->getContentType())) {
            $starsfeed = array();
            $stars = new LibertyStars($tmpObject->mContentId);
            if (!$gBitUser->isRegistered()) {
                $starsfeed['error'] = tra("You need to log in to rate.");
            } else {
                if ($stars->store($_REQUEST)) {
                    //$starsfeed['success'] = tra( "Thank you for rating." );
                } else {
                    $starsfeed['error'] = $stars->mErrors;
                }
            }
        }
    }
    // get up to date reading
    $stars->load();
    $serviceHash = array_merge($tmpObject->mInfo, $stars->mInfo, $stars->getUserRating($tmpObject->mContentId));
    $gBitSmarty->assign('serviceHash', $serviceHash);
Example #7
0
/**
 * Content expunge sql service function
 * 
 * @param array $pObject 
 * @param array $pParamHash 
 * @access public
 * @return TRUE on success, FALSE on failure - mErrors will contain reason for failure
 */
function stars_content_expunge(&$pObject, &$pParamHash)
{
    $stars = new LibertyStars($pObject->mContentId);
    $stars->expunge();
}
Example #8
0
<?php

require_once "../kernel/setup_inc.php";
require_once STARS_PKG_PATH . "LibertyStars.php";
$gBitSystem->verifyPackage('stars');
$stars = new LibertyStars();
$listHash = $_REQUEST;
$ratedContent = $stars->getList($listHash);
$gBitSmarty->assign('ratedContent', $ratedContent);
$gBitSmarty->assign('listInfo', $listHash['listInfo']);
$gBitSystem->display('bitpackage:stars/rated.tpl', tra('Rated Content'), array('display_mode' => 'display'));