$output .= '<a href="'.$path.'" ><img src="'.$CFG->pixpath.'/f/'.$icon.'" class="icon" alt="'.$icon.'" />'.s($filename).'</a>';
if ($this->portfolio_exportable() && has_capability('mod/assignment:exportownsubmission', $this->context)) {
$p['file'] = $file->get_id();
- $output .= portfolio_add_button('assignment_portfolio_caller', $p, null, PORTFOLIO_ADD_ICON_LINK, null, true);
+ $formats = array(portfolio_format_from_file($file));
+ $output .= portfolio_add_button('assignment_portfolio_caller', $p, null, PORTFOLIO_ADD_ICON_LINK, null, true, $formats);
}
$output .= '<br />';
}
if (!$this->assignment->portfolio_exportable()) {
throw new portfolio_caller_exception('notexportable', 'portfolio', $this->get_return_url());
}
+ $fs = get_file_storage();
if (array_key_exists('file', $callbackargs)) {
$this->file = $fs->get_file_by_id($callbackargs['file']);
$this->files = array($this->file);
$this->supportedformats = array(portfolio_format_from_file($this->file));
} else {
- $fs = get_file_storage();
$this->files = $fs->get_area_files($this->assignment->context->id, 'assignment_submission', $this->user->id, '', false);
}
if (empty($this->supportedformats) && is_callable(array($this->assignment, 'portfolio_supported_formats'))) {
if (has_capability('mod/assignment:exportownsubmission', $this->context)) {
$p['file'] = $file->get_id();
- $output .= portfolio_add_button('assignment_portfolio_caller', $p, '/mod/assignment/lib.php', PORTFOLIO_ADD_ICON_LINK, null, true);
+ $formats = array(portfolio_format_from_file($file));
+ $output .= portfolio_add_button('assignment_portfolio_caller', $p, '/mod/assignment/lib.php', PORTFOLIO_ADD_ICON_LINK, null, true, $formats);
}
$output .= '<br />';
}