Minor - Format code.
Minor - fixing PHP warnings.
Fixing gradebook in sessions behaviour see #5962