summaryrefslogtreecommitdiff
path: root/protected/controllers/SearchController.php
diff options
context:
space:
mode:
Diffstat (limited to 'protected/controllers/SearchController.php')
-rw-r--r--protected/controllers/SearchController.php55
1 files changed, 55 insertions, 0 deletions
diff --git a/protected/controllers/SearchController.php b/protected/controllers/SearchController.php
new file mode 100644
index 0000000..2cf87df
--- /dev/null
+++ b/protected/controllers/SearchController.php
@@ -0,0 +1,55 @@
+<?php
+
+class SearchController extends Controller
+{
+ public static $Searchables = array('Verein' => array('beschreibung'),'Sitecontent'=>array('content'));
+ public function actionIndex()
+ {
+ $this->render('index');
+ }
+
+ public function actionSearch()
+ {
+
+ foreach (SearchController::$Searchables as $searchable => $columns) {
+ $q = new CDbCriteria();
+ foreach ($columns as $col) {
+ $q->addSearchCondition($col,$_POST['search']);
+ }
+ $results[$searchable]=CActiveRecord::model($searchable)->findAll($q);
+ }
+
+
+
+ $this->render('results', array(
+ 'results' => $results,
+ 'search' => $_POST['search']));
+ }
+
+ // Uncomment the following methods and override them if needed
+ /*
+ public function filters()
+ {
+ // return the filter configuration for this controller, e.g.:
+ return array(
+ 'inlineFilterName',
+ array(
+ 'class'=>'path.to.FilterClass',
+ 'propertyName'=>'propertyValue',
+ ),
+ );
+ }
+
+ public function actions()
+ {
+ // return external action classes, e.g.:
+ return array(
+ 'action1'=>'path.to.ActionClass',
+ 'action2'=>array(
+ 'class'=>'path.to.AnotherActionClass',
+ 'propertyName'=>'propertyValue',
+ ),
+ );
+ }
+ */
+} \ No newline at end of file