diff options
author | Antonio Gallo <tonicucoz@gmail.com> | 2011-05-21 17:02:31 +0000 |
---|---|---|
committer | Antonio Gallo <tonicucoz@gmail.com> | 2011-05-21 17:02:31 +0000 |
commit | 6a4e5eee22fe3a2b69cdadbdf0cb7b210b6783c7 (patch) | |
tree | bcde13f1e29b40fd92e6ff75580b08ddeb6f66bd /h-source/Application/Controllers | |
parent | 759f536ae8a94ec5cce173fd00855aa39f0dbf3a (diff) |
h-source:improved search, now also the other_names entry is considered
Diffstat (limited to 'h-source/Application/Controllers')
-rw-r--r-- | h-source/Application/Controllers/SearchController.php | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/h-source/Application/Controllers/SearchController.php b/h-source/Application/Controllers/SearchController.php index 9633a0e..9e7cb68 100644 --- a/h-source/Application/Controllers/SearchController.php +++ b/h-source/Application/Controllers/SearchController.php @@ -60,11 +60,18 @@ class SearchController extends BaseController if (strcmp($this->viewArgs['action'],'search') === 0) { Params::$whereClauseSymbolArray = array('like'); + + $this->m['HardwareModel']->logicalOperators = array('AND','OR'); $whereClause = array( - 'type' => $this->viewArgs['type'], - 'model' => "like '%".$this->viewArgs['model']."%'", - '-deleted' => "no", + 'type' => $this->viewArgs['type'], + 'level1' => array( + 'model' => "like '%".$this->viewArgs['model']."%'", + 'other_names' => "like '%".$this->viewArgs['model']."%'", + ), +// 'model' => "like '%".$this->viewArgs['model']."%'", +// 'other_names' => "like '%".$this->viewArgs['model']."%'", + '-deleted' => "no", ); $recordNumber = $this->m['HardwareModel']->clear()->where($whereClause)->orderBy("id_hard desc")->rowNumber(); @@ -77,7 +84,7 @@ class SearchController extends BaseController //set the limit clause $limit = $this->h['Pages']->getLimit($page,$recordNumber,10); - $data['table'] = $this->m['HardwareModel']->clear()->select('id_hard,model,type,comm_year')->where($whereClause)->limit($limit)->orderBy("id_hard desc")->send(); + $data['table'] = $this->m['HardwareModel']->clear()->select('id_hard,model,type,comm_year,other_names')->where($whereClause)->limit($limit)->orderBy("id_hard desc")->send(); // echo $this->m['HardwareModel']->getQuery(); $data['pageList'] = $this->h['Pages']->render($page-3,7); |