Add logging, one activity per course and timeout

All actions that change data get logged.
Teachers can't create more groupdistributions if there is already one
in the course.
It is possible to specify a maximum runtime for the distribution
algorithm to circumvent phps 30 second timelimit.