File tree 2 files changed +19
-4
lines changed
2 files changed +19
-4
lines changed Original file line number Diff line number Diff line change @@ -74,12 +74,20 @@ 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_ ' );
81
+ $ info = get_fast_modinfo ($ COURSE );
80
82
$ context = [
81
83
'chatId ' => $ chatid ,
82
84
'directLineURL ' => $ directlineurl ,
85
+ 'moodleActivityContent ' => $ PAGE ->activityrecord ->content ,
86
+ 'moodleActivityName ' => $ PAGE ->activityrecord ->name ,
87
+ 'moodleActivityType ' => $ PAGE ->pagetype ,
88
+ 'moodleCourseName ' => $ COURSE ->fullname ,
89
+ 'moodleSectionName ' =>$ info ->get_section_info ($ PAGE ->cm ->sectionnum )->name ,
90
+ 'moodleUserName ' => $ USER ->firstname ,
83
91
'token ' => $ token ,
84
92
];
85
93
return $ OUTPUT ->render_from_template ('block_iagora/chat ' , $ context );
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
60
59
localTimezone: Intl.DateTimeFormat().resolvedOptions().timeZone,
61
60
locale,
62
61
name: ' startConversation' ,
63
- type: ' event'
62
+ type: ' event' ,
63
+ value: {
64
+ ' MoodleActivityContent' : ' {{moodleActivityContent}}' ,
65
+ ' MoodleActivityName' : ' {{moodleActivityName}}' ,
66
+ ' MoodleActivityType' : ' {{moodleActivityType}}' ,
67
+ ' MoodleCourseName' : ' {{moodleCourseName}}' ,
68
+ ' MoodleSectionName' : ' {{moodleSectionName}}' ,
69
+ ' MoodleUserName' : ' {{moodleUserName}}' ,
70
+ }
64
71
})
65
72
.subscribe();
66
73
subscription.unsubscribe();
You can’t perform that action at this time.
0 commit comments