Calculate result score using grademax rather than assuming it's out of 100

This results in a true percentage being sent back to the consumer.

As an example, imagine you have a quiz that's marked out of 10, and you have provided it to another site using this tool, with both ends configured for grades to be sent back to the consumer.  A score of 8/10 would be reported back to the consumer as 8% (instead of 80%) because of the assumed maximum grade of 100.

Both the course total and individual grade items have a 'grademax' attribute, so this patch uses that to calculate the actual percentage to report back to the consumer.