echo Html::img('/css/image/f_pic.png', $options); } else { echo Html::img('/css/image/m_pic.png', $options); } } ?> </div> <div class="col-sm-2"> <b>Пол:</b> <?php echo $model->gender ? $model->gender == 1 ? "Мужской" : "Женский" : "<span class='hint'>Не указан</span>"; ?> <br><b>Дата рождения:</b> <?php echo $model->birthday ? CFF::formatData($model->birthday) : "<span class='hint'>Не указана</span>"; ?> </div> <div class="col-sm-8"> <div class="social"> <?php if ($model->vk_page) { echo Html::a('', $model->vk_page, ['title' => 'Аккаунт Вконтакте', 'class' => 'vk-active', 'target' => '_blank']); } else { echo Html::a('', $model->vk_page, ['title' => 'Аккаунт Вконтакте', 'class' => 'vk']); } if ($model->ok_page) { echo Html::a('', $model->ok_page, ['title' => 'Аккаунт Одноклассники', 'class' => 'ok-active', 'target' => '_blank']); } else { echo Html::a('', $model->ok_page, ['title' => 'Аккаунт Одноклассники', 'class' => 'ok']);
/** * @inheritdoc */ public function beforeSave($insert) { if ($this->birthday) { $this->birthday = CFF::formatData($this->birthday); } if ($this->password) { $this->setPassword($this->password); } /** * Защита от подмены собственных данных * Производить изменение ролей может только администратор */ $assign = AuthAssignment::find()->where(['user_id' => $this->id])->one(); if ($assign) { if ($assign->item_name != $this->role->name && !\Yii::$app->user->can('Администратор')) { $this->role = $assign->item_name; // Если Вы не администратор, оставляем роль какая была } } if (parent::beforeSave($insert)) { if ($insert) { $this->generateAuthKey(); } return true; } return false; }