1 <?php
2
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
22 abstract class BaseP3PageTranslation extends CActiveRecord{
23 public static function model($className=__CLASS__)
24 {
25 return parent::model($className);
26 }
27
28 public function tableName()
29 {
30 return 'p3_page_translation';
31 }
32
33 public function rules()
34 {
35 return array(
36 array('p3_page_id, menuName', 'required'),
37 array('language, seoUrl, pageTitle, keywords, description', 'default', 'setOnEmpty' => true, 'value' => null),
38 array('p3_page_id', 'numerical', 'integerOnly'=>true),
39 array('language', 'length', 'max'=>8),
40 array('seoUrl, pageTitle', 'length', 'max'=>255),
41 array('menuName', 'length', 'max'=>128),
42 array('keywords, description', 'safe'),
43 array('id, p3_page_id, language, seoUrl, pageTitle, menuName, keywords, description', 'safe', 'on'=>'search'),
44 );
45 }
46
47 public function relations()
48 {
49 return array(
50 'p3Page' => array(self::BELONGS_TO, 'P3Page', 'p3_page_id'),
51 );
52 }
53
54 public function attributeLabels()
55 {
56 return array(
57 'id' => Yii::t('P3PagesModule.crud', 'ID'),
58 'p3_page_id' => Yii::t('P3PagesModule.crud', 'P3 Page'),
59 'language' => Yii::t('P3PagesModule.crud', 'Language'),
60 'seoUrl' => Yii::t('P3PagesModule.crud', 'Seo Url'),
61 'pageTitle' => Yii::t('P3PagesModule.crud', 'Page Title'),
62 'menuName' => Yii::t('P3PagesModule.crud', 'Menu Name'),
63 'keywords' => Yii::t('P3PagesModule.crud', 'Keywords'),
64 'description' => Yii::t('P3PagesModule.crud', 'Description'),
65 );
66 }
67
68
69 public function search()
70 {
71 $criteria=new CDbCriteria;
72
73 $criteria->compare('id', $this->id);
74 $criteria->compare('p3_page_id', $this->p3_page_id);
75 $criteria->compare('language', $this->language, true);
76 $criteria->compare('seoUrl', $this->seoUrl, true);
77 $criteria->compare('pageTitle', $this->pageTitle, true);
78 $criteria->compare('menuName', $this->menuName, true);
79 $criteria->compare('keywords', $this->keywords, true);
80 $criteria->compare('description', $this->description, true);
81
82 return new CActiveDataProvider(get_class($this), array(
83 'criteria'=>$criteria,
84 ));
85 }
86
87 public function get_label()
88 {
89 return '#'.$this->id;
90
91 }
92
93 }
94