diff options
| author | Patrick Seeger <pseeger@ccwn.org> | 2012-05-13 16:51:28 +0200 |
|---|---|---|
| committer | Patrick Seeger <pseeger@ccwn.org> | 2012-05-13 16:51:28 +0200 |
| commit | 94bdb31c204cdae3ca820828d4731f11f6ffeeae (patch) | |
| tree | 957a63d27379789d808737e6fb8b88ea651d5c1c /protected/controllers | |
| parent | a6cd00ec233d1c7676d75224900ed1543130ac94 (diff) | |
Suche fast fertig
Diffstat (limited to 'protected/controllers')
| -rw-r--r-- | protected/controllers/SearchController.php | 55 |
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 |
