Search moodle.org's
Developer Documentation

See Release Notes
Long Term Support Release

  • Bug fixes for general core bugs in 4.1.x will end 13 November 2023 (12 months).
  • Bug fixes for security issues in 4.1.x will end 10 November 2025 (36 months).
  • PHP version: minimum PHP 7.4.0 Note: minimum PHP version has increased since Moodle 4.0. PHP 8.0.x is supported too.

Differences Between: [Versions 310 and 401] [Versions 39 and 401] [Versions 401 and 402] [Versions 401 and 403]

Functions and classes for comments management

Copyright: 2010 Dongsheng Cai {@link http://dongsheng.org}
License: http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
File Size: 269 lines (10 kb)
Included or required:0 times
Referenced: 3 times
Includes or requires: 0 files

Defines 1 class

comment_manager:: (8 methods):
  __construct()
  get_comments()
  setup_course()
  setup_plugin()
  print_comments()
  delete_comment()
  delete_comments()
  get_component_comments_since()


Class: comment_manager  - X-Ref

comment_manager is helper class to manage moodle comments in admin page (Reports->Comments)

__construct()   X-Ref
Constructs the comment_manage object


get_comments($page)   X-Ref
Return comments by pages

param: int $page
return: array An array of comments

setup_course($courseid)   X-Ref
Records the course object

param: int $courseid

setup_plugin($comment)   X-Ref
Sets up the module or block information for a comment

param: stdClass $comment
return: bool

print_comments($page = 0)   X-Ref
Print comments

param: int $page
return: bool return false if no comments available

delete_comment($commentid)   X-Ref
Delete a comment

param: int $commentid
return: bool

delete_comments($list)   X-Ref
Delete comments

param: string $list A list of comment ids separated by hyphens
return: bool

get_component_comments_since($course, $context, $component, $since, $cm = null)   X-Ref
Get comments created since a given time.

param: stdClass $course    course object
param: stdClass $context   context object
param: string $component   component name
param: int $since          the time to check
param: stdClass $cm        course module object
return: array list of comments db records since the given timelimit