<?php
/*
* @package LabCMS
* @copyright (c) 2006 Alexander Levin aka Loki (loki_angel@mail.ru)
* @support http://labcms.ru
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
*/
//запрос id тем
function admin_pages_search_count($query_text)
{
	$search=Db::instance()->selectCol("SELECT DISTINCT(page_id) FROM ?_pages p WHERE (MATCH(page_title) AGAINST(? IN BOOLEAN MODE) OR MATCH(page_text) AGAINST(? IN BOOLEAN MODE))", $query_text, $query_text);
	return $search;
}

//выборка результатов
function admin_pages_search_result($search, $start, $limit, $module)
{
	$results=Db::instance()->select("SELECT page_title, path FROM ?_pages p JOIN ?_tree t ON p.tree_id=t.tree_id WHERE page_id IN (?a) ORDER BY  page_title LIMIT ?d, ?d", $search, $start, $limit);
	$search_result=array();
	foreach($results as $result)
	{
		$search_result[]=array('name'=>$result['page_title'], 'path'=>$result['path']);
	}
	return $search_result;
}
?>