Note:

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

NEWMODULE Reference: Difference between revisions

From MoodleDocs
No edit summary
 
(26 intermediate revisions by 3 users not shown)
Line 1: Line 1:
[[NEWMODULE Documentation|NEWMODULE Documentation]] > Reference
----
{{Template:Work in progress}}
{{Template:Work in progress}}
{{New_Module}}


This is a first draft of the list ot the functions more frequently used into Moodle modules
This is a first draft of the list of functions frequently used in Moodle modules. The number of occurrences of each function in the following list of 20 modules is found in parenthesis: assignment, chat, choice, data, exercise, feedback, forum, glossary, hotpot, journal, label, lams, lesson, questionnaire, quiz, resource, scorm, survey, wiki, workshop.


*add_instance
== newmodule_add_instance (20) ==
*delete_instance
Create a new newmodule activity
*update_instance
 
*get_participants
Given an object containing all the necessary data (defined by the form in mod.html), this function will create a new instance and return the id number of the new instance. The due date is added to the calendar. This is common to all assignment types.
*user_complete
 
*user_outline
== newmodule_delete_instance (20) ==
*get_post_actions
Deletes an assignment activity
*get_view_actions
 
*cron
Deletes all database records, files and calendar events for this newmodule.
*reset_userdata
This is common to all assignment types.
*print_recent_activity
== newmodule_update_instance (20) ==
*reset_course_form_defaults
Updates a new newmodule activity
*reset_course_form_definition
 
*get_user_grades
Given an object containing all the necessary data (defined by the form in mod.html), this function will update the newmodule instance and return the id number. The due date is updated in the calendar. This is common to all assignment types.
*grade_item_delete
 
*grade_item_update
== newmodule_get_participants (19) ==
*grades
Returns the users with data in one newmodule
*update_grades
 
*reset_gradebook
(users with records in ???)
*scale_used
 
*scale_used_anywhere
== newmodule_user_complete (19) ==
*get_recent_mod_activity
Print complete information about the user's interaction with the newmodule
*log_info
 
*print_overview
== newmodule_user_outline (19) ==
*print_recent_mod_activity
Return an outline of the user's interaction with the assignment.
*refresh_events
 
*file_area
The default method prints the grade and timemodified.
*file_area_name
 
== newmodule_get_post_actions (18) ==
== newmodule_get_view_actions (18) ==
== newmodule_cron (15) ==
== newmodule_reset_userdata (12) ==
This function is used by the reset_course_userdata function in moodlelib.
 
This function will remove all posts from the specified newmodule and clean up any related data.
 
== newmodule_print_recent_activity (11) ==
== newmodule_reset_course_form_defaults (10) ==
== newmodule_reset_course_form_definition (10) ==
Implementation of the function for printing the form elements that control whether the course reset functionality affects the assignment.
 
== newmodule_get_user_grades (8) ==
== newmodule_grade_item_delete (8) ==
== newmodule_grade_item_update (8) ==
== newmodule_grades (8) ==
== newmodule_update_grades (8) ==
== newmodule_reset_gradebook (7) ==
== newmodule_scale_used (7) ==
== newmodule_scale_used_anywhere (6) ==
== newmodule_get_recent_mod_activity (5) ==
== newmodule_log_info (5) ==
== newmodule_print_overview (5) ==
== newmodule_print_recent_mod_activity (5) ==
== newmodule_refresh_events (5) ==
== newmodule_file_area (4) ==
== newmodule_file_area_name (4) ==
 
== newmodule_get_coursemodule_info ==
 
Can be used to customise how the module appears on the course page. The must be static information that only depends on the activity settings, not the currently logged in user, since it is cached. For an example see mod_label.
 
== newmodule_cm_info_view ==
 
This callback lets you customise how the activity is displayed on the course page for the current user. An example is mod_forum which shows the number of unread forum messages for the current user.
 
== newmodule_check_updates_since ==
 
Check if the module has any update that affects the current user since the given time.
 
Please refer to mod/assign/lib.php, mod/forum/lib.php or mod/quiz/lib.php for sample code.

Latest revision as of 12:32, 24 November 2016

Note: This page is a work-in-progress. Feedback and suggested improvements are welcome. Please join the discussion on moodle.org or use the page comments.

This is a first draft of the list of functions frequently used in Moodle modules. The number of occurrences of each function in the following list of 20 modules is found in parenthesis: assignment, chat, choice, data, exercise, feedback, forum, glossary, hotpot, journal, label, lams, lesson, questionnaire, quiz, resource, scorm, survey, wiki, workshop.

newmodule_add_instance (20)

Create a new newmodule activity

Given an object containing all the necessary data (defined by the form in mod.html), this function will create a new instance and return the id number of the new instance. The due date is added to the calendar. This is common to all assignment types.

newmodule_delete_instance (20)

Deletes an assignment activity

Deletes all database records, files and calendar events for this newmodule. This is common to all assignment types.

newmodule_update_instance (20)

Updates a new newmodule activity

Given an object containing all the necessary data (defined by the form in mod.html), this function will update the newmodule instance and return the id number. The due date is updated in the calendar. This is common to all assignment types.

newmodule_get_participants (19)

Returns the users with data in one newmodule

(users with records in ???)

newmodule_user_complete (19)

Print complete information about the user's interaction with the newmodule

newmodule_user_outline (19)

Return an outline of the user's interaction with the assignment.

The default method prints the grade and timemodified.

newmodule_get_post_actions (18)

newmodule_get_view_actions (18)

newmodule_cron (15)

newmodule_reset_userdata (12)

This function is used by the reset_course_userdata function in moodlelib.

This function will remove all posts from the specified newmodule and clean up any related data.

newmodule_print_recent_activity (11)

newmodule_reset_course_form_defaults (10)

newmodule_reset_course_form_definition (10)

Implementation of the function for printing the form elements that control whether the course reset functionality affects the assignment.

newmodule_get_user_grades (8)

newmodule_grade_item_delete (8)

newmodule_grade_item_update (8)

newmodule_grades (8)

newmodule_update_grades (8)

newmodule_reset_gradebook (7)

newmodule_scale_used (7)

newmodule_scale_used_anywhere (6)

newmodule_get_recent_mod_activity (5)

newmodule_log_info (5)

newmodule_print_overview (5)

newmodule_print_recent_mod_activity (5)

newmodule_refresh_events (5)

newmodule_file_area (4)

newmodule_file_area_name (4)

newmodule_get_coursemodule_info

Can be used to customise how the module appears on the course page. The must be static information that only depends on the activity settings, not the currently logged in user, since it is cached. For an example see mod_label.

newmodule_cm_info_view

This callback lets you customise how the activity is displayed on the course page for the current user. An example is mod_forum which shows the number of unread forum messages for the current user.

newmodule_check_updates_since

Check if the module has any update that affects the current user since the given time.

Please refer to mod/assign/lib.php, mod/forum/lib.php or mod/quiz/lib.php for sample code.