Commit 51e0a2628c270e895652bb2f9ab274648df5b6b2
1 parent
3d163909
test
Showing
28 changed files
with
972 additions
and
10 deletions
 
Show diff stats
backend/web/js/option.js
| ... | ... | @@ -17,6 +17,14 @@ function checkboxerInit() { | 
| 17 | 17 | $(value).trigger('change'); | 
| 18 | 18 | }); | 
| 19 | 19 | } | 
| 20 | +function accountRedraw() { | |
| 21 | + var type = $('input[name="User[type]"]:checked').val(); | |
| 22 | + if(type == 2) { | |
| 23 | + $('#form_definition').addClass('form_for_company'); | |
| 24 | + } else { | |
| 25 | + $('#form_definition').removeClass('form_for_company'); | |
| 26 | + } | |
| 27 | +} | |
| 20 | 28 | $(function() { | 
| 21 | 29 | var counter = 0; | 
| 22 | 30 | $(document).on('click', '.add_row', function() { | 
| ... | ... | @@ -137,4 +145,8 @@ $(function() { | 
| 137 | 145 | $(val).find('a[role=tab]').first().trigger('click'); | 
| 138 | 146 | }); | 
| 139 | 147 | checkboxerInit(); | 
| 148 | + accountRedraw(); | |
| 149 | + $(document).on('change', 'input[name="User[type]"]', function() { | |
| 150 | + accountRedraw(); | |
| 151 | + }); | |
| 140 | 152 | }); | 
| 141 | 153 | \ No newline at end of file | ... | ... | 
| 1 | +<?php | |
| 2 | + | |
| 3 | +namespace common\models; | |
| 4 | + | |
| 5 | +use Yii; | |
| 6 | + | |
| 7 | +/** | |
| 8 | + * This is the model class for table "company_info". | |
| 9 | + * | |
| 10 | + * @property integer $company_info_id | |
| 11 | + * @property string $name | |
| 12 | + * @property integer $staff | |
| 13 | + * @property string $street | |
| 14 | + * @property string $house | |
| 15 | + * @property integer $hide_mail | |
| 16 | + */ | |
| 17 | +class CompanyInfo extends \yii\db\ActiveRecord | |
| 18 | +{ | |
| 19 | + /** | |
| 20 | + * @inheritdoc | |
| 21 | + */ | |
| 22 | + public static function tableName() | |
| 23 | + { | |
| 24 | + return 'company_info'; | |
| 25 | + } | |
| 26 | + | |
| 27 | + /** | |
| 28 | + * @inheritdoc | |
| 29 | + */ | |
| 30 | + public function rules() | |
| 31 | + { | |
| 32 | + return [ | |
| 33 | + [['name', 'street', 'house'], 'string'], | |
| 34 | + [['staff', 'hide_mail'], 'integer'] | |
| 35 | + ]; | |
| 36 | + } | |
| 37 | + | |
| 38 | + /** | |
| 39 | + * @inheritdoc | |
| 40 | + */ | |
| 41 | + public function attributeLabels() | |
| 42 | + { | |
| 43 | + return [ | |
| 44 | + 'company_info_id' => Yii::t('app', 'Company Info ID'), | |
| 45 | + 'name' => Yii::t('app', 'Name'), | |
| 46 | + 'staff' => Yii::t('app', 'Staff'), | |
| 47 | + 'street' => Yii::t('app', 'Street'), | |
| 48 | + 'house' => Yii::t('app', 'House'), | |
| 49 | + 'hide_mail' => Yii::t('app', 'Hide Mail'), | |
| 50 | + ]; | |
| 51 | + } | |
| 52 | +} | ... | ... | 
| 1 | +<?php | |
| 2 | + | |
| 3 | +namespace common\models; | |
| 4 | + | |
| 5 | +use Yii; | |
| 6 | +use yii\base\Model; | |
| 7 | +use yii\data\ActiveDataProvider; | |
| 8 | +use common\models\CompanyInfo; | |
| 9 | + | |
| 10 | +/** | |
| 11 | + * CompanyInfoSearch represents the model behind the search form about `common\models\CompanyInfo`. | |
| 12 | + */ | |
| 13 | +class CompanyInfoSearch extends CompanyInfo | |
| 14 | +{ | |
| 15 | + /** | |
| 16 | + * @inheritdoc | |
| 17 | + */ | |
| 18 | + public function rules() | |
| 19 | + { | |
| 20 | + return [ | |
| 21 | + [['company_info_id', 'staff', 'hide_mail'], 'integer'], | |
| 22 | + [['name', 'street', 'house'], 'safe'], | |
| 23 | + ]; | |
| 24 | + } | |
| 25 | + | |
| 26 | + /** | |
| 27 | + * @inheritdoc | |
| 28 | + */ | |
| 29 | + public function scenarios() | |
| 30 | + { | |
| 31 | + // bypass scenarios() implementation in the parent class | |
| 32 | + return Model::scenarios(); | |
| 33 | + } | |
| 34 | + | |
| 35 | + /** | |
| 36 | + * Creates data provider instance with search query applied | |
| 37 | + * | |
| 38 | + * @param array $params | |
| 39 | + * | |
| 40 | + * @return ActiveDataProvider | |
| 41 | + */ | |
| 42 | + public function search($params) | |
| 43 | + { | |
| 44 | + $query = CompanyInfo::find(); | |
| 45 | + | |
| 46 | + $dataProvider = new ActiveDataProvider([ | |
| 47 | + 'query' => $query, | |
| 48 | + ]); | |
| 49 | + | |
| 50 | + $this->load($params); | |
| 51 | + | |
| 52 | + if (!$this->validate()) { | |
| 53 | + // uncomment the following line if you do not want to return any records when validation fails | |
| 54 | + // $query->where('0=1'); | |
| 55 | + return $dataProvider; | |
| 56 | + } | |
| 57 | + | |
| 58 | + $query->andFilterWhere([ | |
| 59 | + 'company_info_id' => $this->company_info_id, | |
| 60 | + 'staff' => $this->staff, | |
| 61 | + 'hide_mail' => $this->hide_mail, | |
| 62 | + ]); | |
| 63 | + | |
| 64 | + $query->andFilterWhere(['like', 'name', $this->name]) | |
| 65 | + ->andFilterWhere(['like', 'street', $this->street]) | |
| 66 | + ->andFilterWhere(['like', 'house', $this->house]); | |
| 67 | + | |
| 68 | + return $dataProvider; | |
| 69 | + } | |
| 70 | +} | ... | ... | 
common/models/User.php
| ... | ... | @@ -31,6 +31,9 @@ class User extends ActiveRecord implements IdentityInterface, UserRbacInterface | 
| 31 | 31 | const STATUS_DELETED = 0; | 
| 32 | 32 | const STATUS_ACTIVE = 10; | 
| 33 | 33 | public $profile; | 
| 34 | + public $old_password; | |
| 35 | + public $new_password; | |
| 36 | + public $password_reply; | |
| 34 | 37 | |
| 35 | 38 | /** | 
| 36 | 39 | * @inheritdoc | 
| ... | ... | @@ -58,6 +61,8 @@ class User extends ActiveRecord implements IdentityInterface, UserRbacInterface | 
| 58 | 61 | return [ | 
| 59 | 62 | ['status', 'default', 'value' => self::STATUS_ACTIVE], | 
| 60 | 63 | ['status', 'in', 'range' => [self::STATUS_ACTIVE, self::STATUS_DELETED]], | 
| 64 | + [['username', 'lastname', 'firstname', 'middlename'], 'string', 'max' => 255], | |
| 65 | + [['type'], 'in', 'range' => [1, 2]], | |
| 61 | 66 | ]; | 
| 62 | 67 | } | 
| 63 | 68 | |
| ... | ... | @@ -263,4 +268,14 @@ class User extends ActiveRecord implements IdentityInterface, UserRbacInterface | 
| 263 | 268 | public function getUserInfo(){ | 
| 264 | 269 | return $this->hasOne(UserInfo::className(), ['user_id' => 'id']); | 
| 265 | 270 | } | 
| 271 | + | |
| 272 | + public function getIsPerformer() | |
| 273 | + { | |
| 274 | + return true; | |
| 275 | + } | |
| 276 | + | |
| 277 | + public function getIsCustomer() | |
| 278 | + { | |
| 279 | + return true; | |
| 280 | + } | |
| 266 | 281 | } | ... | ... | 
common/models/UserInfo.php
| ... | ... | @@ -25,9 +25,28 @@ use Yii; | 
| 25 | 25 | * @property integer $delivery | 
| 26 | 26 | * @property double $prepayment | 
| 27 | 27 | * @property string $about | 
| 28 | + * @property integer $type | |
| 28 | 29 | */ | 
| 29 | 30 | class UserInfo extends \yii\db\ActiveRecord | 
| 30 | 31 | { | 
| 32 | + // Константа обознащающая физическое лицо | |
| 33 | + const USER_TYPE_FIZ = 1; | |
| 34 | + | |
| 35 | + // Константа обозначающая компанию | |
| 36 | + const USER_TYPE_COMPANY = 2; | |
| 37 | + | |
| 38 | + // Константа обозначающая, что компания/физ.лицо свободно | |
| 39 | + const USER_STATUS_FREE = 1; | |
| 40 | + | |
| 41 | + // Константа обозначающая, что компания/физ.лицо занято | |
| 42 | + const USER_STATUS_BUSY = 2; | |
| 43 | + | |
| 44 | + // Константа обозначающая, что компания/физ.лицо хочет стать членом МФП | |
| 45 | + const USER_MEMBER_FALSE = 1; | |
| 46 | + | |
| 47 | + // Константа обозначающая, что компания/физ.лицо не хочет стать членом МФП | |
| 48 | + const USER_MEMBER_TRUE = 2; | |
| 49 | + | |
| 31 | 50 | /** | 
| 32 | 51 | * @inheritdoc | 
| 33 | 52 | */ | 
| ... | ... | @@ -44,10 +63,11 @@ class UserInfo extends \yii\db\ActiveRecord | 
| 44 | 63 | return [ | 
| 45 | 64 | [['user_id', 'view_count', 'contract', 'estimate', 'purchase', 'delivery'], 'integer'], | 
| 46 | 65 | [['date_visit'], 'safe'], | 
| 47 | - [['experience', 'soft', 'guarantee', 'about'], 'string'], | |
| 66 | + [['experience', 'soft', 'guarantee', 'about', 'city', 'country'], 'string'], | |
| 48 | 67 | [['prepayment'], 'number'], | 
| 49 | - [['busy', 'rank', 'location'], 'string', 'max' => 50], | |
| 50 | - [['salary', 'job'], 'string', 'max' => 255] | |
| 68 | + [['rank', 'location'], 'string', 'max' => 50], | |
| 69 | + [['salary', 'job'], 'string', 'max' => 255], | |
| 70 | + [['busy', 'member'], 'boolean'], | |
| 51 | 71 | ]; | 
| 52 | 72 | } | 
| 53 | 73 | ... | ... | 
console/migrations/m160202_090343_user_add_fields.php
0 → 100644
| 1 | +<?php | |
| 2 | + | |
| 3 | +use yii\db\Schema; | |
| 4 | +use yii\db\Migration; | |
| 5 | + | |
| 6 | +class m160202_090343_user_add_fields extends Migration | |
| 7 | +{ | |
| 8 | + public function up() | |
| 9 | + { | |
| 10 | + $this->addColumn('user', 'type', $this->smallInteger()); | |
| 11 | + $this->addColumn('user_info', 'image', $this->integer()); | |
| 12 | + $this->addColumn('user_info', 'poster', $this->integer()); | |
| 13 | + $this->addColumn('user_info', 'member', $this->smallInteger()); | |
| 14 | + | |
| 15 | + $this->createTable('{{%company_info}}', [ | |
| 16 | + 'company_info_id' => $this->primaryKey(), | |
| 17 | + 'name' => $this->string(255)->notNull(), | |
| 18 | + 'staff' => $this->integer(), | |
| 19 | + 'street' => $this->string(255), | |
| 20 | + 'house' => $this->string(255), | |
| 21 | + 'hide_mail' => $this->smallInteger(), | |
| 22 | + 'user_id' => $this->integer(), | |
| 23 | + ], null); | |
| 24 | + } | |
| 25 | + | |
| 26 | + public function down() | |
| 27 | + { | |
| 28 | + $this->dropColumn('user', 'type'); | |
| 29 | + $this->dropColumn('user_info', 'image'); | |
| 30 | + $this->dropColumn('user_info', 'poster'); | |
| 31 | + $this->dropColumn('user_info', 'member'); | |
| 32 | + $this->dropTable('company_info'); | |
| 33 | + } | |
| 34 | +} | ... | ... | 
console/migrations/m160202_094943_user_info_country_city.php
0 → 100644
| 1 | +<?php | |
| 2 | + | |
| 3 | +use yii\db\Schema; | |
| 4 | +use yii\db\Migration; | |
| 5 | + | |
| 6 | +class m160202_094943_user_info_country_city extends Migration | |
| 7 | +{ | |
| 8 | + public function up() | |
| 9 | + { | |
| 10 | + $this->addColumn('user_info', 'country', $this->string(255)); | |
| 11 | + $this->addColumn('user_info', 'city', $this->string(255)); | |
| 12 | + } | |
| 13 | + | |
| 14 | + public function down() | |
| 15 | + { | |
| 16 | + $this->dropColumn('user_info', 'country'); | |
| 17 | + $this->dropColumn('user_info', 'city'); | |
| 18 | + } | |
| 19 | + | |
| 20 | + /* | |
| 21 | + // Use safeUp/safeDown to run migration code within a transaction | |
| 22 | + public function safeUp() | |
| 23 | + { | |
| 24 | + } | |
| 25 | + | |
| 26 | + public function safeDown() | |
| 27 | + { | |
| 28 | + } | |
| 29 | + */ | |
| 30 | +} | ... | ... | 
frontend/controllers/AccountsController.php
| 1 | 1 | <?php | 
| 2 | 2 | namespace frontend\controllers; | 
| 3 | 3 | |
| 4 | +use common\models\CompanyInfo; | |
| 4 | 5 | use common\models\Fields; | 
| 5 | 6 | use common\models\Language; | 
| 6 | 7 | use Yii; | 
| ... | ... | @@ -28,7 +29,7 @@ class AccountsController extends Controller | 
| 28 | 29 | 'class' => AccessControl::className(), | 
| 29 | 30 | 'rules' => [ | 
| 30 | 31 | [ | 
| 31 | - 'actions' => ['cabinet','change-password', 'bookmarks'], | |
| 32 | + //'actions' => ['cabinet','change-password', 'bookmarks', 'projects'], | |
| 32 | 33 | 'allow' => true, | 
| 33 | 34 | 'roles' => ['@'], | 
| 34 | 35 | ], | 
| ... | ... | @@ -75,6 +76,111 @@ class AccountsController extends Controller | 
| 75 | 76 | return $this->render('bookmarks'); | 
| 76 | 77 | } | 
| 77 | 78 | |
| 79 | + public function actionGeneral() | |
| 80 | + { | |
| 81 | + $user_info = UserInfo::find()->where(['user_id' => \Yii::$app->user->getId()])->one(); | |
| 82 | + $company_info = CompanyInfo::find()->where(['user_id' => \Yii::$app->user->getId()])->one(); | |
| 83 | + $user = \Yii::$app->user->identity; | |
| 84 | + if(empty($user_info)) | |
| 85 | + { | |
| 86 | + $user_info = new UserInfo(['user_id' => \Yii::$app->user->getId()]); | |
| 87 | + } | |
| 88 | + if(empty($company_info)) | |
| 89 | + { | |
| 90 | + $company_info = new CompanyInfo(['user_id' => \Yii::$app->user->getId()]); | |
| 91 | + } | |
| 92 | + $post = \Yii::$app->request->post(); | |
| 93 | + if(!empty($post)) | |
| 94 | + { | |
| 95 | + $user_info->load($post); | |
| 96 | + $company_info->load($post); | |
| 97 | + $user->load($post); | |
| 98 | + if($user_info->save() && $user->save() && $company_info->save()) | |
| 99 | + { | |
| 100 | + \Yii::$app->session->setFlash('userinfoupdate', 'Информация успешно обновлена'); | |
| 101 | + } else { | |
| 102 | + \Yii::$app->session->setFlash('userinfoupdate', 'Ошибка обновления. Проверьте форму'); | |
| 103 | + } | |
| 104 | + } | |
| 105 | + return $this->render('general', ['user_info' => $user_info, 'user' => $user, 'company_info' => $company_info]); | |
| 106 | + } | |
| 107 | + | |
| 108 | + public function actionPortfolio() | |
| 109 | + { | |
| 110 | + | |
| 111 | + } | |
| 112 | + | |
| 113 | + /** | |
| 114 | + * $user User | |
| 115 | + */ | |
| 116 | + public function actionSetting() | |
| 117 | + { | |
| 118 | + $user = \Yii::$app->user->identity; | |
| 119 | + $post = \Yii::$app->request->post('User'); | |
| 120 | + if(!empty($post)) { | |
| 121 | + if(empty($post['new_password'])) { | |
| 122 | + $user->addError('new_password', 'Введите новый пароль'); | |
| 123 | + } else { | |
| 124 | + $user->new_password = $post['new_password']; | |
| 125 | + } | |
| 126 | + if(empty($post['old_password'])) { | |
| 127 | + $user->addError('old_password', 'Введите новый пароль'); | |
| 128 | + } else { | |
| 129 | + $user->old_password = $post['old_password']; | |
| 130 | + } | |
| 131 | + if(empty($post['password_reply']) || $post['password_reply'] !== $post['new_password']) { | |
| 132 | + $user->addError('password_reply', 'Неправильный повтор пароля'); | |
| 133 | + } else { | |
| 134 | + $user->password_reply = $post['password_reply']; | |
| 135 | + } | |
| 136 | + if(!$user->hasErrors()) { | |
| 137 | + if($user->validatePassword($user->old_password)) { | |
| 138 | + $user->setPassword($user->new_password); | |
| 139 | + $user->generateAuthKey(); | |
| 140 | + if($user->save()) { | |
| 141 | + \Yii::$app->session->setFlash('passwordupdate', 'Пароль успешно обновлен'); | |
| 142 | + } | |
| 143 | + } else { | |
| 144 | + $user->addError('old_password', 'Неправильный старый пароль'); | |
| 145 | + } | |
| 146 | + } | |
| 147 | + } | |
| 148 | + return $this->render('setting', ['user' => $user]); | |
| 149 | + } | |
| 150 | + | |
| 151 | + public function actionContacts() | |
| 152 | + { | |
| 153 | + $user_info = UserInfo::find()->where(['user_id' => \Yii::$app->user->getId()])->one(); | |
| 154 | + if(empty($user_info)) { | |
| 155 | + $user_info = new UserInfo(['user_id' => \Yii::$app->user->getId()]); | |
| 156 | + } | |
| 157 | + return $this->render('contacts', ['user_info' => $user_info]); | |
| 158 | + } | |
| 159 | + | |
| 160 | + public function actionService() | |
| 161 | + { | |
| 162 | + return $this->render('service'); | |
| 163 | + } | |
| 164 | + | |
| 165 | + public function actionAddSkills() | |
| 166 | + { | |
| 167 | + | |
| 168 | + } | |
| 169 | + | |
| 170 | + public function actionEmployment() | |
| 171 | + { | |
| 172 | + | |
| 173 | + } | |
| 174 | + | |
| 175 | + public function actionProjects() | |
| 176 | + { | |
| 177 | + return $this->render('projects'); | |
| 178 | + } | |
| 179 | + | |
| 180 | + public function actionGallery() | |
| 181 | + { | |
| 182 | + | |
| 183 | + } | |
| 78 | 184 | |
| 79 | 185 | /** | 
| 80 | 186 | * @param $id | ... | ... | 
| 1 | +<?php | |
| 2 | + | |
| 3 | +namespace frontend\controllers; | |
| 4 | + | |
| 5 | +use Yii; | |
| 6 | +use common\models\CompanyInfo; | |
| 7 | +use common\models\CompanyInfoSearch; | |
| 8 | +use yii\web\Controller; | |
| 9 | +use yii\web\NotFoundHttpException; | |
| 10 | +use yii\filters\VerbFilter; | |
| 11 | + | |
| 12 | +/** | |
| 13 | + * CompanyInfoController implements the CRUD actions for CompanyInfo model. | |
| 14 | + */ | |
| 15 | +class CompanyInfoController extends Controller | |
| 16 | +{ | |
| 17 | + public function behaviors() | |
| 18 | + { | |
| 19 | + return [ | |
| 20 | + 'verbs' => [ | |
| 21 | + 'class' => VerbFilter::className(), | |
| 22 | + 'actions' => [ | |
| 23 | + 'delete' => ['post'], | |
| 24 | + ], | |
| 25 | + ], | |
| 26 | + ]; | |
| 27 | + } | |
| 28 | + | |
| 29 | + /** | |
| 30 | + * Lists all CompanyInfo models. | |
| 31 | + * @return mixed | |
| 32 | + */ | |
| 33 | + public function actionIndex() | |
| 34 | + { | |
| 35 | + $searchModel = new CompanyInfoSearch(); | |
| 36 | + $dataProvider = $searchModel->search(Yii::$app->request->queryParams); | |
| 37 | + | |
| 38 | + return $this->render('index', [ | |
| 39 | + 'searchModel' => $searchModel, | |
| 40 | + 'dataProvider' => $dataProvider, | |
| 41 | + ]); | |
| 42 | + } | |
| 43 | + | |
| 44 | + /** | |
| 45 | + * Displays a single CompanyInfo model. | |
| 46 | + * @param integer $id | |
| 47 | + * @return mixed | |
| 48 | + */ | |
| 49 | + public function actionView($id) | |
| 50 | + { | |
| 51 | + return $this->render('view', [ | |
| 52 | + 'model' => $this->findModel($id), | |
| 53 | + ]); | |
| 54 | + } | |
| 55 | + | |
| 56 | + /** | |
| 57 | + * Creates a new CompanyInfo model. | |
| 58 | + * If creation is successful, the browser will be redirected to the 'view' page. | |
| 59 | + * @return mixed | |
| 60 | + */ | |
| 61 | + public function actionCreate() | |
| 62 | + { | |
| 63 | + $model = new CompanyInfo(); | |
| 64 | + | |
| 65 | + if ($model->load(Yii::$app->request->post()) && $model->save()) { | |
| 66 | + return $this->redirect(['view', 'id' => $model->company_info_id]); | |
| 67 | + } else { | |
| 68 | + return $this->render('create', [ | |
| 69 | + 'model' => $model, | |
| 70 | + ]); | |
| 71 | + } | |
| 72 | + } | |
| 73 | + | |
| 74 | + /** | |
| 75 | + * Updates an existing CompanyInfo model. | |
| 76 | + * If update is successful, the browser will be redirected to the 'view' page. | |
| 77 | + * @param integer $id | |
| 78 | + * @return mixed | |
| 79 | + */ | |
| 80 | + public function actionUpdate($id) | |
| 81 | + { | |
| 82 | + $model = $this->findModel($id); | |
| 83 | + | |
| 84 | + if ($model->load(Yii::$app->request->post()) && $model->save()) { | |
| 85 | + return $this->redirect(['view', 'id' => $model->company_info_id]); | |
| 86 | + } else { | |
| 87 | + return $this->render('update', [ | |
| 88 | + 'model' => $model, | |
| 89 | + ]); | |
| 90 | + } | |
| 91 | + } | |
| 92 | + | |
| 93 | + /** | |
| 94 | + * Deletes an existing CompanyInfo model. | |
| 95 | + * If deletion is successful, the browser will be redirected to the 'index' page. | |
| 96 | + * @param integer $id | |
| 97 | + * @return mixed | |
| 98 | + */ | |
| 99 | + public function actionDelete($id) | |
| 100 | + { | |
| 101 | + $this->findModel($id)->delete(); | |
| 102 | + | |
| 103 | + return $this->redirect(['index']); | |
| 104 | + } | |
| 105 | + | |
| 106 | + /** | |
| 107 | + * Finds the CompanyInfo model based on its primary key value. | |
| 108 | + * If the model is not found, a 404 HTTP exception will be thrown. | |
| 109 | + * @param integer $id | |
| 110 | + * @return CompanyInfo the loaded model | |
| 111 | + * @throws NotFoundHttpException if the model cannot be found | |
| 112 | + */ | |
| 113 | + protected function findModel($id) | |
| 114 | + { | |
| 115 | + if (($model = CompanyInfo::findOne($id)) !== null) { | |
| 116 | + return $model; | |
| 117 | + } else { | |
| 118 | + throw new NotFoundHttpException('The requested page does not exist.'); | |
| 119 | + } | |
| 120 | + } | |
| 121 | +} | ... | ... | 
| 1 | +<?php | |
| 2 | +use common\models\Option; | |
| 3 | +use yii\helpers\Html; | |
| 4 | +use yii\widgets\ActiveForm; | |
| 5 | +use \common\widgets\MultiLangForm; | |
| 6 | + | |
| 7 | + $this->title = 'Мой профиль'; | |
| 8 | + $this->params['breadcrumbs'][] = $this->title; | |
| 9 | +?> | |
| 10 | + | |
| 11 | +<h1><?= $this->title ?></h1> | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | +<?php | |
| 16 | + | |
| 17 | +$form = $this->render('_form', [ | |
| 18 | + 'user' => $user, | |
| 19 | + 'user_info' => $user_info, | |
| 20 | +]); | |
| 21 | + | |
| 22 | +echo MultiLangForm::widget(['form'=>$form]); | |
| 23 | + | |
| 24 | +?> | |
| 25 | + | |
| 26 | + | ... | ... | 
| 1 | +<?php | |
| 2 | +use common\models\Option; | |
| 3 | +use yii\helpers\Html; | |
| 4 | +use yii\widgets\ActiveForm; | |
| 5 | +use \common\widgets\MultiLangForm; | |
| 6 | + | |
| 7 | + $this->title = 'Мой профиль'; | |
| 8 | + $this->params['breadcrumbs'][] = $this->title; | |
| 9 | +?> | |
| 10 | + | |
| 11 | +<h1><?= $this->title ?></h1> | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | +<?php | |
| 16 | + | |
| 17 | +$form = $this->render('_form', [ | |
| 18 | + 'user' => $user, | |
| 19 | + 'user_info' => $user_info, | |
| 20 | +]); | |
| 21 | + | |
| 22 | +echo MultiLangForm::widget(['form'=>$form]); | |
| 23 | + | |
| 24 | +?> | |
| 25 | + | |
| 26 | + | ... | ... | 
| 1 | +<?php | |
| 2 | +use common\models\Option; | |
| 3 | +use yii\helpers\Html; | |
| 4 | +use yii\widgets\ActiveForm; | |
| 5 | +use \common\widgets\MultiLangForm; | |
| 6 | + | |
| 7 | + $this->title = 'Мой профиль'; | |
| 8 | + $this->params['breadcrumbs'][] = $this->title; | |
| 9 | +?> | |
| 10 | + | |
| 11 | +<h1><?= $this->title ?></h1> | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | +<?php | |
| 16 | + | |
| 17 | +$form = $this->render('_form', [ | |
| 18 | + 'user' => $user, | |
| 19 | + 'user_info' => $user_info, | |
| 20 | +]); | |
| 21 | + | |
| 22 | +echo MultiLangForm::widget(['form'=>$form]); | |
| 23 | + | |
| 24 | +?> | |
| 25 | + | |
| 26 | + | ... | ... | 
| 1 | +<?php | |
| 2 | +use common\models\Option; | |
| 3 | +use yii\helpers\Html; | |
| 4 | +use yii\widgets\ActiveForm; | |
| 5 | +use \common\widgets\MultiLangForm; | |
| 6 | + | |
| 7 | + $this->title = 'Мой профиль'; | |
| 8 | + $this->params['breadcrumbs'][] = $this->title; | |
| 9 | +?> | |
| 10 | + | |
| 11 | +<h1><?= $this->title ?></h1> | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | +<?php | |
| 16 | + | |
| 17 | +$form = $this->render('_form', [ | |
| 18 | + 'user' => $user, | |
| 19 | + 'user_info' => $user_info, | |
| 20 | +]); | |
| 21 | + | |
| 22 | +echo MultiLangForm::widget(['form'=>$form]); | |
| 23 | + | |
| 24 | +?> | |
| 25 | + | |
| 26 | + | ... | ... | 
| 1 | +<?php | |
| 2 | + /** | |
| 3 | + * @var UserInfo $user_info | |
| 4 | + * @var User $user | |
| 5 | + * @var CompanyInfo $company_info | |
| 6 | + */ | |
| 7 | + use common\models\CompanyInfo; | |
| 8 | + use common\models\Option; | |
| 9 | + use common\models\User; | |
| 10 | + use common\models\UserInfo; | |
| 11 | + use yii\helpers\Html; | |
| 12 | + use yii\widgets\ActiveForm; | |
| 13 | + use \common\widgets\MultiLangForm; | |
| 14 | + | |
| 15 | + $this->title = 'Учетные данные'; | |
| 16 | + $this->params['breadcrumbs'][] = $this->title; | |
| 17 | +?> | |
| 18 | +<h1><?= $this->title ?></h1> | |
| 19 | +<div class="" id="form_definition"> | |
| 20 | + <?php | |
| 21 | + $form = ActiveForm::begin (); | |
| 22 | + echo $form->field ($user, 'isPerformer', ['template' => "{label}:\n{input}\n{hint}\n{error}"]) | |
| 23 | + ->label ('Я - исполнитель') | |
| 24 | + ->hint ('Отображается если указать специализации услуг в личном кабинете.') | |
| 25 | + ->checkbox ([], false); | |
| 26 | + echo $form->field ($user, 'isCustomer', ['template' => "{label}:\n{input}\n{hint}\n{error}"]) | |
| 27 | + ->label ('Я - заказчик') | |
| 28 | + ->hint ('Отображается если созданы заказы.') | |
| 29 | + ->checkbox ([], false); | |
| 30 | + echo $form->field ($user, 'type') | |
| 31 | + ->label ('Кто вы') | |
| 32 | + ->radioList ([1 => 'Частное лицо', 2 => 'Компания']); | |
| 33 | + echo $form->field ($company_info, 'name', ['options' => ['class' => 'form-group company_info']]) | |
| 34 | + ->label ('Название компании') | |
| 35 | + ->textInput (); | |
| 36 | + echo $form->field ($company_info, 'staff', ['options' => ['class' => 'form-group company_info']]) | |
| 37 | + ->label ('Количество сотрудников') | |
| 38 | + ->input ('number'); | |
| 39 | + echo '<div class="company_info">Контакты представителя</div>'; | |
| 40 | + echo $form->field ($user, 'lastname') | |
| 41 | + ->label ('Фамилия') | |
| 42 | + ->textInput (); | |
| 43 | + echo $form->field ($user, 'firstname') | |
| 44 | + ->label ('Имя') | |
| 45 | + ->textInput (); | |
| 46 | + echo $form->field ($user_info, 'country') | |
| 47 | + ->label ('Ваша страна') | |
| 48 | + ->textInput (); | |
| 49 | + echo $form->field ($user_info, 'city') | |
| 50 | + ->label ('Ваш город') | |
| 51 | + ->textInput (); | |
| 52 | + echo $form->field ($company_info, 'street', ['options' => ['class' => 'form-group company_info']]) | |
| 53 | + ->label ('Улица') | |
| 54 | + ->textInput (); | |
| 55 | + echo $form->field ($company_info, 'house', ['options' => ['class' => 'form-group company_info']]) | |
| 56 | + ->label ('Дом') | |
| 57 | + ->textInput (); | |
| 58 | + echo $form->field ($user, 'email') | |
| 59 | + ->label ('Email') | |
| 60 | + ->textInput (['disabled' => 'disabled']); | |
| 61 | + echo $form->field ($company_info, 'hide_mail', ['options' => ['class' => 'form-group company_info'], 'template' => "{input}{label}\n{hint}\n{error}"]) | |
| 62 | + ->label ('Не публиковать Email') | |
| 63 | + ->checkbox ([], false); | |
| 64 | + echo $form->field ($user_info, 'busy') | |
| 65 | + ->label ('Статус') | |
| 66 | + ->radioList ([0 => 'Свободен', 1 => 'Занят']); | |
| 67 | + echo $form->field ($user_info, 'member') | |
| 68 | + ->label ('Членство в МФП') | |
| 69 | + ->hint ('Выберите если хотите стать членом МФП и наш менеджер свяжется с Вами.') | |
| 70 | + ->radioList ([0 => 'Не хочу', 1 => 'Хочу стать']); | |
| 71 | + echo Html::submitButton('Обновить', ['class' => 'btn btn-primary']); | |
| 72 | + $form->end (); | |
| 73 | + ?> | |
| 74 | +</div> | ... | ... | 
| 1 | +<?php | |
| 2 | +use common\models\Option; | |
| 3 | +use yii\helpers\Html; | |
| 4 | +use yii\widgets\ActiveForm; | |
| 5 | +use \common\widgets\MultiLangForm; | |
| 6 | + | |
| 7 | + $this->title = 'Мой профиль'; | |
| 8 | + $this->params['breadcrumbs'][] = $this->title; | |
| 9 | +?> | |
| 10 | + | |
| 11 | +<h1><?= $this->title ?></h1> | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | +<?php | |
| 16 | + | |
| 17 | +$form = $this->render('_form', [ | |
| 18 | + 'user' => $user, | |
| 19 | + 'user_info' => $user_info, | |
| 20 | +]); | |
| 21 | + | |
| 22 | +echo MultiLangForm::widget(['form'=>$form]); | |
| 23 | + | |
| 24 | +?> | |
| 25 | + | |
| 26 | + | ... | ... | 
| 1 | +<?php | |
| 2 | + /** | |
| 3 | + * @var User $user | |
| 4 | + */ | |
| 5 | + use common\models\Option; | |
| 6 | + use common\models\User; | |
| 7 | + use yii\helpers\Html; | |
| 8 | + use yii\widgets\ActiveForm; | |
| 9 | + use \common\widgets\MultiLangForm; | |
| 10 | + | |
| 11 | + $this->title = 'Настройки профиля'; | |
| 12 | + $this->params['breadcrumbs'][] = $this->title; | |
| 13 | +?> | |
| 14 | + | |
| 15 | +<h1><?= $this->title ?></h1> | |
| 16 | + | |
| 17 | +<?php | |
| 18 | + if (\Yii::$app->session->hasFlash ('passwordupdate')) | |
| 19 | + { | |
| 20 | + ?> | |
| 21 | + <div class="alert alert-warning alert-dismissible" role="alert"> | |
| 22 | + <button type="button" class="close" data-dismiss="alert" aria-label="Close"> | |
| 23 | + <span aria-hidden="true">×</span> | |
| 24 | + </button> | |
| 25 | + <p><?= \Yii::$app->session->getFlash ('passwordupdate') ?></p> | |
| 26 | + </div> | |
| 27 | + <? | |
| 28 | + } | |
| 29 | + $form = ActiveForm::begin (); | |
| 30 | + echo "<p>Сменить пароль:</p>"; | |
| 31 | + echo $form->field ($user, 'old_password', ['template' => "{input}{label}\n{hint}\n{error}"]) | |
| 32 | + ->label ('Старый пароль') | |
| 33 | + ->passwordInput (['value' => '']); | |
| 34 | + echo $form->field ($user, 'new_password', ['template' => "{input}{label}\n{hint}\n{error}"]) | |
| 35 | + ->label ('Новый пароль') | |
| 36 | + ->passwordInput (['value' => '']); | |
| 37 | + echo $form->field ($user, 'password_reply', ['template' => "{input}{label}\n{hint}\n{error}"]) | |
| 38 | + ->label ('Повторите пароль') | |
| 39 | + ->passwordInput (['value' => '']); | |
| 40 | + echo Html::submitButton ('Обновить', ['class' => 'btn btn-primary']); | |
| 41 | + $form->end (); | |
| 42 | +?> | |
| 43 | + | |
| 44 | + | ... | ... | 
frontend/views/chat/list.php
| 1 | +<?php | |
| 2 | + | |
| 3 | +use yii\helpers\Html; | |
| 4 | +use yii\widgets\ActiveForm; | |
| 5 | + | |
| 6 | +/* @var $this yii\web\View */ | |
| 7 | +/* @var $model common\models\CompanyInfo */ | |
| 8 | +/* @var $form yii\widgets\ActiveForm */ | |
| 9 | +?> | |
| 10 | + | |
| 11 | +<div class="company-info-form"> | |
| 12 | + | |
| 13 | + <?php $form = ActiveForm::begin(); ?> | |
| 14 | + | |
| 15 | + <?= $form->field($model, 'name')->textInput() ?> | |
| 16 | + | |
| 17 | + <?= $form->field($model, 'staff')->textInput() ?> | |
| 18 | + | |
| 19 | + <?= $form->field($model, 'street')->textInput() ?> | |
| 20 | + | |
| 21 | + <?= $form->field($model, 'house')->textInput() ?> | |
| 22 | + | |
| 23 | + <?= $form->field($model, 'hide_mail')->textInput() ?> | |
| 24 | + | |
| 25 | + <div class="form-group"> | |
| 26 | + <?= Html::submitButton($model->isNewRecord ? Yii::t('app', 'Create') : Yii::t('app', 'Update'), ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']) ?> | |
| 27 | + </div> | |
| 28 | + | |
| 29 | + <?php ActiveForm::end(); ?> | |
| 30 | + | |
| 31 | +</div> | ... | ... | 
| 1 | +<?php | |
| 2 | + | |
| 3 | +use yii\helpers\Html; | |
| 4 | +use yii\widgets\ActiveForm; | |
| 5 | + | |
| 6 | +/* @var $this yii\web\View */ | |
| 7 | +/* @var $model common\models\CompanyInfoSearch */ | |
| 8 | +/* @var $form yii\widgets\ActiveForm */ | |
| 9 | +?> | |
| 10 | + | |
| 11 | +<div class="company-info-search"> | |
| 12 | + | |
| 13 | + <?php $form = ActiveForm::begin([ | |
| 14 | + 'action' => ['index'], | |
| 15 | + 'method' => 'get', | |
| 16 | + ]); ?> | |
| 17 | + | |
| 18 | + <?= $form->field($model, 'company_info_id') ?> | |
| 19 | + | |
| 20 | + <?= $form->field($model, 'name') ?> | |
| 21 | + | |
| 22 | + <?= $form->field($model, 'staff') ?> | |
| 23 | + | |
| 24 | + <?= $form->field($model, 'street') ?> | |
| 25 | + | |
| 26 | + <?= $form->field($model, 'house') ?> | |
| 27 | + | |
| 28 | + <?php // echo $form->field($model, 'hide_mail') ?> | |
| 29 | + | |
| 30 | + <div class="form-group"> | |
| 31 | + <?= Html::submitButton(Yii::t('app', 'Search'), ['class' => 'btn btn-primary']) ?> | |
| 32 | + <?= Html::resetButton(Yii::t('app', 'Reset'), ['class' => 'btn btn-default']) ?> | |
| 33 | + </div> | |
| 34 | + | |
| 35 | + <?php ActiveForm::end(); ?> | |
| 36 | + | |
| 37 | +</div> | ... | ... | 
| 1 | +<?php | |
| 2 | + | |
| 3 | +use yii\helpers\Html; | |
| 4 | + | |
| 5 | + | |
| 6 | +/* @var $this yii\web\View */ | |
| 7 | +/* @var $model common\models\CompanyInfo */ | |
| 8 | + | |
| 9 | +$this->title = Yii::t('app', 'Create Company Info'); | |
| 10 | +$this->params['breadcrumbs'][] = ['label' => Yii::t('app', 'Company Infos'), 'url' => ['index']]; | |
| 11 | +$this->params['breadcrumbs'][] = $this->title; | |
| 12 | +?> | |
| 13 | +<div class="company-info-create"> | |
| 14 | + | |
| 15 | + <h1><?= Html::encode($this->title) ?></h1> | |
| 16 | + | |
| 17 | + <?= $this->render('_form', [ | |
| 18 | + 'model' => $model, | |
| 19 | + ]) ?> | |
| 20 | + | |
| 21 | +</div> | ... | ... | 
| 1 | +<?php | |
| 2 | + | |
| 3 | +use yii\helpers\Html; | |
| 4 | +use yii\grid\GridView; | |
| 5 | + | |
| 6 | +/* @var $this yii\web\View */ | |
| 7 | +/* @var $searchModel common\models\CompanyInfoSearch */ | |
| 8 | +/* @var $dataProvider yii\data\ActiveDataProvider */ | |
| 9 | + | |
| 10 | +$this->title = Yii::t('app', 'Company Infos'); | |
| 11 | +$this->params['breadcrumbs'][] = $this->title; | |
| 12 | +?> | |
| 13 | +<div class="company-info-index"> | |
| 14 | + | |
| 15 | + <h1><?= Html::encode($this->title) ?></h1> | |
| 16 | + <?php // echo $this->render('_search', ['model' => $searchModel]); ?> | |
| 17 | + | |
| 18 | + <p> | |
| 19 | + <?= Html::a(Yii::t('app', 'Create Company Info'), ['create'], ['class' => 'btn btn-success']) ?> | |
| 20 | + </p> | |
| 21 | + | |
| 22 | + <?= GridView::widget([ | |
| 23 | + 'dataProvider' => $dataProvider, | |
| 24 | + 'filterModel' => $searchModel, | |
| 25 | + 'columns' => [ | |
| 26 | + ['class' => 'yii\grid\SerialColumn'], | |
| 27 | + | |
| 28 | + 'company_info_id', | |
| 29 | + 'name', | |
| 30 | + 'staff', | |
| 31 | + 'street', | |
| 32 | + 'house', | |
| 33 | + // 'hide_mail', | |
| 34 | + | |
| 35 | + ['class' => 'yii\grid\ActionColumn'], | |
| 36 | + ], | |
| 37 | + ]); ?> | |
| 38 | + | |
| 39 | +</div> | ... | ... | 
| 1 | +<?php | |
| 2 | + | |
| 3 | +use yii\helpers\Html; | |
| 4 | + | |
| 5 | +/* @var $this yii\web\View */ | |
| 6 | +/* @var $model common\models\CompanyInfo */ | |
| 7 | + | |
| 8 | +$this->title = Yii::t('app', 'Update {modelClass}: ', [ | |
| 9 | + 'modelClass' => 'Company Info', | |
| 10 | +]) . ' ' . $model->name; | |
| 11 | +$this->params['breadcrumbs'][] = ['label' => Yii::t('app', 'Company Infos'), 'url' => ['index']]; | |
| 12 | +$this->params['breadcrumbs'][] = ['label' => $model->name, 'url' => ['view', 'id' => $model->company_info_id]]; | |
| 13 | +$this->params['breadcrumbs'][] = Yii::t('app', 'Update'); | |
| 14 | +?> | |
| 15 | +<div class="company-info-update"> | |
| 16 | + | |
| 17 | + <h1><?= Html::encode($this->title) ?></h1> | |
| 18 | + | |
| 19 | + <?= $this->render('_form', [ | |
| 20 | + 'model' => $model, | |
| 21 | + ]) ?> | |
| 22 | + | |
| 23 | +</div> | ... | ... | 
| 1 | +<?php | |
| 2 | + | |
| 3 | +use yii\helpers\Html; | |
| 4 | +use yii\widgets\DetailView; | |
| 5 | + | |
| 6 | +/* @var $this yii\web\View */ | |
| 7 | +/* @var $model common\models\CompanyInfo */ | |
| 8 | + | |
| 9 | +$this->title = $model->name; | |
| 10 | +$this->params['breadcrumbs'][] = ['label' => Yii::t('app', 'Company Infos'), 'url' => ['index']]; | |
| 11 | +$this->params['breadcrumbs'][] = $this->title; | |
| 12 | +?> | |
| 13 | +<div class="company-info-view"> | |
| 14 | + | |
| 15 | + <h1><?= Html::encode($this->title) ?></h1> | |
| 16 | + | |
| 17 | + <p> | |
| 18 | + <?= Html::a(Yii::t('app', 'Update'), ['update', 'id' => $model->company_info_id], ['class' => 'btn btn-primary']) ?> | |
| 19 | + <?= Html::a(Yii::t('app', 'Delete'), ['delete', 'id' => $model->company_info_id], [ | |
| 20 | + 'class' => 'btn btn-danger', | |
| 21 | + 'data' => [ | |
| 22 | + 'confirm' => Yii::t('app', 'Are you sure you want to delete this item?'), | |
| 23 | + 'method' => 'post', | |
| 24 | + ], | |
| 25 | + ]) ?> | |
| 26 | + </p> | |
| 27 | + | |
| 28 | + <?= DetailView::widget([ | |
| 29 | + 'model' => $model, | |
| 30 | + 'attributes' => [ | |
| 31 | + 'company_info_id', | |
| 32 | + 'name', | |
| 33 | + 'staff', | |
| 34 | + 'street', | |
| 35 | + 'house', | |
| 36 | + 'hide_mail', | |
| 37 | + ], | |
| 38 | + ]) ?> | |
| 39 | + | |
| 40 | +</div> | ... | ... | 
frontend/views/layouts/admin.php
| ... | ... | @@ -25,7 +25,58 @@ $this->beginContent('@app/views/layouts/main.php'); | 
| 25 | 25 | <?= Breadcrumbs::widget([ | 
| 26 | 26 | 'links' => isset($this->params['breadcrumbs']) ? $this->params['breadcrumbs'] : [], | 
| 27 | 27 | ]) ?> | 
| 28 | - | |
| 28 | + <div class="section-box menu-content-wr"> | |
| 29 | + <div class="box-wr"> | |
| 30 | + <div class="box-all"> | |
| 31 | + <?php | |
| 32 | + echo Menu::widget([ | |
| 33 | + 'options' => [ | |
| 34 | + 'class' => 'menu-content', | |
| 35 | + ], | |
| 36 | + 'activeCssClass' => 'active-menu-content', | |
| 37 | + 'items' => [ | |
| 38 | + [ | |
| 39 | + 'label' => 'Общее', | |
| 40 | + 'url' => ['accounts/general'], | |
| 41 | + ], | |
| 42 | + [ | |
| 43 | + 'label' => 'Портфолио', | |
| 44 | + 'url' => ['accounts/portfolio'], | |
| 45 | + ], | |
| 46 | + [ | |
| 47 | + 'label' => 'Настройка аккаунта', | |
| 48 | + 'url' => ['accounts/setting'], | |
| 49 | + ], | |
| 50 | + [ | |
| 51 | + 'label' => 'Контакты', | |
| 52 | + 'url' => ['accounts/contacts'], | |
| 53 | + ], | |
| 54 | + [ | |
| 55 | + 'label' => 'Услуги', | |
| 56 | + 'url' => ['accounts/service'], | |
| 57 | + ], | |
| 58 | + [ | |
| 59 | + 'label' => 'Дополнительные навыки', | |
| 60 | + 'url' => ['accounts/add-skills'], | |
| 61 | + ], | |
| 62 | + [ | |
| 63 | + 'label' => 'Трудовой стаж', | |
| 64 | + 'url' => ['accounts/employment'], | |
| 65 | + ], | |
| 66 | + [ | |
| 67 | + 'label' => 'Проекты', | |
| 68 | + 'url' => ['accounts/projects'], | |
| 69 | + ], | |
| 70 | + [ | |
| 71 | + 'label' => 'Галерея', | |
| 72 | + 'url' => ['accounts/gallery'], | |
| 73 | + ], | |
| 74 | + ], | |
| 75 | + ]); | |
| 76 | + ?> | |
| 77 | + </div> | |
| 78 | + </div> | |
| 79 | + </div> | |
| 29 | 80 | <div class="menu-location-index"> | 
| 30 | 81 | <?= $content ?> | 
| 31 | 82 | |
| ... | ... | @@ -33,6 +84,5 @@ $this->beginContent('@app/views/layouts/main.php'); | 
| 33 | 84 | |
| 34 | 85 | </div> | 
| 35 | 86 | </div> | 
| 36 | -</div> | |
| 37 | - | |
| 87 | + </div> | |
| 38 | 88 | <?php $this->endContent() ?> | 
| 39 | 89 | \ No newline at end of file | ... | ... | 
frontend/views/layouts/gallery.php
frontend/views/layouts/performer.php