当前位置: 首页>>代码示例>>PHP>>正文


PHP NewsStory::rating方法代码示例

本文整理汇总了PHP中NewsStory::rating方法的典型用法代码示例。如果您正苦于以下问题:PHP NewsStory::rating方法的具体用法?PHP NewsStory::rating怎么用?PHP NewsStory::rating使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在NewsStory的用法示例。


在下文中一共展示了NewsStory::rating方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: b_news_top_show

/**
 * Notes about the spotlight :
 * If you have restricted topics on index page (in fact if the program must completly respect the permissions) and if
 * the news you have selected to be viewed in the spotlight can't be viewed by someone then the spotlight is not visible !
 * This is available in the classical and in the tabbed view.
 * But if you have uncheck the option "Restrict topics on index page", then the news will be visible but users without
 * permissions will be rejected when they will try to read news content.
 *
 * Also, if you have selected a tabbed view and wanted to use the Spotlight but did not choosed a story, then the block
 * will switch to the "most recent news" mode (the visible news will be searched according to the permissions)
 */
function b_news_top_show($options)
{
    global $xoopsConfig;
    include_once XOOPS_ROOT_PATH . '/modules/news/include/functions.php';
    $myts =& MyTextSanitizer::getInstance();
    $block = array();
    $displayname = news_getmoduleoption('displayname');
    $tabskin = news_getmoduleoption('tabskin');
    if (file_exists(XOOPS_ROOT_PATH . '/modules/news/language/' . $xoopsConfig['language'] . '/main.php')) {
        include_once XOOPS_ROOT_PATH . '/modules/news/language/' . $xoopsConfig['language'] . '/main.php';
    } else {
        include_once XOOPS_ROOT_PATH . '/modules/news/language/english/main.php';
    }
    $block['displayview'] = $options[8];
    $block['tabskin'] = $tabskin;
    $block['imagesurl'] = XOOPS_URL . '/modules/news/images/';
    $restricted = news_getmoduleoption('restrictindex');
    $dateformat = news_getmoduleoption('dateformat');
    $infotips = news_getmoduleoption('infotips');
    $newsrating = news_getmoduleoption('ratenews');
    if ($dateformat == '') {
        $dateformat = 's';
    }
    $perm_verified = false;
    $news_visible = true;
    // Is the spotlight visible ?
    if ($options[4] == 1 && $restricted && $options[5] == 0) {
        $perm_verified = true;
        $permittedtopics = news_MygetItemIds();
        $permstory = new NewsStory($options[6]);
        if (!in_array($permstory->topicid(), $permittedtopics)) {
            $usespotlight = false;
            $news_visible = false;
            $topicstitles = array();
        }
        $options[4] == 0;
    }
    // Try to see what tabs are visibles (if we are in restricted view of course)
    if ($options[8] == 2 && $restricted && $options[14] != 0) {
        $topics2 = array();
        $permittedtopics = news_MygetItemIds();
        $topics = array_slice($options, 14);
        foreach ($topics as $onetopic) {
            if (in_array($onetopic, $permittedtopics)) {
                $topics2[] = $onetopic;
            }
        }
        $before = array_slice($options, 0, 14);
        $options = array_merge($before, $topics2);
    }
    if ($options[8] == 2) {
        // Tabbed view ********************************************************************************************
        $defcolors[1] = array('#F90', '#FFFFFF', '#F90', '#C60', '#999');
        // Bar Style
        $defcolors[2] = array('#F90', '#FFFFFF', '#F90', '#AAA', '#666');
        // Beveled
        $defcolors[3] = array('#F90', '#FFFFFF', '', '#789', '#789');
        // Classic
        $defcolors[4] = array('#F90', '#FFFFFF', '', '', '');
        // Folders
        $defcolors[5] = array('#F90', '#FFFFFF', '#CCC', 'inherit', '#999');
        // MacOs
        $defcolors[6] = array('#F90', '#FFFFFF', '#FFF', '#DDD', '#999');
        // Plain
        $defcolors[7] = array('#F90', '#FFFFFF', '', '', '');
        // Rounded
        $defcolors[8] = array('#F90', '#FFFFFF', '#F90', '#930', '#C60');
        // ZDnet
        $myurl = $_SERVER['PHP_SELF'];
        if (substr($myurl, strlen($myurl) - 1, 1) == '/') {
            $myurl .= 'index.php';
        }
        $myurl .= '?';
        foreach ($_GET as $key => $value) {
            if ($key != 'NewsTab') {
                $myurl .= $key . '=' . $value . '&';
            }
        }
        $block['url'] = $myurl;
        $tabscount = 0;
        $usespotlight = false;
        if (isset($_GET['NewsTab'])) {
            $_SESSION['NewsTab'] = intval($_GET['NewsTab']);
            $currenttab = intval($_GET['NewsTab']);
        } elseif (isset($_SESSION['NewsTab'])) {
            $currenttab = intval($_SESSION['NewsTab']);
        } else {
            $currenttab = 0;
        }
//.........这里部分代码省略.........
开发者ID:trabisdementia,项目名称:xuups,代码行数:101,代码来源:news_top.php

示例2: getmoduleoption

$sitenavbar = getmoduleoption('sitenavbar');
if ($sitenavbar) {
    $xoopsTpl->assign("xoops_module_header", CreateSiteNavBar());
}
/**
* Enable users to vote
*
* According to a module's option, "ratenews", you can display a link to rate the current news
* The actual rate in showed (and the number of votes)
* Possible modification, restrict votes to registred users
*/
if (getmoduleoption('ratenews')) {
    $xoopsTpl->assign('rates', true);
    $xoopsTpl->assign('lang_ratingc', _NW_RATINGC);
    $xoopsTpl->assign('lang_ratethisnews', _NW_RATETHISNEWS);
    $story['rating'] = number_format($article->rating(), 2);
    if ($article->votes == 1) {
        $story['votes'] = _NW_ONEVOTE;
    } else {
        $story['votes'] = sprintf(_NW_NUMVOTES, $article->votes);
    }
} else {
    $xoopsTpl->assign('rates', false);
}
$xoopsTpl->assign('story', $story);
/**
* META Keywords and description
*
* If you have set this module's option to 'yes' and if the information was entered, then they are rendered in the page else they are computed
*/
if (trim($article->keywords()) != '') {
开发者ID:BackupTheBerlios,项目名称:soopa,代码行数:31,代码来源:article.php


注:本文中的NewsStory::rating方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。