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


PHP BxTemplVotingView::getTopVotedItem方法代码示例

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


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

示例1: BxTemplVotingView

 /**
  * Top Rated Profiles block (Leaders)
  */
 function getBlockCode_Leaders()
 {
     global $site;
     global $max_voting_mark;
     global $index_progressbar_w;
     global $getBlockCode_TopRated_db_num;
     global $max_thumb_height;
     global $max_thumb_width;
     global $oTemplConfig;
     // most rated profiles
     // $rate_max = get_max_votes_profile();
     $oVoting = new BxTemplVotingView('profile', 0, 0);
     $iIdMonth = $oVoting->getTopVotedItem(30, '`Profiles`', '`ID`', "AND `Profiles`.`Status` = 'Active'");
     $iIdWeek = $oVoting->getTopVotedItem(7, '`Profiles`', '`ID`', "AND `Profiles`.`Status` = 'Active' AND `ID`<>{$iIdMonth}");
     $iIdDay = $oVoting->getTopVotedItem(1, '`Profiles`', '`ID`', "AND `Profiles`.`Status` = 'Active' AND `ID`<>{$iIdMonth} AND `ID`<>{$iIdWeek}");
     $oVotingMonth = new BxTemplVotingView('profile', $iIdMonth);
     $oVotingWeek = new BxTemplVotingView('profile', $iIdWeek);
     $oVotingDay = new BxTemplVotingView('profile', $iIdDay);
     $rate_memb_month = getProfileInfo($iIdMonth);
     //db_arr( "SELECT Headline, NickName, ID, Pic_0_addon FROM Profiles WHERE `ID` = '$iIdMonth' LIMIT 1" );
     $rate_memb_week = getProfileInfo($iIdWeek);
     //db_arr( "SELECT Headline, NickName, ID, Pic_0_addon FROM Profiles WHERE `ID` = '$iIdWeek' LIMIT 1" );
     $rate_memb_day = getProfileInfo($iIdDay);
     //db_arr( "SELECT Headline, NickName, ID, Pic_0_addon FROM Profiles WHERE `ID` = '$iIdDay' LIMIT 1" );
     //$rate_memb_month  = db_arr( "SELECT Headline, NickName, Member, COUNT(*) AS `count`, SUM(Mark)/COUNT(*) AS mark, ID, Pic_0_addon  FROM `Votes` INNER JOIN Profiles ON (ID = Member) WHERE Status = 'Active' AND TO_DAYS(NOW()) - TO_DAYS(`Date`) <= 30 GROUP BY Member ORDER BY Mark DESC,`count` DESC LIMIT 1" );
     //$rate_memb_week   = db_arr( "SELECT Headline, NickName, Member, COUNT(*) AS `count`, SUM(Mark)/COUNT(*) AS mark, ID, Pic_0_addon  FROM `Votes` INNER JOIN Profiles ON (ID = Member) WHERE Status = 'Active' AND TO_DAYS(NOW()) - TO_DAYS(`Date`) <= 7 GROUP BY Member ORDER BY Mark DESC,`count` DESC LIMIT 1" );
     $ret = '';
     //#####################################################################
     $ret .= '<div class="clear_both"></div>';
     $ret .= '<div id="prof_of_month">';
     $ret .= '<div class="top_rated_head">';
     $ret .= _t("_Month");
     $ret .= '</div>';
     if (0 < $rate_memb_month['ID']) {
         $ret .= get_member_thumbnail($rate_memb_month['ID'], 'none');
         $ret .= '<div class="rate_block_position">';
         $ret .= $oVotingMonth->getSmallVoting(0);
         $ret .= '</div>';
     } else {
         $ret .= '<div class="top_prof_not_avail">';
         $ret .= '<div class="no_result">';
         $ret .= '<div>';
         $ret .= _t("_no_top_month");
         $ret .= '</div>';
         $ret .= '</div>';
         $ret .= '</div>';
     }
     $ret .= '<div class="clear_both"></div></div>';
     //#####################################################################
     $ret .= '<div id="prof_of_week">';
     $ret .= '<div class="top_rated_head">';
     $ret .= _t("_Week");
     $ret .= '</div>';
     if (0 < $rate_memb_week['ID']) {
         $ret .= get_member_thumbnail($rate_memb_week['ID'], 'none');
         $ret .= '<div class="rate_block_position">';
         $ret .= $oVotingWeek->getSmallVoting(0);
         $ret .= '</div>';
     } else {
         $ret .= '<div class="top_prof_not_avail">';
         $ret .= '<div class="no_result">';
         $ret .= '<div>';
         $ret .= _t("_no_top_week");
         $ret .= '</div>';
         $ret .= '</div>';
         $ret .= '</div>';
     }
     $ret .= '<div class="clear_both"></div></div>';
     //#####################################################################
     $ret .= '<div id="prof_of_day">';
     $ret .= '<div class="top_rated_head">';
     $ret .= _t("_Day");
     $ret .= '</div>';
     if (0 < $rate_memb_day['ID']) {
         $ret .= get_member_thumbnail($rate_memb_day['ID'], 'none');
         $ret .= '<div class="rate_block_position">';
         $ret .= $oVotingDay->getSmallVoting(0);
         $ret .= '</div>';
     } else {
         $ret .= '<div class="top_prof_not_avail">';
         $ret .= '<div class="no_result">';
         $ret .= '<div>';
         $ret .= _t("_no_top_day");
         $ret .= '</div>';
         $ret .= '</div>';
         $ret .= '</div>';
     }
     $ret .= '<div class="clear_both"></div></div>';
     $ret .= '<div class="clear_both"></div>';
     return $ret;
 }
