Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 3.11.x will end 14 Nov 2022 (12 months plus 6 months extension).
  • Bug fixes for security issues in 3.11.x will end 13 Nov 2023 (18 months plus 12 months extension).
  • PHP version: minimum PHP 7.3.0 Note: minimum PHP version has increased since Moodle 3.10. PHP 7.4.x is supported too.

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

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