MDL-71642 qbank_comment: Add question comment plugin to core
This implementation will introduce a qbank plugin "comment" which will allow users with the capability to comment in a question. It also implements a callback for the question preview page to view and add comments from the preview page. Comment plugin is implemented using the existing comments API from the core. Co-Authored-By: Guillermo Gomez Arias <[email protected]> Co-Authored-By: Safat Shahin <[email protected]> Co-Authored-By: Matt Porritt <[email protected]>
This commit is contained in:
committed by
Safat Shahin
co-authored by
Safat Shahin
Matt Porritt
parent
70073fdc74
commit
3be2b123e5
+6
-1
@@ -387,6 +387,9 @@ function question_delete_question($questionid) {
|
||||
}
|
||||
}
|
||||
|
||||
// Delete question comments.
|
||||
$DB->delete_records('comments', ['itemid' => $questionid, 'component' => 'qbank_comment',
|
||||
'commentarea' => 'question']);
|
||||
// Finally delete the question record itself
|
||||
$DB->delete_records('question', array('id' => $questionid));
|
||||
question_bank::notify_question_edited($questionid);
|
||||
@@ -1569,7 +1572,7 @@ function question_has_capability_on($questionorid, $cap, $notused = -1) {
|
||||
|
||||
// These are existing questions capabilities that are set per category.
|
||||
// Each of these has a 'mine' and 'all' version that is appended to the capability name.
|
||||
$capabilitieswithallandmine = ['edit' => 1, 'view' => 1, 'use' => 1, 'move' => 1, 'tag' => 1];
|
||||
$capabilitieswithallandmine = ['edit' => 1, 'view' => 1, 'use' => 1, 'move' => 1, 'tag' => 1, 'comment' => 1];
|
||||
|
||||
if (!isset($capabilitieswithallandmine[$cap])) {
|
||||
return has_capability('moodle/question:' . $cap, $context);
|
||||
@@ -1742,6 +1745,8 @@ function question_get_question_capabilities() {
|
||||
'moodle/question:moveall',
|
||||
'moodle/question:tagmine',
|
||||
'moodle/question:tagall',
|
||||
'moodle/question:commentmine',
|
||||
'moodle/question:commentall',
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user