Location: PHPKode > projects > Simple Way to Usenet > swun/libs/swun/ajax/ajx_swapsearchengine.class.php
<?php
/**
 *  
 * @author  Benjamin Gillissen <hide@address.com>
 * 
 *	**************************************************************

	Copyright (C) 2009  Benjamin Gillissen
	
	This program is free software; you can redistribute it and/or
	modify it under the terms of the GNU General Public License
	as published by the Free Software Foundation; either version 2
	of the License, or (at your option) any later version.
	
	This program is distributed in the hope that it will be useful,
	but WITHOUT ANY WARRANTY; without even the implied warranty of
	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
	GNU General Public License for more details at:
	http://www.gnu.org/copyleft/gpl.html

 *	**************************************************************
 */
class ajx_swapsearchengine extends ajax {

	public static function swapsearchengine($eng){
		parent::$CB = __FUNCTION__;
		$toforce = Array('engine' => $eng);
		$s = new search($toforce);
		$r = $s->get_searchbar();
		
		$tpl = new template();
		if ( FALSE === $tpl->load_file('pages/search/types.tpl') ){ 
			parent::addAssign("search_types","innerHTML", 'tpl not loaded!' );
		} else {
			$tpl->setdata($r['types']);
			parent::addAssign("search_types","innerHTML", $tpl->parse(TRUE) );
		}
		if ( $r['cats']['showcat'] ){
			$tpl = new template();
			if ( FALSE === $tpl->load_file('pages/search/cats.tpl') ){ 
				parent::addAssign("search_categories","innerHTML", 'tpl not loaded!' );
			} else {
				$tpl->setdata($r['cats']);
				parent::addAssign("search_categories","innerHTML", $tpl->parse(TRUE) );
			}
		} else {
			parent::addAssign("search_categories","innerHTML", '');
		}
		if ( $r['usefilter'] ){
			$tpl = new template();
			if ( FALSE === $tpl->load_file('pages/search/filter.tpl') ){ 
				parent::addAssign("search_filter","innerHTML", 'tpl not loaded!' );
			} else {
				$tpl->setdata($r);
				parent::addAssign("search_filter","innerHTML", $tpl->parse(TRUE) );
			}
			//parent::addAssign("search_filter","innerHTML", 'redraw-filter' );
		} else {
			parent::addAssign("search_filter","innerHTML", '');
		}
		return parent::getReply();
	}
	
}
Return current item: Simple Way to Usenet