HOSSUP-2935 - Improved questionnaire_print_overview performance.

Hi Joseph, this patch improves the questionnaire_print_overview performance.  In testing I was seeing a serious improvement in performance from the changes. On a MariaDB command line it went from almost 10s to 0s after the changes (on a production site).  Moodle performance profiling showed me a reduction from 1070ms spent in mysql_query to 181ms on a test site.  The callgraphs showed a shift from mysql_query as the largest CPU hog to file_exists (part of the caching system).