General developer forum

How to group course ?

 
Picture of Herivola R
How to group course ?
 
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.



 
Average of ratings: -
Picture of Martin Greenaway
Re: How to group course ?
 

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?

 
Average of ratings: -
Picture of Herivola R
Re: How to group course ?
 

Thanks you for your answer.

Now, i need to analyze it :D


Thanks Martin

 
Average of ratings: -
Picture of Mark Johnson
Re: How to group course ?
Core developersParticularly helpful MoodlersPlugin 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.

 
Average of ratings: -
Picture of Herivola R
Re: How to group course ?
 

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

 
Average of ratings: -