summaryrefslogtreecommitdiff
path: root/protected
diff options
context:
space:
mode:
authorPatrick Seeger <pseeger@ccwn.org>2012-06-26 16:59:26 +0200
committerPatrick Seeger <pseeger@ccwn.org>2012-06-26 16:59:26 +0200
commitd7f3ac205ced0e1f1c26599b277cbfb988e48900 (patch)
treefa2f976c67ee8d47146d07689982607dcaf92d3b /protected
parent66e981bd3d3f9946afed0efbcaf8efa7907c530f (diff)
Anzeige optimiert, Vereine und Veranstaltungen veröffentlicht
Diffstat (limited to 'protected')
-rw-r--r--protected/controllers/SearchController.php20
-rw-r--r--protected/controllers/VereinController.php2
-rw-r--r--protected/models/Veranstaltung.php14
-rw-r--r--protected/models/Verein.php8
-rw-r--r--protected/modules/cms/models/Sitecontent.php8
-rw-r--r--protected/views/search/results.php6
-rw-r--r--protected/views/veranstaltung/index.php13
-rw-r--r--protected/views/veranstaltung/now.php2
-rw-r--r--protected/views/veranstaltung/view.php2
-rw-r--r--protected/views/verein/_short.php8
-rw-r--r--protected/views/verein/index.php4
-rw-r--r--protected/views/verein/view.php6
12 files changed, 67 insertions, 26 deletions
diff --git a/protected/controllers/SearchController.php b/protected/controllers/SearchController.php
index 1dd2414..603ad7c 100644
--- a/protected/controllers/SearchController.php
+++ b/protected/controllers/SearchController.php
@@ -2,44 +2,40 @@
class SearchController extends Controller
{
- public static $Searchables = array('Verein' => array('beschreibung'),'Sitecontent'=>array('content','title'));
+ public static $Searchables = array('Veranstaltung'=>array('titel','beschreibung'),'Verein' => array('beschreibung','name'),'Sitecontent'=>array('content','title'));
public function actionIndex()
{
$this->render('index');
}
- public function actionSearch()
+ public function actionSearch($search)
{
foreach (SearchController::$Searchables as $searchable => $columns) {
$q = new CDbCriteria();
foreach ($columns as $col) {
- $q->addSearchCondition($col,$_POST['search'],true,'OR');
+ $q->addSearchCondition($col,$search,true,'OR');
}
- $results[$searchable]=CActiveRecord::model($searchable)->findAll($q);
+ $results[$searchable]=CActiveRecord::model($searchable)->published()->findAll($q);
}
$this->render('results', array(
'results' => $results,
- 'search' => $_POST['search']));
+ 'search' => $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',
- ),
+ array('COutputCache','duration'=>3600,'varyByParam'=>array('search')),
);
}
-
+ /*
public function actions()
{
// return external action classes, e.g.:
diff --git a/protected/controllers/VereinController.php b/protected/controllers/VereinController.php
index 407a9e7..2056d6d 100644
--- a/protected/controllers/VereinController.php
+++ b/protected/controllers/VereinController.php
@@ -15,7 +15,7 @@ class VereinController extends Controller
{
return array(
'accessControl', // perform access control for CRUD operations
- array('COutputCache','duration'=>3600,'varyByParam'=>array('id','slug')),
+ //array('COutputCache','duration'=>3600,'varyByParam'=>array('id','slug')),
);
}
diff --git a/protected/models/Veranstaltung.php b/protected/models/Veranstaltung.php
index 0117033..60536cf 100644
--- a/protected/models/Veranstaltung.php
+++ b/protected/models/Veranstaltung.php
@@ -108,8 +108,10 @@ class Veranstaltung extends CActiveRecord
$criteria->compare('standort_id',$this->standort_id);
$criteria->compare('published',true);
+
return new CActiveDataProvider($this, array(
'criteria'=>$criteria,
+
));
}
@@ -145,4 +147,16 @@ class Veranstaltung extends CActiveRecord
// 'LoggableBehavior'=>'application.modules.auditTrail.behaviors.LoggableBehavior',
);
}
+ public function scopes()
+ {
+ return array(
+ 'published'=>array(
+ 'condition'=>'published=1',
+ ),
+ 'sorted'=>array(
+ 'order'=>'startzeit ASC',
+
+ ),
+ );
+ }
} \ No newline at end of file
diff --git a/protected/models/Verein.php b/protected/models/Verein.php
index 78117e0..242bd95 100644
--- a/protected/models/Verein.php
+++ b/protected/models/Verein.php
@@ -133,4 +133,12 @@ class Verein extends CActiveRecord
// 'LoggableBehavior'=>'application.modules.auditTrail.behaviors.LoggableBehavior',
);
}
+ public function scopes()
+ {
+ return array(
+ 'published'=>array(
+ 'condition'=>'published=1',
+ ),
+ );
+ }
} \ No newline at end of file
diff --git a/protected/modules/cms/models/Sitecontent.php b/protected/modules/cms/models/Sitecontent.php
index bcd1385..e63ace2 100644
--- a/protected/modules/cms/models/Sitecontent.php
+++ b/protected/modules/cms/models/Sitecontent.php
@@ -89,4 +89,12 @@ class Sitecontent extends CActiveRecord
}
return parent::beforeSave();
}
+ public function scopes()
+ {
+ return array(
+ 'published'=>array(
+ 'condition'=>'1=1',
+ ),
+ );
+ }
}
diff --git a/protected/views/search/results.php b/protected/views/search/results.php
index 05d2b57..e72cc51 100644
--- a/protected/views/search/results.php
+++ b/protected/views/search/results.php
@@ -5,12 +5,14 @@ $this->breadcrumbs=array(
);?>
<h3>Suchergebnisse für "<?php echo CHtml::encode($search) ?>"</h3>
<?php foreach ($results as $mod => $res) {?>
+ <?php $dataProvider = new CArrayDataProvider($res);
+ if($dataProvider->getItemCount()>0) {?>
<h5><?php echo $mod ?></h5>
<?php
- $dataProvider = new CArrayDataProvider($res);
$this->widget('zii.widgets.CListView', array(
'dataProvider'=>$dataProvider,
'itemView'=>'/'.lcfirst($mod).'/_short', // refers to the partial view named '_post'
));?>
-<?php }?>
+<?php }
+}?>
diff --git a/protected/views/veranstaltung/index.php b/protected/views/veranstaltung/index.php
index e8a5ceb..3703092 100644
--- a/protected/views/veranstaltung/index.php
+++ b/protected/views/veranstaltung/index.php
@@ -5,13 +5,22 @@ $this->breadcrumbs=array(
$this->menu=array(
array('label'=>'Jetzt auf dem Fest', 'url'=>array('now')),
- array('label'=>'Veranstaltung suchen', 'url'=>array('search')),
+ //array('label'=>'Veranstaltung suchen', 'url'=>array('search')),
);?>
<h3>Veranstaltungen</h3>
-<?php $this->widget('zii.widgets.grid.CGridView', array(
+<?php $this->widget('zii.widgets.CListView', array(
+ 'dataProvider'=>$model->published()->sorted()->search(),
+ 'itemView'=>'_short_all', // refers to the partial view named '_post'
+ 'sortableAttributes'=>array(
+ 'startzeit', 'titel'
+ /*'create_time'=>'Post Time',*/
+ ),
+ ));
+
+ $this->widget('zii.widgets.grid.CGridView', array(
'id'=>'veranstaltung-grid',
'dataProvider'=>$model->search(),
'filter'=>$model,
diff --git a/protected/views/veranstaltung/now.php b/protected/views/veranstaltung/now.php
index 12202ba..24354f2 100644
--- a/protected/views/veranstaltung/now.php
+++ b/protected/views/veranstaltung/now.php
@@ -7,7 +7,7 @@ $this->menu=array(
array('label'=>'Alle Veranstaltungen', 'url'=>array('index')),
array('label'=>'Jetzt auf dem Fest', 'url'=>array('now')),
- array('label'=>'Veranstaltung suchen', 'url'=>array('search')),
+ //array('label'=>'Veranstaltung suchen', 'url'=>array('search')),
);?>
diff --git a/protected/views/veranstaltung/view.php b/protected/views/veranstaltung/view.php
index e942aee..edf3ca2 100644
--- a/protected/views/veranstaltung/view.php
+++ b/protected/views/veranstaltung/view.php
@@ -7,7 +7,7 @@ $this->breadcrumbs=array(
$this->menu=array(
array('label'=>'Alle Veranstaltungen', 'url'=>array('index')),
array('label'=>'Jetzt auf dem Fest', 'url'=>array('now')),
- array('label'=>'Veranstaltung suchen', 'url'=>array('search')),
+ // array('label'=>'Veranstaltung suchen', 'url'=>array('search')),
);
?>
diff --git a/protected/views/verein/_short.php b/protected/views/verein/_short.php
index c6e42de..c282b6a 100644
--- a/protected/views/verein/_short.php
+++ b/protected/views/verein/_short.php
@@ -7,8 +7,12 @@ if(strlen(strip_tags($data->beschreibung))>300) {
$myBeschreibung = $tmp[0]."...";
} else {
$myBeschreibung = strip_tags($data->beschreibung);
-}?>
+}
+if(strlen($myBeschreibung)> 0) {
+ $myBeschreibung="<p>".$myBeschreibung."</p>";
+}
+?>
<?php /*
<p><?php echo CHTML::link(CHTML::decode($myBeschreibung),array("verein/view","id"=>$data->id)); ?></p>
*/?>
-<?php echo CHTML::link("<h6>".$data->name." (".$data->standort->name.")</h6><p>".$myBeschreibung."</p>" ,array("verein/view","id"=>$data->id)); ?> \ No newline at end of file
+<div class="erg"><?php echo CHTML::link("<h6>".$data->name."</h6><i>".$data->standort->name."</i>".$myBeschreibung ,array("verein/view","id"=>$data->id)); ?></div> \ No newline at end of file
diff --git a/protected/views/verein/index.php b/protected/views/verein/index.php
index 1e447a0..bfb20a8 100644
--- a/protected/views/verein/index.php
+++ b/protected/views/verein/index.php
@@ -2,11 +2,11 @@
$this->breadcrumbs=array(
'Vereine',
);
-
+/*
$this->menu=array(
array('label' => 'Verein suchen', 'url' => array('search')),
-);
+);*/
?>
<h2>Vereine</h2>
diff --git a/protected/views/verein/view.php b/protected/views/verein/view.php
index eb57968..2e0d0e5 100644
--- a/protected/views/verein/view.php
+++ b/protected/views/verein/view.php
@@ -36,9 +36,9 @@ $dataProvider=new CActiveDataProvider('AngebotVerein', array(
$this->widget('zii.widgets.CListView', array(
'dataProvider'=>$dataProvider,
'itemView'=>'_shortangebotverein',
- 'sortableAttributes'=>array(
- 'preis','menge',
- ),
+ //'sortableAttributes'=>array(
+ // 'preis','menge',
+ //),
));?>
<h4>Veranstaltungen</h4>
<?php