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


PHP BxTemplVotingView::getSqlParts方法代码示例

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


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

示例1: getMembers

 function getMembers($sBlockName, $aParams = array(), $iLimit = 16, $sMode = 'last')
 {
     $aDefFields = array('ID', 'NickName', 'Couple', 'Sex');
     $sCode = '';
     $iOnlineTime = (int) getParam("member_online_time");
     //main fields
     $sqlMainFields = "";
     foreach ($aDefFields as $iKey => $sValue) {
         $sqlMainFields .= "`Profiles`. `{$sValue}`, ";
     }
     $sqlMainFields .= "if(`DateLastNav` > SUBDATE(NOW(), INTERVAL {$iOnlineTime} MINUTE ), 1, 0) AS `is_online`";
     // possible conditions
     $sqlCondition = "WHERE `Profiles`.`Status` = 'Active' and (`Profiles`.`Couple` = 0 or `Profiles`.`Couple` > `Profiles`.`ID`)";
     if (is_array($aParams)) {
         foreach ($aParams as $sField => $sValue) {
             $sqlCondition .= " AND `Profiles`.`{$sField}` = '{$sValue}'";
         }
     }
     // top menu and sorting
     $aModes = array('last', 'top', 'online');
     $aDBTopMenu = array();
     if (empty($_GET[$sBlockName . 'Mode'])) {
         $sMode = 'last';
     } else {
         $sMode = in_array($_GET[$sBlockName . 'Mode'], $aModes) ? $_GET[$sBlockName . 'Mode'] : ($sMode = 'last');
     }
     $sqlOrder = "";
     foreach ($aModes as $sMyMode) {
         switch ($sMyMode) {
             case 'online':
                 if ($sMode == $sMyMode) {
                     $sqlCondition .= " AND `Profiles`.`DateLastNav` > SUBDATE(NOW(), INTERVAL " . $iOnlineTime . " MINUTE)";
                     $sqlOrder = " ORDER BY `Profiles`.`Couple` ASC";
                 }
                 $sModeTitle = _t('_Online');
                 break;
             case 'last':
                 if ($sMode == $sMyMode) {
                     $sqlOrder = " ORDER BY `Profiles`.`Couple` ASC, `Profiles`.`DateReg` DESC";
                 }
                 $sModeTitle = _t('_Latest');
                 break;
             case 'top':
                 if ($sMode == $sMyMode) {
                     $oVotingView = new BxTemplVotingView('profile', 0, 0);
                     $aSql = $oVotingView->getSqlParts('`Profiles`', '`ID`');
                     $sqlOrder = $oVotingView->isEnabled() ? " ORDER BY `Profiles`.`Couple` ASC, (`pr_rating_sum`/`pr_rating_count`) DESC, `pr_rating_count` DESC, `Profiles`.`DateReg` DESC" : $sqlOrder;
                     $sqlMainFields .= $aSql['fields'];
                     $sqlLJoin = $aSql['join'];
                     $sqlCondition .= " AND `pr_rating_count` > 1";
                 }
                 $sModeTitle = _t('_Top');
                 break;
         }
         $aDBTopMenu[$sModeTitle] = array('href' => BX_DOL_URL_ROOT . "index.php?{$sBlockName}Mode={$sMyMode}", 'dynamic' => true, 'active' => $sMyMode == $sMode);
     }
     if (empty($sqlLJoin)) {
         $sqlLJoin = '';
     }
     $iCount = (int) db_value("SELECT COUNT(`Profiles`.`ID`) FROM `Profiles` {$sqlLJoin} {$sqlCondition}");
     $aData = array();
     $sPaginate = '';
     if ($iCount) {
         $iLimit = (int) $iLimit > 0 ? (int) $iLimit : 8;
         $iPages = ceil($iCount / $iLimit);
         $iPage = empty($_GET['page']) ? 1 : (int) $_GET['page'];
         if ($iPage > $iPages) {
             $iPage = $iPages;
         }
         if ($iPage < 1) {
             $iPage = 1;
         }
         $sqlFrom = ($iPage - 1) * $iLimit;
         $sqlLimit = "LIMIT {$sqlFrom}, {$iLimit}";
         $sqlQuery = "SELECT " . $sqlMainFields . " FROM `Profiles` {$sqlLJoin} {$sqlCondition} {$sqlOrder} {$sqlLimit}";
         $rData = db_res($sqlQuery);
         $iCurrCount = mysql_num_rows($rData);
         $aOnline = $aTmplVars = array();
         while ($aData = mysql_fetch_assoc($rData)) {
             $aOnline['is_online'] = $aData['is_online'];
             $aTmplVars[] = array('thumbnail' => get_member_thumbnail($aData['ID'], 'none', true, 'visitor', $aOnline));
         }
         $sCode = $GLOBALS['oSysTemplate']->parseHtmlByName('members_list.html', array('bx_repeat:list' => $aTmplVars));
         if ($iPages > 1) {
             $oPaginate = new BxDolPaginate(array('page_url' => BX_DOL_URL_ROOT . 'index.php', 'count' => $iCount, 'per_page' => $iLimit, 'page' => $iPage, 'on_change_page' => 'return !loadDynamicBlock({id}, \'index.php?' . $sBlockName . 'Mode=' . $sMode . '&page={page}&per_page={per_page}\');'));
             $sPaginate = $oPaginate->getSimplePaginate(BX_DOL_URL_ROOT . 'browse.php');
         }
     } else {
         $sCode = MsgBox(_t("_Empty"));
     }
     return array($sCode, $aDBTopMenu, $sPaginate, true);
 }
