Commit 033f93316b467afbe51d78091db14c550b17d781

Authored by Administrator
1 parent ea09d15d

09.02.16

common/models/User.php
@@ -271,6 +271,11 @@ class User extends ActiveRecord implements IdentityInterface, UserRbacInterface @@ -271,6 +271,11 @@ class User extends ActiveRecord implements IdentityInterface, UserRbacInterface
271 return $this->hasOne(UserInfo::className(), ['user_id' => 'id']); 271 return $this->hasOne(UserInfo::className(), ['user_id' => 'id']);
272 } 272 }
273 273
  274 + public function getCompanyInfo(){
  275 + return $this->hasOne(CompanyInfo::className(), ['user_id' => 'id']);
  276 + }
  277 +
  278 +
274 public function getIsPerformer() 279 public function getIsPerformer()
275 { 280 {
276 return true; 281 return true;
common/models/UserInfo.php
@@ -67,7 +67,7 @@ class UserInfo extends \yii\db\ActiveRecord @@ -67,7 +67,7 @@ class UserInfo extends \yii\db\ActiveRecord
67 [['prepayment'], 'number'], 67 [['prepayment'], 'number'],
68 68
69 [['rank', 'location'], 'string', 'max' => 50], 69 [['rank', 'location'], 'string', 'max' => 50],
70 - [['salary', 'job','firstname','lastname'], 'string', 'max' => 255], 70 + [['salary', 'job'], 'string', 'max' => 255],
71 [['busy', 'member'], 'boolean'], 71 [['busy', 'member'], 'boolean'],
72 ]; 72 ];
73 } 73 }
common/modules/file/controllers/UploaderController.php
@@ -140,7 +140,7 @@ class UploaderController extends Controller { @@ -140,7 +140,7 @@ class UploaderController extends Controller {
140 140
141 if ($request) { 141 if ($request) {
142 142
143 - $model->multi = $request['multi']; 143 + $model->multi = isset($request['multi'])? 1 : 0;
144 144
145 $model->file = UploadedFile::getInstance($model, 'file'); 145 $model->file = UploadedFile::getInstance($model, 'file');
146 146
frontend/components/UserInfo.php 0 → 100644
  1 +<?php
  2 +namespace frontend\components;
  3 +
  4 +
  5 +use Yii;
  6 +use yii\base\Component;
  7 +use yii\base\InvalidConfigException;
  8 +use common\models\User;
  9 +
  10 +class UserInfo extends Component
  11 +{
  12 + public function getUser()
  13 + {
  14 + if(\Yii::$app->user->isGuest){
  15 + die('guest');
  16 + } else {
  17 + return User::findOne(\Yii::$app->user->id);
  18 + }
  19 +
  20 + }
  21 +
  22 +}
0 \ No newline at end of file 23 \ No newline at end of file
frontend/config/main.php
@@ -29,6 +29,11 @@ return [ @@ -29,6 +29,11 @@ return [
29 'identityClass' => 'common\models\User', 29 'identityClass' => 'common\models\User',
30 'enableAutoLogin' => true, 30 'enableAutoLogin' => true,
31 ], 31 ],
  32 + 'userinfo' => [
  33 +
  34 + 'class' => 'frontend\components\UserInfo',
  35 +
  36 + ],
32 'log' => [ 37 'log' => [
33 'traceLevel' => YII_DEBUG ? 3 : 0, 38 'traceLevel' => YII_DEBUG ? 3 : 0,
34 'targets' => [ 39 'targets' => [
frontend/controllers/PerformerController.php
@@ -30,8 +30,6 @@ class PerformerController extends Controller @@ -30,8 +30,6 @@ class PerformerController extends Controller
30 { 30 {
31 public $layout = 'performer'; 31 public $layout = 'performer';
32 32
33 - public $defaultAction = 'common';  
34 -  
35 /** 33 /**
36 * @inheritdoc 34 * @inheritdoc
37 */ 35 */
@@ -50,7 +48,7 @@ class PerformerController extends Controller @@ -50,7 +48,7 @@ class PerformerController extends Controller
50 48
51 public function actionIndex() 49 public function actionIndex()
52 { 50 {
53 - $this->redirect(['site/index']); 51 + return $this->render('common');
54 } 52 }
55 53
56 public function actionCommon(/*$performer_id*/) 54 public function actionCommon(/*$performer_id*/)
frontend/views/layouts/performer.php
@@ -6,9 +6,10 @@ use yii\widgets\Menu; @@ -6,9 +6,10 @@ use yii\widgets\Menu;
6 \frontend\assets\AppAsset::register($this); 6 \frontend\assets\AppAsset::register($this);
7 /* @var $content string */ 7 /* @var $content string */
8 $this->beginContent('@app/views/layouts/main.php'); 8 $this->beginContent('@app/views/layouts/main.php');
  9 +
9 ?> 10 ?>
10 <div class="section-box content"> 11 <div class="section-box content">
11 - <div class="section-box-16" style="background: url('/images/blog/box-16.jpg') no-repeat"> 12 + <div class="section-box-16" style="background: url('<?= Yii::$app->user->identity->userInfo->poster;?>') no-repeat">
12 <div class="box-wr"> 13 <div class="box-wr">
13 <div class="box-all"> 14 <div class="box-all">
14 <div class="blog-buttons-wr style"> 15 <div class="blog-buttons-wr style">