Skip to content

Commit d0417ef

Browse files
committed
WIP
1 parent cc4e9c3 commit d0417ef

File tree

2 files changed

+19
-4
lines changed

2 files changed

+19
-4
lines changed

block_iagora.php

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,12 +74,20 @@ public function get_content() {
7474
* @return string The generated HTML content for the chat.
7575
*/
7676
private function generate_chat_content($directlineurl, $token) {
77-
global $OUTPUT;
77+
global $OUTPUT, $USER, $COURSE, $PAGE;
7878
// Generate a unique identifier for the chat container.
79+
// die(var_dump($PAGE));
7980
$chatid = uniqid('iagora_chat_');
81+
$info = get_fast_modinfo($COURSE);
8082
$context = [
8183
'chatId' => $chatid,
8284
'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,
8391
'token' => $token,
8492
];
8593
return $OUTPUT->render_from_template('block_iagora/chat', $context);

templates/chat.mustache

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,7 @@
3737
"token": "RCurR_XV9ZA.cwA.BKA.iaJrC8xpy8qbOF5xnR..."
3838
}
3939
}}
40-
{{#pix}} t/message, core {{/pix}}
41-
<div id="{{chatId}}" role="main"></div>
40+
<div id="{{chatId}}" role="main" style="height: 500px;"></div>
4241

4342
<script crossorigin="anonymous" src="https://cdn.botframework.com/botframework-webchat/latest/webchat.js"></script>
4443

@@ -60,7 +59,15 @@
6059
localTimezone: Intl.DateTimeFormat().resolvedOptions().timeZone,
6160
locale,
6261
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+
}
6471
})
6572
.subscribe();
6673
subscription.unsubscribe();

0 commit comments

Comments
 (0)