Course Tags

Jump to: navigation, search
Course tags
Project state Specification draft
Tracker issue MDL-36648
Discussion
Assignee Andrew Nicols


Moodle 2.5


The existing course tagging system in Moodle is quite restrictive and is preventing use of course tags in more complex use cases. It would be ideal if course tags could be used to inform other areas of Moodle as to which courses may be of particular interest to a user. As an example, course tagging could be used to influence which courses are displayed in:

  • block_course_overview - perhaps by use of course tag filters; and
  • navigation - perhaps by using the same filters as in the block_course_overview or maybe looking at a users current context and showing them courses with similar tags to the course they are currently viewing.

Course tags should not be tied directly to a context and they should be an admin-configurable system-wide setting.

Course tags could also be linked closely with cohorts to allow restriction of /listing/ of courses based on cohorts. This is a widely requested feature in Moodle and would have a relatively small performance overhead.

User Stories

We have three users, Geoff, Jane, and Bob. They are all taking courses as Noodle University which has a number of Departments.

  • Noodle University has been using Moodle as its VLE for several years and allows students to have access to the courses they have taken in previous years.
  • All students in Noodle University are automatically enrolled onto courses using the Database Enrolment mechanism which also manages their cohort membership based upon various factors including their faculty, department, and major choices.
  • Noodle has several departments including Modern Languages, Maths, and Physics:
    • The Modern Language department offers courses in French, Italian, German, and Spanish; as well as a beginners TEFL course;
    • The Math department offers a variety of courses most of which are available to any math student, but with some only available to those studying a particular field.
    • The Physics department offers a variety of courses and requires its students to choose at least one math course in their first year.

The following tags have been set up at Noodle University (these are just a subset of them):

Tag Description Requirements
currentyear Courses run in the academic year starting 2012 None
year2011 Courses run in the academic year starting 2011 None
year2013 Courses run in the academic year starting 2013 None
languagemajor Courses in the language department which are taken by Language majors Membership of the 'languagemajor' cohort
languageminor Courses in the language department which are taken by Language minors Membership of the 'languageminor' cohort
language-french French courses in the Language department Membership of the 'language-french' cohort
language-german German courses in the Language department Membership of the 'language-german' cohort
language-spanish Spanish courses in the Language department Membership of the 'language-spanish' cohort
language-italian Italian courses in the Language department Membership of the 'language-italian' cohort
mathmajor Courses in the math department which are taken by math majors Membership of the 'mathmajor' cohort
mathminor Courses in the math department which are taken by math minor Membership of the 'mathminor' cohort
math-stats Statistics courses offered by the Math department Membership of the 'math-stats' cohort
math-trig Trigonometry courses offered by the Math department Membership of the 'math-trig' cohort

Looking at some of Noodle's departments, staff have tagged all of the courses such that the courses have the following tags:

Year Course tags
2011-2012 FREN200 language-french, year2011
2011-2012 FREN201 language-french, year2011
2011-2012 FREN202 language-french, year2011
2011-2012 GERM200 language-german, year2011
2011-2012 GERM201 language-german, year2011
2011-2012 GERM202 language-german, year2011
2011-2012 ITAL200 language-italian, year2011
2011-2012 ITAL201 language-italian, year2011
2011-2012 ITAL202 language-italian, year2011
2011-2012 SPAN201 language-spanish, year2011
2011-2012 SPAN202 language-spanish, year2011
2011-2012 SPAN203 language-spanish, year2011
2011-2012 MATH100 math-major, math-minor, year2011
2011-2012 MATH110 math-major, math-minor, year2011
2011-2012 MATH120 math-major, math-minor, year2011
2011-2012 MATH130 math-major, year2011
2011-2012 MATH140 math-major, year2011
2011-2012 MATH210 math-stats, year2011
2011-2012 MATH220 math-trig, year2011
2012-2013 FREN300 language-french, currentyear
2012-2013 FREN301 language-french, currentyear
2012-2013 FREN302 language-french, currentyear
2012-2013 GERM300 language-german, currentyear
2012-2013 GERM301 language-german, currentyear
2012-2013 GERM302 language-german, currentyear
2012-2013 ITAL300 language-italian, currentyear
2012-2013 ITAL301 language-italian, currentyear
2012-2013 ITAL302 language-italian, currentyear
2012-2013 SPAN301 language-spanish, currentyear
2012-2013 SPAN302 language-spanish, currentyear
2012-2013 SPAN303 language-spanish, currentyear
2012-2013 TEFL350 language-major, currentyear
2012-2013 MATH100 math-major, math-minor, currentyear
2012-2013 MATH110 math-major, math-minor, currentyear
2012-2013 MATH120 math-major, math-minor, currentyear
2012-2013 MATH130 math-major, currentyear
2012-2013 MATH140 math-major, currentyear
2012-2013 MATH210 math-stats, currentyear
2012-2013 MATH220 math-trig, currentyear
2013-2014 FREN300 language-french, year2013
2013-2014 FREN301 language-french, year2013
2013-2014 FREN302 language-french, year2013
2013-2014 GERM300 language-german, year2013
2013-2014 GERM301 language-german, year2013
2013-2014 GERM302 language-german, year2013
2013-2014 ITAL300 language-italian, year2013
2013-2014 ITAL301 language-italian, year2013
2013-2014 ITAL302 language-italian, year2013
2013-2014 SPAN301 language-spanish, year2013
2013-2014 SPAN302 language-spanish, year2013
2013-2014 SPAN303 language-spanish, year2013
2013-2014 TEFL350 language-major, year2013
2013-2014 MATH100 math-major, math-minor, year2013
2013-2014 MATH110 math-major, math-minor, year2013
2013-2014 MATH120 math-major, math-minor, year2013
2013-2014 MATH130 math-major, year2013
2013-2014 MATH140 math-major, year2013
2013-2014 MATH210 math-stats, year2013
2013-2014 MATH220 math-trig, year2013

