MDLSITE-3522 Updated compatibility with Moodle 2.7/2.8

* Remove deprecated calls
* Use alternate name fields
* Add proper events