tableFactory - fixes

Made some fixes for the tableFactory and have integrated it with the
admin_lessons page. In this initial implementation, the sql headings
are used, although this will need to be changed later to be the more
friendly user overrides.