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')), "angebote"=>array(self::MANY_MANY, "Angebot", "angebot_verein(verein_id,angebot_id)"), "veranstaltungen"=>array(self::HAS_MANY, "Veranstaltung","verein_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('email',$this->email,true); $criteria->compare('slug',$this->slug,true); $criteria->compare('standort_id',$this->standort_id); return new CActiveDataProvider($this, array( 'criteria'=>$criteria, )); } public function listPublic() { $criteria=new CDbCriteria; //$criteria->compare('startzeit','> '.$nowMin); //$criteria->compare('startzeit','< '.$nowPlus); //$criteria->compare("endzeit"," <= ".$now,'AND'); $criteria->condition = 'published = 1'; $criteria->order = "name ASC"; return new CActiveDataProvider($this, array( 'criteria'=>$criteria, )); } public function behaviors() { return array( // 'LoggableBehavior'=>'application.modules.auditTrail.behaviors.LoggableBehavior', ); } public function scopes() { return array( 'published'=>array( 'condition'=>'published = 1', ), 'sorted'=>array( 'order'=>'name ASC', ), ); } }