summaryrefslogtreecommitdiff
path: root/protected/models/Veranstaltung.php
diff options
context:
space:
mode:
Diffstat (limited to 'protected/models/Veranstaltung.php')
-rw-r--r--protected/models/Veranstaltung.php25
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