UserInfo.php
3.67 KB
1
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
<?php
namespace common\models;
use Yii;
/**
* This is the model class for table "user_info".
*
* @property integer $user_id
* @property integer $view_count
* @property string $busy
* @property string $date_visit
* @property string $experience
* @property string $rank
* @property string $salary
* @property string $job
* @property string $location
* @property string $soft
* @property integer $user_info_id
* @property string $guarantee
* @property integer $contract
* @property integer $estimate
* @property integer $purchase
* @property integer $delivery
* @property double $prepayment
* @property string $about
* @property integer $type
*/
class UserInfo extends \yii\db\ActiveRecord
{
// Константа обознащающая физическое лицо
const USER_TYPE_FIZ = 1;
// Константа обозначающая компанию
const USER_TYPE_COMPANY = 2;
// Константа обозначающая, что компания/физ.лицо свободно
const USER_STATUS_FREE = 1;
// Константа обозначающая, что компания/физ.лицо занято
const USER_STATUS_BUSY = 2;
// Константа обозначающая, что компания/физ.лицо хочет стать членом МФП
const USER_MEMBER_FALSE = 1;
// Константа обозначающая, что компания/физ.лицо не хочет стать членом МФП
const USER_MEMBER_TRUE = 2;
/**
* @inheritdoc
*/
public static function tableName()
{
return 'user_info';
}
/**
* @inheritdoc
*/
public function rules()
{
return [
[['user_id', 'view_count', 'contract', 'estimate', 'purchase', 'delivery','is_customer','is_freelancer'], 'integer'],
[['date_visit'], 'safe'],
[['experience', 'soft', 'guarantee', 'about', 'city', 'country', 'image', 'poster', 'social_vk', 'social_fb', 'social_in', 'social_t'], 'string'],
[['prepayment'], 'number'],
[['rank', 'location'], 'string', 'max' => 50],
[['salary', 'job'], 'string', 'max' => 255],
[['busy', 'member'], 'boolean'],
];
}
public function getBusyText(){
return $this->busy ? 'Занят' : 'Свободный';
}
public function getLastVisit(){
return \Yii::$app->formatter->asRelativeTime($this->date_visit);
}
/**
* @inheritdoc
*/
public function attributeLabels()
{
return [
'user_id' => Yii::t('app', 'User ID'),
'view_count' => Yii::t('app', 'View Count'),
'busy' => Yii::t('app', 'Busy'),
'date_visit' => Yii::t('app', 'Date Visit'),
'experience' => Yii::t('app', 'Experience'),
'rank' => Yii::t('app', 'Rank'),
'salary' => Yii::t('app', 'Salary'),
'job' => Yii::t('app', 'Job'),
'location' => Yii::t('app', 'Location'),
'soft' => Yii::t('app', 'Soft'),
'user_info_id' => Yii::t('app', 'User Info ID'),
'guarantee' => Yii::t('app', 'Guarantee'),
'contract' => Yii::t('app', 'Contract'),
'estimate' => Yii::t('app', 'Estimate'),
'purchase' => Yii::t('app', 'Purchase'),
'delivery' => Yii::t('app', 'Delivery'),
'prepayment' => Yii::t('app', 'Prepayment'),
'about' => Yii::t('app', 'About'),
'type' => Yii::t('app', 'Is Default'),
'alt_location' => 'Город не в списке',
'is_customer' => '',
'is_freelancer' => '',
];
}
}