diff options
| author | Patrick Seeger <pseeger@ccwn.org> | 2014-05-08 14:30:15 +0200 |
|---|---|---|
| committer | Patrick Seeger <pseeger@ccwn.org> | 2014-05-08 14:30:15 +0200 |
| commit | 9631ea589c6fbbb267e901a691b8566cc4891803 (patch) | |
| tree | 2d6eadfba77297cc29a1b665d3db028656cfd18c /protected/models/Veranstaltung.php | |
| parent | 4f3fb96a75df63f8d611bcbadcdc6f33f33c8998 (diff) | |
Anzeige von alten Veranstaltungen verbessert.
Diffstat (limited to 'protected/models/Veranstaltung.php')
| -rw-r--r-- | protected/models/Veranstaltung.php | 25 |
1 files changed, 25 insertions, 0 deletions
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 |
