Speed up gathering of information for each course section

Firstly, this checks section visibility at the start of the section processing, so that hidden sections are skipped immediately (rather than processing each activity in the section and then not adding them at the end).

Secondly, the cm_info functions 'get_url()' and 'get_icon_url()' are used, which both simplifies the code and removes a slow call to 'resource_get_coursemodule_info()' (which needs to access the DB to get the details of the file(s) included in the resource).

Also, the use of 'has_view()' allows for compatibility with any 3rd-party addons that, like the label module, do not have  a 'view' link.