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

Source for file directory_search.php

Documentation is available at directory_search.php

  1. <?php
  2. /**
  3.  * $Header$
  4.  *
  5.  * @copyright (c) 2004 bitweaver.org
  6.  *  Copyright (c) 2003 tikwiki.org
  7.  *  Copyright (c) 2002-2003, Luis Argerich, Garland Foster, Eduardo Polidor, et. al.
  8.  *  All Rights Reserved. See below for details and a complete list of authors.
  9.  *  Licensed under the GNU LESSER GENERAL PUBLIC LICENSE. See http://www.gnu.org/copyleft/lesser.html for details
  10.  *
  11.  *  $Id$
  12.  * @author  Luis Argerich (lrargerich@yahoo.com)
  13.  * @package search
  14.  * @subpackage functions
  15.  */
  16.  
  17. /**
  18.  * required setup
  19.  */
  20. require_once( '../kernel/setup_inc.php' );
  21.  
  22. include_once( DIRECTORY_PKG_PATH.'dir_lib.php' );
  23.  
  24. $gBitSystem->verifyFeature( 'feature_directory' );
  25. $gBitSystem->verifyPermission( 'bit_p_view_directory' );
  26.  
  27. $gBitSmarty->assign('words', $_REQUEST['words']);
  28. $gBitSmarty->assign('where', $_REQUEST['where']);
  29. $gBitSmarty->assign('how', $_REQUEST['how']);
  30.  
  31. if ( empty( $_REQUEST["sort_mode"] ) ) {
  32.     $sort_mode = 'hits_desc';
  33. } else {
  34.     $sort_mode = $_REQUEST["sort_mode"];
  35. }
  36. $gBitSmarty->assign_by_ref('sort_mode', $sort_mode);
  37.  
  38. if (!isset($_REQUEST["offset"])) {
  39.     $offset = 0;
  40. } else {
  41.     $offset = $_REQUEST["offset"];
  42. }
  43. if (isset($_REQUEST['page'])) {
  44.     $page = &$_REQUEST['page'];
  45.     $offset = ($page - 1) * $max_records;
  46. }
  47. $gBitSmarty->assign_by_ref('offset', $offset);
  48.  
  49. if (isset($_REQUEST["find"])) {
  50.     $find = $_REQUEST["find"];
  51. } else {
  52.     $find = '';
  53. }
  54. $gBitSmarty->assign('find', $find);
  55.  
  56. if ($_REQUEST['where'] == 'all') {
  57.     $items = $dirlib->dir_search($_REQUEST['words'], $_REQUEST['how'], $offset, $max_records, $sort_mode);
  58. } else {
  59.     $items = $dirlib->dir_search_cat($_REQUEST['parent'], $_REQUEST['words'], $_REQUEST['how'], $offset, $max_records, $sort_mode);
  60. }
  61.  
  62. $cant_pages = ceil($items["cant"] / $max_records);
  63. $gBitSmarty->assign_by_ref('cant_pages', $cant_pages);
  64. $gBitSmarty->assign('actual_page', 1 + ($offset / $max_records));
  65.  
  66. if ($items["cant"] > ($offset + $max_records)) {
  67.     $gBitSmarty->assign('next_offset', $offset + $max_records);
  68. } else {
  69.     $gBitSmarty->assign('next_offset', -1);
  70. }
  71.  
  72. if ($offset > 0) {
  73.     $gBitSmarty->assign('prev_offset', $offset - $max_records);
  74. } else {
  75.     $gBitSmarty->assign('prev_offset', -1);
  76. }
  77.  
  78. $gBitSmarty->assign_by_ref('items', $items["data"]);
  79.  
  80. $section = 'directory';
  81. // Display the template
  82. $gBitSystem->display( 'bitpackage:search/directory_search.tpl', NULL, array( 'display_mode' => 'display' ));
  83.  
  84. ?>

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