Commit 6a97773ceebd2d051bc95790057fe4a240a9c33d
1 parent
a942071d
01.03.16
Showing
10 changed files
with
335 additions
and
134 deletions
Show diff stats
1 | +<?php | |
2 | + | |
3 | +namespace common\models; | |
4 | + | |
5 | +use Yii; | |
6 | + | |
7 | +/** | |
8 | + * This is the model class for table "chat". | |
9 | + * | |
10 | + * @property integer $chat_id | |
11 | + * @property integer $status | |
12 | + * @property string $comment | |
13 | + * @property integer $from_user | |
14 | + * @property integer $to_user | |
15 | + * | |
16 | + * @property User $fromUser | |
17 | + * @property User $toUser | |
18 | + * @property Message[] $messages | |
19 | + */ | |
20 | +class Chat extends \yii\db\ActiveRecord | |
21 | +{ | |
22 | + /** | |
23 | + * @inheritdoc | |
24 | + */ | |
25 | + public static function tableName() | |
26 | + { | |
27 | + return 'chat'; | |
28 | + } | |
29 | + | |
30 | + /** | |
31 | + * @inheritdoc | |
32 | + */ | |
33 | + public function rules() | |
34 | + { | |
35 | + return [ | |
36 | + [['status', 'from_user', 'to_user'], 'integer'], | |
37 | + [['comment'], 'string'], | |
38 | + [['from_user'], 'exist', 'skipOnError' => true, 'targetClass' => User::className(), 'targetAttribute' => ['from_user' => 'id']], | |
39 | + [['to_user'], 'exist', 'skipOnError' => true, 'targetClass' => User::className(), 'targetAttribute' => ['to_user' => 'id']], | |
40 | + ]; | |
41 | + } | |
42 | + | |
43 | + /** | |
44 | + * @inheritdoc | |
45 | + */ | |
46 | + public function attributeLabels() | |
47 | + { | |
48 | + return [ | |
49 | + 'chat_id' => 'Chat ID', | |
50 | + 'status' => 'Status', | |
51 | + 'comment' => 'Comment', | |
52 | + 'from_user' => 'From User', | |
53 | + 'to_user' => 'To User', | |
54 | + ]; | |
55 | + } | |
56 | + | |
57 | + /** | |
58 | + * @return \yii\db\ActiveQuery | |
59 | + */ | |
60 | + public function getFromUser() | |
61 | + { | |
62 | + return $this->hasOne(User::className(), ['id' => 'from_user']); | |
63 | + } | |
64 | + | |
65 | + /** | |
66 | + * @return \yii\db\ActiveQuery | |
67 | + */ | |
68 | + public function getToUser() | |
69 | + { | |
70 | + return $this->hasOne(User::className(), ['id' => 'to_user']); | |
71 | + } | |
72 | + | |
73 | + /** | |
74 | + * @return \yii\db\ActiveQuery | |
75 | + */ | |
76 | + public function getMessages() | |
77 | + { | |
78 | + return $this->hasMany(Message::className(), ['chat_id' => 'chat_id'])->orderBy('message_id')->all() ; | |
79 | + } | |
80 | +} | ... | ... |
1 | +<?php | |
2 | + | |
3 | +namespace common\models; | |
4 | + | |
5 | +use Yii; | |
6 | + | |
7 | +/** | |
8 | + * This is the model class for table "file". | |
9 | + * | |
10 | + * @property integer $file_id | |
11 | + * @property integer $status | |
12 | + * @property string $name | |
13 | + * @property string $dir | |
14 | + */ | |
15 | +class File extends \yii\db\ActiveRecord | |
16 | +{ | |
17 | + /** | |
18 | + * @inheritdoc | |
19 | + */ | |
20 | + public static function tableName() | |
21 | + { | |
22 | + return 'file'; | |
23 | + } | |
24 | + | |
25 | + /** | |
26 | + * @inheritdoc | |
27 | + */ | |
28 | + public function rules() | |
29 | + { | |
30 | + return [ | |
31 | + [['status'], 'integer'], | |
32 | + [['name'], 'string', 'max' => 50], | |
33 | + [['dir'], 'string', 'max' => 255], | |
34 | + ]; | |
35 | + } | |
36 | + | |
37 | + /** | |
38 | + * @inheritdoc | |
39 | + */ | |
40 | + public function attributeLabels() | |
41 | + { | |
42 | + return [ | |
43 | + 'file_id' => 'File ID', | |
44 | + 'status' => 'Status', | |
45 | + 'name' => 'Name', | |
46 | + 'dir' => 'Dir', | |
47 | + ]; | |
48 | + } | |
49 | +} | ... | ... |
1 | +<?php | |
2 | + | |
3 | +namespace common\models; | |
4 | + | |
5 | +use Yii; | |
6 | + | |
7 | +/** | |
8 | + * This is the model class for table "message". | |
9 | + * | |
10 | + * @property integer $message_id | |
11 | + * @property integer $chat_id | |
12 | + * @property integer $user_id | |
13 | + * @property integer $status | |
14 | + * @property string $text | |
15 | + * @property string $files | |
16 | + * @property string $date | |
17 | + * | |
18 | + * @property Chat $chat | |
19 | + */ | |
20 | +class Message extends \yii\db\ActiveRecord | |
21 | +{ | |
22 | + /** | |
23 | + * @inheritdoc | |
24 | + */ | |
25 | + public static function tableName() | |
26 | + { | |
27 | + return 'message'; | |
28 | + } | |
29 | + | |
30 | + /** | |
31 | + * @inheritdoc | |
32 | + */ | |
33 | + public function rules() | |
34 | + { | |
35 | + return [ | |
36 | + [['chat_id', 'user_id', 'status'], 'integer'], | |
37 | + [['text'], 'string'], | |
38 | + [['date'], 'safe'], | |
39 | + [['files'], 'string', 'max' => 255], | |
40 | + [['chat_id'], 'exist', 'skipOnError' => true, 'targetClass' => Chat::className(), 'targetAttribute' => ['chat_id' => 'chat_id']], | |
41 | + ]; | |
42 | + } | |
43 | + | |
44 | + /** | |
45 | + * @inheritdoc | |
46 | + */ | |
47 | + public function attributeLabels() | |
48 | + { | |
49 | + return [ | |
50 | + 'message_id' => 'Message ID', | |
51 | + 'chat_id' => 'Chat ID', | |
52 | + 'user_id' => 'User ID', | |
53 | + 'status' => 'Status', | |
54 | + 'text' => 'Сообщение', | |
55 | + 'files' => 'Files', | |
56 | + 'date' => 'Date', | |
57 | + ]; | |
58 | + } | |
59 | + | |
60 | + /** | |
61 | + * @return \yii\db\ActiveQuery | |
62 | + */ | |
63 | + public function getChat() | |
64 | + { | |
65 | + return $this->hasOne(Chat::className(), ['chat_id' => 'chat_id']); | |
66 | + } | |
67 | + | |
68 | + public function isMy(){ | |
69 | + if($this->user_id == \Yii::$app->user->id){ | |
70 | + return true; | |
71 | + } else { | |
72 | + return false; | |
73 | + } | |
74 | + } | |
75 | +} | ... | ... |
console/migrations/m160301_105759_chat.php
... | ... | @@ -8,20 +8,46 @@ class m160301_105759_chat extends Migration |
8 | 8 | { |
9 | 9 | $this->createTable('{{%chat}}', [ |
10 | 10 | 'chat_id' => $this->primaryKey(), |
11 | - 'status' => $this->string(), | |
12 | - 'comment' => $this->string(), | |
11 | + 'status' => $this->integer(), | |
12 | + 'comment' => $this->text(), | |
13 | 13 | 'from_user' => $this->integer(), |
14 | 14 | 'to_user' => $this->integer(), |
15 | 15 | ]); |
16 | 16 | |
17 | + | |
18 | + $this->createTable('{{%file}}', [ | |
19 | + 'file_id' => $this->primaryKey(), | |
20 | + 'status' => $this->integer(), | |
21 | + 'name' => $this->string(50), | |
22 | + 'dir' => $this->string(255) | |
23 | + ]); | |
24 | + | |
25 | + | |
26 | + $this->createTable('{{%message}}', [ | |
27 | + 'message_id' => $this->primaryKey(), | |
28 | + 'chat_id' => $this->integer(), | |
29 | + 'user_id' => $this->integer(), | |
30 | + 'status' => $this->integer(), | |
31 | + 'text' => $this->text(), | |
32 | + 'files' => $this->string(255), | |
33 | + 'date' => $this->timestamp()->defaultExpression('NOW()'), | |
34 | + | |
35 | + ]); | |
36 | + | |
37 | + | |
17 | 38 | $this->addForeignKey('chat_from_user', '{{%chat}}', 'from_user', '{{%user}}', 'id', 'SET NULL', 'NO ACTION'); |
18 | 39 | $this->addForeignKey('chat_to_user', '{{%chat}}', 'to_user', '{{%user}}', 'id', 'SET NULL', 'NO ACTION'); |
40 | + | |
41 | + $this->addForeignKey('message_to_chat', '{{%message}}', 'chat_id', '{{%chat}}', 'chat_id', 'CASCADE', 'CASCADE'); | |
19 | 42 | } |
20 | 43 | |
21 | 44 | public function down() |
22 | 45 | { |
23 | 46 | $this->dropForeignKey('chat_from_user', '{{%chat}}'); |
24 | 47 | $this->dropForeignKey('chat_to_user', '{{%chat}}'); |
48 | + $this->dropForeignKey('message_to_chat', '{{%message}}'); | |
25 | 49 | $this->dropTable('{{%chat}}'); |
50 | + $this->dropTable('{{%file}}'); | |
51 | + $this->dropTable('{{%message}}'); | |
26 | 52 | } |
27 | 53 | } | ... | ... |
frontend/config/main.php
... | ... | @@ -37,6 +37,9 @@ return [ |
37 | 37 | 'sourcePath' => '@bower/bootstrap/dist', |
38 | 38 | 'css' => [] |
39 | 39 | ], |
40 | + 'yii\web\JqueryAsset' =>[ | |
41 | + 'js' => [] | |
42 | + ] | |
40 | 43 | ], |
41 | 44 | ], |
42 | 45 | //'PageController'=>[ |
... | ... | @@ -81,6 +84,7 @@ return [ |
81 | 84 | 'company/blog-view/<company_id:[\w-]+>/<link:[\w-]+>' => 'company/blog-view', |
82 | 85 | 'company/vacancy-view/<company_id:[\w-]+>/<link:[\w-]+>' => 'company/vacancy-view', |
83 | 86 | 'company/<action>/<company_id:[\w-]+>' => 'company/<action>', |
87 | + 'chat/message/<user_id:[\w-]>'=> 'chat/message', | |
84 | 88 | 'tender/view/<tender_id:[\d-]+>' => 'tender/view', |
85 | 89 | |
86 | 90 | ] | ... | ... |
frontend/controllers/ChatController.php
1 | 1 | <?php |
2 | 2 | namespace frontend\controllers; |
3 | 3 | |
4 | +use common\models\Chat; | |
5 | +use common\models\Message; | |
4 | 6 | use Yii; |
5 | 7 | use common\models\User; |
6 | 8 | use yii\data\ActiveDataProvider; |
... | ... | @@ -23,7 +25,7 @@ class ChatController extends Controller |
23 | 25 | 'class' => AccessControl::className(), |
24 | 26 | 'rules' => [ |
25 | 27 | [ |
26 | - 'actions' => ['list', 'message'], | |
28 | + 'actions' => ['list', 'message', 'message-save'], | |
27 | 29 | 'allow' => true, |
28 | 30 | 'roles' => ['@'], |
29 | 31 | ], |
... | ... | @@ -38,8 +40,52 @@ class ChatController extends Controller |
38 | 40 | return $this->render('list'); |
39 | 41 | } |
40 | 42 | |
41 | - public function actionMessage(/*$user_id*/) | |
43 | + public function actionMessage($user_id) | |
42 | 44 | { |
43 | - return $this->render('message'); | |
45 | + $user = \Yii::$app->user->identity; | |
46 | + | |
47 | + $chat = Chat::find() | |
48 | + ->where([ | |
49 | + 'or', | |
50 | + ['from_user' => $user_id,], | |
51 | + ['to_user' => $user_id,], | |
52 | + ]) | |
53 | + ->andWhere([ | |
54 | + 'or', | |
55 | + ['from_user'=> $user->id,], | |
56 | + ['to_user'=> $user->id,], | |
57 | + ])->one(); | |
58 | + if(!$chat instanceof Chat){ | |
59 | + $chat = new Chat(); | |
60 | + $chat->from_user = $user->id; | |
61 | + $chat->to_user = $user_id; | |
62 | + $chat->save(); | |
63 | + | |
64 | + } | |
65 | + | |
66 | + | |
67 | + $post = \Yii::$app->request->post(); | |
68 | + if(isset($post)){ | |
69 | + | |
70 | + | |
71 | + | |
72 | + $message = new Message(); | |
73 | + | |
74 | + | |
75 | + if($message->load($post, 'Message')){ | |
76 | + | |
77 | + $message->chat_id = $chat->chat_id; | |
78 | + $message->user_id = $user->id; | |
79 | + $message->save(); | |
80 | + | |
81 | + return $this->redirect(['chat/message', 'user_id'=>$user_id]); | |
82 | + } | |
83 | + } | |
84 | + | |
85 | + return $this->render('message',[ | |
86 | + 'chat' => $chat, | |
87 | + 'user_id' => $user_id | |
88 | + ]); | |
44 | 89 | } |
90 | + | |
45 | 91 | } | ... | ... |
frontend/views/chat/message.php
1 | 1 | <?php |
2 | - use common\models\Option; | |
2 | +use common\models\Message; | |
3 | +use common\models\Option; | |
4 | +use yii\widgets\ActiveForm; | |
3 | 5 | |
4 | - $this->registerJsFile('/js/jscroll.js'); | |
6 | +$this->registerJsFile("/js/forms.js"); | |
7 | + $this->registerJsFile("/js/jmousewhell.js"); | |
8 | + $this->registerJsFile("/js/jscroll.js"); | |
5 | 9 | $this->title = 'Мой профиль'; |
6 | -$this->params['breadcrumbs'][] = $this->title; | |
10 | + $this->params['breadcrumbs'][] = $this->title; | |
7 | 11 | ?> |
8 | 12 | |
9 | 13 | <div class="section-box content"> |
... | ... | @@ -86,134 +90,49 @@ $this->params['breadcrumbs'][] = $this->title; |
86 | 90 | <div class="cabinet-message-read-wr style"> |
87 | 91 | <div class="comments_block"> |
88 | 92 | <div class="content"> |
89 | - <div class="comment left"> | |
90 | - <div class="author_pic"><img src="/images/ded-ico.png"></div> | |
91 | - <div class="comment_text"> | |
92 | - На постоянные работы по созданию сайтов, в нашу команду требуется html-верстальщик. Оплата сдельная за проект. В отклике прошу написать свой Skype и почту. А так же 3 проекта с реализованной адаптивной версткой и 3 проекта мобильных сайтов. | |
93 | - <div class="comment_time"> | |
94 | - 25.11.15<br> | |
95 | - 15:00 | |
93 | + <?php foreach($chat->messages as $message):?> | |
94 | + <?php if($message->isMy()):?> | |
95 | + <div class="comment right"> | |
96 | + <div class="author_pic"><img src="/images/ded-ico.png"></div> | |
97 | + <div class="comment_text"> | |
98 | + <?= $message->text ?> | |
99 | + <div class="comment_time"> | |
100 | + 26.11.15<br> | |
101 | + 18:00 | |
102 | + </div> | |
103 | + </div> | |
104 | + <div class="offer_link"><a href="#">Коммерческое предложение</a></div> | |
105 | + <div style="clear:both;"></div> | |
96 | 106 | </div> |
97 | - </div> | |
98 | - <div style="clear:both;"></div> | |
99 | - </div> | |
100 | - <div class="comment left"> | |
101 | - <div class="author_pic"><img src="/images/ded-ico.png"></div> | |
102 | - <div class="comment_text"> | |
103 | - На постоянные работы по созданию сайтов, в нашу команду требуется html-верстальщик. Оплата сдельная за проект. В отклике прошу написать свой Skype и почту. А так же 3 проекта с реализованной адаптивной версткой и 3 проекта мобильных сайтов. | |
104 | - <div class="comment_time"> | |
105 | - 25.11.15<br> | |
106 | - 15:00 | |
107 | - </div> | |
108 | - </div> | |
109 | - <div style="clear:both;"></div> | |
110 | - </div> | |
111 | - <div class="comment left"> | |
112 | - <div class="author_pic"><img src="/images/ded-ico.png"></div> | |
113 | - <div class="comment_text"> | |
114 | - На постоянные работы по созданию сайтов, в нашу команду требуется html-верстальщик. Оплата сдельная за проект. В отклике прошу написать свой Skype и почту. А так же 3 проекта с реализованной адаптивной версткой и 3 проекта мобильных сайтов. | |
115 | - <div class="comment_time"> | |
116 | - 25.11.15<br> | |
117 | - 15:00 | |
118 | - </div> | |
119 | - </div> | |
120 | - <div style="clear:both;"></div> | |
121 | - </div> | |
122 | - <div class="comment left"> | |
123 | - <div class="author_pic"><img src="/images/ded-ico.png"></div> | |
124 | - <div class="comment_text"> | |
125 | - На постоянные работы по созданию сайтов, в нашу команду требуется html-верстальщик. Оплата сдельная за проект. В отклике прошу написать свой Skype и почту. А так же 3 проекта с реализованной адаптивной версткой и 3 проекта мобильных сайтов. | |
126 | - <div class="comment_time"> | |
127 | - 25.11.15<br> | |
128 | - 15:00 | |
107 | + <?php else: ?> | |
108 | + <div class="comment left"> | |
109 | + <div class="author_pic"><img src="/images/ded-ico.png"></div> | |
110 | + <div class="comment_text"> | |
111 | + <?= $message->text ?> | |
112 | + <div class="comment_time"> | |
113 | + 25.11.15<br> | |
114 | + 15:00 | |
115 | + </div> | |
116 | + </div> | |
117 | + <div style="clear:both;"></div> | |
129 | 118 | </div> |
130 | - </div> | |
131 | - <div style="clear:both;"></div> | |
132 | - </div> | |
133 | - <div class="comment left"> | |
134 | - <div class="author_pic"><img src="/images/ded-ico.png"></div> | |
135 | - <div class="comment_text"> | |
136 | - На постоянные работы по созданию сайтов, в нашу команду требуется html-верстальщик. Оплата сдельная за проект. В отклике прошу написать свой Skype и почту. А так же 3 проекта с реализованной адаптивной версткой и 3 проекта мобильных сайтов. | |
137 | - <div class="comment_time"> | |
138 | - 25.11.15<br> | |
139 | - 15:00 | |
140 | - </div> | |
141 | - </div> | |
142 | - <div style="clear:both;"></div> | |
143 | - </div> | |
144 | - <div class="comment right"> | |
145 | - <div class="author_pic"><img src="/images/ded-ico.png"></div> | |
146 | - <div class="comment_text"> | |
147 | - На постоянные работы по созданию сайтов, в нашу команду требуется html-верстальщик. Оплата сдельная за проект. В отклике прошу написать свой Skype и почту. А так же 3 проекта с реализованной адаптивной версткой и 3 проекта мобильных сайтов. | |
148 | - <div class="comment_time"> | |
149 | - 26.11.15<br> | |
150 | - 18:00 | |
151 | - </div> | |
152 | - </div> | |
153 | - <div class="offer_link"><a href="#">Коммерческое предложение</a></div> | |
154 | - <div style="clear:both;"></div> | |
155 | - </div> | |
156 | - <div class="comment right"> | |
157 | - <div class="author_pic"><img src="/images/ded-ico.png"></div> | |
158 | - <div class="comment_text"> | |
159 | - На постоянные работы по созданию сайтов, в нашу команду требуется html-верстальщик. Оплата сдельная за проект. В отклике прошу написать свой Skype и почту. А так же 3 проекта с реализованной адаптивной версткой и 3 проекта мобильных сайтов. | |
160 | - <div class="comment_time"> | |
161 | - 26.11.15<br> | |
162 | - 18:00 | |
163 | - </div> | |
164 | - </div> | |
165 | - <div class="offer_link"><a href="#">Коммерческое предложение</a></div> | |
166 | - <div style="clear:both;"></div> | |
167 | - </div> | |
168 | - <div class="comment right"> | |
169 | - <div class="author_pic"><img src="/images/ded-ico.png"></div> | |
170 | - <div class="comment_text"> | |
171 | - На постоянные работы по созданию сайтов, в нашу команду требуется html-верстальщик. Оплата сдельная за проект. В отклике прошу написать свой Skype и почту. А так же 3 проекта с реализованной адаптивной версткой и 3 проекта мобильных сайтов. | |
172 | - <div class="comment_time"> | |
173 | - 26.11.15<br> | |
174 | - 18:00 | |
175 | - </div> | |
176 | - </div> | |
177 | - <div class="offer_link"><a href="#">Коммерческое предложение</a></div> | |
178 | - <div style="clear:both;"></div> | |
179 | - </div> | |
180 | - <div class="comment right"> | |
181 | - <div class="author_pic"><img src="/images/ded-ico.png"></div> | |
182 | - <div class="comment_text"> | |
183 | - На постоянные работы по созданию сайтов, в нашу команду требуется html-верстальщик. Оплата сдельная за проект. В отклике прошу написать свой Skype и почту. А так же 3 проекта с реализованной адаптивной версткой и 3 проекта мобильных сайтов. | |
184 | - <div class="comment_time"> | |
185 | - 26.11.15<br> | |
186 | - 18:00 | |
187 | - </div> | |
188 | - </div> | |
189 | - <div class="offer_link"><a href="#">Коммерческое предложение</a></div> | |
190 | - <div style="clear:both;"></div> | |
191 | - </div> | |
192 | - <div class="comment left"> | |
193 | - <div class="author_pic"><img src="/images/ded-ico.png"></div> | |
194 | - <div class="comment_text"> | |
195 | - На постоянные работы по созданию сайтов, в нашу команду требуется html-верстальщик. Оплата сдельная за проект. В отклике прошу написать свой Skype и почту. А так же 3 проекта с реализованной адаптивной версткой и 3 проекта мобильных сайтов. | |
196 | - <div class="comment_time"> | |
197 | - 25.11.15<br> | |
198 | - 15:00 | |
199 | - </div> | |
200 | - </div> | |
201 | - <div style="clear:both;"></div> | |
202 | - </div> | |
119 | + <?php endif;?> | |
120 | + <?php endforeach; ?> | |
203 | 121 | <div style="height:20px;"></div> |
204 | 122 | </div> |
205 | 123 | </div> |
206 | 124 | <div class="comment_type"> |
207 | - <form action="" method="post"> | |
208 | - <label>Сообщение</label> | |
209 | - <textarea class="message_text"></textarea> | |
125 | + <?php $form = ActiveForm::begin(['method'=> 'post']); ?> | |
126 | + | |
127 | + <?= $form->field(new Message(), 'text') | |
128 | + ->textarea(['class'=> 'message_text']); ?> | |
210 | 129 | <input type="submit" class="send_mess_but" value="Отправить"> |
211 | 130 | <div class="inputfile"> |
212 | 131 | <div class="file_input_title">Прикрепить файл</div> |
213 | 132 | <input type="file" class="input_file"> |
214 | 133 | <div class="input_file_text">Максимальный размер файла 5 МБ</div> |
215 | 134 | </div> |
216 | - </form> | |
135 | + <?php $form::end(); ?> | |
217 | 136 | </div> |
218 | 137 | </div> |
219 | 138 | </div> | ... | ... |
frontend/views/layouts/gallery.php
1 | 1 | <?php |
2 | 2 | |
3 | 3 | use yii\helpers\Html; |
4 | +use yii\helpers\Url; | |
4 | 5 | use yii\widgets\Breadcrumbs; |
5 | 6 | use yii\widgets\Menu; |
6 | 7 | |
... | ... | @@ -14,7 +15,7 @@ $this->beginContent('@app/views/layouts/main.php'); |
14 | 15 | <div class="box-all"> |
15 | 16 | <div class="blog-buttons-wr style"> |
16 | 17 | <a class="blog-buttons-offer" href="#">Предложить<br>проект</a> |
17 | - <a class="blog-buttons-write" href="#">Написать<br>сообщение</a> | |
18 | + <?= Html::a('Предложить проект', Url::toRoute(['chat/message', 'user_id' => $this->params['user']->id]), ['class'=> 'blog-buttons-write'])?> | |
18 | 19 | <a class="blog-buttons-add-favorite" href="#">Добавить<br>в закладки</a> |
19 | 20 | </div> |
20 | 21 | </div> | ... | ... |
frontend/views/layouts/performer.php
... | ... | @@ -3,6 +3,7 @@ |
3 | 3 | use common\models\User; |
4 | 4 | use yii\helpers\ArrayHelper; |
5 | 5 | use yii\helpers\Html; |
6 | +use yii\helpers\Url; | |
6 | 7 | use yii\widgets\Menu; |
7 | 8 | |
8 | 9 | \frontend\assets\AppAsset::register($this); |
... | ... | @@ -17,7 +18,7 @@ $this->beginContent('@app/views/layouts/main.php'); |
17 | 18 | <div class="box-all"> |
18 | 19 | <div class="blog-buttons-wr style"> |
19 | 20 | <a class="blog-buttons-offer" href="#">Предложить<br>проект</a> |
20 | - <a class="blog-buttons-write" href="#">Написать<br>сообщение</a> | |
21 | + <?= Html::a('Предложить проект', Url::toRoute(['chat/message', 'user_id' => $this->params['user']->id]), ['class'=> 'blog-buttons-write'])?> | |
21 | 22 | <a class="blog-buttons-add-favorite" href="#">Добавить<br>в закладки</a> |
22 | 23 | </div> |
23 | 24 | </div> | ... | ... |
frontend/web/js/script.js
... | ... | @@ -690,14 +690,14 @@ $(document).ready(function(){ |
690 | 690 | } |
691 | 691 | } |
692 | 692 | |
693 | - function include(url) { | |
694 | - var script = document.createElement('script'); | |
695 | - script.src = url; | |
696 | - document.getElementsByTagName('head')[0].appendChild(script); | |
697 | - } | |
698 | - include("/js/forms.js"); | |
699 | - include("/js/jmousewhell.js"); | |
700 | - include("/js/jscroll.js"); | |
693 | + //function include(url) { | |
694 | + // var script = document.createElement('script'); | |
695 | + // script.src = url; | |
696 | + // document.getElementsByTagName('head')[0].appendChild(script); | |
697 | + //} | |
698 | + //include("/js/forms.js"); | |
699 | + //include("/js/jmousewhell.js"); | |
700 | + //include("/js/jscroll.js"); | |
701 | 701 | |
702 | 702 | function inputNumber(){ |
703 | 703 | $('.form-price-wr input').keypress(function(e) { | ... | ... |