Getting a list of all course categories + User Multiple Selector

Getting a list of all course categories + User Multiple Selector

by an4rei . -
Number of replies: 3

So I'm pretty much trying to develop a local plugin for moodle that consists of a bulk command: to change the certificates of the users selected to status 4 - expired(certificates present in the Course Category selected) 

So I was thinking I should first show a List of all Course Categories / a simple textbox for entering the course category ID.

Followed by a page where I would show a Multiple Selector( the one with (Add <) and (Remove >) which moves the users from the right column to the left column)-- example at /admin/roles/admins.php

Therefore as I'm really new to moodle development but got about 4 years in PHP and different programing languages, I'd really enjoy some tips/ideas/code demonstrations on how should I approach this.

I could do a simple SQL query to get all the course categories but I'm really not sure on how does the certificates match the course IDs(what table, what column) 


Would appreciate some help, thank you!

Average of ratings: -
In reply to an4rei .

Re: Getting a list of all course categories + User Multiple Selector

by A. Obeid -
Hi
global $DB, $USER;
you get userid from $USER->id
all user_courses: enrol_get_all_users_courses($id, true, null);
and course Categorie $DB->get_record('course_categories', array('id' => $course->category));
In reply to A. Obeid

Re: Getting a list of all course categories + User Multiple Selector

by an4rei . -
Hi and thanks for your answer.
Is it possible to get all the enrolled users from a certain course category?
In reply to an4rei .

Re: Getting a list of all course categories + User Multiple Selector

by A. Obeid -
I don't now an way to get all users from categories.
this class core_course_category give you all information about categories.
Example $coursecat = core_course_category::get($category) 
than you get all courses core_course_category::search_courses() and for each course you get all users