"MDL-19118, fixed comments api in format_text function"
This commit is contained in:
@@ -24,6 +24,12 @@ require_once($CFG->dirroot . '/comment/lib.php');
|
||||
$contextid = optional_param('contextid', SYSCONTEXTID, PARAM_INT);
|
||||
list($context, $course, $cm) = get_context_info_array($contextid);
|
||||
|
||||
if (!empty($course)) {
|
||||
$PAGE->set_course($course);
|
||||
} else {
|
||||
$PAGE->set_course($SITE);
|
||||
}
|
||||
|
||||
require_login($course, true, $cm);
|
||||
|
||||
$err = new stdclass;
|
||||
@@ -54,7 +60,9 @@ $page = optional_param('page', 0, PARAM_INT);
|
||||
if (!empty($client_id)) {
|
||||
$cmt = new stdclass;
|
||||
$cmt->contextid = $contextid;
|
||||
$cmt->courseid = $course->id;
|
||||
if (!empty($course)) {
|
||||
$cmt->courseid = $course->id;
|
||||
}
|
||||
$cmt->area = $area;
|
||||
$cmt->itemid = $itemid;
|
||||
$cmt->client_id = $client_id;
|
||||
|
||||
+1
-1
@@ -117,7 +117,7 @@ class comment {
|
||||
if (!empty($options->env)) {
|
||||
$this->env = $options->env;
|
||||
} else {
|
||||
$this->env = 'embedded';
|
||||
$this->env = '';
|
||||
}
|
||||
|
||||
if (!empty($options->linktext)) {
|
||||
|
||||
+1
-1
@@ -949,7 +949,7 @@ function format_text($text, $format=FORMAT_MOODLE, $options=NULL, $courseid=NULL
|
||||
return ''; // no need to do any filters and cleaning
|
||||
}
|
||||
if (!empty($options->comments) && !empty($CFG->usecomments)) {
|
||||
require_once($CFG->libdir . '/commentlib.php');
|
||||
require_once($CFG->dirroot . '/comment/lib.php');
|
||||
$comment = new comment($options->comments);
|
||||
$cmt = $comment->output(true);
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user