MDL-27857 Export to portfolio support in the assignment module improved
Portfolio API code in the assignment module expected that the current user is the author of the submission. Therefore the "Export to portfolio" button did not work when the submission was viewed by a teacher (eg at the page with the list of all submissions in the Advanced upload assignment). This patch introduces a new callback argument 'submissionid' that holds explicit ID of the submission the export deals with. With it available, we do not need to expect the current user is the author of the submission. The patch also cleans some strings used for portfolio callback exceptions.
This commit is contained in:
@@ -96,7 +96,7 @@ class assignment_files implements renderable {
|
||||
$files = $fs->get_area_files($this->context->id, 'mod_assignment', $filearea, $itemid, "timemodified", false);
|
||||
if (count($files) >= 1 && has_capability('mod/assignment:exportownsubmission', $this->context)) {
|
||||
$button = new portfolio_add_button();
|
||||
$button->set_callback_options('assignment_portfolio_caller', array('id' => $this->cm->id), '/mod/assignment/locallib.php');
|
||||
$button->set_callback_options('assignment_portfolio_caller', array('id' => $this->cm->id, 'submissionid' => $itemid), '/mod/assignment/locallib.php');
|
||||
$button->reset_formats();
|
||||
$this->portfolioform = $button->to_html(PORTFOLIO_ADD_TEXT_LINK);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user