summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPatrick Seeger <pseeger@ccwn.org>2014-05-08 14:30:15 +0200
committerPatrick Seeger <pseeger@ccwn.org>2014-05-08 14:30:15 +0200
commit9631ea589c6fbbb267e901a691b8566cc4891803 (patch)
tree2d6eadfba77297cc29a1b665d3db028656cfd18c
parent4f3fb96a75df63f8d611bcbadcdc6f33f33c8998 (diff)
Anzeige von alten Veranstaltungen verbessert.
-rw-r--r--css/main.css7
-rw-r--r--protected/models/Veranstaltung.php25
-rw-r--r--protected/views/myVeranstaltung/index.php4
-rw-r--r--protected/views/myVeranstaltung/view.php4
-rw-r--r--protected/views/veranstaltung/index.php6
-rw-r--r--protected/views/veranstaltung/view.php6
6 files changed, 48 insertions, 4 deletions
diff --git a/css/main.css b/css/main.css
index 13327b8..91c9266 100644
--- a/css/main.css
+++ b/css/main.css
@@ -227,3 +227,10 @@ div.search-form
{
background: #80CFFF;
}
+
+.grid-view table.items tr.old
+{
+
+ color: #aaaaaa;
+}
+
diff --git a/protected/models/Veranstaltung.php b/protected/models/Veranstaltung.php
index 496cf30..9c2a3d8 100644
--- a/protected/models/Veranstaltung.php
+++ b/protected/models/Veranstaltung.php
@@ -19,6 +19,13 @@
*/
class Veranstaltung extends CActiveRecord
{
+
+ public function getThisYear (){
+ $feststart = CDateTimeParser::parse(Yii::app()->params['start_date']." 00:00", 'dd.MM.yyyy HH:mm');
+ $terminstart = CDateTimeParser::parse($this->startzeit, 'yyyy-MM-dd HH:mm:ss');
+ return ($terminstart >= $feststart );
+
+ }
/**
* Returns the static model of the specified AR class.
* @param string $className active record class name.
@@ -131,4 +138,22 @@ 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',
+ ),
+ 'thisYear'=>array(
+ 'condition'=>"startzeit > STR_TO_DATE('".Yii::app()->params['start_date']."',GET_FORMAT(DATE,'EUR'))",
+
+ ),
+ 'sortedDESC'=>array(
+ 'order'=>'startzeit DESC',
+ ),
+ );
+ }
} \ No newline at end of file
diff --git a/protected/views/myVeranstaltung/index.php b/protected/views/myVeranstaltung/index.php
index 373e056..2471e44 100644
--- a/protected/views/myVeranstaltung/index.php
+++ b/protected/views/myVeranstaltung/index.php
@@ -20,6 +20,10 @@ $this->menu=array(
'id'=>'veranstaltung-grid',
'dataProvider'=>$model->search(),
'filter'=>$model,
+ 'rowCssClassExpression' => '
+ ( $row%2 ? $this->rowCssClass[1] : $this->rowCssClass[0] ) .
+ ( $data->thisYear ? null : " old" )
+ ',
'columns'=>array(
//'id',
//'verein_id',
diff --git a/protected/views/myVeranstaltung/view.php b/protected/views/myVeranstaltung/view.php
index cb1ab82..4c66a23 100644
--- a/protected/views/myVeranstaltung/view.php
+++ b/protected/views/myVeranstaltung/view.php
@@ -13,7 +13,9 @@ $this->menu=array(
?>
<h1><?php echo $model->titel; ?></h1>
-
+<?php if(!$model->thisYear) {?>
+ <div class="box " style="background-color:yellow;"><h2>Achtung: Termin in der Vergangenheit</h2><p>Dieser Termin liegt in der Vergangenheit und wird nicht auf der Seite angezeigt werden.</p></div>
+<?php }?>
<?php $this->widget('zii.widgets.CDetailView', array(
'data'=>$model,
'attributes'=>array(
diff --git a/protected/views/veranstaltung/index.php b/protected/views/veranstaltung/index.php
index 35f2ec7..caaa91e 100644
--- a/protected/views/veranstaltung/index.php
+++ b/protected/views/veranstaltung/index.php
@@ -17,8 +17,12 @@ $this->menu=array(
<?php $this->widget('zii.widgets.grid.CGridView', array(
'id'=>'veranstaltung-grid',
- 'dataProvider'=>$model->search(),
+ 'dataProvider'=>$model->sortedDESC()->search(),
'filter'=>$model,
+ 'rowCssClassExpression' => '
+ ( $row%2 ? $this->rowCssClass[1] : $this->rowCssClass[0] ) .
+ ( $data->thisYear ? null : " old" )
+ ',
'columns'=>array(
array('header'=>'Verein',
'name'=>'verein_id',
diff --git a/protected/views/veranstaltung/view.php b/protected/views/veranstaltung/view.php
index 55444d8..4579060 100644
--- a/protected/views/veranstaltung/view.php
+++ b/protected/views/veranstaltung/view.php
@@ -13,7 +13,9 @@ $this->menu=array(
?>
<h1><?php echo $model->titel; ?></h1>
-
+<?php if(!$model->thisYear) {?>
+ <div class="box " style="background-color:yellow;"><h2>Achtung: Termin in der Vergangenheit</h2><p>Dieser Termin liegt in der Vergangenheit und wird nicht auf der Seite angezeigt werden.</p></div>
+<?php }?>
<?php $this->widget('zii.widgets.CDetailView', array(
'data'=>$model,
'attributes'=>array(
@@ -23,6 +25,6 @@ $this->menu=array(
array('label'=>'Endzeit', 'value'=>Format::displayDateTime($model->endzeit)),
'beschreibung:html',
array('label'=>'Standort', 'value'=>($model->standort) ? $model->standort->name : null),
- array('label'=>'Öfentlich', 'value'=>CHtml::image($model->published ? "images/ok.png" : "images/nok.png", $model->published ? "ok.png" : "nok.png"), 'type'=>'raw'),
+ array('label'=>'Öffentlich', 'value'=>CHtml::image($model->published ? "images/ok.png" : "images/nok.png", $model->published ? "ok.png" : "nok.png"), 'type'=>'raw'),
),
)); ?>