From 9631ea589c6fbbb267e901a691b8566cc4891803 Mon Sep 17 00:00:00 2001 From: Patrick Seeger Date: Thu, 8 May 2014 14:30:15 +0200 Subject: Anzeige von alten Veranstaltungen verbessert. --- css/main.css | 9 ++++++++- protected/models/Veranstaltung.php | 25 +++++++++++++++++++++++++ protected/views/myVeranstaltung/index.php | 4 ++++ protected/views/myVeranstaltung/view.php | 4 +++- protected/views/veranstaltung/index.php | 6 +++++- protected/views/veranstaltung/view.php | 6 ++++-- 6 files changed, 49 insertions(+), 5 deletions(-) diff --git a/css/main.css b/css/main.css index 13327b8..91c9266 100644 --- a/css/main.css +++ b/css/main.css @@ -226,4 +226,11 @@ div.search-form .operations li a:hover { background: #80CFFF; -} \ No newline at end of file +} + +.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( ?>

titel; ?>

- +thisYear) {?> +

Achtung: Termin in der Vergangenheit

Dieser Termin liegt in der Vergangenheit und wird nicht auf der Seite angezeigt werden.

+ 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( 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( ?>

titel; ?>

- +thisYear) {?> +

Achtung: Termin in der Vergangenheit

Dieser Termin liegt in der Vergangenheit und wird nicht auf der Seite angezeigt werden.

+ 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'), ), )); ?> -- cgit v1.0-28-g1787