|
Moodle
2.2.1
http://www.collinsharper.com
|
Go to the source code of this file.
| enum FIRSTUSEDEXCELROW |
| enum FRONTPAGECOURSELIMIT |
| enum FRONTPAGECOURSELIST |
| enum FRONTPAGENEWS |
| enum FRONTPAGETOPICONLY |
| enum MOD_CLASS_ACTIVITY |
| enum MOD_CLASS_RESOURCE |
| add_course_module | ( | $ | mod | ) |
| add_mod_to_section | ( | $ | mod, |
| $ | beforemod = NULL |
||
| ) |
Given a full mod object with section and course already defined, adds this module to that section.
| object | $mod | |
| int | $beforemod | An existing ID which we will insert the new module before |
Definition at line 2717 of file lib.php.

| build_logs_array | ( | $ | course, |
| $ | user = 0, |
||
| $ | date = 0, |
||
| $ | order = "l.time ASC", |
||
| $ | limitfrom = '', |
||
| $ | limitnum = '', |
||
| $ | modname = "", |
||
| $ | modid = 0, |
||
| $ | modaction = "", |
||
| $ | groupid = 0 |
||
| ) |
Setup for group handling.
If the group mode is separate, and this user does not have editing privileges, then only the user's group can be viewed.
If this course doesn't have groups, no groupid can be specified.
Getting all members of a group.
Definition at line 218 of file lib.php.


| build_mnet_logs_array | ( | $ | hostid, |
| $ | course, | ||
| $ | user = 0, |
||
| $ | date = 0, |
||
| $ | order = "l.time ASC", |
||
| $ | limitfrom = '', |
||
| $ | limitnum = '', |
||
| $ | modname = "", |
||
| $ | modid = 0, |
||
| $ | modaction = "", |
||
| $ | groupid = 0 |
||
| ) |
| can_delete_course | ( | $ | courseid | ) |
| can_edit_in_category | ( | $ | categoryid = 0 | ) |
Does the user have permission to edit things in this category?
| integer | $categoryid | The id of the category we are showing, or 0 for system context. |
Definition at line 2325 of file lib.php.


| category_delete_full | ( | $ | category, |
| $ | showfeedback = true |
||
| ) |
| category_delete_move | ( | $ | category, |
| $ | newparentid, | ||
| $ | showfeedback = true |
||
| ) |
| course_allowed_module | ( | $ | course, |
| $ | mod | ||
| ) |
This function will take an int (module id) or a string (module name) and return true or false, whether it's allowed in the given course (object) $mod is not allowed to be an object, as the field for the module id is inconsistent depending on where in the code it's called from (sometimes $mod->id, sometimes $mod->module)
Definition at line 3329 of file lib.php.


| course_category_hide | ( | $ | category | ) |
| course_category_show | ( | $ | category | ) |
| course_format_ajax_support | ( | $ | format | ) |
Returns the information about the ajax support in the given source format
The returned object's property (boolean)capable indicates that the course format supports Moodle course ajax features. The property (array)testedbrowsers can be used as a parameter for {
| string | $format |
| course_format_name | ( | $ | course, |
| $ | max = 100 |
||
| ) |
| course_format_uses_sections | ( | $ | format | ) |
| course_get_display | ( | $ | courseid | ) |
Returns the course section to display or 0 meaning show all sections. Returns 0 for guests. It also sets the $USER->display cache to array($courseid=>return value)
| int | $courseid | The course id |
Definition at line 1284 of file lib.php.


| course_page_type_list | ( | $ | pagetype, |
| $ | parentcontext, | ||
| $ | currentcontext | ||
| ) |
| course_set_display | ( | $ | courseid, |
| $ | display | ||
| ) |
Show one section only or all sections.
| int | $courseid | The course id |
| mixed | $display | show only this section, 0 or 'all' means show all sections |
Definition at line 1310 of file lib.php.


| create_course | ( | $ | data, |
| $ | editoroptions = NULL |
||
| ) |
Create a course and either return a $course object
Please note this functions does not verify any access control, the calling code is responsible for all validation (usually it is the form definition).
| array | $editoroptions | course description editor options |
| object | $data | - all the data needed for an entry in the 'course' table |
Definition at line 3758 of file lib.php.


