diff options
| author | Patrick Seeger <pseeger@ccwn.org> | 2012-04-22 10:56:25 +0200 |
|---|---|---|
| committer | Patrick Seeger <pseeger@ccwn.org> | 2012-04-22 10:56:25 +0200 |
| commit | 2a8b46329775b8503519d432a52dba13e8547d8e (patch) | |
| tree | 74aca6815e0cdc617dd125b894591d00f04a44c0 /protected/modules/cms/models/Sitecontent.php | |
| parent | 12c8482bf883988c0fc5ed4c8972396af63e8258 (diff) | |
cms integriert (yaycms)
Diffstat (limited to '')
| -rw-r--r-- | protected/modules/cms/models/Sitecontent.php | 82 |
1 files changed, 82 insertions, 0 deletions
diff --git a/protected/modules/cms/models/Sitecontent.php b/protected/modules/cms/models/Sitecontent.php new file mode 100644 index 0000000..a15029f --- /dev/null +++ b/protected/modules/cms/models/Sitecontent.php @@ -0,0 +1,82 @@ +<?php + +class Sitecontent extends CActiveRecord +{ + public static function model($className=__CLASS__) + { + return parent::model($className); + } + + public function primaryKey() { + return array('id', 'language'); + } + + public function beforeValidate() { + if(Yii::app()->controller->module->enableHtmlPurifier) { + $purifier = new CHtmlPurifier(); + $this->content = $purifier->purify($this->content); + } + return parent::beforeValidate(); + } + + public function tableName() + { + return 'sitecontent'; + } + + public function rules() + { + return array( + array('id, position, title, language', 'required'), + array('parent, position, createtime, updatetime', 'numerical', 'integerOnly'=>true), + array('title, keywords, description', 'length', 'max'=>255), + array('content, title_url, title_browser', 'safe'), + array('id, position, title, keywords, description, content, authorid, createtime, updatetime, language', 'safe', 'on'=>'search'), + ); + } + + public function relations() + { + return array( + 'parent' => array(self::BELONGS_TO, 'Sitecontent', 'parent'), + 'childs' => array(self::HAS_MANY, 'Sitecontent', 'parent'), + ); + } + + public function attributeLabels() + { + return array( + 'id' => '#', + 'parent' => Yii::t('CmsModule.cms', 'Parent'), + 'position' => Yii::t('CmsModule.cms', 'Position'), + 'title' => Yii::t('CmsModule.cms', 'Title'), + 'title_url' => Yii::t('CmsModule.cms', 'URL title'), + 'title_browser' => Yii::t('CmsModule.cms', 'Browser title'), + 'content' => Yii::t('CmsModule.cms', 'Content'), + 'authorid' => Yii::t('CmsModule.cms', 'Authorid'), + 'createtime' => Yii::t('CmsModule.cms', 'Createtime'), + 'updatetime' => Yii::t('CmsModule.cms', 'Updatetime'), + 'language' => Yii::t('CmsModule.cms', 'Language'), + ); + } + + public function search() + { + $criteria=new CDbCriteria; + + $criteria->compare('id',$this->id); + $criteria->compare('position',$this->position); + $criteria->compare('language',$this->language); + $criteria->compare('title',$this->title,true); + $criteria->compare('keywords',$this->keywords,true); + $criteria->compare('description',$this->description,true); + $criteria->compare('content',$this->content,true); + $criteria->compare('authorid',$this->authorid); + $criteria->compare('createtime',$this->createtime); + $criteria->compare('updatetime',$this->updatetime); + + return new CActiveDataProvider('Sitecontent', array( + 'criteria'=>$criteria, + )); + } +} |
