Updated for Moodle format

Eight files were modified to conform to the Moodle programming style.
All files now pass the codechecker and the php checker.