1 <?php
2 3 4 5 6 7 8 9
10
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46
47 abstract class BaseP3MediaMeta extends CActiveRecord{
48 public static function model($className=__CLASS__)
49 {
50 return parent::model($className);
51 }
52
53 public function tableName()
54 {
55 return 'p3_media_meta';
56 }
57
58 public function rules()
59 {
60 return array(
61 array('id', 'required'),
62 array('status, type, language, treeParent_id, treePosition, begin, end, keywords, customData, label, owner, checkAccessCreate, checkAccessRead, checkAccessUpdate, checkAccessDelete, createdAt, createdBy, modifiedAt, modifiedBy, guid, ancestor_guid, model', 'default', 'setOnEmpty' => true, 'value' => null),
63 array('id, status, treeParent_id, treePosition, label', 'numerical', 'integerOnly'=>true),
64 array('type, owner, createdBy, modifiedBy, guid, ancestor_guid', 'length', 'max'=>64),
65 array('language', 'length', 'max'=>8),
66 array('checkAccessCreate, checkAccessRead, checkAccessUpdate, checkAccessDelete', 'length', 'max'=>256),
67 array('model', 'length', 'max'=>128),
68 array('begin, end, keywords, customData, createdAt, modifiedAt', 'safe'),
69 array('id, status, type, language, treeParent_id, treePosition, begin, end, keywords, customData, label, owner, checkAccessCreate, checkAccessRead, checkAccessUpdate, checkAccessDelete, createdAt, createdBy, modifiedAt, modifiedBy, guid, ancestor_guid, model', 'safe', 'on'=>'search'),
70 );
71 }
72
73 public function relations()
74 {
75 return array(
76 'id0' => array(self::BELONGS_TO, 'P3Media', 'id'),
77 'treeParent' => array(self::BELONGS_TO, 'P3MediaMeta', 'treeParent_id'),
78 'p3MediaMetas' => array(self::HAS_MANY, 'P3MediaMeta', 'treeParent_id'),
79 );
80 }
81
82 public function attributeLabels()
83 {
84 return array(
85 'id' => Yii::t('app', 'ID'),
86 'status' => Yii::t('app', 'Status'),
87 'type' => Yii::t('app', 'Type'),
88 'language' => Yii::t('app', 'Language'),
89 'treeParent_id' => Yii::t('app', 'Tree Parent'),
90 'treePosition' => Yii::t('app', 'Tree Position'),
91 'begin' => Yii::t('app', 'Begin'),
92 'end' => Yii::t('app', 'End'),
93 'keywords' => Yii::t('app', 'Keywords'),
94 'customData' => Yii::t('app', 'Custom Data'),
95 'label' => Yii::t('app', 'Label'),
96 'owner' => Yii::t('app', 'Owner'),
97 'checkAccessCreate' => Yii::t('app', 'Check Access Create'),
98 'checkAccessRead' => Yii::t('app', 'Check Access Read'),
99 'checkAccessUpdate' => Yii::t('app', 'Check Access Update'),
100 'checkAccessDelete' => Yii::t('app', 'Check Access Delete'),
101 'createdAt' => Yii::t('app', 'Created At'),
102 'createdBy' => Yii::t('app', 'Created By'),
103 'modifiedAt' => Yii::t('app', 'Modified At'),
104 'modifiedBy' => Yii::t('app', 'Modified By'),
105 'guid' => Yii::t('app', 'Guid'),
106 'ancestor_guid' => Yii::t('app', 'Ancestor Guid'),
107 'model' => Yii::t('app', 'Model'),
108 );
109 }
110
111
112 public function search()
113 {
114 $criteria=new CDbCriteria;
115
116 $criteria->compare('id', $this->id);
117 $criteria->compare('status', $this->status);
118 $criteria->compare('type', $this->type, true);
119 $criteria->compare('language', $this->language, true);
120 $criteria->compare('treeParent_id', $this->treeParent_id);
121 $criteria->compare('treePosition', $this->treePosition);
122 $criteria->compare('begin', $this->begin, true);
123 $criteria->compare('end', $this->end, true);
124 $criteria->compare('keywords', $this->keywords, true);
125 $criteria->compare('customData', $this->customData, true);
126 $criteria->compare('label', $this->label);
127 $criteria->compare('owner', $this->owner, true);
128 $criteria->compare('checkAccessCreate', $this->checkAccessCreate, true);
129 $criteria->compare('checkAccessRead', $this->checkAccessRead, true);
130 $criteria->compare('checkAccessUpdate', $this->checkAccessUpdate, true);
131 $criteria->compare('checkAccessDelete', $this->checkAccessDelete, true);
132 $criteria->compare('createdAt', $this->createdAt, true);
133 $criteria->compare('createdBy', $this->createdBy, true);
134 $criteria->compare('modifiedAt', $this->modifiedAt, true);
135 $criteria->compare('modifiedBy', $this->modifiedBy, true);
136 $criteria->compare('guid', $this->guid, true);
137 $criteria->compare('ancestor_guid', $this->ancestor_guid, true);
138 $criteria->compare('model', $this->model, true);
139
140 return new CActiveDataProvider(get_class($this), array(
141 'criteria'=>$criteria,
142 ));
143 }
144
145 public function get_label()
146 {
147 return '#'.$this->id;
148
149 }
150
151 }
152