Note:

If you want to create a new page for developers, you should create it on the Moodle Developer Resource site.

Libraries Organization: Difference between revisions

From MoodleDocs
(New page: {{Moodle 2.0}} This document has for goal to defined a libraries structure to avoid to end up with a mess of function everywhere into Moodle. For example at this moment, group library func...)
 
No edit summary
Line 1: Line 1:
{{Moodle 2.0}}
{{Moodle 2.0}}
This document has for goal to defined a libraries structure to avoid to end up with a mess of function everywhere into Moodle.
This document has for goal to defined a libraries structure to avoid to end up with a mess of function everywhere into Moodle.
For example at this moment, group library functions can be found in group/lib.php, group/locallib.php and lib/grouplib.php.
 
We suggest that we split library functions into two files, one lib.php that contains all library functions that can be called by external application and one locallib.php that contains all functions that are internal to Moodle core.
 
currently in group/lib.php:<br/>
groups_add_member($grouporid, $userorid)<br/>
groups_remove_member($grouporid, $userorid)<br/>
groups_create_group($data, $editform=false, $editoroptions=null)<br/>
groups_create_grouping($data, $editoroptions=null)<br/>
groups_update_group($data, $editform=false)<br/>
groups_update_grouping($data, $editoroptions=null)<br/>
groups_delete_group($grouporid)<br/>
groups_delete_grouping($groupingorid)<br/>
groups_delete_group_members($courseid, $userid=0, $showfeedback=false)<br/>
groups_delete_groupings_groups($courseid, $showfeedback=false)<br/>
groups_delete_groups($courseid, $showfeedback=false)<br/>
groups_delete_groupings($courseid, $showfeedback=false)<br/>
groups_get_possible_roles($context)<br/>
groups_get_potential_members($courseid, $roleid = null, $orderby = 'lastname,firstname')<br/>
groups_parse_name($format, $groupnumber)<br/>
groups_assign_grouping($groupingid, $groupid)<br/>
groups_unassign_grouping($groupingid, $groupid)<br/>
groups_get_members_by_role($groupid, $courseid, $fields='u.*', $sort='u.lastname ASC', $extrawheretest='', $whereparams=array())<br/>
groups_calculate_role_people($rs, $context)<br/>
 
currently in lib/grouplib.php:<br/>
groups_group_exists($groupid)<br/>
groups_get_group_name($groupid)<br/>
groups_get_grouping_name($groupingid)<br/>
groups_get_group_by_name($courseid, $name)<br/>
groups_get_grouping_by_name($courseid, $name)<br/>
groups_get_group($groupid, $fields='*', $strictness=IGNORE_MISSING)<br/>
groups_get_grouping($groupingid, $fields='*', $strictness=IGNORE_MISSING)<br/>
groups_get_all_groups($courseid, $userid=0, $groupingid=0, $fields='g.*')<br/>
groups_get_user_groups($courseid, $userid=0)<br/>
groups_get_all_groupings($courseid)<br/>
groups_is_member($groupid, $userid=null)<br/>
groups_has_membership($cm, $userid=null)<br/>
groups_get_members($groupid, $fields='u.*', $sort='lastname ASC')<br/>
groups_get_grouping_members($groupingid, $fields='u.*', $sort='lastname ASC')<br/>
groups_get_course_groupmode($course)<br/>
groups_get_activity_groupmode($cm, $course=null)<br/>
groups_print_course_menu($course, $urlroot, $return=false)<br/>
groups_print_activity_menu($cm, $urlroot, $return=false, $hideallparticipants=false)<br/>
groups_get_course_group($course, $update=false)<br/>
groups_get_activity_group($cm, $update=false)<br/>
groups_get_activity_allowed_groups($cm,$userid=0)<br/>
groups_course_module_visible($cm, $userid=null)<br/>

Revision as of 06:47, 27 January 2010

Moodle 2.0


This document has for goal to defined a libraries structure to avoid to end up with a mess of function everywhere into Moodle.

We suggest that we split library functions into two files, one lib.php that contains all library functions that can be called by external application and one locallib.php that contains all functions that are internal to Moodle core.

currently in group/lib.php:
groups_add_member($grouporid, $userorid)
groups_remove_member($grouporid, $userorid)
groups_create_group($data, $editform=false, $editoroptions=null)
groups_create_grouping($data, $editoroptions=null)
groups_update_group($data, $editform=false)
groups_update_grouping($data, $editoroptions=null)
groups_delete_group($grouporid)
groups_delete_grouping($groupingorid)
groups_delete_group_members($courseid, $userid=0, $showfeedback=false)
groups_delete_groupings_groups($courseid, $showfeedback=false)
groups_delete_groups($courseid, $showfeedback=false)
groups_delete_groupings($courseid, $showfeedback=false)
groups_get_possible_roles($context)
groups_get_potential_members($courseid, $roleid = null, $orderby = 'lastname,firstname')
groups_parse_name($format, $groupnumber)
groups_assign_grouping($groupingid, $groupid)
groups_unassign_grouping($groupingid, $groupid)
groups_get_members_by_role($groupid, $courseid, $fields='u.*', $sort='u.lastname ASC', $extrawheretest=, $whereparams=array())
groups_calculate_role_people($rs, $context)

currently in lib/grouplib.php:
groups_group_exists($groupid)
groups_get_group_name($groupid)
groups_get_grouping_name($groupingid)
groups_get_group_by_name($courseid, $name)
groups_get_grouping_by_name($courseid, $name)
groups_get_group($groupid, $fields='*', $strictness=IGNORE_MISSING)
groups_get_grouping($groupingid, $fields='*', $strictness=IGNORE_MISSING)
groups_get_all_groups($courseid, $userid=0, $groupingid=0, $fields='g.*')
groups_get_user_groups($courseid, $userid=0)
groups_get_all_groupings($courseid)
groups_is_member($groupid, $userid=null)
groups_has_membership($cm, $userid=null)
groups_get_members($groupid, $fields='u.*', $sort='lastname ASC')
groups_get_grouping_members($groupingid, $fields='u.*', $sort='lastname ASC')
groups_get_course_groupmode($course)
groups_get_activity_groupmode($cm, $course=null)
groups_print_course_menu($course, $urlroot, $return=false)
groups_print_activity_menu($cm, $urlroot, $return=false, $hideallparticipants=false)
groups_get_course_group($course, $update=false)
groups_get_activity_group($cm, $update=false)
groups_get_activity_allowed_groups($cm,$userid=0)
groups_course_module_visible($cm, $userid=null)