Commit 83cba62cb1e41653de621bd4a3e7de6caa7d85ae
1 parent
6daaaafa
24.02.16
Showing
8 changed files
with
33 additions
and
15 deletions
Show diff stats
common/components/UserCheck.php
| @@ -16,9 +16,13 @@ class UserCheck implements BootstrapInterface | @@ -16,9 +16,13 @@ class UserCheck implements BootstrapInterface | ||
| 16 | 16 | ||
| 17 | if(\Yii::$app->user->identity instanceof User){ | 17 | if(\Yii::$app->user->identity instanceof User){ |
| 18 | $userInfo = \Yii::$app->user->identity->userInfo; | 18 | $userInfo = \Yii::$app->user->identity->userInfo; |
| 19 | - $expression = new Expression('NOW()'); | ||
| 20 | - $userInfo->date_visit = (new \yii\db\Query)->select($expression)->scalar(); | ||
| 21 | - $userInfo->save(); | 19 | + if($userInfo instanceof UserInfo){ |
| 20 | + $expression = new Expression('NOW()'); | ||
| 21 | + $userInfo->date_visit = (new \yii\db\Query)->select($expression)->scalar(); | ||
| 22 | + $userInfo->save(); | ||
| 23 | + } | ||
| 24 | + | ||
| 25 | + | ||
| 22 | } | 26 | } |
| 23 | 27 | ||
| 24 | }); | 28 | }); |
common/models/Project.php
| @@ -173,6 +173,15 @@ | @@ -173,6 +173,15 @@ | ||
| 173 | ->viaTable('project_payment', [ 'project_id' => 'project_id' ]); | 173 | ->viaTable('project_payment', [ 'project_id' => 'project_id' ]); |
| 174 | } | 174 | } |
| 175 | 175 | ||
| 176 | + /** | ||
| 177 | + * @return \yii\db\ActiveQuery | ||
| 178 | + */ | ||
| 179 | + public function getParent() | ||
| 180 | + { | ||
| 181 | + return $this->hasOne(self::className(), [ 'project_id' => 'project_pid' ]); | ||
| 182 | + } | ||
| 183 | + | ||
| 184 | + | ||
| 176 | 185 | ||
| 177 | public function getBudgetCurrency() | 186 | public function getBudgetCurrency() |
| 178 | { | 187 | { |
common/models/User.php
frontend/config/main.php
| @@ -70,6 +70,7 @@ return [ | @@ -70,6 +70,7 @@ return [ | ||
| 70 | 'company/portfolio/<company_id:[\w-]+>/<filter:[\d]+>' => 'company/portfolio-filter', | 70 | 'company/portfolio/<company_id:[\w-]+>/<filter:[\d]+>' => 'company/portfolio-filter', |
| 71 | 'company/blog-view/<company_id:[\w-]+>/<link:[\w-]+>' => 'company/blog-view', | 71 | 'company/blog-view/<company_id:[\w-]+>/<link:[\w-]+>' => 'company/blog-view', |
| 72 | 'company/<action>/<company_id:[\w-]+>' => 'company/<action>', | 72 | 'company/<action>/<company_id:[\w-]+>' => 'company/<action>', |
| 73 | + 'tender/view/<tender_id:[\d-]+>' => 'tender/view', | ||
| 73 | 74 | ||
| 74 | ] | 75 | ] |
| 75 | ], | 76 | ], |
frontend/controllers/SiteController.php
| @@ -246,6 +246,7 @@ class SiteController extends Controller | @@ -246,6 +246,7 @@ class SiteController extends Controller | ||
| 246 | 246 | ||
| 247 | $model = new SignupForm(); | 247 | $model = new SignupForm(); |
| 248 | if ($model->load(Yii::$app->request->post())) { | 248 | if ($model->load(Yii::$app->request->post())) { |
| 249 | + | ||
| 249 | if ($user = $model->signup()) { | 250 | if ($user = $model->signup()) { |
| 250 | 251 | ||
| 251 | $user_info = new UserInfo(); | 252 | $user_info = new UserInfo(); |
frontend/models/SignupForm.php
| @@ -59,12 +59,16 @@ class SignupForm extends Model | @@ -59,12 +59,16 @@ class SignupForm extends Model | ||
| 59 | */ | 59 | */ |
| 60 | public function signup() | 60 | public function signup() |
| 61 | { | 61 | { |
| 62 | + | ||
| 62 | if ($this->validate()) { | 63 | if ($this->validate()) { |
| 63 | $user = new User(); | 64 | $user = new User(); |
| 64 | $user->username = $this->username; | 65 | $user->username = $this->username; |
| 66 | + $user->firstname = $this->firstname; | ||
| 67 | + $user->lastname = $this->lastname; | ||
| 65 | $user->email = $this->email; | 68 | $user->email = $this->email; |
| 66 | $user->setPassword($this->password); | 69 | $user->setPassword($this->password); |
| 67 | $user->generateAuthKey(); | 70 | $user->generateAuthKey(); |
| 71 | + | ||
| 68 | if ($user->save()) { | 72 | if ($user->save()) { |
| 69 | return $user; | 73 | return $user; |
| 70 | } | 74 | } |
frontend/views/search/_projects_list_view.php
| 1 | +<?php | ||
| 2 | +use yii\helpers\Html; | ||
| 3 | +use yii\helpers\Url; | ||
| 4 | + | ||
| 5 | +?> | ||
| 1 | <div class="search-profile-blocks"> | 6 | <div class="search-profile-blocks"> |
| 2 | - <a href="" class="srch-prof-title"><?= $model->name?></a> | ||
| 3 | - <div class="srch-prof-budget"><span></span>Бюджет: <?= $model->budget?> <?= $model->budgetCurrency->label?> (Договорной)</div> | 7 | + <?= Html::a($model->name, Url::toRoute( ['tender/view','tender_id' =>$model->project_id] )) ?> |
| 8 | + <div class="srch-prof-budget"><span></span>Бюджет: <?= $model->budget?> <?= $model->budgetCurrency->label?> (<?= $model->contractual ? "Договорной" : "Не договорной" ?>)</div> | ||
| 4 | <div class="srch-prof-contract-wr"> | 9 | <div class="srch-prof-contract-wr"> |
| 5 | <div class="srch-prof-contract-button">ПОДРЯД</div> | 10 | <div class="srch-prof-contract-button">ПОДРЯД</div> |
| 6 | <div class="srch-prof-contract-txt"> | 11 | <div class="srch-prof-contract-txt"> |
| 7 | - <span>Из проекта: </span><a href="#">Печерский квартал</a> | 12 | + <?php if(!empty($model->parent->name)):?> |
| 13 | + <span>Из проекта: </span><?= Html::a($model->parent->name, Url::toRoute(['tender/view', 'tender_id' =>$model->parent->project_id ])) ?> | ||
| 14 | + <?php endif; ?> | ||
| 8 | </div> | 15 | </div> |
| 9 | </div> | 16 | </div> |
| 10 | <div class="srch-prof-text"> | 17 | <div class="srch-prof-text"> |
| @@ -15,7 +22,7 @@ | @@ -15,7 +22,7 @@ | ||
| 15 | <img src="/images/ico-city.png" alt=""/><span><?= $model->city?></span> | 22 | <img src="/images/ico-city.png" alt=""/><span><?= $model->city?></span> |
| 16 | </div> | 23 | </div> |
| 17 | <div class="srch-prof-params srch-prof-params-clock"> | 24 | <div class="srch-prof-params srch-prof-params-clock"> |
| 18 | - <img src="/images/ico-clock.png" alt=""/><span><?= $model->end?></span> | 25 | + <img src="/images/ico-clock.png" alt=""/><span><?= Yii::$app->formatter->asDatetime($model->date_end, 'Y-MM-d')?></span> |
| 19 | </div> | 26 | </div> |
| 20 | <div class="srch-prof-params srch-prof-params-comm"> | 27 | <div class="srch-prof-params srch-prof-params-comm"> |
| 21 | <img src="/images/ico-comm.png" alt=""/><span>4 предложения</span> | 28 | <img src="/images/ico-comm.png" alt=""/><span>4 предложения</span> |