1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/** |
4
|
|
|
* This is the model class for table "log". |
5
|
|
|
* |
6
|
|
|
* The followings are the available columns in table 'log': |
7
|
|
|
* @property integer $id |
8
|
|
|
* @property string $level |
9
|
|
|
* @property string $category |
10
|
|
|
* @property string $logtime |
11
|
|
|
* @property string $source_address |
12
|
|
|
* @property string $message |
13
|
|
|
* |
14
|
|
|
* @author Sam Stenvall <[email protected]> |
15
|
|
|
* @copyright Copyright © Sam Stenvall 2014- |
16
|
|
|
* @license https://www.gnu.org/licenses/gpl.html The GNU General Public License v3.0 |
17
|
|
|
*/ |
18
|
|
|
class Log extends CActiveRecord |
19
|
|
|
{ |
20
|
|
|
|
21
|
|
|
/** |
22
|
|
|
* Returns the static model of the specified AR class. |
23
|
|
|
* @param string $className active record class name. |
24
|
|
|
* @return Log the static model class |
25
|
|
|
*/ |
26
|
|
|
public static function model($className = __CLASS__) |
27
|
|
|
{ |
28
|
|
|
return parent::model($className); |
29
|
|
|
} |
30
|
|
|
|
31
|
|
|
/** |
32
|
|
|
* @return string the associated database table name |
33
|
|
|
*/ |
34
|
|
|
public function tableName() |
35
|
|
|
{ |
36
|
|
|
return 'log'; |
37
|
|
|
} |
38
|
|
|
|
39
|
|
|
/** |
40
|
|
|
* @return array validation rules for model attributes. |
41
|
|
|
*/ |
42
|
|
|
public function rules() |
43
|
|
|
{ |
44
|
|
|
return array( |
45
|
|
|
array('id, level, category, logtime, source_address, message', 'safe', 'on'=>'search'), |
46
|
|
|
); |
47
|
|
|
} |
48
|
|
|
|
49
|
|
|
/** |
50
|
|
|
* @return array customized attribute labels (name=>label) |
51
|
|
|
*/ |
52
|
|
|
public function attributeLabels() |
53
|
|
|
{ |
54
|
|
|
return array( |
55
|
|
|
'id'=>Yii::t('Log', 'ID'), |
56
|
|
|
'level'=>Yii::t('Log', 'Level'), |
57
|
|
|
'category'=>Yii::t('Log', 'Category'), |
58
|
|
|
'logtime'=>Yii::t('Log', 'Logtime'), |
59
|
|
|
'source_address'=>Yii::t('Log', 'Source address'), |
60
|
|
|
'message'=>Yii::t('Log', 'Message'), |
61
|
|
|
); |
62
|
|
|
} |
63
|
|
|
|
64
|
|
|
/** |
65
|
|
|
* Retrieves a list of models based on the current search/filter conditions. |
66
|
|
|
* @return CActiveDataProvider the data provider that can return the models |
67
|
|
|
* based on the search/filter conditions. |
68
|
|
|
*/ |
69
|
|
|
public function search() |
70
|
|
|
{ |
71
|
|
|
$criteria = new CDbCriteria; |
72
|
|
|
$criteria->compare('id', $this->id); |
73
|
|
|
$criteria->compare('level', $this->level, true); |
74
|
|
|
$criteria->compare('category', $this->category, true); |
75
|
|
|
$criteria->compare('logtime', $this->logtime, true); |
76
|
|
|
$criteria->compare('source_address', $this->source_address, true); |
77
|
|
|
$criteria->compare('message', $this->message, true); |
78
|
|
|
|
79
|
|
|
return new CActiveDataProvider($this, array( |
80
|
|
|
'criteria'=>$criteria, |
81
|
|
|
'pagination'=>array( |
82
|
|
|
'pageSize'=>20, |
83
|
|
|
), |
84
|
|
|
'sort'=>array( |
85
|
|
|
'defaultOrder'=>'id DESC', |
86
|
|
|
) |
87
|
|
|
)); |
88
|
|
|
} |
89
|
|
|
|
90
|
|
|
} |
91
|
|
|
|