MDL-76582 question: Allow response filearea to have different pattern
This commit is contained in:
@@ -248,6 +248,7 @@ class question_attempt_step {
|
||||
* type question_attempt::PARAM_FILES.
|
||||
*
|
||||
* @param string $name the name of the associated variable.
|
||||
* @param int $contextid contextid of the question attempt
|
||||
* @return array of {@link stored_files}.
|
||||
*/
|
||||
public function get_qt_files($name, $contextid) {
|
||||
@@ -261,8 +262,9 @@ class question_attempt_step {
|
||||
}
|
||||
|
||||
$fs = get_file_storage();
|
||||
$filearea = question_file_saver::clean_file_area_name('response_' . $name);
|
||||
$this->files[$name] = $fs->get_area_files($contextid, 'question',
|
||||
'response_' . $name, $this->id, 'sortorder', false);
|
||||
$filearea, $this->id, 'sortorder', false);
|
||||
|
||||
return $this->files[$name];
|
||||
}
|
||||
@@ -287,13 +289,14 @@ class question_attempt_step {
|
||||
*
|
||||
* @param string $name the variable name the files belong to.
|
||||
* @param int $contextid the id of the context the quba belongs to.
|
||||
* @param string $text the text to update the URLs in.
|
||||
* @param string|null $text the text to update the URLs in.
|
||||
* @return array(int, string) the draft itemid and the text with URLs rewritten.
|
||||
*/
|
||||
public function prepare_response_files_draft_itemid_with_text($name, $contextid, $text) {
|
||||
$filearea = question_file_saver::clean_file_area_name('response_' . $name);
|
||||
$draftid = 0; // Will be filled in by file_prepare_draft_area.
|
||||
$newtext = file_prepare_draft_area($draftid, $contextid, 'question',
|
||||
'response_' . $name, $this->id, null, $text);
|
||||
$filearea, $this->id, null, $text);
|
||||
return array($draftid, $newtext);
|
||||
}
|
||||
|
||||
@@ -306,12 +309,13 @@ class question_attempt_step {
|
||||
* @param string $text the text to update the URLs in.
|
||||
* @param int $contextid the id of the context the quba belongs to.
|
||||
* @param string $name the variable name the files belong to.
|
||||
* @param array $extra extra file path components.
|
||||
* @param array $extras extra file path components.
|
||||
* @return string the rewritten text.
|
||||
*/
|
||||
public function rewrite_response_pluginfile_urls($text, $contextid, $name, $extras) {
|
||||
$filearea = question_file_saver::clean_file_area_name('response_' . $name);
|
||||
return question_rewrite_question_urls($text, 'pluginfile.php', $contextid,
|
||||
'question', 'response_' . $name, $extras, $this->id);
|
||||
'question', $filearea, $extras, $this->id);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user