Commit 182feb54f84ccdbccd3d3e101ef6f56d70fe77df
1 parent
0b098d0a
customer
Showing
5 changed files
with
196 additions
and
3 deletions
Show diff stats
| 1 | +<?php | |
| 2 | + | |
| 3 | + namespace common\models; | |
| 4 | + | |
| 5 | + use Yii; | |
| 6 | + | |
| 7 | + /** | |
| 8 | + * This is the model class for table "customer". | |
| 9 | + * | |
| 10 | + * @property int $id | |
| 11 | + * @property string $name | |
| 12 | + * @property string $secondname | |
| 13 | + * @property string $dignity | |
| 14 | + * @property int $gender | |
| 15 | + * @property string $birth | |
| 16 | + * @property string $citizenship | |
| 17 | + * @property string $passport | |
| 18 | + * @property string $email | |
| 19 | + * @property string $organization | |
| 20 | + * @property int $status | |
| 21 | + * @property int $language_id | |
| 22 | + * @property string $image | |
| 23 | + * @property bool $conference | |
| 24 | + * @property bool $geee | |
| 25 | + * @property bool $gere | |
| 26 | + */ | |
| 27 | + class Customer extends \yii\db\ActiveRecord | |
| 28 | + { | |
| 29 | + const STATUS_NEW = 2; | |
| 30 | + const STATUS_ACTIVE = 1; | |
| 31 | + const STATUS_NO = 0; | |
| 32 | + | |
| 33 | + const MALE = 1; | |
| 34 | + const FEMALE = 2; | |
| 35 | + /** | |
| 36 | + * {@inheritdoc} | |
| 37 | + */ | |
| 38 | + public static function tableName() | |
| 39 | + { | |
| 40 | + return 'customer'; | |
| 41 | + } | |
| 42 | + | |
| 43 | + /** | |
| 44 | + * {@inheritdoc} | |
| 45 | + */ | |
| 46 | + public function rules() | |
| 47 | + { | |
| 48 | + return [ | |
| 49 | + [ | |
| 50 | + [ | |
| 51 | + 'gender', | |
| 52 | + 'status', | |
| 53 | + 'language_id', | |
| 54 | + ], | |
| 55 | + 'default', | |
| 56 | + 'value' => null, | |
| 57 | + ], | |
| 58 | + [ | |
| 59 | + [ | |
| 60 | + 'gender', | |
| 61 | + 'status', | |
| 62 | + 'language_id', | |
| 63 | + ], | |
| 64 | + 'integer', | |
| 65 | + ], | |
| 66 | + [ | |
| 67 | + [ 'organization' ], | |
| 68 | + 'string', | |
| 69 | + ], | |
| 70 | + [ | |
| 71 | + [ | |
| 72 | + 'conference', | |
| 73 | + 'geee', | |
| 74 | + 'gere', | |
| 75 | + ], | |
| 76 | + 'boolean', | |
| 77 | + ], | |
| 78 | + [ | |
| 79 | + [ | |
| 80 | + 'name', | |
| 81 | + 'secondname', | |
| 82 | + 'dignity', | |
| 83 | + 'birth', | |
| 84 | + 'citizenship', | |
| 85 | + 'passport', | |
| 86 | + 'email', | |
| 87 | + 'image', | |
| 88 | + ], | |
| 89 | + 'string', | |
| 90 | + 'max' => 255, | |
| 91 | + ], | |
| 92 | + [ | |
| 93 | + [ 'gender' ], | |
| 94 | + 'in', | |
| 95 | + 'range' => [ | |
| 96 | + self::MALE, | |
| 97 | + self::FEMALE, | |
| 98 | + ], | |
| 99 | + ], | |
| 100 | + [ | |
| 101 | + [ | |
| 102 | + 'gender', | |
| 103 | + 'organization', | |
| 104 | + 'name', | |
| 105 | + 'secondname', | |
| 106 | + 'dignity', | |
| 107 | + 'birth', | |
| 108 | + 'citizenship', | |
| 109 | + 'passport', | |
| 110 | + 'email', | |
| 111 | + 'image', | |
| 112 | + ], | |
| 113 | + 'required', | |
| 114 | + ], | |
| 115 | + ['email', 'email'], | |
| 116 | + ['image', 'file', 'extensions' => ['png', 'jpg', 'gif'], 'maxSize' => 1024*1024*1024*2] | |
| 117 | + | |
| 118 | + ]; | |
| 119 | + } | |
| 120 | + | |
| 121 | + /** | |
| 122 | + * {@inheritdoc} | |
| 123 | + */ | |
| 124 | + public function attributeLabels() | |
| 125 | + { | |
| 126 | + return [ | |
| 127 | + 'id' => Yii::t('app', 'ID'), | |
| 128 | + 'name' => Yii::t('app', 'Name'), | |
| 129 | + 'secondname' => Yii::t('app', 'Secondname'), | |
| 130 | + 'dignity' => Yii::t('app', 'Dignity'), | |
| 131 | + 'gender' => Yii::t('app', 'Gender'), | |
| 132 | + 'birth' => Yii::t('app', 'Birth'), | |
| 133 | + 'citizenship' => Yii::t('app', 'Citizenship'), | |
| 134 | + 'passport' => Yii::t('app', 'Passport'), | |
| 135 | + 'email' => Yii::t('app', 'Email'), | |
| 136 | + 'organization' => Yii::t('app', 'Organization'), | |
| 137 | + 'status' => Yii::t('app', 'Status'), | |
| 138 | + 'language_id' => Yii::t('app', 'Language ID'), | |
| 139 | + 'image' => Yii::t('app', 'Image'), | |
| 140 | + 'conference' => Yii::t('app', 'Conference'), | |
| 141 | + 'geee' => Yii::t('app', 'Geee'), | |
| 142 | + 'gere' => Yii::t('app', 'Gere'), | |
| 143 | + ]; | |
| 144 | + } | |
| 145 | + } | ... | ... |
console/migrations/m180830_105258_create_customer_table.php
0 → 100644
| 1 | +<?php | |
| 2 | + | |
| 3 | +use yii\db\Migration; | |
| 4 | + | |
| 5 | +/** | |
| 6 | + * Handles the creation of table `customer`. | |
| 7 | + */ | |
| 8 | +class m180830_105258_create_customer_table extends Migration | |
| 9 | +{ | |
| 10 | + /** | |
| 11 | + * {@inheritdoc} | |
| 12 | + */ | |
| 13 | + public function safeUp() | |
| 14 | + { | |
| 15 | + $this->createTable('customer', [ | |
| 16 | + 'id' => $this->primaryKey(), | |
| 17 | + 'name' => $this->string(), | |
| 18 | + 'secondname' => $this->string(), | |
| 19 | + 'dignity' => $this->string(), | |
| 20 | + 'gender' => $this->smallInteger(1), | |
| 21 | + 'birth' => $this->string(), | |
| 22 | + 'citizenship' => $this->string(), | |
| 23 | + 'passport' => $this->string(), | |
| 24 | + 'email' => $this->string(), | |
| 25 | + 'organization' => $this->text(), | |
| 26 | + 'status' => $this->smallInteger(1), | |
| 27 | + 'language_id' => $this->integer(), | |
| 28 | + 'image' => $this->string(), | |
| 29 | + 'conference' => $this->boolean(), | |
| 30 | + 'geee' => $this->boolean(), | |
| 31 | + 'gere' => $this->boolean() | |
| 32 | + | |
| 33 | + ]); | |
| 34 | + } | |
| 35 | + | |
| 36 | + /** | |
| 37 | + * {@inheritdoc} | |
| 38 | + */ | |
| 39 | + public function safeDown() | |
| 40 | + { | |
| 41 | + $this->dropTable('customer'); | |
| 42 | + } | |
| 43 | +} | ... | ... |
frontend/controllers/SiteController.php
frontend/views/layouts/main.php
| ... | ... | @@ -109,8 +109,8 @@ |
| 109 | 109 | <div class="row"> |
| 110 | 110 | <div class="col-xs-12 col-sm-7 col-md-9 logo-title-col"> |
| 111 | 111 | <div class="logo-title"> |
| 112 | - <span>9й Міжнародний Форум<br />з енергетики для сталого розвитку</span> | |
| 113 | - <i>12-18 листопада 2018 року, Київ, Україна</i> | |
| 112 | + <span><?=\Yii::t('app', '9й Міжнародний Форум<br />з енергетики для сталого розвитку')?></span> | |
| 113 | + <i><?=\Yii::t('app', '12-18 листопада 2018 року, Київ, Україна')?></i> | |
| 114 | 114 | </div> |
| 115 | 115 | </div> |
| 116 | 116 | <div class="hidden-xs col-sm-5 col-md-3 logos-header-wr"> |
| ... | ... | @@ -222,7 +222,7 @@ |
| 222 | 222 | </div> |
| 223 | 223 | <div class="col-xs-12 col-sm-6 col-sm-pull-6"> |
| 224 | 224 | <div class="footer-txt"> |
| 225 | - <span>Дев'ятий Міжнародний форум <br/>з енергетики для сталого розвитку</span> | |
| 225 | + <span><?=\Yii::t('app', 'Дев\'ятий Міжнародний форум <br />з енергетики для сталого розвитку')?></span> | |
| 226 | 226 | </div> |
| 227 | 227 | </div> |
| 228 | 228 | </div> | ... | ... |