diff options
| author | Max Kremmel <xing@synapse.plus.com> | 2006-02-04 10:10:50 +0000 |
|---|---|---|
| committer | Max Kremmel <xing@synapse.plus.com> | 2006-02-04 10:10:50 +0000 |
| commit | becd37c845286fd66721b3e7d6398fd1d8d54c26 (patch) | |
| tree | f624487ff322a1b48aaeff95b4d04532da3b5748 /rankings.php | |
| parent | 2f587fe180a1c8c464b146ee77a9a87469b728fd (diff) | |
| download | articles-becd37c845286fd66721b3e7d6398fd1d8d54c26.tar.gz articles-becd37c845286fd66721b3e7d6398fd1d8d54c26.tar.bz2 articles-becd37c845286fd66721b3e7d6398fd1d8d54c26.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 | 64 |
1 files changed, 41 insertions, 23 deletions
diff --git a/rankings.php b/rankings.php index 985ff7a..e7f3233 100644 --- a/rankings.php +++ b/rankings.php @@ -1,6 +1,6 @@ <?php /** - * @version $Header: /cvsroot/bitweaver/_bit_articles/rankings.php,v 1.5 2006/01/10 21:11:08 squareing Exp $ + * @version $Header: /cvsroot/bitweaver/_bit_articles/rankings.php,v 1.6 2006/02/04 10:10:50 squareing Exp $ * @package article * @subpackage functions */ @@ -10,40 +10,58 @@ */ require_once( '../bit_setup_inc.php' ); -include_once( KERNEL_PKG_PATH . 'rank_lib.php' ); +include_once( LIBERTY_PKG_PATH . 'LibertyContent.php' ); include_once( ARTICLES_PKG_PATH . 'BitArticle.php' ); $gBitSystem->isPackageActive( 'articles' ); $gBitSystem->isFeatureActive( 'feature_cms_rankings' ); $gBitSystem->verifyPermission( 'bit_p_read_article' ); -$allrankings = array( +$rankingOptions = array( array( - 'name' => tra( 'Top articles' ), - 'value' => 'contentRanking' + 'output' => tra( 'Most Often Viewed' ), + 'value' => 'hits_desc' + ), + array( + 'output' => tra( 'Most Recently Modified' ), + 'value' => 'last_modified_desc' + ), + array( + 'output' => tra( 'Most Active Authors' ), + 'value' => 'top_authors' ), -// array( -// 'name' => tra( 'Top authors' ), -// 'value' => 'cms_ranking_top_authors' -// ) ); -$gBitSmarty->assign( 'allrankings', $allrankings ); +$gBitSmarty->assign( 'rankingOptions', $rankingOptions ); -if ( !isset( $_REQUEST["which"] ) ) { - $func = 'contentRanking'; +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 { - $func = $_REQUEST["which"]; + $gBitSmarty->assign( 'attribute', 'hits' ); + $_REQUEST['attribute'] = tra( 'Hits' ); } -$gBitSmarty->assign( 'which', $func ); -$listHash = array( - 'title' => tra( 'Article Rankings' ), - 'content_type_guid' => BITARTICLE_CONTENT_TYPE_GUID, - 'limit' => ( !empty( $_REQUEST['limit'] ) ? $_REQUEST['limit'] : 10 ), -); -$rankings[] = $ranklib->$func( $listHash ); -$gBitSmarty->assign( 'rankings', $rankings ); +$_REQUEST['title'] = tra( 'Article Rankings' ); +$_REQUEST['content_type_guid'] = BITARTICLE_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 ); -// Display the template -$gBitSystem->display( 'bitpackage:kernel/ranking.tpl', tra( "Articles" ) ); +$gBitSystem->display( 'bitpackage:liberty/rankings.tpl', tra( "Article Rankings" ) ); ?> |
