Gentics Portal.Node PHP API
 All Classes Namespaces Functions Variables Pages
FGTemplates.php
1 <?php
2 
3 /**
4  * This is the model class for table "templates".
5  *
6  * The followings are the available columns in table 'templates':
7  * @property string $id
8  * @property string $name
9  * @property string $json
10  * @property string $user
11  * @property integer $global
12  */
13 class FGTemplates extends CActiveRecord
14 {
15  /**
16  * Returns the static model of the specified AR class.
17  * @param string $className active record class name.
18  * @return Templates the static model class
19  */
20  public static function model($className=__CLASS__)
21  {
22  return parent::model($className);
23  }
24 
25  /**
26  * @return string the associated database table name
27  */
28  public function tableName()
29  {
30  return 'templates';
31  }
32 
33  /**
34  * @return array validation rules for model attributes.
35  */
36  public function rules()
37  {
38  // NOTE: you should only define rules for those attributes that
39  // will receive user inputs.
40  return array(
41  array('name, json, user', 'required'),
42  array('global', 'numerical', 'integerOnly'=>true),
43  array('name, user', 'length', 'max'=>255),
44  // The following rule is used by search().
45  // Please remove those attributes that should not be searched.
46  array('id, name, json, user, global', 'safe', 'on'=>'search'),
47  );
48  }
49 
50  /**
51  * @return array relational rules.
52  */
53  public function relations()
54  {
55  // NOTE: you may need to adjust the relation name and the related
56  // class name for the relations automatically generated below.
57  return array(
58  );
59  }
60 
61  public function defaultScope()
62  {
63  return array(
64  'order'=>'id DESC'
65  );
66  }
67 
68  /**
69  * @return array customized attribute labels (name=>label)
70  */
71  public function attributeLabels()
72  {
73  return array(
74  'id' => 'ID',
75  'name' => 'Name',
76  'json' => 'Json',
77  'user' => 'User',
78  'global' => 'Global',
79  );
80  }
81 
82  /**
83  * Retrieves a list of models based on the current search/filter conditions.
84  * @return CActiveDataProvider the data provider that can return the models based on the search/filter conditions.
85  */
86  public function search()
87  {
88  // Warning: Please modify the following code to remove attributes that
89  // should not be searched.
90 
91  $criteria=new CDbCriteria;
92 
93  $criteria->compare('id',$this->id,true);
94  $criteria->compare('name',$this->name,true);
95  $criteria->compare('json',$this->json,true);
96  $criteria->compare('user',$this->user,true);
97  $criteria->compare('global',$this->global);
98 
99  return new CActiveDataProvider($this, array(
100  'criteria'=>$criteria,
101  ));
102  }
103 }