Noodle University have enabled the /my course page and by default show several blocks including:

  • block_course_overview - the standard Course Overview block listing courses you are currently enrolled on
  • block_course_available - a custom block developed by Noodle listing all courses within a defined set of course categories

User Story 1 - Jane

Jane is a second-year Language student majoring in French and Italian. She is currently preparing for her third year and wishes to find out more about her courses for the year to come. She only wants to be presented with information on the courses which she can actually take part in.

Jane has been placed into appropriate cohorts for her study including:

  • language-major
  • language-french
  • language-german
  • Jane opens her /my page and clicks the option on the block_course_available page to only show courses for the 2013-2014 academic year.
  • She is only interested in courses which she is eligible to take and is presented with a list of French, and Italian courses. She is also offered the option to take the TEFL course as she is a language major.
  • Jane is only able to view courses in which she is currently enrolled in, and those she is interested in:
    • FREN300
    • FREN301
    • FREN302
    • ITAL300
    • ITAL301
    • ITAL302
    • TEFL350

User Story 2 - Geoff

Geoff is a first year physics student and needs to look at his options for his second term. He has to choose from a selection of Math modules in addition to the compulsory Physics modules he has already been enrolled on.

  • Geoff opens his /my page and clicks the option on the block_course_available page to only show courses for the current academic year
  • Geoff is presented with a list of modules that he is able to take:
    • MATH100
    • MATH110
    • MATH120

User Story 3 - Bob

Bob is a third-year undergraduate Language student. He has taken 10-12 courses in each year of his degree and still has access to these courses for his studies. He wants to be able to limit the courses shown on his Course Overview block to just the courses he is actively studying and hide the courses he is not. He also wants the same courses to be shown on the 'My courses' section of his Navigation tree.

  • Geoff opens Moodle and is directed to his /my page
  • Geoff is presented with a list of modules that he is currently enrolled in and is taking this academic year:
    • GERM301
    • GERM302
    • TEFL350
    • SPAN301
    • SPAN303
    • /several more/
  • Geoff wishes to view some of the courses he took last year, so he clicks from the drop-down list in the course overview block and selects pre-defined filter option for '2011-2012 Academic year'. The block updates to show:
    • GERM204
    • GERM205
    • GERM206
    • SPAN201
    • /several more/


Database changes

New Tables:

coursetag

  • id
  • idnumber
  • name
  • description
  • descriptionformat
  • timecreated
  • timemodified

coursetag_courses

  • id
  • coursetagid
  • courseid

coursetag_cohorts

  • id
  • coursetagid
  • cohortid


Sample queries

Select all courses with any of tags a, b, or c and any of tags d, e, or f and that user matches any cohort membership requirements

 SELECT
   c.*
 FROM {course} c
 INNER JOIN {coursetag_courses} ctc ON ctc.courseid = c.id
 INNER JOIN {coursetags} ct ON ct.id = ctc.coursetagid
 LEFT JOIN {coursetag_cohorts} ctch ON ctch.coursetagid = ct.id
 LEFT JOIN {cohort_members} chm ON chm.id = ctch.cohortid
 WHERE chm.userid = ? AND (
   ct.id IN (a, b, c) AND
   ct.id IN (d, e, f)
 ) AND
 ( ctch.id IS NULL OR ch.id IS NOT NULL )

Object model

Class course_tag

method type description
create() static creates a new course tag
remove() static removes a tag and all associations
fetch_by_name() Fetches a tag and it's details by its unique name
fetch_by_id() Fetches a tag and it's details by its unique id
add_to_course() Add a course to the current tag
remove_from_course() Remove the specified course from the current tag
fetch_courses() List all courses under the current tag

Backwards compatibility

None - we should get rid of the old interface if possible

User interface

Future thoughts to consider