diff options
| author | Max Kremmel <xing@synapse.plus.com> | 2006-02-04 10:10:51 +0000 |
|---|---|---|
| committer | Max Kremmel <xing@synapse.plus.com> | 2006-02-04 10:10:51 +0000 |
| commit | d70cad558ad944ef547075b50d8aa732907ee917 (patch) | |
| tree | e5ed2a0a19ac5016fcc49d2ed123776ef441089d /rankings.php | |
| parent | 97320f00188ad31412bc35ca1c483ec7987d2d9d (diff) | |
| download | wiki-d70cad558ad944ef547075b50d8aa732907ee917.tar.gz wiki-d70cad558ad944ef547075b50d8aa732907ee917.tar.bz2 wiki-d70cad558ad944ef547075b50d8aa732907ee917.zip | |
remove rankings from kernel, unify rankings in single function: LibertyContent::getContentRanking()
move blog ranking stuff to blogs - need to wait till blogs are part of Liberty before we can apply this approach
fix LibertyContent::getAuthorsList() to return more than one entry.
Diffstat (limited to 'rankings.php')
| -rw-r--r-- | rankings.php | 86 |
1 files changed, 43 insertions, 43 deletions
diff --git a/rankings.php b/rankings.php index 44564d1..58f0b03 100644 --- a/rankings.php +++ b/rankings.php @@ -1,6 +1,6 @@ <?php /** - * $Header: /cvsroot/bitweaver/_bit_wiki/rankings.php,v 1.5 2006/01/27 21:57:53 squareing Exp $ + * $Header: /cvsroot/bitweaver/_bit_wiki/rankings.php,v 1.6 2006/02/04 10:10:51 squareing Exp $ * * Copyright (c) 2004 bitweaver.org * Copyright (c) 2003 tikwiki.org @@ -8,7 +8,7 @@ * All Rights Reserved. See copyright.txt for details and a complete list of authors. * Licensed under the GNU LESSER GENERAL PUBLIC LICENSE. See license.txt for details * - * $Id: rankings.php,v 1.5 2006/01/27 21:57:53 squareing Exp $ + * $Id: rankings.php,v 1.6 2006/02/04 10:10:51 squareing Exp $ * @package wiki * @subpackage functions */ @@ -17,56 +17,56 @@ * required setup */ require_once( '../bit_setup_inc.php' ); -include_once( KERNEL_PKG_PATH.'rank_lib.php' ); $gBitSystem->verifyPackage( 'wiki' ); $gBitSystem->verifyFeature( 'feature_wiki_rankings' ); $gBitSystem->verifyPermission( 'bit_p_view' ); -// Get the page from the request var or default it to HomePage -if (!isset($_REQUEST["limit"])) { - $limit = 10; -} else { - $limit = $_REQUEST["limit"]; -} -$allrankings = array( +$rankingOptions = array( array( - 'name' => tra('Most often viewed pages'), - 'value' => 'wiki_ranking_top_pages' -), + 'output' => tra( 'Most Often Viewed' ), + 'value' => 'hits_desc' + ), array( - 'name' => tra('Most recently modified pages'), - 'value' => 'wiki_ranking_last_pages' -), + 'output' => tra( 'Most Recently Modified' ), + 'value' => 'last_modified_desc' + ), array( - 'name' => tra('Most relevant pages'), - 'value' => 'wiki_ranking_top_pagerank' -), - array( - 'name' => tra('Most active authors'), - 'value' => 'wiki_ranking_top_authors' -) + 'output' => tra( 'Most Active Authors' ), + 'value' => 'top_authors' + ), ); -$gBitSmarty->assign('allrankings', $allrankings); -if (!isset($_REQUEST["which"])) { - $which = 'wiki_ranking_top_pages'; +$gBitSmarty->assign( 'rankingOptions', $rankingOptions ); + +if( !empty( $_REQUEST['sort_mode'] ) ) { + switch( $_REQUEST['sort_mode'] ) { + case 'last_modified_desc': + $gBitSmarty->assign( 'attribute', 'last_modified' ); + $_REQUEST['attribute'] = tra( 'Date of last modification' ); + break; + case 'top_authors': + $gBitSmarty->assign( 'attribute', 'ag_hits' ); + $_REQUEST['attribute'] = tra( 'Hits to items by this Author' ); + break; + default: + $gBitSmarty->assign( 'attribute', 'hits' ); + $_REQUEST['attribute'] = tra( 'Hits' ); + break; + } } else { - $which = $_REQUEST["which"]; + $gBitSmarty->assign( 'attribute', 'hits' ); + $_REQUEST['attribute'] = tra( 'Hits' ); } -$gBitSmarty->assign('which', $which); -$gBitSmarty->assign_by_ref('limit', $limit); -// Rankings: -// Top Pages -// Last pages -// Top Authors -$rankings = array(); -$rk = $ranklib->$which($limit); -$rank["data"] = $rk["data"]; -$rank["title"] = $rk["title"]; -$rank["y"] = $rk["y"]; -$rankings[] = $rank; -$gBitSmarty->assign_by_ref('rankings', $rankings); -$gBitSmarty->assign('rpage', WIKI_PKG_URL.'rankings.php'); -// Display the template -$gBitSystem->display( 'bitpackage:kernel/ranking.tpl'); + +$_REQUEST['title'] = tra( 'Wiki Rankings' ); +$_REQUEST['content_type_guid'] = BITPAGE_CONTENT_TYPE_GUID; +$_REQUEST['max_records'] = !empty( $_REQUEST['max_records'] ) ? $_REQUEST['max_records'] : 10; + +if( empty( $gContent ) ) { + $gContent = new LibertyContent(); +} +$rankList = $gContent->getContentRanking( $_REQUEST ); +$gBitSmarty->assign( 'rankList', $rankList ); + +$gBitSystem->display( 'bitpackage:liberty/rankings.tpl', tra( "Wiki Rankings" ) ); ?> |
