Moodle APIs 3.9
Moodle 3.9.13+ (Build: 20220325)
Files | Namespaces | Classes | Functions | Variables
core_notes

Files

file  externallib.php
 External notes API.
 
file  lib.php
 Library of functions and constants for notes.
 
file  lib.php
 core_notes data generator.
 
file  provider.php
 Privacy Subsystem implementation for core_notes.
 

Namespaces

namespace  core_notes\privacy
  
 

Classes

class  core_notes\privacy\provider
 Implementation of the privacy subsystem plugin provider for core_notes. More...
 
class  core_notes_external
 
class  core_notes_generator
 

Functions

 core_notes_myprofile_navigation (core_user\output\myprofile\tree $tree, $user, $iscurrentuser, $course)
 Add nodes to myprofile page. More...
 
 note_delete ($note)
 Deletes a note object based on its id. More...
 
 note_delete_all ($courseid)
 Delete all notes about users in course-. More...
 
 note_get_state_name ($state)
 Converts a state value to its corespondent name. More...
 
 note_get_state_names ()
 Returns an array of mappings from state values to state names. More...
 
 note_list ($courseid=0, $userid=0, $state='', $author=0, $order='lastmodified DESC', $limitfrom=0, $limitnum=0)
 Retrieves a list of note objects with specific atributes. More...
 
 note_load ($noteid)
 Retrieves a note object based on its id. More...
 
 note_page_type_list ($pagetype, $parentcontext, $currentcontext)
 Return a list of page types. More...
 
 note_print ($note, $detail=NOTES_SHOW_FULL)
 Prints a note object. More...
 
 note_print_list ($notes, $detail=NOTES_SHOW_FULL)
 Prints a list of note objects. More...
 
 note_print_notes ($header, $addcourseid=0, $viewnotes=true, $courseid=0, $userid=0, $state='', $author=0)
 Retrieves and prints a list of note objects with specific atributes. More...
 
 note_save (&$note)
 Saves a note object. More...
 
 note_view ($context, $userid)
 Trigger notes viewed event. More...
 

Variables

global core_notes\privacy::$CFG
 
const NOTES_SHOW_BODY 0x01
 
const NOTES_SHOW_FOOT 0x04
 
const NOTES_SHOW_FULL 0x07
 Constants for note parts (flags used by note_print and note_print_list).
 
const NOTES_SHOW_HEAD 0x02
 
const NOTES_STATE_DRAFT 'draft'
 Constants for states.
 
const NOTES_STATE_PUBLIC 'public'
 
const NOTES_STATE_SITE 'site'
 

Detailed Description

Function Documentation

◆ core_notes_myprofile_navigation()

core_notes_myprofile_navigation ( core_user\output\myprofile\tree  $tree,
  $user,
  $iscurrentuser,
  $course 
)

Add nodes to myprofile page.

Parameters
core_user::output::myprofile::tree$treeTree object
stdClass$useruser object
bool$iscurrentuser
stdClass$courseCourse object
Return values
bool

◆ note_delete()

note_delete (   $note)

Deletes a note object based on its id.

Parameters
int | object$noteid of the note to delete, or a note object which is to be deleted.
Return values
booleantrue always

◆ note_delete_all()

note_delete_all (   $courseid)

Delete all notes about users in course-.

Parameters
int$courseid
Return values
boolsuccess

◆ note_get_state_name()

note_get_state_name (   $state)

Converts a state value to its corespondent name.

Parameters
string$statestate value to convert
Return values
stringcorespondent state name

◆ note_get_state_names()

note_get_state_names ( )

Returns an array of mappings from state values to state names.

Return values
arrayof mappings

◆ note_list()

note_list (   $courseid = 0,
  $userid = 0,
  $state = '',
  $author = 0,
  $order = 'lastmodified DESC',
  $limitfrom = 0,
  $limitnum = 0 
)

Retrieves a list of note objects with specific atributes.

Parameters
int$courseidid of the course in which the notes were posted (0 means any)
int$useridid of the user to which the notes refer (0 means any)
string$statestate of the notes (i.e. draft, public, site) ('' means any)
int$authorid of the user who modified the note last time (0 means any)
string$orderan order to sort the results in
int$limitfromnumber of records to skip (offset)
int$limitnumnumber of records to fetch
Return values
arrayof note objects

◆ note_load()

note_load (   $noteid)

Retrieves a note object based on its id.

Parameters
int$noteidID of the note to retrieve
Return values
stdClassobject

◆ note_page_type_list()

note_page_type_list (   $pagetype,
  $parentcontext,
  $currentcontext 
)

Return a list of page types.

Parameters
string$pagetypecurrent page type
stdClass$parentcontextBlock's parent context
stdClass$currentcontextCurrent context of block

◆ note_print()

note_print (   $note,
  $detail = NOTES_SHOW_FULL 
)

Prints a note object.

Parameters
note$notethe note object to print
int$detailOR-ed NOTES_SHOW_xyz flags that specify which note parts to print

◆ note_print_list()

note_print_list (   $notes,
  $detail = NOTES_SHOW_FULL 
)

Prints a list of note objects.

Parameters
array$notesarray of note objects to print
int$detailOR-ed NOTES_SHOW_xyz flags that specify which note parts to print

◆ note_print_notes()

note_print_notes (   $header,
  $addcourseid = 0,
  $viewnotes = true,
  $courseid = 0,
  $userid = 0,
  $state = '',
  $author = 0 
)

Retrieves and prints a list of note objects with specific atributes.

Parameters
string$headerHTML to print above the list
int$addcourseidid of the course for the add notes link (0 hide link)
boolean$viewnotestrue if the notes should be printed; false otherwise (print notesnotvisible string)
int$courseidid of the course in which the notes were posted (0 means any)
int$useridid of the user to which the notes refer (0 means any)
string$statestate of the notes (i.e. draft, public, site) ('' means any)
int$authorid of the user who modified the note last time (0 means any)

◆ note_save()

note_save ( $note)

Saves a note object.

The note object is passed by reference and its fields (i.e. id) might change during the save.

Parameters
stdClass$noteobject to save
Return values
booleantrue if the object was saved; false otherwise

◆ note_view()

note_view (   $context,
  $userid 
)

Trigger notes viewed event.

Parameters
stdClass$contextcontext object
int$useriduser id (the user we are viewing the notes)
Since
Moodle 2.9