Skip to content

Commit

Permalink
mod-assignment MDL-21106 Changed itemid for online assignment from as…
Browse files Browse the repository at this point in the history
…signment->id to user->id
  • Loading branch information
Sam Hemelryk committed Dec 16, 2009
1 parent a6ffb8e commit fb1ee4d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
9 changes: 5 additions & 4 deletions mod/assignment/type/online/assignment.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ function view() {

/// prepare form and process submitted data
$mformdata = new stdClass;
$mformdata->assignmentid = $this->assignment->id;
$mformdata->context = $this->context;
$mformdata->maxbytes = $this->course->maxbytes;
$mform = new mod_assignment_online_edit_form(null, $mformdata);
Expand Down Expand Up @@ -106,7 +105,7 @@ function view() {
} else {
echo $OUTPUT->box_start('generalbox boxwidthwide boxaligncenter', 'online');
if ($submission && has_capability('mod/assignment:exportownsubmission', $this->context)) {
$text = file_rewrite_pluginfile_urls($submission->data1, 'pluginfile.php', $this->context->id, 'assignment_online_submission', $this->assignment->id);
$text = file_rewrite_pluginfile_urls($submission->data1, 'pluginfile.php', $this->context->id, 'assignment_online_submission', $USER->id);
echo format_text($text, $submission->data2);
$button = new portfolio_add_button();
$button->set_callback_options('assignment_portfolio_caller', array('id' => $this->cm->id), '/mod/assignment/locallib.php');
Expand Down Expand Up @@ -360,6 +359,7 @@ public function send_file($filearea, $args) {
class mod_assignment_online_edit_form extends moodleform {

public function set_data($data) {
global $USER;
$editoroptions = $this->get_editor_options();
if (!isset($data->text)) {
$data->text = '';
Expand All @@ -369,15 +369,16 @@ public function set_data($data) {
} else {
$data->textformat = $data->format;
}
$data = file_prepare_standard_editor($data, 'text', $editoroptions, $this->_customdata->context, $editoroptions['filearea'], $this->_customdata->assignmentid);
$data = file_prepare_standard_editor($data, 'text', $editoroptions, $this->_customdata->context, $editoroptions['filearea'], $USER->id);
return parent::set_data($data);
}

public function get_data() {
global $USER;
$data = parent::get_data();
if ($data) {
$editoroptions = $this->get_editor_options();
$data = file_postupdate_standard_editor($data, 'text', $editoroptions, $this->_customdata->context, $editoroptions['filearea'], $this->_customdata->assignmentid);
$data = file_postupdate_standard_editor($data, 'text', $editoroptions, $this->_customdata->context, $editoroptions['filearea'], $USER->id);
$data->format = $data->textformat;
}
return $data;
Expand Down
2 changes: 1 addition & 1 deletion mod/assignment/type/online/file.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
echo '</table>';
echo $OUTPUT->box_end();

$text = file_rewrite_pluginfile_urls($submission->data1, 'pluginfile.php', $context->id, 'assignment_online_submission', $assignment->id);
$text = file_rewrite_pluginfile_urls($submission->data1, 'pluginfile.php', $context->id, 'assignment_online_submission', $USER->id);
echo $OUTPUT->box(format_text($text, $submission->data2), 'generalbox boxaligncenter boxwidthwide');
echo $OUTPUT->close_window_button();
echo $OUTPUT->footer();
Expand Down

0 comments on commit fb1ee4d

Please sign in to comment.