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

Source for file rankings.php

Documentation is available at rankings.php

  1. <?php
  2. /**
  3.  * Copyright (c) 2004 bitweaver.org
  4.  * Copyright (c) 2003 tikwiki.org
  5.  * Copyright (c) 2002-2003, Luis Argerich, Garland Foster, Eduardo Polidor, et. al.
  6.  * All Rights Reserved. See below for details and a complete list of authors.
  7.  * Licensed under the GNU LESSER GENERAL PUBLIC LICENSE. See http://www.gnu.org/copyleft/lesser.html for details
  8.  *
  9.  * @package wiki
  10.  * @subpackage functions
  11.  */
  12.  
  13. /**
  14.  * required setup
  15.  */
  16. require_once( '../kernel/setup_inc.php' );
  17.  
  18. $gBitSystem->verifyPackage( 'wiki' );
  19. $gBitSystem->verifyFeature( 'wiki_rankings' );
  20. $gBitSystem->verifyPermission( 'p_wiki_list_pages' );
  21.  
  22. $rankingOptions = array(
  23.     array(
  24.         'output' => tra( 'Most Often Viewed' ),
  25.         'value' => 'hits_desc'
  26.     ),
  27.     array(
  28.         'output' => tra( 'Most Recently Modified' ),
  29.         'value' => 'last_modified_desc'
  30.     ),
  31.     array(
  32.         'output' => tra( 'Most Active Authors' ),
  33.         'value' => 'top_authors'
  34.     ),
  35. );
  36. $gBitSmarty->assign( 'rankingOptions', $rankingOptions );
  37.  
  38. if( !empty( $_REQUEST['sort_mode'] ) ) {
  39.     switch( $_REQUEST['sort_mode'] ) {
  40.         case 'last_modified_desc':
  41.             $gBitSmarty->assign( 'attribute', 'last_modified' );
  42.             $_REQUEST['attribute'] = tra( 'Date of last modification' );
  43.             break;
  44.         case 'top_authors':
  45.             $gBitSmarty->assign( 'attribute', 'ag_hits' );
  46.             $_REQUEST['attribute'] = tra( 'Hits to items by this Author' );
  47.             break;
  48.         default:
  49.             $gBitSmarty->assign( 'attribute', 'hits' );
  50.             $_REQUEST['attribute'] = tra( 'Hits' );
  51.             break;
  52.     }
  53. } else {
  54.     $gBitSmarty->assign( 'attribute', 'hits' );
  55.     $_REQUEST['attribute'] = tra( 'Hits' );
  56. }
  57.  
  58. $_REQUEST['title']             = tra( 'Wiki Rankings' );
  59. $_REQUEST['content_type_guid'] = BITPAGE_CONTENT_TYPE_GUID;
  60. $_REQUEST['max_records']       = !empty( $_REQUEST['max_records'] ) ? $_REQUEST['max_records'] : 10;
  61.  
  62. if( empty( $gContent ) ) {
  63.     $gContent = new LibertyContent();
  64. }
  65. $rankList = $gContent->getContentRanking( $_REQUEST );
  66. $gBitSmarty->assign( 'rankList', $rankList );
  67.  
  68. $gBitSystem->display( 'bitpackage:liberty/rankings.tpl', tra( "Wiki Rankings" ) , array( 'display_mode' => 'display' ));
  69. ?>

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