diff options
| author | Patrick Seeger <pseeger@ccwn.org> | 2012-04-30 10:18:11 +0200 |
|---|---|---|
| committer | Patrick Seeger <pseeger@ccwn.org> | 2012-04-30 10:18:11 +0200 |
| commit | acec2b5dc35302147f9a9c73d837dce2f3f9958e (patch) | |
| tree | 2f88a3a657a9211331e1e63e056a089189bd0dd2 /protected/models | |
| parent | 56593a21209f3ce55fe66d303dbe01b8e081778b (diff) | |
| parent | 148a216bba21cec1cbe07b60b5191791e0016d6f (diff) | |
Merge branch 'master' of ssh://proxy.ccwn.org:9044/home/ccwn/git-repos/admin.astaf.de
Diffstat (limited to 'protected/models')
| -rw-r--r-- | protected/models/Angebot.php | 9 | ||||
| -rw-r--r-- | protected/models/AngebotVerein.php | 24 | ||||
| -rw-r--r-- | protected/models/Kategorie.php | 8 | ||||
| -rw-r--r-- | protected/models/LoginForm.php | 2 | ||||
| -rw-r--r-- | protected/models/Standort.php | 16 | ||||
| -rw-r--r-- | protected/models/User.php | 2 | ||||
| -rw-r--r-- | protected/models/Veranstaltung.php | 130 | ||||
| -rw-r--r-- | protected/models/Verein.php | 12 |
8 files changed, 187 insertions, 16 deletions
diff --git a/protected/models/Angebot.php b/protected/models/Angebot.php index 7791bcb..d6ae02a 100644 --- a/protected/models/Angebot.php +++ b/protected/models/Angebot.php @@ -27,7 +27,7 @@ class Angebot extends CActiveRecord */ public function tableName() { - return 'angebot'; + return 'angebote'; } /** @@ -38,6 +38,7 @@ class Angebot extends CActiveRecord // NOTE: you should only define rules for those attributes that // will receive user inputs. return array( + array('name, kategorie_id', 'required'), array('kategorie_id, published', 'numerical', 'integerOnly'=>true), array('name', 'length', 'max'=>80), array('beschreibung', 'safe'), @@ -96,4 +97,10 @@ class Angebot extends CActiveRecord 'criteria'=>$criteria, )); } + + public function behaviors() { + return array( + 'LoggableBehavior'=>'application.modules.auditTrail.behaviors.LoggableBehavior', + ); + } }
\ No newline at end of file diff --git a/protected/models/AngebotVerein.php b/protected/models/AngebotVerein.php index 54cb734..26c6dab 100644 --- a/protected/models/AngebotVerein.php +++ b/protected/models/AngebotVerein.php @@ -6,7 +6,8 @@ * The followings are the available columns in table 'angebot_verein': * @property integer $angebot_id * @property integer $verein_id - * @property integer $menge + * @property double $menge + * @property string $einheit * @property double $preis * @property integer $published */ @@ -38,12 +39,13 @@ class AngebotVerein extends CActiveRecord // NOTE: you should only define rules for those attributes that // will receive user inputs. return array( - array('angebot_id, verein_id, menge', 'required'), - array('angebot_id, verein_id, menge, published', 'numerical', 'integerOnly'=>true), - array('preis', 'numerical'), + array('angebot_id, verein_id, menge, einheit, preis', 'required'), + array('angebot_id, verein_id, published', 'numerical', 'integerOnly'=>true), + array('menge, preis', 'numerical'), + array('einheit', 'length', 'max'=>20), // The following rule is used by search(). // Please remove those attributes that should not be searched. - array('angebot_id, verein_id, menge, preis, published', 'safe', 'on'=>'search'), + array('angebot_id, verein_id, menge, einheit, preis, published', 'safe', 'on'=>'search'), ); } @@ -55,6 +57,8 @@ class AngebotVerein extends CActiveRecord // NOTE: you may need to adjust the relation name and the related // class name for the relations automatically generated below. return array( + "angebot"=>array(self::HAS_ONE, "Angebot", array('id'=>'angebot_id')), + "verein"=>array(self::HAS_ONE, "Verein", array('id'=>'verein_id')) ); } @@ -67,8 +71,9 @@ class AngebotVerein extends CActiveRecord 'angebot_id' => 'Angebot', 'verein_id' => 'Verein', 'menge' => 'Menge', + 'einheit' => 'Einheit', 'preis' => 'Preis', - 'published' => 'Published', + 'published' => 'Öffentlich', ); } @@ -86,6 +91,7 @@ class AngebotVerein extends CActiveRecord $criteria->compare('angebot_id',$this->angebot_id); $criteria->compare('verein_id',$this->verein_id); $criteria->compare('menge',$this->menge); + $criteria->compare('einheit',$this->einheit,true); $criteria->compare('preis',$this->preis); $criteria->compare('published',$this->published); @@ -93,4 +99,10 @@ class AngebotVerein extends CActiveRecord 'criteria'=>$criteria, )); } + + public function behaviors() { + return array( + 'LoggableBehavior'=>'application.modules.auditTrail.behaviors.LoggableBehavior', + ); + } }
\ No newline at end of file diff --git a/protected/models/Kategorie.php b/protected/models/Kategorie.php index 4e39910..93c799d 100644 --- a/protected/models/Kategorie.php +++ b/protected/models/Kategorie.php @@ -28,7 +28,7 @@ class Kategorie extends CActiveRecord */ public function tableName() { - return 'kategorie'; + return 'kategorien'; } /** @@ -98,4 +98,10 @@ class Kategorie extends CActiveRecord 'criteria'=>$criteria, )); } + + public function behaviors() { + return array( + 'LoggableBehavior'=>'application.modules.auditTrail.behaviors.LoggableBehavior', + ); + } }
\ No newline at end of file diff --git a/protected/models/LoginForm.php b/protected/models/LoginForm.php index eb36e4a..3904698 100644 --- a/protected/models/LoginForm.php +++ b/protected/models/LoginForm.php @@ -67,7 +67,7 @@ class LoginForm extends CFormModel } if($this->_identity->errorCode===UserIdentity::ERROR_NONE) { - $duration=$this->rememberMe ? 3600*24*30 : 0; // 30 days + $duration=$this->rememberMe ? 3600*24*1 : 0; // 1 days Yii::app()->user->login($this->_identity,$duration); return true; } diff --git a/protected/models/Standort.php b/protected/models/Standort.php index 48493f6..d62a594 100644 --- a/protected/models/Standort.php +++ b/protected/models/Standort.php @@ -5,6 +5,7 @@ * * The followings are the available columns in table 'standort': * @property integer $id + * @property string $type * @property string $name * @property double $pos_lat * @property double $pos_long @@ -32,7 +33,7 @@ class Standort extends CActiveRecord */ public function tableName() { - return 'standort'; + return 'standorte'; } /** @@ -43,13 +44,14 @@ class Standort extends CActiveRecord // NOTE: you should only define rules for those attributes that // will receive user inputs. return array( - array('name, pos_lat, pos_long', 'required'), + array('name, pos_lat, pos_long, type', 'required'), array('published', 'numerical', 'integerOnly'=>true), array('pos_lat, pos_long', 'numerical'), + array('type', 'length', 'max'=>6), array('name', 'length', 'max'=>80), // The following rule is used by search(). // Please remove those attributes that should not be searched. - array('id, name, pos_lat, pos_long, published', 'safe', 'on'=>'search'), + array('id, type, name, pos_lat, pos_long, published', 'safe', 'on'=>'search'), ); } @@ -71,6 +73,7 @@ class Standort extends CActiveRecord { return array( 'id' => 'ID', + 'type' => 'Typ', 'name' => 'Name', 'pos_lat' => 'Pos Lat', 'pos_long' => 'Pos Long', @@ -90,6 +93,7 @@ class Standort extends CActiveRecord $criteria=new CDbCriteria; $criteria->compare('id',$this->id); + $criteria->compare('type',$this->type,true); $criteria->compare('name',$this->name,true); $criteria->compare('pos_lat',$this->pos_lat); $criteria->compare('pos_long',$this->pos_long); @@ -99,4 +103,10 @@ class Standort extends CActiveRecord 'criteria'=>$criteria, )); } + + public function behaviors() { + return array( + 'LoggableBehavior'=>'application.modules.auditTrail.behaviors.LoggableBehavior', + ); + } }
\ No newline at end of file diff --git a/protected/models/User.php b/protected/models/User.php index f3a2163..b6a1609 100644 --- a/protected/models/User.php +++ b/protected/models/User.php @@ -31,7 +31,7 @@ class User extends CActiveRecord */ public function tableName() { - return 'astaf_user'; + return 'benutzer'; } /** diff --git a/protected/models/Veranstaltung.php b/protected/models/Veranstaltung.php new file mode 100644 index 0000000..64c7854 --- /dev/null +++ b/protected/models/Veranstaltung.php @@ -0,0 +1,130 @@ +<?php + +/** + * This is the model class for table "termin". + * + * The followings are the available columns in table 'termin': + * @property integer $id + * @property integer $verein_id + * @property string $titel + * @property string $startzeit + * @property string $endzeit + * @property string $beschreibung + * @property integer $standort_id + * @property integer $published + * + * The followings are the available model relations: + * @property Standort $standort + * @property Verein $verein + */ +class Veranstaltung extends CActiveRecord +{ + /** + * Returns the static model of the specified AR class. + * @param string $className active record class name. + * @return Veranstaltung the static model class + */ + public static function model($className=__CLASS__) + { + return parent::model($className); + } + + /** + * @return string the associated database table name + */ + public function tableName() + { + return 'veranstaltungen'; + } + + /** + * @return array validation rules for model attributes. + */ + public function rules() + { + // 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('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'), + ); + } + + /** + * @return array relational rules. + */ + public function relations() + { + // NOTE: you may need to adjust the relation name and the related + // class name for the relations automatically generated below. + return array( + 'standort' => array(self::BELONGS_TO, 'Standort', 'standort_id'), + 'verein' => array(self::BELONGS_TO, 'Verein', 'verein_id'), + ); + } + + /** + * @return array customized attribute labels (name=>label) + */ + public function attributeLabels() + { + return array( + 'id' => 'ID', + 'verein_id' => 'Verein', + 'titel' => 'Titel', + 'startzeit' => 'Startzeit', + 'endzeit' => 'Endzeit', + 'beschreibung' => 'Beschreibung', + 'standort_id' => 'Standort', + 'published' => 'Öffentlich', + ); + } + + /** + * Retrieves a list of models based on the current search/filter conditions. + * @return CActiveDataProvider the data provider that can return the models based on the search/filter conditions. + */ + public function search() + { + // Warning: Please modify the following code to remove attributes that + // should not be searched. + + $criteria=new CDbCriteria; + + $criteria->compare('id',$this->id); + $criteria->compare('verein_id',$this->verein_id); + $criteria->compare('titel',$this->titel,true); + $criteria->compare('startzeit',$this->startzeit,true); + $criteria->compare('endzeit',$this->endzeit,true); + $criteria->compare('beschreibung',$this->beschreibung,true); + $criteria->compare('standort_id',$this->standort_id); + $criteria->compare('published',$this->published); + + return new CActiveDataProvider($this, array( + 'criteria'=>$criteria, + )); + } + + 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', + ); + } +}
\ No newline at end of file diff --git a/protected/models/Verein.php b/protected/models/Verein.php index dba05db..83fc21f 100644 --- a/protected/models/Verein.php +++ b/protected/models/Verein.php @@ -33,7 +33,7 @@ class Verein extends CActiveRecord */ public function tableName() { - return 'verein'; + return 'vereine'; } /** @@ -48,8 +48,8 @@ class Verein extends CActiveRecord array('standort_id, published', 'numerical', 'integerOnly'=>true), array('name, url', 'length', 'max'=>255), array('bild, email, slug', 'length', 'max'=>100), - array("url", "url", "allowEmpty"=>true, "message"=>"Die eingebene URL ist ung�ltig."), - array("email", "email", "message"=>"Die eingebene eMail-Adresse ist ung�ltig."), + array("url", "url", "allowEmpty"=>true, "message"=>"Die eingebene URL ist ungültig."), + array("email", "email", "message"=>"Die eingebene eMail-Adresse ist ungültig."), array("uploadedImage", "file", "types"=>"jpg, gif, png", "allowEmpty"=>true, "wrongType"=>'Die Datei "{file}" konnte nicht hochgeladen werden. Es sind nur Dateien mit den folgenden Endungen erlaubt: {extensions}.'), array('kontaktdaten, beschreibung', 'safe'), // The following rule is used by search(). @@ -116,4 +116,10 @@ class Verein extends CActiveRecord 'criteria'=>$criteria, )); } + + public function behaviors() { + return array( + 'LoggableBehavior'=>'application.modules.auditTrail.behaviors.LoggableBehavior', + ); + } }
\ No newline at end of file |
