mirror of
https://github.com/moodle/moodle.git
synced 2025-04-21 16:32:18 +02:00
MDL-61407 question: Allow formatters to ignore caps
This commit is contained in:
parent
04507546ec
commit
cc98914e85
@ -2073,7 +2073,7 @@ function question_pluginfile($course, $context, $component, $filearea, $args, $f
|
||||
}
|
||||
|
||||
// export data to moodle file pool
|
||||
if (!$content = $qformat->exportprocess(true)) {
|
||||
if (!$content = $qformat->exportprocess()) {
|
||||
send_file_not_found();
|
||||
}
|
||||
|
||||
|
@ -793,11 +793,13 @@ class qformat_default {
|
||||
}
|
||||
|
||||
/**
|
||||
* Do the export
|
||||
* For most types this should not need to be overrided
|
||||
* @return stored_file
|
||||
* Perform the export.
|
||||
* For most types this should not need to be overrided.
|
||||
*
|
||||
* @param bool $checkcapabilities Whether to check capabilities when exporting the questions.
|
||||
* @return string The content of the export.
|
||||
*/
|
||||
public function exportprocess() {
|
||||
public function exportprocess($checkcapabilities = true) {
|
||||
global $CFG, $OUTPUT, $DB, $USER;
|
||||
|
||||
// get the questions (from database) in this category
|
||||
@ -857,7 +859,7 @@ class qformat_default {
|
||||
// export the question displaying message
|
||||
$count++;
|
||||
|
||||
if (question_has_capability_on($question, 'view')) {
|
||||
if (!$checkcapabilities || question_has_capability_on($question, 'view')) {
|
||||
$expout .= $this->writequestion($question, $contextid) . "\n";
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,11 @@
|
||||
This files describes API changes for code that uses the question API.
|
||||
|
||||
=== 3.5 ===
|
||||
|
||||
1) The question format exportprocess function now adds a
|
||||
$checkcapabilities boolean to allow questions to be exported in
|
||||
certain circumstances.
|
||||
|
||||
=== 3.2 ===
|
||||
|
||||
1) The following renderers have been deprecated in favour of the renderable
|
||||
|
Loading…
x
Reference in New Issue
Block a user