MDL-47778 tool_monitor: changes made to get_user_courses_select()

The changes -

1) Ensure courses exist before we loop to avoid PHP warning.
2) Checked that the number of courses to display do not exceed the max setting.
3) Used format_string() instead of format_text().
4) Used the course context instead of system context.