diff options
| author | Tristan Zur <tzur@ccwn.org> | 2012-04-28 17:06:39 +0200 |
|---|---|---|
| committer | Tristan Zur <tzur@ccwn.org> | 2012-04-28 17:06:39 +0200 |
| commit | 139dbc9cc21fb1d419c6ecc80380f723e613efbc (patch) | |
| tree | 3bfa5c3ee5c84e2ff9ec7ccef2b27f1f378a6a19 /protected/models/Veranstaltung.php | |
| parent | 2d4bddcbf7b816f86db6f308a4d11bc9787c1f99 (diff) | |
- AuditTrail Berechtigungen gesetzt (Nur Admin)
- Fehler in Extension "CJuiDateTimePicker" beseitigt
- DateCompareValidator hinzugefügt
- DateRangeValidator hinzugefügt
- Datenbanktabellennamen geändert
- Views für die Veranstaltungen bearbeitet
Diffstat (limited to 'protected/models/Veranstaltung.php')
| -rw-r--r-- | protected/models/Veranstaltung.php | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/protected/models/Veranstaltung.php b/protected/models/Veranstaltung.php index fedd79f..64c7854 100644 --- a/protected/models/Veranstaltung.php +++ b/protected/models/Veranstaltung.php @@ -34,7 +34,7 @@ class Veranstaltung extends CActiveRecord */ public function tableName() { - return 'termin'; + return 'veranstaltungen'; } /** @@ -45,10 +45,13 @@ class Veranstaltung extends CActiveRecord // NOTE: you should only define rules for those attributes that // will receive user inputs. return array( + array('verein_id, standort_id, titel, startzeit, endzeit', 'required'), array('verein_id, standort_id, published', 'numerical', 'integerOnly'=>true), array('titel', 'length', 'max'=>100), array('startzeit, endzeit, beschreibung', 'safe'), - array('verein_id, standort_id, titel, startzeit, endzeit', 'required'), + array('startzeit, endzeit', 'date', 'format'=>'dd.MM.yyyy HH:mm'), + array('startzeit, endzeit', 'DateRangeValidator', 'minDate'=>Yii::app()->params['start_date'].' '.Yii::app()->params['start_time'], 'maxDate'=>Yii::app()->params['end_date'].' '.Yii::app()->params['end_time']), + array('startzeit', 'DateCompareValidator', 'compareAttribute'=>'endzeit', 'operator'=>'<'), // The following rule is used by search(). // Please remove those attributes that should not be searched. array('id, verein_id, titel, startzeit, endzeit, beschreibung, standort_id, published', 'safe', 'on'=>'search'), @@ -81,7 +84,7 @@ class Veranstaltung extends CActiveRecord 'endzeit' => 'Endzeit', 'beschreibung' => 'Beschreibung', 'standort_id' => 'Standort', - 'published' => 'Published', + 'published' => 'Öffentlich', ); } @@ -110,6 +113,15 @@ class Veranstaltung extends CActiveRecord )); } + public function beforeSave() { + $isValid = parent::beforeSave(); + if ($isValid) { + $this->startzeit = Format::dbDateTime($this->startzeit); + $this->endzeit = Format::dbDateTime($this->endzeit); + } + return $isValid; + } + public function behaviors() { return array( 'LoggableBehavior'=>'application.modules.auditTrail.behaviors.LoggableBehavior', |
