Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 3.10.x will end 8 November 2021 (12 months).
  • Bug fixes for security issues in 3.10.x will end 9 May 2022 (18 months).
  • PHP version: minimum PHP 7.2.0 Note: minimum PHP version has increased since Moodle 3.8. PHP 7.3.x and 7.4.x are supported too.
/notes/ -> lib.php (source)

Library of functions and constants for notes

Copyright: 2007 onwards Yu Zhang
License: http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
File Size: 416 lines (14 kb)
Included or required: 3 times
Referenced: 6 times
Includes or requires: 0 files

Defines 13 functions


Functions that are not part of a class:

note_list($courseid=0, $userid=0, $state = '', $author = 0, $order='lastmodified DESC', $limitfrom=0, $limitnum=0)   X-Ref
Retrieves a list of note objects with specific atributes.

param: int    $courseid id of the course in which the notes were posted (0 means any)
param: int    $userid id of the user to which the notes refer (0 means any)
param: string $state state of the notes (i.e. draft, public, site) ('' means any)
param: int    $author id of the user who modified the note last time (0 means any)
param: string $order an order to sort the results in
param: int    $limitfrom number of records to skip (offset)
param: int    $limitnum number of records to fetch
return: array of note objects

note_load($noteid)   X-Ref
Retrieves a note object based on its id.

param: int $noteid ID of the note to retrieve
return: stdClass object

note_save(&$note)   X-Ref
Saves a note object. The note object is passed by reference and its fields (i.e. id)
might change during the save.

param: stdClass   $note object to save
return: boolean true if the object was saved; false otherwise

note_delete($note)   X-Ref
Deletes a note object based on its id.

param: int|object    $note id of the note to delete, or a note object which is to be deleted.
return: boolean true always

note_get_state_name($state)   X-Ref
Converts a state value to its corespondent name

param: string  $state state value to convert
return: string corespondent state name

note_get_state_names()   X-Ref
Returns an array of mappings from state values to state names

return: array of mappings

note_print($note, $detail = NOTES_SHOW_FULL)   X-Ref
Prints a note object

param: note  $note the note object to print
param: int   $detail OR-ed NOTES_SHOW_xyz flags that specify which note parts to print

note_print_list($notes, $detail = NOTES_SHOW_FULL)   X-Ref
Prints a list of note objects

param: array  $notes array of note objects to print
param: int   $detail OR-ed NOTES_SHOW_xyz flags that specify which note parts to print

note_print_notes($header, $addcourseid = 0, $viewnotes = true, $courseid = 0, $userid = 0, $state = '', $author = 0)   X-Ref
Retrieves and prints a list of note objects with specific atributes.

param: string  $header HTML to print above the list
param: int     $addcourseid id of the course for the add notes link (0 hide link)
param: boolean $viewnotes true if the notes should be printed; false otherwise (print notesnotvisible string)
param: int     $courseid id of the course in which the notes were posted (0 means any)
param: int     $userid id of the user to which the notes refer (0 means any)
param: string  $state state of the notes (i.e. draft, public, site) ('' means any)
param: int     $author id of the user who modified the note last time (0 means any)

note_delete_all($courseid)   X-Ref
Delete all notes about users in course-

param: int $courseid
return: bool success

note_page_type_list($pagetype, $parentcontext, $currentcontext)   X-Ref
Return a list of page types

param: string $pagetype current page type
param: stdClass $parentcontext Block's parent context
param: stdClass $currentcontext Current context of block

note_view($context, $userid)   X-Ref
Trigger notes viewed event

param: stdClass $context context object
param: int $userid  user id (the user we are viewing the notes)

core_notes_myprofile_navigation(core_user\output\myprofile\tree $tree, $user, $iscurrentuser, $course)   X-Ref
Add nodes to myprofile page.

param: \core_user\output\myprofile\tree $tree Tree object
param: stdClass $user user object
param: bool $iscurrentuser
param: stdClass $course Course object
return: bool