diff options
Diffstat (limited to 'protected/models')
| -rw-r--r-- | protected/models/Angebot.php | 106 | ||||
| -rw-r--r-- | protected/models/AngebotVerein.php | 108 | ||||
| -rw-r--r-- | protected/models/CmsPage.php | 133 | ||||
| -rw-r--r-- | protected/models/Kategorie.php | 107 | ||||
| -rw-r--r-- | protected/models/Standort.php | 112 | ||||
| -rw-r--r-- | protected/models/Veranstaltung.php | 130 | ||||
| -rw-r--r-- | protected/models/Verein.php | 125 |
7 files changed, 688 insertions, 133 deletions
diff --git a/protected/models/Angebot.php b/protected/models/Angebot.php new file mode 100644 index 0000000..d6ae02a --- /dev/null +++ b/protected/models/Angebot.php @@ -0,0 +1,106 @@ +<?php + +/** + * This is the model class for table "angebot". + * + * The followings are the available columns in table 'angebot': + * @property integer $id + * @property integer $kategorie_id + * @property string $name + * @property string $beschreibung + * @property integer $published + */ +class Angebot extends CActiveRecord +{ + /** + * Returns the static model of the specified AR class. + * @param string $className active record class name. + * @return Angebot 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 'angebote'; + } + + /** + * @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('name, kategorie_id', 'required'), + array('kategorie_id, published', 'numerical', 'integerOnly'=>true), + array('name', 'length', 'max'=>80), + array('beschreibung', 'safe'), + // The following rule is used by search(). + // Please remove those attributes that should not be searched. + array('id, kategorie_id, name, beschreibung, 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( + "kategorie"=>array(self::HAS_ONE, "Kategorie", array('id'=>'kategorie_id')), + "angebot_vereine"=>array(self::HAS_MANY, "AngebotVerein", array('angebot_id'=>'id')) + ); + } + + /** + * @return array customized attribute labels (name=>label) + */ + public function attributeLabels() + { + return array( + 'id' => 'ID', + 'kategorie_id' => 'Kategorie', + 'kategorie' => 'Kategorie', + 'name' => 'Name', + 'beschreibung' => 'Beschreibung', + '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('kategorie_id',$this->kategorie_id); + $criteria->compare('name',$this->name,true); + $criteria->compare('beschreibung',$this->beschreibung,true); + $criteria->compare('published',$this->published); + + return new CActiveDataProvider($this, array( + '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 new file mode 100644 index 0000000..26c6dab --- /dev/null +++ b/protected/models/AngebotVerein.php @@ -0,0 +1,108 @@ +<?php + +/** + * This is the model class for table "angebot_verein". + * + * The followings are the available columns in table 'angebot_verein': + * @property integer $angebot_id + * @property integer $verein_id + * @property double $menge + * @property string $einheit + * @property double $preis + * @property integer $published + */ +class AngebotVerein extends CActiveRecord +{ + /** + * Returns the static model of the specified AR class. + * @param string $className active record class name. + * @return AngebotVerein 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 'angebot_verein'; + } + + /** + * @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('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, einheit, preis, 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( + "angebot"=>array(self::HAS_ONE, "Angebot", array('id'=>'angebot_id')), + "verein"=>array(self::HAS_ONE, "Verein", array('id'=>'verein_id')) + ); + } + + /** + * @return array customized attribute labels (name=>label) + */ + public function attributeLabels() + { + return array( + 'angebot_id' => 'Angebot', + 'verein_id' => 'Verein', + 'menge' => 'Menge', + 'einheit' => 'Einheit', + 'preis' => 'Preis', + '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('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); + + return new CActiveDataProvider($this, array( + 'criteria'=>$criteria, + )); + } + + public function behaviors() { + return array( + 'LoggableBehavior'=>'application.modules.auditTrail.behaviors.LoggableBehavior', + ); + } +}
\ No newline at end of file diff --git a/protected/models/CmsPage.php b/protected/models/CmsPage.php deleted file mode 100644 index 92acf23..0000000 --- a/protected/models/CmsPage.php +++ /dev/null @@ -1,133 +0,0 @@ -<?php - -/** - * This is the model class for table "{{cms_page}}". - * - * The followings are the available columns in table '{{cms_page}}': - * @property integer $id - * @property string $content - * @property string $title - * @property string $create_time - * @property string $update_time - * @property integer $status - * @property string $slug - */ -class CmsPage extends CActiveRecord -{ - - - const STATUS_PUBLISHED=1; - const STATUS_DRAFT=2; - const STATUS_DELETED=3; - /** - * Returns the static model of the specified AR class. - * @param string $className active record class name. - * @return CmsPage 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 '{{cms_page}}'; - } - - /** - * @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('content, title, status, slug', 'required'), - array('status', 'numerical', 'integerOnly'=>true), - array('status', 'in', 'range'=>array(1,2,3)), - array('title, slug', 'length', 'max'=>255), - // The following rule is used by search(). - // Please remove those attributes that should not be searched. - array('id, content, title, create_time, update_time, status, slug', 'safe', 'on'=>'search'), - //array('title, status', '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( - ); - } - - /** - * @return array customized attribute labels (name=>label) - */ - public function attributeLabels() - { - return array( - 'id' => 'ID', - 'content' => 'Content', - 'title' => 'Title', - 'create_time' => 'Create Time', - 'update_time' => 'Update Time', - 'status' => 'Status', - 'slug' => 'Slug', - ); - } - - /** - * 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('content',$this->content,true); - $criteria->compare('title',$this->title,true); - $criteria->compare('create_time',$this->create_time,true); - $criteria->compare('update_time',$this->update_time,true); - $criteria->compare('status',$this->status); - $criteria->compare('slug',$this->slug,true); - - return new CActiveDataProvider($this, array( - 'criteria'=>$criteria, - )); - } - - public function getUrl() - { - return Yii::app()->createUrl('cms', array( - 'slug'=>$this->slug, - )); - } - - protected function beforeSave() - { - if(parent::beforeSave()) - { - if($this->isNewRecord) - { - $this->create_time=$this->update_time=new CDbExpression('NOW()'); - //$this->author_id=Yii::app()->user->id; - } - else - $this->update_time=new CDbExpression('NOW()'); - return true; - } - else - return false; - } -}
\ No newline at end of file diff --git a/protected/models/Kategorie.php b/protected/models/Kategorie.php new file mode 100644 index 0000000..93c799d --- /dev/null +++ b/protected/models/Kategorie.php @@ -0,0 +1,107 @@ +<?php + +/** + * This is the model class for table "kategorie". + * + * The followings are the available columns in table 'kategorie': + * @property integer $id + * @property string $name + * @property string $einheiten + * @property double $default_menge + * @property string $default_einheit + * @property integer $published + */ +class Kategorie extends CActiveRecord +{ + /** + * Returns the static model of the specified AR class. + * @param string $className active record class name. + * @return Kategorie 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 'kategorien'; + } + + /** + * @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('name, einheiten, default_einheit', 'required'), + array('published', 'numerical', 'integerOnly'=>true), + array('default_menge', 'numerical', "numberPattern"=>"/^\s*[-+]?[0-9]*(,|\.)?[0-9]+([eE][-+]?[0-9]+)?\s*$/"), + array('name, einheiten', 'length', 'max'=>100), + array('default_einheit', 'length', 'max'=>20), + // The following rule is used by search(). + // Please remove those attributes that should not be searched. + array('id, name, einheiten, default_menge, default_einheit, 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( + ); + } + + /** + * @return array customized attribute labels (name=>label) + */ + public function attributeLabels() + { + return array( + 'id' => 'ID', + 'name' => 'Name', + 'einheiten' => 'Einheiten', + 'default_menge' => 'Standardmenge', + 'default_einheit' => 'Standardeinheit', + 'published' => 'Published', + ); + } + + /** + * 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('name',$this->name,true); + $criteria->compare('einheiten',$this->einheiten,true); + $criteria->compare('default_menge',$this->default_menge); + $criteria->compare('default_einheit',$this->default_einheit,true); + $criteria->compare('published',$this->published); + + return new CActiveDataProvider($this, array( + 'criteria'=>$criteria, + )); + } + + public function behaviors() { + return array( + 'LoggableBehavior'=>'application.modules.auditTrail.behaviors.LoggableBehavior', + ); + } +}
\ No newline at end of file diff --git a/protected/models/Standort.php b/protected/models/Standort.php new file mode 100644 index 0000000..d62a594 --- /dev/null +++ b/protected/models/Standort.php @@ -0,0 +1,112 @@ +<?php + +/** + * This is the model class for table "standort". + * + * 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 + * @property integer $published + */ +class Standort extends CActiveRecord +{ + /** + * Returns the static model of the specified AR class. + * @param string $className active record class name. + * @return Standort the static model class + */ + public static function model($className=__CLASS__) + { + return parent::model($className); + } + + public function afterConstruct() { + $this->pos_lat = Yii::app()->params['pos_lat']; + $this->pos_long = Yii::app()->params['pos_long']; + } + + /** + * @return string the associated database table name + */ + public function tableName() + { + return 'standorte'; + } + + /** + * @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('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, type, name, pos_lat, pos_long, 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( + ); + } + + /** + * @return array customized attribute labels (name=>label) + */ + public function attributeLabels() + { + return array( + 'id' => 'ID', + 'type' => 'Typ', + 'name' => 'Name', + 'pos_lat' => 'Pos Lat', + 'pos_long' => 'Pos Long', + '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('type',$this->type,true); + $criteria->compare('name',$this->name,true); + $criteria->compare('pos_lat',$this->pos_lat); + $criteria->compare('pos_long',$this->pos_long); + $criteria->compare('published',$this->published); + + return new CActiveDataProvider($this, array( + 'criteria'=>$criteria, + )); + } + + public function behaviors() { + return array( + 'LoggableBehavior'=>'application.modules.auditTrail.behaviors.LoggableBehavior', + ); + } +}
\ No newline at end of file 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 new file mode 100644 index 0000000..f0d30dd --- /dev/null +++ b/protected/models/Verein.php @@ -0,0 +1,125 @@ +<?php + +/** + * This is the model class for table "verein". + * + * The followings are the available columns in table 'verein': + * @property integer $id + * @property string $name + * @property string $url + * @property string $bild + * @property string $email + * @property string $slug + * @property string $kontaktdaten + * @property string $beschreibung + * @property integer $standort_id + * @property integer $published + */ +class Verein extends CActiveRecord +{ + public $uploadedImage; + /** + * Returns the static model of the specified AR class. + * @param string $className active record class name. + * @return Verein 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 'vereine'; + } + + /** + * @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("email, name", "required"), + 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("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(). + // Please remove those attributes that should not be searched. + array('id, name, url, bild, email, slug, kontaktdaten, 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::HAS_ONE, "Standort", array('id'=>'standort_id')) + ); + } + + /** + * @return array customized attribute labels (name=>label) + */ + public function attributeLabels() + { + return array( + 'id' => 'ID', + 'name' => 'Name', + 'url' => 'Homepage', + 'bild' => 'Logo', + 'email' => 'Email', + 'slug' => 'Anmeldename', + 'kontaktdaten' => 'Kontaktdaten', + 'beschreibung' => 'Beschreibung', + 'standort_id' => 'Standort', + 'standort' => '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('name',$this->name,true); + $criteria->compare('url',$this->url,true); + $criteria->compare('bild',$this->bild,true); + $criteria->compare('email',$this->email,true); + $criteria->compare('slug',$this->slug,true); + $criteria->compare('kontaktdaten',$this->kontaktdaten,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 behaviors() { + return array( +// 'LoggableBehavior'=>'application.modules.auditTrail.behaviors.LoggableBehavior', + ); + } +}
\ No newline at end of file |
