2012-12-16 08:40:08 +00:00
|
|
|
<?php
|
|
|
|
class SearchController extends Zend_Controller_Action
|
|
|
|
{
|
|
|
|
function preDispatch()
|
|
|
|
{
|
|
|
|
$this->db=Zend_Registry::get('db');
|
|
|
|
$this->view->config = Zend_Registry::get('config');
|
|
|
|
$this->messenger=$this->_helper->getHelper('FlashMessenger');
|
2013-06-02 03:56:12 +00:00
|
|
|
$this->view->messages = $this->messenger->getMessages();
|
2013-06-09 03:03:47 +00:00
|
|
|
$this->view->theme = new Theme();
|
2013-06-02 03:56:12 +00:00
|
|
|
$this->view->nav = array(
|
|
|
|
array('link'=>'/','title'=>'<i class="icon-home"></i>'),
|
|
|
|
array('link'=>'/data','title'=>$this->view->config->title->data),
|
|
|
|
);
|
2012-12-16 08:40:08 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
function indexAction()
|
|
|
|
{
|
|
|
|
$search=new Search();
|
|
|
|
$search->dosearch();
|
|
|
|
$this->view->hot=$search->hot;
|
|
|
|
$this->view->total_cost=$search->total_cost;
|
|
|
|
$this->view->count=$search->count;
|
|
|
|
$this->view->base_url=$search->base_url;
|
|
|
|
$this->view->error=$search->error;
|
|
|
|
$this->view->docs=$search->docs;
|
|
|
|
$this->view->search=$search->search;
|
|
|
|
$this->view->related=$search->related;
|
|
|
|
$this->view->pager=$search->pager;
|
|
|
|
$this->view->total=$search->total;
|
|
|
|
$this->view->expanded=$search->expanded;
|
|
|
|
}
|
|
|
|
function suggestAction()
|
|
|
|
{
|
|
|
|
$q = isset($_GET['term']) ? trim($_GET['term']) : '';
|
|
|
|
$q = get_magic_quotes_gpc() ? stripslashes($q) : $q;
|
|
|
|
$search=new Search();
|
|
|
|
$this->_helper->layout->disableLayout();
|
|
|
|
$this->_helper->viewRenderer->setNoRender();
|
|
|
|
header("Content-Type: application/json; charset=utf-8");
|
|
|
|
echo $search->suggest($q);
|
2013-06-09 03:03:47 +00:00
|
|
|
}
|
|
|
|
function advanceAction()
|
|
|
|
{
|
|
|
|
$this->view->east=$this->getParam('east');
|
|
|
|
$this->view->west=$this->getParam('west');
|
|
|
|
$this->view->south=$this->getParam('south');
|
|
|
|
$this->view->north=$this->getParam('north');
|
|
|
|
$this->view->begin=$this->getParam('begin');
|
|
|
|
$this->view->end=$this->getParam('end');
|
|
|
|
$this->view->q=$this->getParam('q');
|
|
|
|
}
|
2012-12-16 08:40:08 +00:00
|
|
|
}
|