Moodle APIs
3.8
Moodle 3.8.6 (Build: 20201109)
|
Course and category management interface helper class. More...
Static Public Member Functions | |
static | action_category_change_sortorder_down_one (\core_course_category $category) |
Resort a categories subcategories shifting the given category down one. More... | |
static | action_category_change_sortorder_down_one_by_id ($categoryid) |
Resort a categories subcategories shifting the given category down one. More... | |
static | action_category_change_sortorder_up_one (\core_course_category $category) |
Resort a categories subcategories shifting the given category up one. More... | |
static | action_category_change_sortorder_up_one_by_id ($categoryid) |
Resort a categories subcategories shifting the given category up one. More... | |
static | action_category_hide (\core_course_category $category) |
Makes a category hidden given a core_course_category object. More... | |
static | action_category_hide_by_id ($categoryid) |
Makes a category hidden given a course category id or database record. More... | |
static | action_category_move_courses_into (\core_course_category $oldcategory, core_course_category $newcategory, array $courseids) |
Moves courses out of one category and into a new category. More... | |
static | action_category_resort_courses (\core_course_category $category, $sort, $cleanup=true) |
Resorts the courses within the given category. More... | |
static | action_category_resort_subcategories (\core_course_category $category, $sort, $cleanup=true) |
Resorts the sub categories of the given category. More... | |
static | action_category_show (\core_course_category $category) |
Makes a category visible given a core_course_category object. More... | |
static | action_category_show_by_id ($categoryid) |
Makes a category visible given a course category id or database record. More... | |
static | action_course_change_sortorder_after_course ($courserecordorid, $moveaftercourseid) |
Changes the sort order so that the first course appears after the second course. More... | |
static | action_course_change_sortorder_down_one (\core_course_list_element $course, core_course_category $category) |
Resorts the courses within a category moving the given course down by one. More... | |
static moodle_database | action_course_change_sortorder_down_one_by_record ($courserecordorid) |
Resorts the courses within a category moving the given course down by one. More... | |
static | action_course_change_sortorder_up_one (\core_course_list_element $course, core_course_category $category) |
Resorts the courses within a category moving the given course up by one. More... | |
static moodle_database | action_course_change_sortorder_up_one_by_record ($courserecordorid) |
Resorts the courses within a category moving the given course up by one. More... | |
static | action_course_hide (\core_course_list_element $course) |
Makes a course hidden given a core_course_list_element object. More... | |
static moodle_database | action_course_hide_by_record ($courserecordorid) |
Makes a course hidden given a course id or a database record. More... | |
static | action_course_show (\core_course_list_element $course) |
Makes a course visible given a core_course_list_element object. More... | |
static moodle_database | action_course_show_by_record ($courserecordorid) |
Makes a course visible given a course id or a database record. More... | |
static | get_category_children_visibility ($categoryid) |
Returns an array of all categoryids that have the given category as a parent and their visible value. More... | |
static | get_category_courses_visibility ($categoryid) |
Returns an array of courseids and visiblity for all courses within the given category. More... | |
static | get_category_listitem_actions (\core_course_category $category) |
Returns an array of actions that can be performed upon a category being shown in a list. More... | |
static | get_course_detail_actions (\core_course_list_element $course) |
Returns an array of actions that can be performed on the course being displayed. More... | |
static moodle_database | get_course_detail_array (\core_course_list_element $course) |
Returns course details in an array ready to be printed. More... | |
static | get_course_listitem_actions (\core_course_category $category, core_course_list_element $course) |
Returns an array of actions for a course listitem. More... | |
static | get_expanded_categories ($withpath=null) |
Returns the categories that should be expanded when displaying the interface. More... | |
static | get_management_viewmodes () |
Returns the view modes for the management interface. More... | |
static | move_courses_into_category ($categoryorid, $courseids=array()) |
Moves one or more courses out of the category they are currently in and into a new category. More... | |
static | record_expanded_category (\core_course_category $coursecat, $expanded=true) |
Records when a category is expanded or collapsed so that when the user. More... | |
static | search_courses ($search, $blocklist, $modulelist, $page=0, $perpage=null) |
Search for courses with matching params. More... | |
Static Protected Attributes | |
static null array | $expandedcategories = null |
The expanded category structure if its already being loaded from the cache. | |
Course and category management interface helper class.
This class provides methods useful to the course and category management interfaces. Many of the methods on this class are static and serve one of two purposes.
|
static |
Resort a categories subcategories shifting the given category down one.
core_course_category | $category |
bool |
moodle_exception |
|
static |
Resort a categories subcategories shifting the given category down one.
int | $categoryid |
bool |
|
static |
Resort a categories subcategories shifting the given category up one.
core_course_category | $category |
bool |
moodle_exception |
|
static |
Resort a categories subcategories shifting the given category up one.
int | $categoryid |
bool |
|
static |
Makes a category hidden given a core_course_category object.
core_course_category | $category |
bool |
moodle_exception |
|
static |
Makes a category hidden given a course category id or database record.
int | stdClass | $categoryid |
bool |
|
static |
Moves courses out of one category and into a new category.
core_course_category | $oldcategory | The category we are moving courses out of. |
core_course_category | $newcategory | The category we are moving courses into. |
array | $courseids | The ID's of the courses we want to move. |
bool | True on success. |
moodle_exception |
|
static |
Resorts the courses within the given category.
core_course_category | $category | |
string | $sort | One of fullname, shortname or idnumber |
bool | $cleanup | If true cleanup will be done, if false you will need to do it manually later. |
bool |
moodle_exception |
|
static |
Resorts the sub categories of the given category.
core_course_category | $category | |
string | $sort | One of idnumber or name. |
bool | $cleanup | If true cleanup will be done, if false you will need to do it manually later. |
bool |
moodle_exception |
|
static |
Makes a category visible given a core_course_category object.
core_course_category | $category |
bool |
moodle_exception |
|
static |
Makes a category visible given a course category id or database record.
int | stdClass | $categoryid |
bool |
|
static |
Changes the sort order so that the first course appears after the second course.
int | stdClass | $courserecordorid | |
int | $moveaftercourseid |
bool |
moodle_exception |
|
static |
Resorts the courses within a category moving the given course down by one.
core_course_list_element | $course | |
core_course_category | $category |
bool |
moodle_exception |
|
static |
Resorts the courses within a category moving the given course down by one.
$DB
int | stdClass | $courserecordorid |
bool |
|
static |
Resorts the courses within a category moving the given course up by one.
core_course_list_element | $course | |
core_course_category | $category |
bool |
moodle_exception |
|
static |
Resorts the courses within a category moving the given course up by one.
$DB
int | stdClass | $courserecordorid |
bool |
|
static |
Makes a course hidden given a core_course_list_element object.
core_course_list_element | $course |
bool |
moodle_exception |
|
static |
Makes a course hidden given a course id or a database record.
$DB
int | stdClass | $courserecordorid |
bool |
|
static |
Makes a course visible given a core_course_list_element object.
core_course_list_element | $course |
bool |
moodle_exception |
|
static |
Makes a course visible given a course id or a database record.
$DB
int | stdClass | $courserecordorid |
bool |
|
static |
Returns an array of all categoryids that have the given category as a parent and their visible value.
int | $categoryid |
array |
|
static |
Returns an array of courseids and visiblity for all courses within the given category.
int | $categoryid |
array |
|
static |
Returns an array of actions that can be performed upon a category being shown in a list.
core_course_category | $category |
array |
|
static |
Returns an array of actions that can be performed on the course being displayed.
core_course_list_element | $course |
array |
|
static |
Returns course details in an array ready to be printed.
$DB
core_course_list_element | $course |
array |
|
static |
Returns an array of actions for a course listitem.
core_course_category | $category | |
core_course_list_element | $course |
array |
|
static |
Returns the categories that should be expanded when displaying the interface.
int | null | $withpath | If specified a path to require as the parent. |
core_course_category[] | An array of Category ID's to expand. |
|
static |
Returns the view modes for the management interface.
array |
|
static |
Moves one or more courses out of the category they are currently in and into a new category.
This function works much the same way as action_category_move_courses_into however it allows courses from multiple categories to be moved into a single category.
int | core_course_category | $categoryorid | The category to move them into. |
array | int | $courseids | An array of course id's or optionally just a single course id. |
bool | True on success or false on failure. |
moodle_exception |
|
static |
Records when a category is expanded or collapsed so that when the user.
core_course_category | $coursecat | The category we're working with. |
bool | $expanded | True if the category is expanded now. |
|
static |
Search for courses with matching params.
Please note that only one of search, blocklist, or modulelist can be specified at a time. Specifying more than one will result in only the first being used.
string | $search | Words to search for. We search fullname, shortname, idnumber and summary. |
int | $blocklist | The ID of a block, courses will only be returned if they use this block. |
string | $modulelist | The name of a module (relates to database table name). Only courses containing this module will be returned. |
int | $page | The page number to display, starting at 0. |
int | $perpage | The number of courses to display per page. |
array |