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

Source for file list_content.php

Documentation is available at list_content.php

  1. <?php
  2. /**
  3.  * list_content
  4.  *
  5.  * @author   spider <spider@steelsun.com>
  6.  * @version  $Revision$
  7.  * @package  liberty
  8.  * @subpackage functions
  9.  */
  10.  
  11. /**
  12.  * required setup
  13.  */
  14. require_once("../kernel/setup_inc.php");
  15.  
  16. $gBitSystem->verifyPermission( 'p_liberty_list_content' );
  17.  
  18. // some content specific offsets and pagination settings
  19. if( !empty( $_REQUEST['sort_mode'] )) {
  20.     $content_sort_mode = $_REQUEST['sort_mode'];
  21.     $gBitSmarty->assign( 'sort_mode', $content_sort_mode );
  22. }
  23.  
  24. #$max_content = ( !empty( $_REQUEST['max_records'] )) ? $_REQUEST['max_records'] : $gBitSystem->getConfig( 'max_records' );
  25.  
  26. if( !empty( $_SESSION['liberty_records_per_page'] )) {
  27.     $max_content = $_SESSION['liberty_records_per_page'];
  28. } else {
  29.     $max_content = $gBitSystem->getConfig( 'max_records', 10 );
  30. }
  31. if( !empty( $_REQUEST["max_records"] )) {
  32.     $max_content = $_REQUEST["max_records"];
  33.     $_SESSION['liberty_records_per_page'] = $max_content;
  34. }
  35.  
  36. // now that we have all the offsets, we can get the content list
  37. include_once( LIBERTY_PKG_PATH.'get_content_list_inc.php' );
  38.  
  39. $gBitSmarty->assign( 'contentSelect', $contentSelect );
  40. $gBitSmarty->assign( 'contentTypes', $contentTypes );
  41. $gBitSmarty->assign( 'contentList', $contentList );
  42. $contentListHash['listInfo']['ihash']['content_type_guid'] = $contentSelect;
  43. $contentListHash['listInfo']['ihash']['user_id'] = @BitBase::verifyId( $_REQUEST['user_id'] ) ? $_REQUEST['user_id'] : NULL;
  44. $contentListHash['listInfo']['ihash']['find'] = $contentListHash['listInfo']['find'];
  45. $gBitSmarty->assign( 'listInfo', $contentListHash['listInfo'] );
  46. $gBitSmarty->assign( 'content_type_guids', ( isset( $_REQUEST['content_type_guid'] ) ? $_REQUEST['content_type_guid'] : NULL ));
  47.  
  48. //depricate 'ajax_xml', use 'output'
  49. //@todo clean out from other packages
  50. if( !empty( $_REQUEST['ajax_xml'] )) {
  51.     $_REQUEST['output'] = 'ajax';
  52. }
  53.  
  54. if( !empty( $_REQUEST['output'] )) {
  55.     switch( $_REQUEST['output'] ) {
  56.     case 'json':
  57.         $gBitSmarty->assign_by_ref( 'listcontent', $contentList );
  58.         header( 'Content-type:application/json' );
  59.         $gBitSmarty->display( 'bitpackage:liberty/list_content_json.tpl' );
  60.         break;
  61.     case 'ajax':
  62.         /* @TODO the results structure of this are limited and 
  63.          * seem specific to some package use. It also requires 
  64.          * an extra value 'id' which also seems very specific. 
  65.          * Recommend that this be standardized, but 
  66.          * a package dependency somewhere is likely an issue
  67.          */
  68.         require_once( UTIL_PKG_PATH.'javascript/suggest/suggest_lib.php' );
  69.         foreach( array_keys( $contentList ) as $row ) {
  70.             $xmlList[$contentList[$row]['content_id']] = $contentList[$row]['title'];
  71.         }
  72.         $xml = SuggestLib::exportXml( $xmlList, $_REQUEST['id'] );
  73.         header( "Content-Type: text/xml\n\n" );
  74.         print $xml;
  75.         break;
  76.     case 'raw':
  77.         //means we just want the contents of $contentList when we include this file
  78.         break;
  79.     }
  80. } else {
  81.     $gBitSystem->setBrowserTitle( 'List Content' );
  82.     $gBitSystem->display( 'bitpackage:liberty/list_content.tpl' , NULL, array( 'display_mode' => 'list' ));
  83. }
  84. ?>

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