How to group course ?

How to group course ?

by Herivola R -
Number of replies: 4
Hello,

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.

Thanks.


Attachment uml.PNG
Average of ratings: -
In reply to Herivola R

Re: How to group course ?

by Martin Greenaway -

Lots of things are possible, including this - but are you absolutely sure that this is something that could not be solved using cohorts and cohort sync enrolment?

In reply to Martin Greenaway

Re: How to group course ?

by Herivola R -

Thanks you for your answer.

Now, i need to analyze it :D


Thanks Martin

In reply to Herivola R

Re: How to group course ?

by Mark Johnson -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers
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):
mdl_course
mdl_course_categories
mdl_context
mdl_role_assignments
mdl_role
mdl_user

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.

In reply to Mark Johnson

Re: How to group course ?

by Herivola R -

Thank you for your complete answer.

The problem is : a course has only one 1 category.

My goal is to have a course in multiple category.

I think i have to use an interim table :D