articles
[ class tree: articles ] [ index: articles ] [ all elements ]

Source for file rankings.php

Documentation is available at rankings.php

  1. <?php 
  2. /**
  3.  * @version $Header$
  4.  * @package articles
  5.  * @subpackage functions
  6.  */
  7.  
  8. /**
  9.  * Initialization
  10.  */
  11. require_once '../kernel/setup_inc.php';
  12.  
  13. include_once( LIBERTY_PKG_PATH . 'LibertyContent.php' );
  14. include_once( ARTICLES_PKG_PATH . 'BitArticle.php' );
  15.  
  16. $gBitSystem->isPackageActive( 'articles' );
  17. $gBitSystem->isFeatureActive( 'articles_rankings' );
  18. $gBitSystem->verifyPermission( 'p_articles_read' );
  19.  
  20. $rankingOptions = array(
  21.     array(
  22.         'output' => tra( 'Most Often Viewed' ),
  23.         'value' => 'hits_desc'
  24.     ),
  25.     array(
  26.         'output' => tra( 'Most Recently Modified' ),
  27.         'value' => 'last_modified_desc'
  28.     ),
  29.     array(
  30.         'output' => tra( 'Most Active Authors' ),
  31.         'value' => 'top_authors'
  32.     ),
  33. );
  34. $gBitSmarty->assign( 'rankingOptions', $rankingOptions );
  35.  
  36. if( !empty( $_REQUEST['sort_mode'] ) ) {
  37.     switch( $_REQUEST['sort_mode'] ) {
  38.         case 'last_modified_desc':
  39.             $gBitSmarty->assign( 'attribute', 'last_modified' );
  40.             $_REQUEST['attribute'] = tra( 'Date of last modification' );
  41.             break;
  42.         case 'top_authors':
  43.             $gBitSmarty->assign( 'attribute', 'ag_hits' );
  44.             $_REQUEST['attribute'] = tra( 'Hits to items by this Author' );
  45.             break;
  46.         default:
  47.             $gBitSmarty->assign( 'attribute', 'hits' );
  48.             $_REQUEST['attribute'] = tra( 'Hits' );
  49.             break;
  50.     }
  51. } else {
  52.     $gBitSmarty->assign( 'attribute', 'hits' );
  53.     $_REQUEST['attribute'] = tra( 'Hits' );
  54. }
  55.  
  56. $_REQUEST['title']             = tra( 'Article Rankings' );
  57. $_REQUEST['content_type_guid'] = BITARTICLE_CONTENT_TYPE_GUID;
  58. $_REQUEST['max_records']       = !empty( $_REQUEST['max_records'] ) ? $_REQUEST['max_records'] : 10;
  59.  
  60. if( empty( $gContent ) ) {
  61.     $gContent = new LibertyContent();
  62. }
  63. $rankList = $gContent->getContentRanking( $_REQUEST );
  64. $gBitSmarty->assign( 'rankList', $rankList );
  65.  
  66. $gBitSystem->display( 'bitpackage:liberty/rankings.tpl', tra( "Article Rankings" ) , array( 'display_mode' => 'display' ));

Documentation generated on Wed, 29 Jul 2015 13:57:18 +0000 by phpDocumentor 1.5.0-lsces