Finished working on download link. You can now choose a media file in the study to use as a download link. Then in the Template you choose as a link type to use the download.

Fixed error in sql query in download.class