Undefined method levels

Fix this exception https://groups.google.com/forum/#!topic/coursemology/emUJJEohQ-Q
It is caused by a user, probably admin, trying to attempt an assessment of a course he's not enrolled. In this case, his UserCourse record can't be found so we were trying to access the levels property of nil.
Fixed by removing the attempt button if a user is not enrolled and redirect to the access denied page if he tries to access with url.
Line is too long. [85/80]<br>Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.