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 abstract class BaseP3PageMeta extends CActiveRecord {
40
41 public static function model($className = __CLASS__) {
42 return parent::model($className);
43 }
44
45 public function tableName() {
46 return 'p3_page_meta';
47 }
48
49 public function rules() {
50 return array(
51 array('type', 'unique'),
52 array('type', 'identificationColumnValidator'),
53 array('id, createdAt', 'required'),
54 array('status, type, language, treeParent_id, treePosition, begin, end, keywords, customData, label, owner, checkAccessCreate, checkAccessRead, checkAccessUpdate, checkAccessDelete, createdBy, modifiedAt, modifiedBy, guid, ancestor_guid, model', 'default', 'setOnEmpty' => true, 'value' => null),
55 array('id, status, treeParent_id, treePosition, label', 'numerical', 'integerOnly' => true),
56 array('type, owner, createdBy, modifiedBy, guid, ancestor_guid', 'length', 'max' => 64),
57 array('language', 'length', 'max' => 8),
58 array('checkAccessCreate, checkAccessRead, checkAccessUpdate, checkAccessDelete', 'length', 'max' => 256),
59 array('model', 'length', 'max' => 128),
60 array('begin, end, keywords, customData, modifiedAt', 'safe'),
61 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'),
62 );
63 }
64
65 public function relations() {
66 return array(
67 'treeParent' => array(self::BELONGS_TO, 'P3PageMeta', 'treeParent_id'),
68 'p3PageMetas' => array(self::HAS_MANY, 'P3PageMeta', 'treeParent_id', 'order' => 'treePosition'),
69 'id0' => array(self::BELONGS_TO, 'P3Page', 'id'),
70 );
71 }
72
73 public function attributeLabels() {
74 return array(
75 'id' => Yii::t('P3PagesModule.crud', 'ID'),
76 'status' => Yii::t('P3PagesModule.crud', 'Status'),
77 'type' => Yii::t('P3PagesModule.crud', 'Type'),
78 'language' => Yii::t('P3PagesModule.crud', 'Language'),
79 'treeParent_id' => Yii::t('P3PagesModule.crud', 'Tree Parent'),
80 'treePosition' => Yii::t('P3PagesModule.crud', 'Tree Position'),
81 'begin' => Yii::t('P3PagesModule.crud', 'Begin'),
82 'end' => Yii::t('P3PagesModule.crud', 'End'),
83 'keywords' => Yii::t('P3PagesModule.crud', 'Keywords'),
84 'customData' => Yii::t('P3PagesModule.crud', 'Custom Data'),
85 'label' => Yii::t('P3PagesModule.crud', 'Label'),
86 'owner' => Yii::t('P3PagesModule.crud', 'Owner'),
87 'checkAccessCreate' => Yii::t('P3PagesModule.crud', 'Check Access Create'),
88 'checkAccessRead' => Yii::t('P3PagesModule.crud', 'Check Access Read'),
89 'checkAccessUpdate' => Yii::t('P3PagesModule.crud', 'Check Access Update'),
90 'checkAccessDelete' => Yii::t('P3PagesModule.crud', 'Check Access Delete'),
91 'createdAt' => Yii::t('P3PagesModule.crud', 'Created At'),
92 'createdBy' => Yii::t('P3PagesModule.crud', 'Created By'),
93 'modifiedAt' => Yii::t('P3PagesModule.crud', 'Modified At'),
94 'modifiedBy' => Yii::t('P3PagesModule.crud', 'Modified By'),
95 'guid' => Yii::t('P3PagesModule.crud', 'Guid'),
96 'ancestor_guid' => Yii::t('P3PagesModule.crud', 'Ancestor Guid'),
97 'model' => Yii::t('P3PagesModule.crud', 'Model'),
98 );
99 }
100
101 public function search() {
102 $criteria = new CDbCriteria;
103
104 $criteria->compare('id', $this->id);
105 $criteria->compare('status', $this->status);
106 $criteria->compare('type', $this->type, true);
107 $criteria->compare('language', $this->language, true);
108 $criteria->compare('treeParent_id', $this->treeParent_id);
109 $criteria->compare('treePosition', $this->treePosition);
110 $criteria->compare('begin', $this->begin, true);
111 $criteria->compare('end', $this->end, true);
112 $criteria->compare('keywords', $this->keywords, true);
113 $criteria->compare('customData', $this->customData, true);
114 $criteria->compare('label', $this->label);
115 $criteria->compare('owner', $this->owner, true);
116 $criteria->compare('checkAccessCreate', $this->checkAccessCreate, true);
117 $criteria->compare('checkAccessRead', $this->checkAccessRead, true);
118 $criteria->compare('checkAccessUpdate', $this->checkAccessUpdate, true);
119 $criteria->compare('checkAccessDelete', $this->checkAccessDelete, true);
120 $criteria->compare('createdAt', $this->createdAt, true);
121 $criteria->compare('createdBy', $this->createdBy, true);
122 $criteria->compare('modifiedAt', $this->modifiedAt, true);
123 $criteria->compare('modifiedBy', $this->modifiedBy, true);
124 $criteria->compare('guid', $this->guid, true);
125 $criteria->compare('ancestor_guid', $this->ancestor_guid, true);
126 $criteria->compare('model', $this->model, true);
127
128 return new CActiveDataProvider(get_class($this), array(
129 'criteria' => $criteria,
130 ));
131 }
132
133 public function get_label() {
134 return '#' . $this->id;
135 }
136
137 }
138