summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPatrick Seeger <pseeger@ccwn.org>2014-06-20 16:12:37 +0200
committerPatrick Seeger <pseeger@ccwn.org>2014-06-20 16:12:37 +0200
commit3f5fb160700b79249521afffb9c83e7f13eedbd8 (patch)
tree8f5fa682e13fecea470cf8a456ed73786d1a7bbf
parent02d863bc91b58d6a50dd0ec13bbeb07f56ac61ae (diff)
Anzeige von Veranstaltungen verschönert
-rw-r--r--protected/controllers/VeranstaltungController.php5
-rw-r--r--protected/models/AngebotVerein.php16
-rw-r--r--protected/views/veranstaltung/_list_veranstaltungen.php45
-rw-r--r--protected/views/veranstaltung/index.php76
-rw-r--r--protected/views/veranstaltung/stage.php5
-rw-r--r--protected/views/verein/view.php6
6 files changed, 117 insertions, 36 deletions
diff --git a/protected/controllers/VeranstaltungController.php b/protected/controllers/VeranstaltungController.php
index d047f1d..4cc1c58 100644
--- a/protected/controllers/VeranstaltungController.php
+++ b/protected/controllers/VeranstaltungController.php
@@ -54,13 +54,16 @@ class VeranstaltungController extends Controller
*/
public function actionIndex()
{
+ $tag="Alle";
$model=new Veranstaltung('search');
$model->unsetAttributes(); // clear any default values
if(isset($_GET['Veranstaltung']))
$model->attributes=$_GET['Veranstaltung'];
-
+ if(isset($_GET['tag']))
+ $tag=$_GET['tag'];
$this->render('index',array(
'model'=>$model,
+ 'tag' => $tag,
));
}
diff --git a/protected/models/AngebotVerein.php b/protected/models/AngebotVerein.php
index 1031100..b7c9326 100644
--- a/protected/models/AngebotVerein.php
+++ b/protected/models/AngebotVerein.php
@@ -105,4 +105,20 @@ class AngebotVerein extends CActiveRecord
//'LoggableBehavior'=>'application.modules.auditTrail.behaviors.LoggableBehavior',
);
}
+ public function parentVerein($vereinId=0)
+ {
+ $this->getDbCriteria()->mergeWith(array(
+ 'condition'=>"verein_id = $vereinId",
+ ));
+ return $this;
+ }
+
+ public function scopes()
+ {
+ return array(
+ 'published'=>array(
+ 'condition'=>'`t`.`published`=1',
+ ),
+ );
+ }
} \ No newline at end of file
diff --git a/protected/views/veranstaltung/_list_veranstaltungen.php b/protected/views/veranstaltung/_list_veranstaltungen.php
new file mode 100644
index 0000000..95a7c51
--- /dev/null
+++ b/protected/views/veranstaltung/_list_veranstaltungen.php
@@ -0,0 +1,45 @@
+<?php
+$this->widget('zii.widgets.grid.CGridView', array(
+
+ 'dataProvider'=>$veranstaltungen->search(),
+ 'columns'=>array(
+ array(
+ 'name'=>'startzeit',
+ 'type'=>'html',
+ 'sortable' => true,
+ 'header' => "Wann?",
+ 'value'=>'Yii::app()->dateFormatter->format(\'EEEE\',$data->startzeit)."<br />".Yii::app()->dateFormatter->format(\'HH:mm\',$data->startzeit)." Uhr"',
+ 'htmlOptions' => array('style'=>"width:15%;"),
+ ),
+ array(
+ 'name'=> 'titel',
+ 'header' =>'Was?',
+ 'type' => 'Raw',
+ 'value' => 'CHTML::link($data->titel,array("veranstaltung/view","id"=>$data->id))',
+ ),
+ array(
+ 'name' => "standort_id",
+ 'type' => 'Raw',
+ 'header' => "Wo?",
+ 'sortable' => true,
+ 'value' => 'CHTML::link($data->standort->name,array("standort/view","id"=>$data->standort->id))',
+ ),
+
+ array(
+ 'name' => "verein_id",
+ 'header' => "Verein",
+ 'sortable' => true,
+ 'type' => 'Raw',
+ 'value' => 'CHTML::link($data->verein->name,array("verein/view","id"=>$data->verein->id))',
+ ),
+ ),
+ 'blankDisplay' => "Heute keine Termine bekannt",
+ 'enableSorting' => true,
+ 'enablePagination' => true,
+ 'showTableOnEmpty' => false,
+ 'hideHeader' => false,
+ 'template' => '{pager} {items} {pager}',
+ 'htmlOptions' => array('class'=>''),
+
+
+)); \ No newline at end of file
diff --git a/protected/views/veranstaltung/index.php b/protected/views/veranstaltung/index.php
index 4415f85..5c6d9c6 100644
--- a/protected/views/veranstaltung/index.php
+++ b/protected/views/veranstaltung/index.php
@@ -6,41 +6,51 @@ $this->pageTitle = 'Veranstaltungen - ' . Yii::app()->name;
$this->menu=array(
array('label'=>'Jetzt auf dem Fest', 'url'=>array('now')),
+ array('label'=>'Freitag', 'url'=>array('index','tag'=>'Freitag')),
+ array('label'=>'Samstag', 'url'=>array('index','tag'=>'Samstag')),
+ array('label'=>'Sonntag', 'url'=>array('index','tag'=>'Sonntag')),
+ //array('label'=>'Bühnenprogramm', 'url'=>array('stage')),
//array('label'=>'Veranstaltung suchen', 'url'=>array('search')),
-);?>
-<h3>Veranstaltungen</h3>
+);/*
+$buehnen = new CActiveDataProvider('Standort', array(
+ 'criteria'=>array(
+ 'condition'=>"type='Bühne'",
-
-<?php $this->widget('zii.widgets.CListView', array(
- 'dataProvider'=>$model->published()->thisYear()->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,
- 'columns'=>array(
- array('header'=>'Verein',
- 'name'=>'verein_id',
- 'filter'=>CHtml::listData(Verein::model()->findAll(), 'id', 'name'),
- 'value'=>'$data->verein->name'),
- 'titel',
- array('header'=>'Startzeit', 'value'=>'Format::displayDateTime($data->startzeit)'),
- array('header'=>'Endzeit', 'value'=>'Format::displayDateTime($data->endzeit)'),
- array('header'=>'Standort',
- 'name'=>'standort_id',
- 'filter'=>CHtml::listData(Standort::model()->findAll(array('condition'=>'type="Bühne"')), 'id', 'name'),
- 'value'=>'($data->standort) ? $data->standort->name : "Kein Standort"'),
- array('header'=>'Öffentlich',
- 'value'=>'CHtml::image($data->published ? "images/ok.png" : "images/nok.png", $data->published ? "ok.png" : "nok.png")', 'type'=>'raw'),
- array(
- 'class'=>'CButtonColumn',
- ),
- )
-)); */?>
+$mymenu = array();
+foreach ($buehnen->getData() as $buehne) {
+ $mymenu = array_merge( $mymenu , array(array('label' => 'Bühnenprogramm '.$buehne->name, 'url'=>array('stage','id'=>$buehne->id))));
+}
+$this->menu = array_merge($this->menu, $mymenu);
+*/
+?>
+<h2>Veranstaltungen
+<?php
+$veranstaltung = new Veranstaltung();
+$veranstaltung->with('verein')->with('standort');
+switch ($tag) {
+ case 'Freitag':
+ $veranstaltung->freitag();
+ echo " am ".$tag;
+ break;
+ case 'Samstag':
+ $veranstaltung->samstag();
+ echo " am ".$tag;
+ break;
+ case 'Sonntag':
+ $veranstaltung->sonntag();
+ echo " am ".$tag;
+ break;
+}
+?>
+</h2>
+
+<?php
+$veranstaltung->published()->thisYear()->sorted();
+$this->renderPartial('_list_veranstaltungen',array(
+ 'veranstaltungen'=>$veranstaltung
+ ));
+
+?> \ No newline at end of file
diff --git a/protected/views/veranstaltung/stage.php b/protected/views/veranstaltung/stage.php
index 80744ab..997823d 100644
--- a/protected/views/veranstaltung/stage.php
+++ b/protected/views/veranstaltung/stage.php
@@ -49,9 +49,12 @@ $sonntag=new CActiveDataProvider('Veranstaltung', array(
<?php
$veranstaltung = new Veranstaltung();
+
+$veranstaltung->published()->thisYear()->freitag()->parentStage($model->id)->sorted();
+
$this->widget('zii.widgets.grid.CGridView', array(
- 'dataProvider'=>$veranstaltung->published()->thisYear()->freitag()->parentStage($model->id)->sorted()->search(),
+ 'dataProvider'=>$veranstaltung->search(),
'columns'=>array(
array( // display 'create_time' using an expression
'name'=>'Startzeit',
diff --git a/protected/views/verein/view.php b/protected/views/verein/view.php
index f7c066d..6b835d6 100644
--- a/protected/views/verein/view.php
+++ b/protected/views/verein/view.php
@@ -41,13 +41,17 @@ $dataProvider=new CActiveDataProvider('AngebotVerein', array(
'pageSize'=>20,
),
));
+
+
$this->widget('zii.widgets.CListView', array(
'dataProvider'=>$dataProvider,
'itemView'=>'_shortangebotverein',
//'sortableAttributes'=>array(
// 'preis','menge',
//),
- ));?>
+ ));
+
+?>
<h4>Veranstaltungen</h4>
<?php
$veranstaltung = new Veranstaltung();