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 | |
| parent | a6cd00ec233d1c7676d75224900ed1543130ac94 (diff) | |
Suche fast fertig
| -rw-r--r-- | .gitignore | 1 | ||||
| -rw-r--r-- | protected/controllers/SearchController.php | 55 | ||||
| -rw-r--r-- | protected/modules/cms/controllers/SitecontentController.php | 3 | ||||
| -rw-r--r-- | protected/modules/cms/views/sitecontent/_short.php | 34 | ||||
| -rw-r--r-- | protected/views/search/index.php | 10 | ||||
| -rw-r--r-- | protected/views/search/results.php | 22 | ||||
| -rw-r--r-- | protected/views/standort/view.php | 9 | ||||
| -rw-r--r-- | protected/views/verein/_short.php | 5 | ||||
| -rw-r--r-- | themes/astaf/views/layouts/main.php | 2 |
9 files changed, 135 insertions, 6 deletions
@@ -1,3 +1,4 @@ /assets/**/* /protected/runtime/**/* /protected/runtime/application.log +/protected/extensions/egmap/.DS_Store
\ No newline at end of file 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 diff --git a/protected/modules/cms/controllers/SitecontentController.php b/protected/modules/cms/controllers/SitecontentController.php index a2a3906..e4f7a5f 100644 --- a/protected/modules/cms/controllers/SitecontentController.php +++ b/protected/modules/cms/controllers/SitecontentController.php @@ -17,6 +17,9 @@ class SitecontentController extends Controller $q = new CDbCriteria(); $q->addSearchCondition('content',$_POST['search']); $results = Sitecontent::model()->findAll($q); + $q = new CDbCriteria(); + $q->addSearchCondition('beschreibung',$_POST['search']); + $results = Verein::model()->findAll($q); $this->render('results', array( 'results' => $results, diff --git a/protected/modules/cms/views/sitecontent/_short.php b/protected/modules/cms/views/sitecontent/_short.php new file mode 100644 index 0000000..0352c04 --- /dev/null +++ b/protected/modules/cms/views/sitecontent/_short.php @@ -0,0 +1,34 @@ +<div class="view"> + + <b><?php echo CHtml::encode($data->getAttributeLabel('id')); ?>:</b> + <?php echo CHtml::link(CHtml::encode($data->id), array('view', 'id'=>$data->id)); ?> + <br /> + + <b><?php echo CHtml::encode($data->getAttributeLabel('position')); ?>:</b> + <?php echo CHtml::encode($data->position); ?> + <br /> + + <b><?php echo CHtml::encode($data->getAttributeLabel('title')); ?>:</b> + <?php echo CHtml::encode($data->title); ?> + <br /> + + <b><?php echo CHtml::encode($data->getAttributeLabel('content')); ?>:</b> + <?php echo CHtml::encode($data->content); ?> + <br /> + + <b><?php echo CHtml::encode($data->getAttributeLabel('authorid')); ?>:</b> + <?php echo CHtml::encode($data->authorid); ?> + <br /> + + <b><?php echo CHtml::encode($data->getAttributeLabel('createtime')); ?>:</b> + <?php echo CHtml::encode($data->createtime); ?> + <br /> + + <?php /* + <b><?php echo CHtml::encode($data->getAttributeLabel('updatetime')); ?>:</b> + <?php echo CHtml::encode($data->updatetime); ?> + <br /> + + */ ?> + +</div> diff --git a/protected/views/search/index.php b/protected/views/search/index.php new file mode 100644 index 0000000..7b457ef --- /dev/null +++ b/protected/views/search/index.php @@ -0,0 +1,10 @@ +<?php +$this->breadcrumbs=array( + 'Search', +);?> +<h1><?php echo $this->id . '/' . $this->action->id; ?></h1> + +<p> + You may change the content of this page by modifying + the file <tt><?php echo __FILE__; ?></tt>. +</p> diff --git a/protected/views/search/results.php b/protected/views/search/results.php new file mode 100644 index 0000000..c1d80e2 --- /dev/null +++ b/protected/views/search/results.php @@ -0,0 +1,22 @@ +<?php +$this->breadcrumbs=array( + 'Search'=>array('/search'), + 'Results', +);?> +<h3><?php echo $this->id . '/' . $this->action->id; ?></h3> +<?php foreach ($results as $mod => $res) {?> + <h6><?php echo $mod ?></h6> + <?php + $dataProvider = new CArrayDataProvider($res); + $this->widget('zii.widgets.CListView', array( + 'dataProvider'=>$dataProvider, + 'itemView'=>'/cms/'.lcfirst($mod).'/_short', // refers to the partial view named '_post' + 'sortableAttributes'=>array( + 'name', + /*'create_time'=>'Post Time',*/ + ), + ));?> +<?php }?> +<p> + <pre><?php print_r($results)?></pre> +</p> diff --git a/protected/views/standort/view.php b/protected/views/standort/view.php index 26312a3..0674ce9 100644 --- a/protected/views/standort/view.php +++ b/protected/views/standort/view.php @@ -48,7 +48,7 @@ $gMap->enableMarkerClusterer(new EGMapMarkerClusterer()); $gMap->renderMap(); ?> </p> -<p> +<h6>Folgende Vereine finden sich <?php echo $model->name?></h6> <?php $dataProvider=new CActiveDataProvider('Verein', array( 'criteria'=>array( @@ -57,11 +57,12 @@ $dataProvider=new CActiveDataProvider('Verein', array( 'pagination'=>array( 'pageSize'=>20, ), + )); $this->widget('zii.widgets.CListView', array( 'dataProvider'=>$dataProvider, 'itemView'=>'/verein/_short', - + 'sortableAttributes'=>array( + 'name' + ) ));?> - -</p>
\ No newline at end of file diff --git a/protected/views/verein/_short.php b/protected/views/verein/_short.php index e31ed34..0ff6284 100644 --- a/protected/views/verein/_short.php +++ b/protected/views/verein/_short.php @@ -1,4 +1,6 @@ +<?php /* <h6><?php echo CHTML::link($data->name,array("verein/view","id"=>$data->id)); ?></h6> + */?> <?php if(strlen(strip_tags($data->beschreibung))>300) { $tmp = str_split(strip_tags($data->beschreibung),297); @@ -6,6 +8,7 @@ if(strlen(strip_tags($data->beschreibung))>300) { } else { $myBeschreibung = strip_tags($data->beschreibung); }?> +<?php /* <p><?php echo CHTML::link(CHTML::decode($myBeschreibung),array("verein/view","id"=>$data->id)); ?></p> - + */?> <?php echo CHTML::link("<h6>".$data->name."</h6><p>".$myBeschreibung."</p>" ,array("verein/view","id"=>$data->id)); ?>
\ No newline at end of file diff --git a/themes/astaf/views/layouts/main.php b/themes/astaf/views/layouts/main.php index 025952f..1fec929 100644 --- a/themes/astaf/views/layouts/main.php +++ b/themes/astaf/views/layouts/main.php @@ -58,7 +58,7 @@ )); ?> - <?php echo CHtml::beginForm(CController::createUrl('/cms/sitecontent/search'),'post',array( 'class'=>'ym-searchform')); ?> + <?php echo CHtml::beginForm(CController::createUrl('/search/search'),'post',array( 'class'=>'ym-searchform')); ?> <input class="ym-searchfield" name="search" id="search" type="search" placeholder="Suchen..." /> <input class="ym-searchbutton" type="submit" value="Suchen" /> </form> |
