From a2dc13192f9462bc4a05f336d9384ba1eb7c6b0b Mon Sep 17 00:00:00 2001 From: Charles Severance Date: Mon, 10 Jun 2024 09:06:33 -0400 Subject: [PATCH] Add the lti.gradeChangeNotify post message --- src/Core/Result.php | 3 +++ src/UI/Output.php | 24 +++++++++++++++++++----- 2 files changed, 22 insertions(+), 5 deletions(-) diff --git a/src/Core/Result.php b/src/Core/Result.php index 69c9e492..631c67d4 100644 --- a/src/Core/Result.php +++ b/src/Core/Result.php @@ -389,6 +389,9 @@ public function gradeSend($grade, $row=false, &$debug_log=false, $extra=false) { if ( is_array($debug_log) ) $debug_log[] = $msg; error_log($msg); } + + // Send notification + $this->session_put('lti.gradeChangeNotify', true); } else { $msg = 'Grade failure '.$grade.' id='.$USER->id.' via '.$GradeSendTransport; if ( is_array($debug_log) ) $debug_log[] = $msg; diff --git a/src/UI/Output.php b/src/UI/Output.php index d8f99c5f..0a19aebd 100644 --- a/src/UI/Output.php +++ b/src/UI/Output.php @@ -616,12 +616,26 @@ public static function handleHeartBeat($cookie) } function footerEnd() { - $end = "\n\n\n"; - if ( $this->buffer ) { - return $end; - } else { - echo($end); + ob_start(); + + if ( $this->session_get('lti.gradeChangeNotify') ) { +?> + +session_forget('lti.gradeChangeNotify'); } + + echo("\n\n\n"); + + $ob_output = ob_get_contents(); + ob_end_clean(); + if ( $this->buffer ) return $ob_output; + echo($ob_output); } function footer() {