General developer forum
How to group course ?
I'm developping a plugin. I want to create a table 'courseGroup' which may have a lot of courses.
(! I don't want to use category or profil existing in moodle but i want my own plugin ! )
The goal is to display a courseGroup by User Role.
Is it possible ? I work on it.
To check I understand correctly, you want to display the Course Groups where a user has a certain role within one of the courses?
This is possible, but the database relationships for achieving this are fairly complex. You can actually achieve this with the existing course categories structure, but you say you dont want to do that, so you might be doing something more that I've understood.
You'll want to look at the following tables and understand the relationships between then (assuming you're using the default mdl_ prefix):
Don't try adding an field like "IDCourseGroup" to the core mdl_course table, or indeed modifying the core tables at all - this is asking for trouble. If you want to link courses to your own mdl_course_group table, have an interim table like "mdl_course_group_courses" that associates ids from mdl_course with ids from your mdl_course_group table.