开发者ID:newton27,项目名称:dolphin.pro,代码行数:92,代码来源:BxBaseIndexPageView.php

示例2: getConditionArray

 function getConditionArray($logged)
 {
     $aWhere = array();
     $aWhere[] = '1';
     $iUser = 0;
     if (isset($_GET['ownerName'])) {
         $sName = process_db_input($_GET['ownerName']);
         $iUser = (int) db_value("SELECT `ID` FROM `Profiles` WHERE `NickName`='{$sName}'");
     } elseif (isset($_GET['userID'])) {
         $iUser = (int) $_GET['userID'];
     }
     if ($iUser) {
         $aWhere[] = "`{$this->sMainTable}`.`{$this->aTableFields['medProfId']}`={$iUser}";
     }
     if (isset($_GET['tag'])) {
         $sTag = htmlspecialchars_adv($_GET['tag']);
         $aWhere[] = "`{$this->sMainTable}`.`{$this->aTableFields['medTags']}` like '%{$sTag}%'";
     }
     if (isset($_GET['action'])) {
         $sAct = htmlspecialchars_adv($_GET['action']);
         switch ($sAct) {
             case 'fav':
                 $sAddon = $this->getFavoriteCondition($this->iViewer);
                 break;
             case 'del':
                 $sAddon = '';
                 if (isset($_GET['fileID'])) {
                     $this->deleteMedia($_GET['fileID'], $logged);
                 }
                 break;
         }
     }
     $aSqlQuery['sqlWhere'] = "WHERE " . implode(' AND ', $aWhere) . $sAddon . " AND `Approved`= 'true'";
     $iTotalNum = db_value("SELECT COUNT( * ) FROM `{$this->sMainTable}` {$aSqlQuery['sqlWhere']}");
     if (!$iTotalNum) {
         return false;
     }
     $iPerPage = (int) $_GET['per_page'];
     if (!$iPerPage) {
         $iPerPage = 10;
     }
     $iTotalPages = ceil($iTotalNum / $iPerPage);
     $iCurPage = (int) $_GET['page'];
     if ($iCurPage > $iTotalPages) {
         $iCurPage = $iTotalPages;
     }
     if ($iCurPage < 1) {
         $iCurPage = 1;
     }
     $sLimitFrom = ($iCurPage - 1) * $iPerPage;
     $aSqlQuery['sqlLimit'] = "LIMIT {$sLimitFrom}, {$iPerPage}";
     $aSqlQuery['sqlOrder'] = 'ORDER BY `medDate` DESC';
     if (isset($_GET['rate'])) {
         $oVotingView = new BxTemplVotingView('g' . $this->sType, 0, 0);
         $aSql = $oVotingView->getSqlParts('`' . $this->sMainTable . '`', '`' . $this->aTableFields['medID'] . '`');
         $sHow = $_GET['rate'] == 'top' ? "DESC" : "ASC";
         $aSqlQuery['sqlOrder'] = $oVotingView->isEnabled() ? "ORDER BY `voting_rate` {$sHow}, `voting_count` {$sHow}, `medDate` {$sHow}" : $aSqlQuery['sqlOrder'];
         $aSqlQuery['rateFields'] = $aSql['fields'];
         $aSqlQuery['rateJoin'] = $aSql['join'];
     }
     return array('query' => $aSqlQuery, 'total' => $iTotalPages, 'per_page' => $iPerPage, 'cur_page' => $iCurPage);
 }
