EliteConf
Main Page
Related Pages
Namespaces
Data Structures
Files
File List
Globals
All
Data Structures
Namespaces
Files
Functions
Variables
Pages
test
protected
models
Users.php
Go to the documentation of this file.
1
<?php
2
14
class
Users
extends
CActiveRecord
15
{
22
public
$Retype_Password
;
23
public
$verifyCode
;
24
25
public
static
function
model
($className=__CLASS__)
26
{
27
return
parent::model($className);
28
}
29
33
public
function
tableName
()
34
{
35
return
'users'
;
36
}
37
41
public
function
rules
()
42
{
43
// NOTE: you should only define rules for those attributes that
44
// will receive user inputs.
45
return
array(
46
array(
'username'
,
'length'
,
'max'
=>20),
47
// convert username to lower case
48
array(
'username'
,
'filter'
,
'filter'
=>
'strtolower'
),
49
array(
'username'
,
'match'
,
'pattern'
=>
'/^[A-Za-z0-9_]+$/u'
),
50
array(
'password'
,
'length'
,
'max'
=>64,
'min'
=>6),
51
array(
'Retype_Password'
,
'length'
,
'max'
=>64,
'min'
=>6),
52
// compare password to repeated password
53
array(
'password'
,
'compare'
,
'compareAttribute'
=>
'Retype_Password'
),
54
array(
'firstname'
,
'length'
,
'max'
=>60),
55
array(
'lastname'
,
'length'
,
'max'
=>40),
56
array(
'email'
,
'length'
,
'max'
=>100),
57
// make sure email is a valid email
58
array(
'email'
,
'email'
),
59
// make sure username and email are unique
60
array(
'username, email'
,
'unique'
),
61
array(
'username, password, Retype_Password, firstname, lastname, email, verifyCode'
,
'required'
),
62
//array('password', 'length', 'max'=>255),
63
// The following rule is used by search().
64
// Please remove those attributes that should not be searched.
65
array(
'userid, username, firstname, lastname, email, password'
,
'safe'
,
'on'
=>
'search'
),
66
);
67
}
68
72
public
function
relations
()
73
{
74
// NOTE: you may need to adjust the relation name and the related
75
// class name for the relations automatically generated below.
76
return
array(
77
);
78
}
79
83
public
function
attributeLabels
()
84
{
85
return
array(
86
'userid'
=>
'Userid'
,
87
'username'
=>
'Username'
,
88
'firstname'
=>
'Firstname'
,
89
'lastname'
=>
'Lastname'
,
90
'email'
=>
'Email'
,
91
'password'
=>
'Password'
,
92
);
93
}
94
99
public
function
search
()
100
{
101
// Warning: Please modify the following code to remove attributes that
102
// should not be searched.
103
104
$criteria=
new
CDbCriteria;
105
106
$criteria->compare(
'userid'
,$this->userid,
true
);
107
$criteria->compare(
'username'
,$this->username,
true
);
108
$criteria->compare(
'firstname'
,$this->firstname,
true
);
109
$criteria->compare(
'lastname'
,$this->lastname,
true
);
110
$criteria->compare(
'email'
,$this->email,
true
);
111
$criteria->compare(
'password'
,$this->password,
true
);
112
113
return
new
CActiveDataProvider($this, array(
114
'criteria'
=>$criteria,
115
));
116
}
117
}
Generated on Sun Jun 2 2013 05:35:38 for EliteConf by
1.8.4