/**
 * 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 recommends_content_expunge(&$pObject, &$pParamHash)
{
    $recommends = new LibertyRecommends($pObject->mContentId);
    $recommends->expunge();
}
<?php

$recommends = new LibertyRecommends();
$listHash = array('user_id' => $gQueryUserId);
$userRecommendings = $recommends->getList($listHash);
// calculate this users average recommending
$sum = 0;
foreach ($userRecommendings as $recommending) {
    $sum += $recommending['user_recommending'];
}
if (count($userRecommendings) > 0) {
    $average = round($sum / count($userRecommendings));
} else {
    $average = 0;
}
$recommends = $gBitSystem->getConfig('recommends_used_in_display', 2);
$pixels = $recommends * $gBitSystem->getConfig('recommends_icon_width', 48);
$average_pixels = $average * $pixels / 100;
$gBitSmarty->assign('average_pixels', $average_pixels);
Example #3
0
* @author xing <*****@*****.**>
* @version $Revision$
* @package recommends
*/
/**
 * Setup
 */
require_once "../kernel/setup_inc.php";
$gBitSystem->verifyPackage('recommends');
$recommendsfeed = array();
if (@BitBase::verifyId($_REQUEST['content_id']) && isset($_REQUEST['recommends_recommending'])) {
    if ($tmpObject = LibertyBase::getLibertyObject($_REQUEST['content_id'])) {
        // check if this feature allows recommending
        if ($gBitSystem->isFeatureActive('recommends_recommend_' . $tmpObject->getContentType())) {
            $recommendsfeed = array();
            $recommends = new LibertyRecommends($tmpObject->mContentId);
            if (!$gBitUser->isRegistered()) {
                $recommendsfeed['error'] = tra("You need to log in to recommend.");
            } else {
                if ($recommends->store($_REQUEST)) {
                    //$recommendsfeed['success'] = tra( "Thank you for recommending." );
                } else {
                    $recommendsfeed['error'] = $recommends->mErrors;
                }
            }
        }
    }
    // get up to date reading
    $recommends->load();
    $serviceHash = array_merge($tmpObject->mInfo, $recommends->mInfo);
    $gBitSmarty->assign('serviceHash', $serviceHash);
Example #4
0
<?php

require_once "../kernel/setup_inc.php";
require_once RECOMMENDS_PKG_PATH . "LibertyRecommends.php";
$gBitSystem->verifyPackage('recommends');
$recommends = new LibertyRecommends();
$listHash = $_REQUEST;
if ($gBitSystem->isFeatureActive('recommends_timeout_days')) {
    $listHash['timeout'] = $gBitSystem->getUTCTime() - $gBitSystem->getConfig('recommends_timout_days', 15) * RECOMMENDS_TIMEOUT_DAYS_SCALE;
}
$listHash['recommends'] = $gBitSystem->getConfig('recommends_minimum_recommends', '10');
$recommendedContent = $recommends->getList($listHash);
$gBitSmarty->assign('recommendedContent', $recommendedContent);
$gBitSmarty->assign('listInfo', $listHash['listInfo']);
$contentType = 'Content';
$contentTypes = array('' => 'All Content');
$contentSelect = '';
foreach ($gLibertySystem->mContentTypes as $cType) {
    if ($gBitSystem->isFeatureActive('recommends_recommend_' . $cType['content_type_guid'])) {
        $contentTypes[$cType['content_type_guid']] = $gLibertySystem->getContentTypeName($cType['content_type_guid']);
        if (isset($_REQUEST['content_type']) && $_REQUEST['content_type'] == $cType['content_type_guid']) {
            $contentType = $gLibertySystem->getContentTypeName($cType['content_type_guid'], TRUE);
            $contentSelect = $cType['content_type_guid'];
        }
    }
}
$gBitSmarty->assign('recommendContentTypes', $contentTypes);
$gBitSmarty->assign_by_ref('listInfo', $_REQUEST['listInfo']);
$gBitSmarty->assign('contentType', $contentType);
$gBitSmarty->assign('contentSelect', $contentSelect);
$gBitSystem->display('bitpackage:recommends/recommended.tpl', tra('Recommended Content'), array('display_mode' => 'display'));