File tree 2 files changed +11
-5
lines changed 2 files changed +11
-5
lines changed Original file line number Diff line number Diff line change @@ -74,13 +74,16 @@ public function get_content() {
74
74
* @return string The generated HTML content for the chat.
75
75
*/
76
76
private function generate_chat_content ($ directlineurl , $ token ) {
77
- global $ OUTPUT ;
77
+ global $ OUTPUT , $ USER , $ COURSE , $ PAGE ;
78
78
// Generate a unique identifier for the chat container.
79
+ // die(var_dump($PAGE));
79
80
$ chatid = uniqid ('iagora_chat_ ' );
80
81
$ context = [
81
82
'chatId ' => $ chatid ,
82
83
'directLineURL ' => $ directlineurl ,
83
84
'token ' => $ token ,
85
+ 'moodleUserName ' => $ USER ->firstname ,
86
+ 'moodleCourseName ' => $ COURSE ->fullname ,
84
87
];
85
88
return $ OUTPUT ->render_from_template ('block_iagora/chat ' , $ context );
86
89
}
Original file line number Diff line number Diff line change 37
37
" token" : " RCurR_XV9ZA.cwA.BKA.iaJrC8xpy8qbOF5xnR..."
38
38
}
39
39
}}
40
- { {#pix} } t/message, core { {/pix} }
41
- <div id =" { { chatId} } " role =" main" ></div >
40
+ <div id =" { { chatId} } " role =" main" style =" height : 500px ;" ></div >
42
41
43
42
<script crossorigin =" anonymous" src =" https://cdn.botframework.com/botframework-webchat/latest/webchat.js" ></script >
44
43
45
- { {# js} }
44
+ { {js} }
46
45
/* global WebChat */
47
46
/* eslint-disable promise/no-native */
48
47
(async function() {
60
59
localTimezone: Intl.DateTimeFormat().resolvedOptions().timeZone,
61
60
locale,
62
61
name: ' startConversation' ,
63
- type: ' event'
62
+ type: ' event' ,
63
+ value: {
64
+ ' MoodleUserName' : ' {{moodleUserName}}' ,
65
+ ' MoodleCourseName' : ' {{moodleCourseName}}'
66
+ }
64
67
})
65
68
.subscribe();
66
69
subscription.unsubscribe();
You can’t perform that action at this time.
0 commit comments