MDL-30811 output: Add support for session notifications

This commit is contained in:
Andrew Nicols
2016-02-29 09:05:56 +08:00
parent 243468030a
commit 0346323cec
16 changed files with 622 additions and 55 deletions
+8
View File
@@ -157,10 +157,18 @@ class manager {
public static function init_empty_session() {
global $CFG;
// Backup notifications. These should be preserved across session changes until the user fetches and clears them.
$notifications = [];
if (isset($GLOBALS['SESSION']->notifications)) {
$notifications = $GLOBALS['SESSION']->notifications;
}
$GLOBALS['SESSION'] = new \stdClass();
$GLOBALS['USER'] = new \stdClass();
$GLOBALS['USER']->id = 0;
// Restore notifications.
$GLOBALS['SESSION']->notifications = $notifications;
if (isset($CFG->mnet_localhost_id)) {
$GLOBALS['USER']->mnethostid = $CFG->mnet_localhost_id;
} else {