* Returns html code for displaying "Download" button if applicable.
*/
public function download_buttons() {
- if ($this->is_downloadable() && !$this->is_downloading()) {
+ global $OUTPUT;
- $elementid = $this->uniqueid . '_download';
- $html = '<div class="mdl-align">';
- $html .= '<form action="'. $this->baseurl .'" method="post" class="form-inline">';
- if ($courseid = $this->feedbackstructure->get_courseid()) {
- $html .= '<input type="hidden" name="courseid" value="' . s($courseid) . '">';
- }
- $html .= html_writer::tag('label', get_string('downloadresponseas', 'feedback'),
- ['for' => $elementid]);
- $html .= html_writer::select($this->get_download_menu(),
- $this->downloadparamname, $this->defaultdownloadformat, false, ['id' => $elementid]);
- $html .= html_writer::empty_tag('input', ['type' => 'submit', 'value' => get_string('download')]);
- $html .= '</form></div>';
-
- return $html;
+ if ($this->is_downloadable() && !$this->is_downloading()) {
+ return $OUTPUT->download_dataformat_selector(get_string('downloadas', 'table'),
+ $this->baseurl->out_omit_querystring(), $this->downloadparamname, $this->baseurl->params());
} else {
return '';
}
}
// Part 2. Update courseid in the completed table.
- $sql = "UPDATE {feedback_completed$suffix} c "
+ $sql = "UPDATE {feedback_completed$suffix} "
. "SET courseid = (SELECT COALESCE(MIN(v.course_id), 0) "
- . "FROM {feedback_value$suffix} v WHERE v.completed = c.id)";
+ . "FROM {feedback_value$suffix} v "
+ . "WHERE v.completed = {feedback_completed$suffix}.id)";
$DB->execute($sql);
}