ta-list-for-course.php: fix bugs, generalize.