From 6a4e5eee22fe3a2b69cdadbdf0cb7b210b6783c7 Mon Sep 17 00:00:00 2001 From: Antonio Gallo Date: Sat, 21 May 2011 17:02:31 +0000 Subject: h-source:improved search, now also the other_names entry is considered --- h-source/Application/Controllers/SearchController.php | 15 +++++++++++---- h-source/Application/Views/Search/results.php | 17 +++++++++++------ h-source/Application/Views/header.php | 4 ---- 3 files changed, 22 insertions(+), 14 deletions(-) (limited to 'h-source/Application') 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); diff --git a/h-source/Application/Views/Search/results.php b/h-source/Application/Views/Search/results.php index dfe0ab9..2bc14f4 100644 --- a/h-source/Application/Views/Search/results.php +++ b/h-source/Application/Views/Search/results.php @@ -38,14 +38,19 @@ ?>
-
- : "> +
+
:
-
- : + +
+
:
-
- : + +
+
:
+
+
+
:
diff --git a/h-source/Application/Views/header.php b/h-source/Application/Views/header.php index e86006b..5247659 100644 --- a/h-source/Application/Views/header.php +++ b/h-source/Application/Views/header.php @@ -36,10 +36,6 @@ $currPos = $querySanitized ? $this->controller."/".$this->action : 'home/index'; - - -- cgit v1.2.3