| delete_course_module | ( | $ | id | ) |
| delete_mod_from_section | ( | $ | mod, |
| $ | section | ||
| ) |
| get_all_mods | ( | $ | courseid, |
| &$ | mods, | ||
| &$ | modnames, | ||
| &$ | modnamesplural, | ||
| &$ | modnamesused | ||
| ) |
| get_all_sections | ( | $ | courseid | ) |
Returns an array of sections for the requested course id
This function stores the sections against the course id within a staticvar encase of subsequent requests. This is used all over + in some standard libs and course format callbacks so subsequent requests are a reality.
array $coursesections
| int | $courseid |
Definition at line 1267 of file lib.php.

| get_array_of_activities | ( | $ | courseid | ) |
| get_category_or_system_context | ( | $ | categoryid | ) |
Return the course category context for the category with id $categoryid, except that if $categoryid is 0, return the system context.
| integer | $categoryid | a category id or 0. |
Definition at line 1911 of file lib.php.


| get_child_categories | ( | $ | parentid | ) |
Gets the child categories of a given courses category. Uses a static cache to make repeat calls efficient.
| int | $parentid | the id of a course category. |
Definition at line 1926 of file lib.php.


| get_course_category_tree | ( | $ | id = 0, |
| $ | depth = 0 |
||
| ) |
This function generates a structured array of courses and categories.
The depth of categories is limited by $CFG->maxcategorydepth however there is no limit on the number of courses!
Suitable for use with the course renderers course_category_tree method: $renderer = $PAGE->get_renderer('core','course'); echo $renderer->course_category_tree(get_course_category_tree());
moodle_database $DB
| int | $id | |
| int | $depth |
Definition at line 2056 of file lib.php.

| get_course_display_name_for_list | ( | $ | course | ) |
Gets the name of a course to be displayed when showing a list of courses. By default this is just $course->fullname but user can configure it. The result of this function should be passed through print_string.
| object | $course | Moodle course object |
Definition at line 2177 of file lib.php.

| get_course_section | ( | $ | section, |
| $ | courseid | ||
| ) |
| get_generic_section_name | ( | $ | format, |
| stdClass $ | section | ||
| ) |
Gets the generic section name for a courses section.
| string | $format | Course format ID e.g. 'weeks' $course->format |
| stdClass | $section | Section object from database |
Definition at line 3628 of file lib.php.

| get_print_section_cm_text | ( | cm_info $ | cm, |
| $ | course | ||
| ) |
Obtains shared data that is used in print_section when displaying a course-module entry.
Calls format_text or format_string as appropriate, and obtains the correct icon.
This data is also used in other areas of the code.
| cm_info | $cm | Course-module data (must come from get_fast_modinfo) |
| object | $course | Moodle course object |
Definition at line 1376 of file lib.php.