开发者ID:BackupTheBerlios,项目名称:dolphin-dwbn-svn,代码行数:94,代码来源:BxBaseIndex.php

示例2: array

    /**
     * Top Rated Profiles block (Leaders)
     */
    function getBlockCode_Leaders()
    {
        $sLeaders = $sLeaderValues = '';
        $aPreferSex = array();
        $sPeriodTypesMale = getParam('leaders_male_types');
        $sPeriodTypesFemale = getParam('leaders_female_types');
        if ($sPeriodTypesMale == '' || $sPeriodTypesFemale == '') {
            return;
        }
        $sCurrentMode = !empty($_GET['leaders_mode']) && ($_GET['leaders_mode'] == 'all' || $_GET['leaders_mode'] == 'male' || $_GET['leaders_mode'] == 'female') ? $_GET['leaders_mode'] : 'all';
        $aDBTopMenu = array();
        foreach (array('all', 'male', 'female') as $sEachMode) {
            switch ($sEachMode) {
                case 'all':
                    if ($sCurrentMode == $sEachMode) {
                        $aPreferSex[] = 'male';
                        $aPreferSex[] = 'female';
                    }
                    $sModeTitle = _t('_All');
                    break;
                case 'male':
                    if ($sCurrentMode == $sEachMode) {
                        $aPreferSex[] = 'male';
                    }
                    $sModeTitle = _t('_By Male');
                    break;
                case 'female':
                    if ($sCurrentMode == $sEachMode) {
                        $aPreferSex[] = 'female';
                    }
                    $sModeTitle = _t('_By Female');
                    break;
            }
            $aDBTopMenu[$sModeTitle] = array('href' => BX_DOL_URL_ROOT . "index.php?leaders_mode={$sEachMode}", 'dynamic' => true, 'active' => $sEachMode == $sCurrentMode);
        }
        $aPeriodTypesMale = explode(',', $sPeriodTypesMale);
        $aPeriodTypesFemale = explode(',', $sPeriodTypesFemale);
        $oVoting = new BxTemplVotingView('profile', 0, 0);
        $aLeadersList = array();
        $aPeriodTypes = array();
        $iIDYear = $iIDMonth = $iIDWeek = $iIDDay = 0;
        foreach ($aPreferSex as $sSex) {
            $aPeriodTypes[$sSex] = $sSex == 'male' ? $aPeriodTypesMale : $aPeriodTypesFemale;
            foreach ($aPeriodTypes[$sSex] as $sPeriodType) {
                switch ($sPeriodType) {
                    case 'year':
                        $iIDYear = $oVoting->getTopVotedItem(365, '`Profiles`', '`ID`', "AND `Profiles`.`Status` = 'Active' AND `Profiles`.`Sex` = '{$sSex}'");
                        $aLeadersList[$sSex]['year'] = $iIDYear;
                        break;
                    case 'month':
                        $sYearAddon = $iIDYear ? "AND `ID`<>'{$iIDYear}'" : '';
                        $iIDMonth = $oVoting->getTopVotedItem(30, '`Profiles`', '`ID`', "AND `Profiles`.`Status` = 'Active' {$sYearAddon} AND `Profiles`.`Sex` = '{$sSex}'");
                        $aLeadersList[$sSex]['month'] = $iIDMonth;
                        break;
                    case 'week':
                        $sYearAddon = $iIDYear ? "AND `ID`<>'{$iIDYear}'" : '';
                        $sMonthAddon = $iIDMonth ? "AND `ID`<>'{$iIDMonth}'" : '';
                        $iIDWeek = $oVoting->getTopVotedItem(7, '`Profiles`', '`ID`', "AND `Profiles`.`Status` = 'Active' {$sYearAddon} {$sMonthAddon} AND `Profiles`.`Sex` = '{$sSex}'");
                        $aLeadersList[$sSex]['week'] = $iIDWeek;
                        break;
                    case 'day':
                        $sYearAddon = $iIDYear ? "AND `ID`<>'{$iIDYear}'" : '';
                        $sMonthAddon = $iIDMonth ? "AND `ID`<>'{$iIDMonth}'" : '';
                        $sWeekAddon = $iIDWeek ? "AND `ID`<>'{$iIDWeek}'" : '';
                        $iIDDay = $oVoting->getTopVotedItem(1, '`Profiles`', '`ID`', "AND `Profiles`.`Status` = 'Active' {$sYearAddon} {$sMonthAddon} {$sWeekAddon} AND `Profiles`.`Sex` = '{$sSex}'");
                        $aLeadersList[$sSex]['day'] = $iIDDay;
                        break;
                }
            }
            $sLeaderValues .= $this->genLeaderPack($aLeadersList[$sSex], $sSex);
        }
        $sLeaders = <<<EOF
<div class="clear_both"></div>
\t{$sLeaderValues}
<div class="clear_both"></div>
EOF;
        $sLeaderMembers = $GLOBALS['oFunctions']->centerContent($sLeaders, '.featured_block_1');
        return array($sLeaderMembers, $aDBTopMenu);
    }
开发者ID:dalinhuang,项目名称:shopexts,代码行数:82,代码来源:BxBaseIndexPageView.php


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