Commit f8eac9c43a21621d5a4bf8d0c0984fcd6bfa23a9

Authored by Alexey Boroda
1 parent b6741a94

-Logout

console/migrations/m161229_140924_add_regexp_column_to_user_table.php 0 → 100644
  1 +<?php
  2 +
  3 +use yii\db\Migration;
  4 +
  5 +/**
  6 + * Handles adding regexp to table `user`.
  7 + */
  8 +class m161229_140924_add_regexp_column_to_user_table extends Migration
  9 +{
  10 + /**
  11 + * @inheritdoc
  12 + */
  13 + public function up()
  14 + {
  15 + $this->addColumn('user', 'regexp', $this->string(255));
  16 + $this->addColumn('user', 'name', $this->string(255));
  17 + }
  18 +
  19 + /**
  20 + * @inheritdoc
  21 + */
  22 + public function down()
  23 + {
  24 + $this->dropColumn('user', 'regexp');
  25 + $this->dropColumn('user', 'name');
  26 + }
  27 +}
... ...
frontend/controllers/CabinetController.php
... ... @@ -64,11 +64,11 @@
64 64 }
65 65  
66 66 $table = IntellectualProperty::find()
67   - ->where(
68   - [
69   - 'user_id' => \Yii::$app->user->identity->id,
70   - ]
71   - )
  67 +// ->where(
  68 +// [
  69 +// 'user_id' => \Yii::$app->user->identity->id,
  70 +// ]
  71 +// )
72 72 ->all();
73 73  
74 74 return $this->render(
... ... @@ -128,11 +128,11 @@
128 128 public function actionList()
129 129 {
130 130 $table = IntellectualProperty::find()
131   - ->where(
132   - [
133   - 'user_id' => \Yii::$app->user->identity->id,
134   - ]
135   - )
  131 +// ->where(
  132 +// [
  133 +// 'user_id' => \Yii::$app->user->identity->id,
  134 +// ]
  135 +// )
136 136 ->all();
137 137 return $this->render(
138 138 'list',
... ...
frontend/views/layouts/cabinet.php
... ... @@ -71,7 +71,7 @@ EOT;
71 71 <a href="#" class="btn_mails"><span>23</span></a>
72 72  
73 73 <div class="name-wrapp-login">
74   - <span class="name_" style="background: url('/images/cabinet/ico/ico-5.png')0 50% no-repeat">Дмитро (фізична особа)</span>
  74 + <span class="name_" style="background: url('/images/cabinet/ico/ico-5.png')0 50% no-repeat"><?php echo \Yii::$app->user->identity->name?></span>
75 75 <div id="hidden_list_head" class="_off">
76 76 <ul>
77 77 <li><span class="s_">Киев</span></li>
... ...
frontend/views/site/index.php
... ... @@ -13,6 +13,7 @@
13 13  
14 14 $this->title = 'My Yii Application';
15 15 ?>
  16 +
16 17 <div class="section-box-header">
17 18 <div class="container">
18 19 <div class="row">
... ... @@ -27,6 +28,18 @@
27 28 </ul>
28 29 <div class="login-wrapp">
29 30 <?php
  31 + if(!\Yii::$app->user->isGuest) {
  32 + echo Html::a('Вийти',
  33 + [
  34 + 'site/logout'
  35 + ],
  36 + [
  37 + 'data-method' => 'post',
  38 + 'class' => 'btn-logout',
  39 + ]);
  40 + }
  41 + ?>
  42 + <?php
30 43 if(\Yii::$app->user->isGuest) {
31 44 echo Html::a('вхід', '#', [
32 45 'class' => 'btn_login',
... ... @@ -39,6 +52,7 @@
39 52 ]);
40 53 }
41 54 ?>
  55 +
42 56 </div>
43 57 </div>
44 58 </div>
... ...
frontend/web/css/style.css
... ... @@ -46,6 +46,15 @@ ul.main_menu li a:hover {text-decoration: underline;}
46 46 .login-wrapp {
47 47 float: right;
48 48 }
  49 +.btn-logout {
  50 + float: left;
  51 + display: block;
  52 + margin-top: 30px;
  53 + font-family: Ubuntu;
  54 + color: #02a1ee;
  55 + font-weight: 700;
  56 +
  57 +}
49 58 .btn_login {
50 59 margin-top: 23px;
51 60 float: right;
... ...