| get_section_name | ( | stdClass $ | course, |
| stdClass $ | section | ||
| ) |
Returns the display name of the given section that the course prefers.
This function utilizes a callback that can be implemented within the course formats lib.php file to customize the display name that is used to reference the section.
By default (if callback is not defined) the method {
| stdClass | $course | The course to get the section name for |
| stdClass | $section | Section object from database |
Inelegant hack for bug 3408
Definition at line 3599 of file lib.php.


| make_categories_list | ( | &$ | list, |
| &$ | parents, | ||
| $ | requiredcapability = '', |
||
| $ | excludeid = 0, |
||
| $ | category = NULL, |
||
| $ | path = "" |
||
| ) |
This function recursively travels the categories, building up a nice list for display. It also makes an array that list all the parents for each category.
For example, if you have a tree of categories like: Miscellaneous (id = 1) Subcategory (id = 2) Sub-subcategory (id = 4) Other category (id = 3) Then after calling this function you will have $list = array(1 => 'Miscellaneous', 2 => 'Miscellaneous / Subcategory', 4 => 'Miscellaneous / Subcategory / Sub-subcategory', 3 => 'Other category'); $parents = array(2 => array(1), 4 => array(1, 2));
If you specify $requiredcapability, then only categories where the current user has that capability will be added to $list, although all categories will still be added to $parents, and if you only have $requiredcapability in a child category, not the parent, then the child catgegory will still be included.
If you specify the option $excluded, then that category, and all its children, are omitted from the tree. This is useful when you are doing something like moving categories, where you do not want to allow people to move a category to be the child of itself.
| array | $list | For output, accumulates an array categoryid => full category path name |
| array | $parents | For output, accumulates an array categoryid => list of parent category ids. |
| string/array | $requiredcapability if given, only categories where the current user has this capability will be added to $list. Can also be an array of capabilities, in which case they are all required. | |
| integer | $excludeid | Omit this category and its children from the lists built. |
| object | $category | Build the tree starting at this category - otherwise starts at the top level. |
| string | $path | For internal use, as part of recursive calls. |
Definition at line 1985 of file lib.php.


This function will return $options array for html_writer::select(), with whitespace to denote nesting.
Definition at line 2156 of file lib.php.


| make_editing_buttons | ( | stdClass $ | mod, |
| $ | absolute_ignored = true, |
||
| $ | moveselect = true, |
||
| $ | indent = -1, |
||
| $ | section = -1 |
||
| ) |
Produces the editing buttons for a module
core_renderer $OUTPUT type $str
| stdClass | $mod | The module to produce editing buttons for |
| bool | $absolute_ignored | ignored - all links are absolute |
| bool | $moveselect | If true a move seleciton process is used (default true) |
| int | $indent | The current indenting |
| int | $section | The section to link back to |
Definition at line 3079 of file lib.php.

| make_log_url | ( | $ | module, |
| $ | url | ||
| ) |
| move_category | ( | $ | category, |
| $ | newparentcat | ||
| ) |
| move_courses | ( | $ | courseids, |
| $ | categoryid | ||
| ) |
| move_section | ( | $ | course, |
| $ | section, | ||
| $ | move | ||
| ) |
| move_section_to | ( | $ | course, |
| $ | section, | ||
| $ | destination | ||
| ) |
Moves a section within a course, from a position to another. Be very careful: $section and $destination refer to section number, not id!.
| object | $course | |
| int | $section | Section number (not id!!!) |
| int | $destination |
Moves a whole course section up and down within the course
Definition at line 2930 of file lib.php.


| moveto_module | ( | $ | mod, |
| $ | section, | ||
| $ | beforemod = NULL |
||
| ) |
Move the module object $mod to the specified $section If $beforemod exists then that is the module before which $modid should be inserted All parameters are objects
Remove original module from original section
Update module itself if necessary
Add the module into the new section
Definition at line 3035 of file lib.php.

| print_category_info | ( | $ | category, |
| $ | depth = 0, |
||
| $ | showcourses = false |
||
| ) |
Prints the category info in indented fashion This function is only used by print_whole_category_list() above
Definition at line 2190 of file lib.php.


| print_course | ( | $ | course, |
| $ | highlightterms = '' |
||
| ) |
Print a description of a course, suitable for browsing in a list.
| object | $course | the course object. |
| string | $highlightterms | (optional) some search terms that should be highlighted in the display. |
first find all roles that are supposed to be displayed
Rename some of the role names if needed
Definition at line 2424 of file lib.php.


| print_course_request_buttons | ( | $ | systemcontext | ) |
| print_course_search | ( | $ | value = "", |
| $ | return = false, |
||
| $ | format = "plain" |
||
| ) |
| print_courses | ( | $ | category | ) |
| print_log | ( | $ | course, |
| $ | user = 0, |
||
| $ | date = 0, |
||
| $ | order = "l.time ASC", |
||
| $ | page = 0, |
||
| $ | perpage = 100, |
||
| $ | url = "", |
||
| $ | modname = "", |
||
| $ | modid = 0, |
||
| $ | modaction = "", |
||
| $ | groupid = 0 |
||
| ) |
| print_log_csv | ( | $ | course, |
| $ | user, | ||
| $ | date, | ||
| $ | order = 'l.time DESC', |
||
| $ | modname, | ||
| $ | modid, | ||
| $ | modaction, | ||
| $ | groupid | ||
| ) |
| print_log_ods | ( | $ | course, |
| $ | user, | ||
| $ | date, | ||
| $ | order = 'l.time DESC', |
||
| $ | modname, | ||
| $ | modid, | ||
| $ | modaction, | ||
| $ | groupid | ||
| ) |
| print_log_xls | ( | $ | course, |
| $ | user, | ||
| $ | date, | ||
| $ | order = 'l.time DESC', |
||
| $ | modname, | ||
| $ | modid, | ||
| $ | modaction, | ||
| $ | groupid | ||
| ) |
| print_mnet_log | ( | $ | hostid, |
| $ | course, | ||
| $ | user = 0, |
||
| $ | date = 0, |
||
| $ | order = "l.time ASC", |
||
| $ | page = 0, |
||
| $ | perpage = 100, |
||
| $ | url = "", |
||
| $ | modname = "", |
||
| $ | modid = 0, |
||
| $ | modaction = "", |
||
| $ | groupid = 0 |
||
| ) |
| print_my_moodle | ( | ) |
| print_overview | ( | $ | courses, |
| array $ | remote_courses = array() |
||
| ) |
| print_recent_activity | ( | $ | course | ) |
This function trawls through the logs looking for anything new since the user's last login
Firstly, have there been any new enrolments?
Next, have there been any modifications to the course structure?
Now display new things from each module
Definition at line 888 of file lib.php.


| print_remote_course | ( | $ | course, |
| $ | width = "100%" |
||
| ) |
| print_remote_host | ( | $ | host, |
| $ | width = "100%" |
||
| ) |
| print_section_add_menus | ( | $ | course, |
| $ | section, | ||
| $ | modnames, | ||
| $ | vertical = false, |
||
| $ | return = false |
||
| ) |
| print_whole_category_list | ( | $ | category = NULL, |
| $ | displaylist = NULL, |
||
| $ | parentslist = NULL, |
||
| $ | depth = -1, |
||
| $ | showcourses = true |
||
| ) |
| reorder_sections | ( | $ | sections, |
| $ | origin_position, | ||
| $ | target_position | ||
| ) |
Reordering algorithm for course sections. Given an array of section->section indexed by section->id, an original position number and a target position number, rebuilds the array so that the move is made without any duplication of section positions. Note: The target_position is the position AFTER WHICH the moved section will be inserted. If you want to insert a section before the first one, you must give 0 as the target (section 0 can never be moved).
| array | $sections | |
| int | $origin_position | |
| int | $target_position |
Definition at line 2974 of file lib.php.

| save_local_role_names | ( | $ | courseid, |
| $ | data | ||
| ) |
| set_coursemodule_groupmode | ( | $ | id, |
| $ | groupmode | ||
| ) |
| set_coursemodule_idnumber | ( | $ | id, |
| $ | idnumber | ||
| ) |
| set_coursemodule_visible | ( | $ | id, |
| $ | visible, | ||
| $ | prevstateoverrides = false |
||
| ) |
$prevstateoverrides = true will set the visibility of the course module to what is defined in visibleold. This enables us to remember the current visibility when making a whole section hidden, so that when we toggle that section back to visible, we are able to return the visibility of the course module back to what it was originally.
Definition at line 2773 of file lib.php.


| set_section_visible | ( | $ | courseid, |
| $ | sectionnumber, | ||
| $ | visibility | ||
| ) |
| update_category_button | ( | $ | categoryid = 0 | ) |
Prints the turn editing on/off button on course/index.php or course/category.php.
| integer | $categoryid | The id of the category we are showing, or 0 for system context. |
Definition at line 2337 of file lib.php.

| update_course | ( | $ | data, |
| $ | editoroptions = NULL |
||
| ) |
Update a course.
Please note this functions does not verify any access control, the calling code is responsible for all validation (usually it is the form definition).
| object | $data | - all the data needed for an entry in the 'course' table |
| array | $editoroptions | course description editor options |
Definition at line 3857 of file lib.php.

| update_restricted_mods | ( | $ | course, |
| $ | mods | ||
| ) |