开发者ID:BackupTheBerlios,项目名称:dolphin-dwbn-svn,代码行数:62,代码来源:BxDolSharedMedia.php

示例3: PageCompPageMainCode

if (!$iPerPage) {
    $iPerPage = 10;
}
$iTotalPages = ceil($iTotalNum / $iPerPage);
$iCurPage = (int) $_GET['page'];
if ($iCurPage > $iTotalPages) {
    $iCurPage = $iTotalPages;
}
if ($iCurPage < 1) {
    $iCurPage = 1;
}
$sLimitFrom = ($iCurPage - 1) * $iPerPage;
$sqlOrderBy = 'ORDER BY `medDate` DESC';
if (isset($_GET['rate'])) {
    $oVotingView = new BxTemplVotingView('gphoto', 0, 0);
    $aSql = $oVotingView->getSqlParts('`sharePhotoFiles`', '`medID`');
    $sHow = $_GET['rate'] == 'top' ? "DESC" : "ASC";
    $sqlOrderBy = $oVotingView->isEnabled() ? "ORDER BY `voting_rate` {$sHow}, `voting_count` {$sHow}, `medDate` {$sHow}" : $sqlOrderBy;
    $sqlFields = $aSql['fields'];
    $sqlLJoin = $aSql['join'];
}
$sqlLimit = "LIMIT {$sLimitFrom}, {$iPerPage}";
$sQuery = "\r\n\tSELECT\r\n\t\t`sharePhotoFiles`.`medID`,\r\n\t\t`sharePhotoFiles`.`medProfId`,\r\n\t\t`sharePhotoFiles`.`medTitle`,\r\n\t\tUNIX_TIMESTAMP(`sharePhotoFiles`.`medDate`) as `medDate`,\r\n\t\t`sharePhotoFiles`.`medViews`,\r\n\t\t`sharePhotoFiles`.`medExt`,\r\n\t\t`Profiles`.`NickName`\r\n\t\t{$sqlFields}\r\n\tFROM `sharePhotoFiles`\r\n\tLEFT JOIN `Profiles` ON\r\n\t\t`Profiles`.`ID` = `sharePhotoFiles`.`medProfId`\r\n\t{$sqlLJoin}\r\n\t{$sqlWhere}\r\n\t{$sqlOrderBy}\r\n\t{$sqlLimit}\r\n\t";
$rData = db_res($sQuery);
$_page_cont[$_ni]['page_main_code'] = PageCompPageMainCode();
PageCode();
function PageCompPageMainCode()
{
    global $site;
    global $rData;
    global $iTotalPages;
开发者ID:BackupTheBerlios,项目名称:dolphin-dwbn-svn,代码行数:31,代码来源:browsePhoto.php

示例4: PageCompShareMusicContent

function PageCompShareMusicContent($sCaption, $iID = 0)
{
    global $site;
    $max_num = (int) getParam("top_photos_max_num");
    $mode = process_db_input(getParam("top_photos_mode"));
    $mode = $_GET['shMusicMode'];
    if ($mode != 'rand' && $mode != 'top' && $mode != 'last') {
        $mode = 'last';
    }
    $sqlSelect = "SELECT `ID` as `medID`,\r\n\t\t\t\t\t\t `Title` as `medTitle`,\r\n\t\t\t\t\t\t `Date` as `medDate`\r\n\t\t\t\t\t\t ";
    $sqlFrom = " FROM `RayMusicFiles`";
    if ($iID != 0) {
        $sqlWhere = " WHERE `Approved`='true' AND `Owner`='{$iID}'";
    }
    $menu = '<div class="dbTopMenu">';
    foreach (array('last', 'top', 'rand') as $myMode) {
        switch ($myMode) {
            case 'last':
                if ($mode == $myMode) {
                    $sqlOrder = "\r\n\t  \t\tORDER BY `medDate` DESC";
                }
                $modeTitle = _t('_Latest');
                break;
            case 'rand':
                if ($mode == $myMode) {
                    $sqlOrder = "\r\n\t  \t\tORDER BY RAND()";
                }
                $modeTitle = _t('_Random');
                break;
            case 'top':
                if ($mode == $myMode) {
                    $oVotingView = new BxTemplVotingView('gmusic', 0, 0);
                    $aSql = $oVotingView->getSqlParts('`RayMusicFiles`', '`ID`');
                    $sHow = "DESC";
                    $sqlOrderBy = $oVotingView->isEnabled() ? "ORDER BY `voting_rate` {$sHow}, `voting_count` {$sHow}, `medDate` {$sHow}" : $sqlOrderBy;
                    $sqlFields = $aSql['fields'];
                    $sqlLJoin = $aSql['join'];
                    $sqlSelect .= $sqlFields;
                    $sqlFrom .= $sqlLJoin;
                    $sqlOrder = $sqlOrderBy;
                }
                $modeTitle = _t('_Top');
                break;
        }
        //if( $_SERVER['PHP_SELF'] == 'rewrite_name.php' )
        if ($myMode == $mode) {
            $menu .= "<div class=\"active\">{$modeTitle}</div>";
        } else {
            if (basename($_SERVER['PHP_SELF']) == 'rewrite_name.php' || basename($_SERVER['PHP_SELF']) == 'profile.php') {
                $menu .= "<div class=\"notActive\"><a href=\"profile.php?ID={$iID}&shMusicMode={$myMode}\" class=\"top_members_menu\" onclick=\"getHtmlData( 'show_shareMusic', this.href+'&amp;show_only=shareMusic'); return false;\">{$modeTitle}</a></div>";
            } else {
                $menu .= "<div class=\"notActive\"><a href=\"{$_SERVER['PHP_SELF']}?shMusicMode={$myMode}\" class=\"top_members_menu\" onclick=\"getHtmlData( 'show_shareMusic', this.href+'&amp;show_only=shareMusic'); return false;\">{$modeTitle}</a></div>";
            }
        }
    }
    $menu .= '</div>';
    $aNum = db_arr("SELECT COUNT(`RayMusicFiles`.`ID`) {$sqlFrom} {$sqlWhere}");
    $num = (int) $aNum[0];
    $ret = '';
    if ($num) {
        $pages = ceil($num / $max_num);
        $page = (int) $_GET['page_p'];
        if ($page < 1 or $mode == 'rand') {
            $page = 1;
        }
        if ($page > $pages) {
            $page = $pages;
        }
        $sqlLimitFrom = ($page - 1) * $max_num;
        $sqlLimit = "\r\n\t\tLIMIT {$sqlLimitFrom}, {$max_num}";
        $rData = db_res($sqlSelect . $sqlFrom . $sqlWhere . $sqlOrder . $sqlLimit);
        $sAddon = '';
        $iCounter = 1;
        $ret .= '<div class="clear_both"></div>';
        while ($aData = mysql_fetch_array($rData)) {
            $sHref = $site['url'] . 'viewMusic.php?fileID=' . $aData['medID'];
            $sVidTitle = strlen($aData['medTitle']) > 0 ? $aData['medTitle'] : _t("_Untitled");
            $sImg = '<a href="' . $sHref . '"><img src="' . $site['images'] . 'music.png"></a>';
            $oVotingView = new BxTemplVotingView('gmusic', $aData['medID']);
            if ($oVotingView->isEnabled()) {
                $sRate = $oVotingView->getSmallVoting(0);
                $sShowRate = '<div class="galleryRate">' . $sRate . '</div>';
            }
            if ($iCounter % 3 != 0) {
                $ret .= '<div class="shareMusicContent_1">';
            } else {
                $ret .= '<div class="shareMusicContent_2">';
                $sAddon = '<div class="clear_both"></div>';
            }
            $ret .= '<div class="lastMusicPic">' . $sImg . '</div>';
            $ret .= '<div><a href="' . $sHref . '">' . $sVidTitle . '</a></div>';
            $ret .= $sShowRate . '</div>';
            $ret .= $sAddon;
            $sAddon = '';
            $iCounter++;
        }
        $ret .= '<div class="clear_both"></div>';
        $ret = DesignBoxContent(_t($sCaption), $ret, 1, $menu);
    }
    return $ret;
//.........这里部分代码省略.........
开发者ID:BackupTheBerlios,项目名称:dolphin-dwbn-svn,代码行数:101,代码来源:sharing.inc.php

示例5: getParam

 function getBlockCode_Members()
 {
     global $tmpl;
     // number of profiles
     $max_num = (int) getParam("top_members_max_num");
     //	Get Sex from GET data
     if ($_GET['Sex'] && $_GET['Sex'] != "all") {
         $sex = process_db_input($_GET['Sex']);
         $query_add = " AND `Sex` = '{$sex}'";
     } else {
         $sex = "all";
         $query_add = "";
     }
     $query_add .= ' AND (`Couple`=0 OR `Couple`>`ID`)';
     $query = "\r\n\t\t\tSELECT\r\n\t\t\t\t`Profiles`.*\r\n\t\t\t";
     if ($_GET['members_mode'] == 'online' or $_GET['members_mode'] == 'rand' or $_GET['members_mode'] == 'last' or $_GET['members_mode'] == 'top') {
         $mode = $_GET['members_mode'];
     } else {
         $mode = 'last';
     }
     $aDBTopMenu = array();
     //$menu = '<div class="dbTopMenu">';
     foreach (array('last', 'top', 'online', 'rand') as $myMode) {
         switch ($myMode) {
             case 'online':
                 if ($mode == $myMode) {
                     $filter = " FROM `Profiles` WHERE `DateLastNav` > SUBDATE(NOW(), INTERVAL " . (int) getParam("member_online_time") . " MINUTE) AND `Status` = 'Active' AND `PrimPhoto` != 0 {$query_add} ORDER BY `Couple` ASC";
                 }
                 $modeTitle = _t('_Online');
                 break;
             case 'rand':
                 if ($mode == $myMode) {
                     $filter = " FROM `Profiles` WHERE `Status` = 'Active' AND `PrimPhoto` != 0 {$query_add} ORDER BY `Couple` ASC, RAND()";
                 }
                 $modeTitle = _t('_Random');
                 break;
             case 'last':
                 if ($mode == $myMode) {
                     $filter = " FROM `Profiles` WHERE `Status` = 'Active' {$query_add} ORDER BY `Couple` ASC, `DateReg` DESC";
                 }
                 $modeTitle = _t('_Latest');
                 break;
             case 'top':
                 if ($mode == $myMode) {
                     $oVotingView = new BxTemplVotingView('profile', 0, 0);
                     $aSql = $oVotingView->getSqlParts('`Profiles`', '`ID`');
                     $sqlOrderBy = $oVotingView->isEnabled() ? " ORDER BY `Couple` ASC, (`pr_rating_sum`/`pr_rating_count`) DESC, `pr_rating_count` DESC, `DateReg` DESC" : $sqlOrderBy;
                     $sqlFields = $aSql['fields'];
                     $sqlLJoin = $aSql['join'];
                     $filter = "{$sqlFields} FROM `Profiles` {$sqlLJoin} WHERE `Status` = 'Active' AND `pr_rating_count` > 2 {$query_add} {$sqlOrderBy}";
                     $filter2 = " FROM `Profiles` {$sqlLJoin} WHERE `Status` = 'Active' AND `pr_rating_count` > 2 {$query_add} {$sqlOrderBy}";
                 }
                 $modeTitle = _t('_Top');
                 break;
         }
         $aDBTopMenu[$modeTitle] = array('href' => "{$_SERVER['PHP_SELF']}?members_mode={$myMode}", 'dynamic' => true, 'active' => $myMode == $mode);
         /*if( $myMode == $mode )
         			$menu .= "<div class=\"active\">$modeTitle</a></div>";
         		else
         			$menu .= "<div class=\"notActive\"><a href=\"{$_SERVER['PHP_SELF']}?members_mode=$myMode&amp;Sex=$sex\" class=\"top_members_menu\" onclick=\"getHtmlData( 'show_members', this.href+'&amp;show_only=members'); return false;\">$modeTitle</a></div>";*/
     }
     /*$menu .= '<div class="clear_both"></div>';
     		$menu .= '</div>';*/
     $ret = '';
     $aNum = db_arr("SELECT COUNT(`Profiles`.`ID`) " . (isset($filter2) ? $filter2 : $filter));
     $num = (int) $aNum[0];
     if ($num) {
         $pages = ceil($num / $max_num);
         $page = (int) $_GET['page'];
         if ($page < 1 or $mode == 'rand') {
             $page = 1;
         }
         if ($page > $pages) {
             $page = $pages;
         }
         $sqlFrom = ($page - 1) * $max_num;
         $limit = " LIMIT {$sqlFrom}, {$max_num}";
         $templ_search = file_get_contents("{$dir['root']}templates/tmpl_{$tmpl}/topmebers_index.html");
         $result = db_res($query . $filter . $limit);
         $iCounter = 1;
         $ret .= '<div class="clear_both"></div>';
         while ($p_arr = mysql_fetch_array($result)) {
             $ret .= PrintSearhResult($p_arr, $templ_search, 3);
             /*if( ($iCounter % 3) != 0 )
             			$ret .= PrintSearhResult( $p_arr, $templ_search, 1 );
             		else
             			$ret .= PrintSearhResult( $p_arr, $templ_search, 2 );
             		$iCounter++;*/
         }
         $ret .= '<div class="clear_both"></div>';
         $aDBBottomMenu = array();
         if ($pages > 1) {
             //$ret .= '<div class="dbBottomMenu">';
             if ($page > 1) {
                 $prevPage = $page - 1;
                 $aDBBottomMenu[_t('_Back')] = array('href' => "{$_SERVER['PHP_SELF']}?members_mode={$mode}&amp;page={$prevPage}", 'dynamic' => true, 'class' => 'backMembers');
                 /*$ret .= "
                 			<a href=\"{$_SERVER['PHP_SELF']}?members_mode=$mode&amp;page=$prevPage\"
                 			  class=\"backMembers\"
                 			  onclick=\"getHtmlData( 'show_members', this.href+'&amp;show_only=members'); return false;\">"._t('_Back')."</a>
//.........这里部分代码省略.........
开发者ID:BackupTheBerlios,项目名称:dolphin-dwbn-svn,代码行数:101,代码来源:BxBaseIndex.php

示例6: PageCompTopMembersContent

function PageCompTopMembersContent($sCaption)
{
    global $tmpl;
    // number of profiles
    $max_num = (int) getParam("top_members_max_num");
    //	Get Sex from GET data
    if ($_GET['Sex'] && $_GET['Sex'] != "all") {
        $sex = process_db_input($_GET['Sex']);
        $query_add = " AND `Sex` = '{$sex}'";
    } else {
        $sex = "all";
        $query_add = "";
    }
    $query = "\r\n\t\tSELECT\r\n\t\t\t`Profiles`.*\r\n\t\t";
    if ($_GET['Mode'] == 'online' or $_GET['Mode'] == 'rand' or $_GET['Mode'] == 'last' or $_GET['Mode'] == 'top') {
        $mode = $_GET['Mode'];
    } else {
        $mode = 'last';
    }
    $menu = '<div class="dbTopMenu">';
    foreach (array('last', 'top', 'online', 'rand') as $myMode) {
        switch ($myMode) {
            case 'online':
                if ($mode == $myMode) {
                    $filter = " FROM `Profiles` WHERE `LastNavTime` > SUBDATE(NOW(), INTERVAL " . (int) getParam("member_online_time") . " MINUTE) AND `Status` = 'Active' AND `PrimPhoto` != 0 {$query_add}";
                }
                $modeTitle = _t('_Online');
                break;
            case 'rand':
                if ($mode == $myMode) {
                    $filter = " FROM `Profiles` WHERE `Status` = 'Active' AND `PrimPhoto` != 0 {$query_add} ORDER BY RAND()";
                }
                $modeTitle = _t('_Random');
                break;
            case 'last':
                if ($mode == $myMode) {
                    $filter = " FROM `Profiles` WHERE `Status` = 'Active' {$query_add} ORDER BY `LastReg` DESC";
                }
                $modeTitle = _t('_Latest');
                break;
            case 'top':
                if ($mode == $myMode) {
                    $oVotingView = new BxTemplVotingView('profile', 0, 0);
                    $aSql = $oVotingView->getSqlParts('`Profiles`', '`ID`');
                    $sqlOrderBy = $oVotingView->isEnabled() ? " ORDER BY (`pr_rating_sum`/`pr_rating_count`) DESC, `pr_rating_count` DESC, `LastReg` DESC" : $sqlOrderBy;
                    $sqlFields = $aSql['fields'];
                    $sqlLJoin = $aSql['join'];
                    $filter = "{$sqlFields} FROM `Profiles` {$sqlLJoin} WHERE `Status` = 'Active' AND `pr_rating_count` > 2 {$query_add} {$sqlOrderBy}";
                    $filter2 = " FROM `Profiles` {$sqlLJoin} WHERE `Status` = 'Active' AND `pr_rating_count` > 2 {$query_add} {$sqlOrderBy}";
                }
                $modeTitle = _t('_Top');
                break;
        }
        if ($myMode == $mode) {
            $menu .= "<div class=\"active\">{$modeTitle}</a></div>";
        } else {
            $menu .= "<div class=\"notActive\"><a href=\"{$_SERVER['PHP_SELF']}?Mode={$myMode}&amp;Sex={$sex}\" class=\"top_members_menu\" onclick=\"getHtmlData( 'show_members', this.href+'&amp;show_only=members'); return false;\">{$modeTitle}</a></div>";
        }
    }
    $menu .= '<div class="clear_both"></div>';
    $menu .= '</div>';
    $ret = '';
    $aNum = db_arr("SELECT COUNT(`Profiles`.`ID`) " . (isset($filter2) ? $filter2 : $filter));
    $num = (int) $aNum[0];
    if ($num) {
        $pages = ceil($num / $max_num);
        $page = (int) $_GET['page'];
        if ($page < 1 or $mode == 'rand') {
            $page = 1;
        }
        if ($page > $pages) {
            $page = $pages;
        }
        $sqlFrom = ($page - 1) * $max_num;
        $limit = " LIMIT {$sqlFrom}, {$max_num}";
        $templ_search = file_get_contents("{$dir['root']}templates/tmpl_{$tmpl}/topmebers_index.html");
        $result = db_res($query . $filter . $limit);
        $iCounter = 1;
        $ret .= '<div class="clear_both"></div>';
        while ($p_arr = mysql_fetch_array($result)) {
            if ($iCounter % 3 != 0) {
                $ret .= PrintSearhResult($p_arr, $templ_search, 1);
            } else {
                $ret .= PrintSearhResult($p_arr, $templ_search, 2);
            }
            $iCounter++;
        }
        $ret .= '<div class="clear_both"></div>';
        if ($pages > 1) {
            $ret .= '<div class="dbBottomMenu">';
            if ($page > 1) {
                $prevPage = $page - 1;
                $ret .= "\r\n\t\t\t\t\t<a href=\"{$_SERVER['PHP_SELF']}?Mode={$mode}&amp;page={$prevPage}\"\r\n\t\t\t\t\t  class=\"backMembers\"\r\n\t\t\t\t\t  onclick=\"getHtmlData( 'show_members', this.href+'&amp;show_only=members'); return false;\">" . _t('_Back') . "</a>\r\n\t\t\t\t";
            }
            if ($page < $pages) {
                $nextPage = $page + 1;
                $ret .= "\r\n\t\t\t\t\t<a href=\"{$_SERVER['PHP_SELF']}?Mode={$mode}&amp;page={$nextPage}\"\r\n\t\t\t\t\t  class=\"moreMembers\"\r\n\t\t\t\t\t  onclick=\"getHtmlData( 'show_members', this.href+'&amp;show_only=members'); return false;\">" . _t('_Next') . "</a>\r\n\t\t\t\t";
            }
            $ret .= '</div>';
        }
//.........这里部分代码省略.........
开发者ID:BackupTheBerlios,项目名称:dolphin-dwbn-svn,代码行数:101,代码来源:index.php


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