添加到 trunk
+YUCHENG HU+ git-svn-id: https://svn.code.sf.net/p/hawebs/svn@321 a2543c7e-f6e9-4f8a-8bff-1ffc34733512
This commit is contained in:
@@ -0,0 +1,13 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<config>
|
||||
<params>
|
||||
<param name="enabled" type="radio" default="0" label="Gather Search Statistics" description="TIPSEARCHSTATISTICS">
|
||||
<option value="0">No</option>
|
||||
<option value="1">Yes</option>
|
||||
</param>
|
||||
<param name="show_date" type="radio" default="1" label="Show Created Date" description="TIPIFSETTOSHOWDATETIMECREATED">
|
||||
<option value="0">Hide</option>
|
||||
<option value="1">Show</option>
|
||||
</param>
|
||||
</params>
|
||||
</config>
|
||||
@@ -0,0 +1,46 @@
|
||||
<?php
|
||||
/**
|
||||
* @version $Id: controller.php 10381 2008-06-01 03:35:53Z pasamio $
|
||||
* @package Joomla
|
||||
* @subpackage Search
|
||||
* @copyright Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved.
|
||||
* @license GNU/GPL, see LICENSE.php
|
||||
* Joomla! is free software. This version may have been modified pursuant to the
|
||||
* GNU General Public License, and as distributed it includes or is derivative
|
||||
* of works licensed under the GNU General Public License or other free or open
|
||||
* source software licenses. See COPYRIGHT.php for copyright notices and
|
||||
* details.
|
||||
*/
|
||||
|
||||
// Check to ensure this file is included in Joomla!
|
||||
defined('_JEXEC') or die( 'Restricted access' );
|
||||
|
||||
jimport('joomla.application.component.controller');
|
||||
|
||||
/**
|
||||
* @package Joomla
|
||||
* @subpackage Search
|
||||
*/
|
||||
class SearchController extends JController
|
||||
{
|
||||
/**
|
||||
* Show Search Statistics
|
||||
*/
|
||||
function display()
|
||||
{
|
||||
$model =& $this->getModel( 'Search' );
|
||||
$view =& $this->getView( 'Search' );
|
||||
$view->setModel( $model, true );
|
||||
$view->display();
|
||||
}
|
||||
|
||||
/**
|
||||
* Reset Statistics
|
||||
*/
|
||||
function reset()
|
||||
{
|
||||
$model =& $this->getModel( 'Search' );
|
||||
$model->reset();
|
||||
$this->setRedirect('index.php?option=com_search');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
<html><body bgcolor="#FFFFFF"></body></html>
|
||||
@@ -0,0 +1,204 @@
|
||||
<?php
|
||||
/**
|
||||
* @version $Id: search.php 12389 2009-07-01 00:34:45Z ian $
|
||||
* @package Joomla
|
||||
* @subpackage Search
|
||||
* @copyright Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved.
|
||||
* @license GNU/GPL, see LICENSE.php
|
||||
* Joomla! is free software. This version may have been modified pursuant to the
|
||||
* GNU General Public License, and as distributed it includes or is derivative
|
||||
* of works licensed under the GNU General Public License or other free or open
|
||||
* source software licenses. See COPYRIGHT.php for copyright notices and
|
||||
* details.
|
||||
*/
|
||||
|
||||
// Check to ensure this file is included in Joomla!
|
||||
defined('_JEXEC') or die( 'Restricted access' );
|
||||
|
||||
/**
|
||||
* @package Joomla
|
||||
* @subpackage Search
|
||||
*/
|
||||
class SearchHelper
|
||||
{
|
||||
function santiseSearchWord(&$searchword, $searchphrase)
|
||||
{
|
||||
$ignored = false;
|
||||
|
||||
$lang =& JFactory::getLanguage();
|
||||
|
||||
$search_ignore = array();
|
||||
$tag = $lang->getTag();
|
||||
$ignoreFile = $lang->getLanguagePath().DS.$tag.DS.$tag.'.ignore.php';
|
||||
if (file_exists($ignoreFile)) {
|
||||
include $ignoreFile;
|
||||
}
|
||||
|
||||
// check for words to ignore
|
||||
$aterms = explode( ' ', JString::strtolower( $searchword ) );
|
||||
|
||||
// first case is single ignored word
|
||||
if ( count( $aterms ) == 1 && in_array( JString::strtolower( $searchword ), $search_ignore ) ) {
|
||||
$ignored = true;
|
||||
}
|
||||
|
||||
// filter out search terms that are too small
|
||||
foreach( $aterms AS $aterm ) {
|
||||
if (JString::strlen( $aterm ) < 3) {
|
||||
$search_ignore[] = $aterm;
|
||||
}
|
||||
}
|
||||
|
||||
// next is to remove ignored words from type 'all' or 'any' (not exact) searches with multiple words
|
||||
if ( count( $aterms ) > 1 && $searchphrase != 'exact' ) {
|
||||
$pruned = array_diff( $aterms, $search_ignore );
|
||||
$searchword = implode( ' ', $pruned );
|
||||
}
|
||||
|
||||
return $ignored;
|
||||
}
|
||||
|
||||
function limitSearchWord(&$searchword)
|
||||
{
|
||||
$restriction = false;
|
||||
|
||||
// limit searchword to 20 characters
|
||||
if ( JString::strlen( $searchword ) > 20 ) {
|
||||
$searchword = JString::substr( $searchword, 0, 19 );
|
||||
$restriction = true;
|
||||
}
|
||||
|
||||
// searchword must contain a minimum of 3 characters
|
||||
if ( $searchword && JString::strlen( $searchword ) < 3 ) {
|
||||
$searchword = '';
|
||||
$restriction = true;
|
||||
}
|
||||
|
||||
return $restriction;
|
||||
}
|
||||
|
||||
function logSearch( $search_term )
|
||||
{
|
||||
global $mainframe;
|
||||
|
||||
$db =& JFactory::getDBO();
|
||||
|
||||
$params = &JComponentHelper::getParams( 'com_search' );
|
||||
$enable_log_searches = $params->get('enabled');
|
||||
|
||||
$search_term = $db->getEscaped( trim( $search_term) );
|
||||
|
||||
if ( @$enable_log_searches )
|
||||
{
|
||||
$db =& JFactory::getDBO();
|
||||
$query = 'SELECT hits'
|
||||
. ' FROM #__core_log_searches'
|
||||
. ' WHERE LOWER( search_term ) = "'.$search_term.'"'
|
||||
;
|
||||
$db->setQuery( $query );
|
||||
$hits = intval( $db->loadResult() );
|
||||
if ( $hits ) {
|
||||
$query = 'UPDATE #__core_log_searches'
|
||||
. ' SET hits = ( hits + 1 )'
|
||||
. ' WHERE LOWER( search_term ) = "'.$search_term.'"'
|
||||
;
|
||||
$db->setQuery( $query );
|
||||
$db->query();
|
||||
} else {
|
||||
$query = 'INSERT INTO #__core_log_searches VALUES ( "'.$search_term.'", 1 )';
|
||||
$db->setQuery( $query );
|
||||
$db->query();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Prepares results from search for display
|
||||
*
|
||||
* @param string The source string
|
||||
* @param int Number of chars to trim
|
||||
* @param string The searchword to select around
|
||||
* @return string
|
||||
*/
|
||||
function prepareSearchContent( $text, $length = 200, $searchword )
|
||||
{
|
||||
// strips tags won't remove the actual jscript
|
||||
$text = preg_replace( "'<script[^>]*>.*?</script>'si", "", $text );
|
||||
$text = preg_replace( '/{.+?}/', '', $text);
|
||||
//$text = preg_replace( '/<a\s+.*?href="([^"]+)"[^>]*>([^<]+)<\/a>/is','\2', $text );
|
||||
// replace line breaking tags with whitespace
|
||||
$text = preg_replace( "'<(br[^/>]*?/|hr[^/>]*?/|/(div|h[1-6]|li|p|td))>'si", ' ', $text );
|
||||
|
||||
return SearchHelper::_smartSubstr( strip_tags( $text ), $length, $searchword );
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks an object for search terms (after stripping fields of HTML)
|
||||
*
|
||||
* @param object The object to check
|
||||
* @param string Search words to check for
|
||||
* @param array List of object variables to check against
|
||||
* @returns boolean True if searchTerm is in object, false otherwise
|
||||
*/
|
||||
function checkNoHtml($object, $searchTerm, $fields) {
|
||||
$searchRegex = array(
|
||||
'#<script[^>]*>.*?</script>#si',
|
||||
'#<style[^>]*>.*?</style>#si',
|
||||
'#<!.*?(--|]])>#si',
|
||||
'#<[^>]*>#i'
|
||||
);
|
||||
$terms = explode(' ', $searchTerm);
|
||||
if(empty($fields)) return false;
|
||||
foreach($fields AS $field) {
|
||||
if(!isset($object->$field)) continue;
|
||||
$text = $object->$field;
|
||||
foreach($searchRegex As $regex) {
|
||||
$text = preg_replace($regex, '', $text);
|
||||
}
|
||||
foreach($terms AS $term) {
|
||||
if(JString::stristr($text, $term) !== false) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* returns substring of characters around a searchword
|
||||
*
|
||||
* @param string The source string
|
||||
* @param int Number of chars to return
|
||||
* @param string The searchword to select around
|
||||
* @return string
|
||||
*/
|
||||
function _smartSubstr($text, $length = 200, $searchword)
|
||||
{
|
||||
$textlen = JString::strlen($text);
|
||||
$lsearchword = JString::strtolower($searchword);
|
||||
$wordfound = false;
|
||||
$pos = 0;
|
||||
while ($wordfound === false && $pos < $textlen) {
|
||||
if (($wordpos = @JString::strpos($text, ' ', $pos + $length)) !== false) {
|
||||
$chunk_size = $wordpos - $pos;
|
||||
} else {
|
||||
$chunk_size = $length;
|
||||
}
|
||||
$chunk = JString::substr($text, $pos, $chunk_size);
|
||||
$wordfound = JString::strpos(JString::strtolower($chunk), $lsearchword);
|
||||
if ($wordfound === false) {
|
||||
$pos += $chunk_size + 1;
|
||||
}
|
||||
}
|
||||
|
||||
if ($wordfound !== false) {
|
||||
return (($pos > 0) ? '... ' : '') . $chunk . ' ...';
|
||||
} else {
|
||||
if (($wordpos = @JString::strpos($text, ' ', $length)) !== false) {
|
||||
return JString::substr($text, 0, $wordpos) . ' ...';
|
||||
} else {
|
||||
return JString::substr($text, 0, $length);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
/**
|
||||
* @version $Id: site.php 12389 2009-07-01 00:34:45Z ian $
|
||||
* @package Joomla
|
||||
* @subpackage Search
|
||||
* @copyright Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved.
|
||||
* @license GNU/GPL, see LICENSE.php
|
||||
* Joomla! is free software. This version may have been modified pursuant to the
|
||||
* GNU General Public License, and as distributed it includes or is derivative
|
||||
* of works licensed under the GNU General Public License or other free or open
|
||||
* source software licenses. See COPYRIGHT.php for copyright notices and details.
|
||||
*/
|
||||
|
||||
// Check to ensure this file is included in Joomla!
|
||||
defined('_JEXEC') or die( 'Restricted access' );
|
||||
|
||||
/**
|
||||
* False JSite class used to fool the frontend search plugins because they route the results
|
||||
*/
|
||||
class JSite extends JObject
|
||||
{
|
||||
/**
|
||||
* False method to fool the frontend search plugins
|
||||
*/
|
||||
function getMenu()
|
||||
{
|
||||
$result = new JSite;
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* False method to fool the frontend search plugins
|
||||
*/
|
||||
function getItems()
|
||||
{
|
||||
return array();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
<html><body bgcolor="#FFFFFF"></body></html>
|
||||
@@ -0,0 +1 @@
|
||||
<html><body bgcolor="#FFFFFF"></body></html>
|
||||
@@ -0,0 +1,122 @@
|
||||
<?php
|
||||
/**
|
||||
* @version $Id: search.php 10381 2008-06-01 03:35:53Z pasamio $
|
||||
* @package Joomla
|
||||
* @subpackage Search
|
||||
* @copyright Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved.
|
||||
* @license GNU/GPL, see LICENSE.php
|
||||
* Joomla! is free software. This version may have been modified pursuant to the
|
||||
* GNU General Public License, and as distributed it includes or is derivative
|
||||
* of works licensed under the GNU General Public License or other free or open
|
||||
* source software licenses. See COPYRIGHT.php for copyright notices and
|
||||
* details.
|
||||
*/
|
||||
|
||||
// Check to ensure this file is included in Joomla!
|
||||
defined('_JEXEC') or die( 'Restricted access' );
|
||||
|
||||
jimport( 'joomla.application.component.model' );
|
||||
|
||||
/**
|
||||
* @package Joomla
|
||||
* @subpackage Search
|
||||
*/
|
||||
class SearchModelSearch extends JModel
|
||||
{
|
||||
|
||||
var $lists = '';
|
||||
|
||||
/**
|
||||
* Overridden constructor
|
||||
* @access protected
|
||||
*/
|
||||
function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
function reset()
|
||||
{
|
||||
$db =& JFactory::getDBO();
|
||||
$db->setQuery( 'DELETE FROM #__core_log_searches' );
|
||||
$db->query();
|
||||
}
|
||||
|
||||
function getItems( )
|
||||
{
|
||||
global $mainframe, $option;
|
||||
$db =& JFactory::getDBO();
|
||||
|
||||
$filter_order = $mainframe->getUserStateFromRequest( 'com_search.filter_order', 'filter_order', 'hits', 'cmd' );
|
||||
$filter_order_Dir = $mainframe->getUserStateFromRequest( 'com_search.filter_order_Dir', 'filter_order_Dir', '', 'word' );
|
||||
$limit = $mainframe->getUserStateFromRequest( 'global.list.limit', 'limit', $mainframe->getCfg('list_limit'), 'int' );
|
||||
$limitstart = $mainframe->getUserStateFromRequest( 'com_search.limitstart', 'limitstart', 0, 'int' );
|
||||
$search = $mainframe->getUserStateFromRequest( 'com_search.search', 'search', '', 'string' );
|
||||
$search = JString::strtolower( $search );
|
||||
$showResults = JRequest::getInt('search_results');
|
||||
|
||||
// table ordering
|
||||
if ( $filter_order_Dir == 'ASC' ) {
|
||||
$this->lists['order_Dir'] = 'ASC';
|
||||
} else {
|
||||
$this->lists['order_Dir'] = 'DESC';
|
||||
}
|
||||
$this->lists['order'] = $filter_order;
|
||||
|
||||
// search filter
|
||||
$this->lists['search']= $search;
|
||||
|
||||
$where = array();
|
||||
if ($search) {
|
||||
$where[] = 'LOWER( search_term ) LIKE '.$db->Quote( '%'.$db->getEscaped( $search, true ).'%', false );
|
||||
}
|
||||
|
||||
$where = ( count( $where ) ? ' WHERE ' . implode( ' AND ', $where ) : '' );
|
||||
$orderby = ' ORDER BY '. $filter_order .' '. $filter_order_Dir .', hits DESC';
|
||||
|
||||
// get the total number of records
|
||||
$query = 'SELECT COUNT(*)'
|
||||
. ' FROM #__core_log_searches'
|
||||
. $where;
|
||||
$db->setQuery( $query );
|
||||
$total = $db->loadResult();
|
||||
|
||||
jimport( 'joomla.html.pagination' );
|
||||
$pageNav = new JPagination( $total, $limitstart, $limit );
|
||||
|
||||
$query = ' SELECT * '
|
||||
. ' FROM #__core_log_searches '
|
||||
. $where
|
||||
. $orderby;
|
||||
$db->setQuery( $query, $pageNav->limitstart, $pageNav->limit );
|
||||
|
||||
$rows = $db->loadObjectList();
|
||||
|
||||
JPluginHelper::importPlugin( 'search' );
|
||||
|
||||
if (!class_exists( 'JSite' ))
|
||||
{
|
||||
// This fools the routers in the search plugins into thinking it's in the frontend
|
||||
require_once( JPATH_COMPONENT.DS.'helpers'.DS.'site.php' );
|
||||
}
|
||||
|
||||
for ($i=0, $n = count($rows); $i < $n; $i++) {
|
||||
// determine if number of results for search item should be calculated
|
||||
// by default it is `off` as it is highly query intensive
|
||||
if ( $showResults ) {
|
||||
$results = $mainframe->triggerEvent( 'onSearch', array( $rows[$i]->search_term ) );
|
||||
|
||||
$count = 0;
|
||||
for ($j = 0, $n2 = count( $results ); $j < $n2; $j++) {
|
||||
$count += count( $results[$j] );
|
||||
}
|
||||
|
||||
$rows[$i]->returns = $count;
|
||||
} else {
|
||||
$rows[$i]->returns = null;
|
||||
}
|
||||
}
|
||||
|
||||
return $rows;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
/**
|
||||
* @version $Id: search.php 10381 2008-06-01 03:35:53Z pasamio $
|
||||
* @package Joomla
|
||||
* @subpackage Search
|
||||
* @copyright Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved.
|
||||
* @license GNU/GPL, see LICENSE.php
|
||||
* Joomla! is free software. This version may have been modified pursuant
|
||||
* to the GNU General Public License, and as distributed it includes or
|
||||
* is derivative of works licensed under the GNU General Public License or
|
||||
* other free or open source software licenses.
|
||||
* See COPYRIGHT.php for copyright notices and details.
|
||||
*/
|
||||
|
||||
// no direct access
|
||||
defined( '_JEXEC' ) or die( 'Restricted access' );
|
||||
|
||||
require_once( JPATH_COMPONENT.DS.'controller.php' );
|
||||
|
||||
$controller = new SearchController();
|
||||
$controller->execute( JRequest::getCmd( 'task' ) );
|
||||
$controller->redirect();
|
||||
@@ -0,0 +1,12 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<install type="component" version="1.5.0">
|
||||
<name>Search</name>
|
||||
<author>Joomla! Project</author>
|
||||
<creationDate>2006</creationDate>
|
||||
<copyright>Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved.</copyright>
|
||||
<license>http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL</license>
|
||||
<authorEmail>[email protected]</authorEmail>
|
||||
<authorUrl>www.joomla.org</authorUrl>
|
||||
<version>1.5.0</version>
|
||||
<description>DESCSEARCH</description>
|
||||
</install>
|
||||
@@ -0,0 +1 @@
|
||||
<html><body bgcolor="#FFFFFF"></body></html>
|
||||
@@ -0,0 +1 @@
|
||||
<html><body bgcolor="#FFFFFF"></body></html>
|
||||
@@ -0,0 +1,89 @@
|
||||
<?php defined('_JEXEC') or die('Restricted access'); ?>
|
||||
|
||||
<form action="index.php" method="post" name="adminForm">
|
||||
<table>
|
||||
<tr>
|
||||
<td align="left" width="100%">
|
||||
<?php echo JText::_( 'Filter' ); ?>:
|
||||
<input type="text" name="search" id="search" value="<?php echo $this->escape($this->search); ?>" class="text_area" onchange="document.adminForm.submit();" />
|
||||
<button onclick="this.form.submit();"><?php echo JText::_( 'Go' ); ?></button>
|
||||
<button onclick="document.getElementById('search').value='';this.form.submit();"><?php echo JText::_( 'Reset' ); ?></button>
|
||||
</td>
|
||||
<td nowrap="nowrap">
|
||||
<span class="componentheading"><?php echo JText::_( 'Search Logging' ); ?> :
|
||||
<?php echo $this->enabled ? '<b><font color="green">'. JText::_( 'Enabled' ) .'</font></b>' : '<b><font color="red">'. JText::_( 'Disabled' ) .'</font></b>' ?>
|
||||
</span>
|
||||
</td>
|
||||
<td nowrap="nowrap" align="right">
|
||||
<?php if ( $this->showResults ) : ?>
|
||||
<a href="index.php?option=com_search&search_results=0"><?php echo JText::_( 'Hide Search Results' ); ?></a>
|
||||
<?php else : ?>
|
||||
<a href="index.php?option=com_search&search_results=1"><?php echo JText::_( 'Show Search Results' ); ?></a>
|
||||
<?php endif; ?>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<div id="tablecell">
|
||||
<table class="adminlist">
|
||||
<thead>
|
||||
<tr>
|
||||
<th width="10">
|
||||
<?php echo JText::_( 'NUM' ); ?>
|
||||
</th>
|
||||
<th class="title">
|
||||
<?php echo JHTML::_('grid.sort', 'Search Text', 'search_term', @$this->lists['order_Dir'], @$this->lists['order'] ); ?>
|
||||
</th>
|
||||
<th nowrap="nowrap" width="20%">
|
||||
<?php echo JHTML::_('grid.sort', 'Times Requested', 'hits', @$this->lists['order_Dir'], @$this->lists['order'] ); ?>
|
||||
</th>
|
||||
<?php
|
||||
if ( $this->showResults ) : ?>
|
||||
<th nowrap="nowrap" width="20%">
|
||||
<?php echo JText::_( 'Results Returned' ); ?>
|
||||
</th>
|
||||
<?php endif; ?>
|
||||
</tr>
|
||||
</thead>
|
||||
<tfoot>
|
||||
<tr>
|
||||
<td colspan="4">
|
||||
<?php echo $this->pageNav->getListFooter(); ?>
|
||||
</td>
|
||||
</tr>
|
||||
</tfoot>
|
||||
<tbody>
|
||||
<?php
|
||||
$k = 0;
|
||||
for ($i=0, $n = count($this->items); $i < $n; $i++) {
|
||||
$row =& $this->items[$i];
|
||||
?>
|
||||
<tr class="row<?php echo $k;?>">
|
||||
<td align="right">
|
||||
<?php echo $i+1+$this->pageNav->limitstart; ?>
|
||||
</td>
|
||||
<td>
|
||||
<?php echo htmlspecialchars($row->search_term, ENT_QUOTES, 'UTF-8'); ?>
|
||||
</td>
|
||||
<td align="center">
|
||||
<?php echo $row->hits; ?>
|
||||
</td>
|
||||
<?php if ( $this->showResults ) : ?>
|
||||
<td align="center">
|
||||
<?php echo $row->returns; ?>
|
||||
</td>
|
||||
<?php endif; ?>
|
||||
</tr>
|
||||
<?php
|
||||
$k = 1 - $k;
|
||||
}
|
||||
?>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<input type="hidden" name="option" value="com_search" />
|
||||
<input type="hidden" name="task" value="" />
|
||||
<input type="hidden" name="filter_order" value="<?php echo $this->lists['order']; ?>" />
|
||||
<input type="hidden" name="filter_order_Dir" value="<?php echo $this->lists['order_Dir']; ?>" />
|
||||
</form>
|
||||
@@ -0,0 +1 @@
|
||||
<html><body bgcolor="#FFFFFF"></body></html>
|
||||
@@ -0,0 +1,64 @@
|
||||
<?php
|
||||
/**
|
||||
* @version $Id: view.php 10381 2008-06-01 03:35:53Z pasamio $
|
||||
* @package Joomla
|
||||
* @subpackage Search
|
||||
* @copyright Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved.
|
||||
* @license GNU/GPL, see LICENSE.php
|
||||
* Joomla! is free software. This version may have been modified pursuant
|
||||
* to the GNU General Public License, and as distributed it includes or
|
||||
* is derivative of works licensed under the GNU General Public License or
|
||||
* other free or open source software licenses.
|
||||
* See COPYRIGHT.php for copyright notices and details.
|
||||
*/
|
||||
|
||||
// no direct access
|
||||
defined( '_JEXEC' ) or die( 'Restricted access' );
|
||||
|
||||
jimport('joomla.application.component.view');
|
||||
|
||||
/**
|
||||
* @package Joomla
|
||||
* @subpackage Search
|
||||
* @since 1.5
|
||||
*/
|
||||
class SearchViewSearch extends JView
|
||||
{
|
||||
function display($tpl=null)
|
||||
{
|
||||
global $mainframe;
|
||||
|
||||
JToolBarHelper::title( JText::_( 'Search Statistics' ), 'searchtext.png' );
|
||||
JToolBarHelper::custom( 'reset', 'delete.png', 'delete_f2.png', 'Reset', false );
|
||||
JToolBarHelper::preferences( 'com_search', '150' );
|
||||
JToolBarHelper::help( 'screen.stats.searches' );
|
||||
|
||||
$document = & JFactory::getDocument();
|
||||
$document->setTitle(JText::_('Search Statistics'));
|
||||
|
||||
$limit = $mainframe->getUserStateFromRequest( 'global.list.limit', 'limit', $mainframe->getCfg('list_limit'), 'int' );
|
||||
$limitstart = $mainframe->getUserStateFromRequest( 'com_search.limitstart', 'limitstart', 0, 'int' );
|
||||
|
||||
$model = $this->getModel();
|
||||
$items = $model->getItems();
|
||||
$params = &JComponentHelper::getParams( 'com_search' );
|
||||
$enabled = $params->get('enabled');
|
||||
JHTML::_('behavior.tooltip');
|
||||
jimport('joomla.html.pagination');
|
||||
$pageNav = new JPagination( count($items), $limitstart, $limit );
|
||||
|
||||
$showResults = JRequest::getInt('search_results');
|
||||
|
||||
$search = $mainframe->getUserStateFromRequest( 'com_search.search', 'search', '', 'string' );
|
||||
|
||||
$this->assignRef('items', $items);
|
||||
$this->assignRef('enabled', $enabled);
|
||||
$this->assignRef('pageNav', $pageNav);
|
||||
$this->assignRef('search', $search );
|
||||
$this->assignRef('lists', $model->lists );
|
||||
|
||||
$this->assignRef('showResults', $showResults);
|
||||
|
||||
parent::display($tpl);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user