$string['invalidid'] = 'assignment ID was incorrect';
$string['invalidassignment'] = 'incorrect assignment';
$string['invalidtype']= 'Incorrect assignment type';
+$string['invaliduserid'] = 'Invalid user ID';
$string['late'] = '$a late';
$string['maximumgrade'] = 'Maximum grade';
$string['maximumsize'] = 'Maximum size';
if ($files = $fs->get_area_files($this->context->id, 'assignment_submission', $userid, "timemodified", false)) {
$p = array(
'assignmentid' => $this->cm->id,
+ 'userid' => $USER->id,
);
foreach ($files as $file) {
$filename = $file->get_filename();
private $assignment;
private $assignmentfile;
- private $userid;
private $file;
private $files;
throw new portfolio_caller_exception('invalidid', 'assignment');
}
+ if (!array_key_exists('userid', $callbackargs)) {
+ throw new portfolio_caller_exception('invaliduserid', 'assignment');
+ }
+ if (!$this->user = $DB->get_record('user', array('id' => $callbackargs['userid']))) {
+ throw new portfolio_caller_exception('invaliduserid', 'assignment');
+ }
$this->assignmentfile = $CFG->dirroot . '/mod/assignment/type/' . $assignment->assignmenttype . '/assignment.class.php';
require_once($this->assignmentfile);
$assignmentclass = "assignment_$assignment->assignmenttype";
- $this->assignment= new $assignmentclass($this->cm->id, $assignment, $this->cm);
+ $this->assignment = new $assignmentclass($this->cm->id, $assignment, $this->cm);
if (!$this->assignment->portfolio_exportable()) {
throw new portfolio_caller_exception('notexportable', 'portfolio', $this->get_return_url());
}
}
public function expected_time() {
- if (is_callable(array($this->assignmnet, 'portfolio_get_expected_time'))) {
+ if (is_callable(array($this->assignment, 'portfolio_get_expected_time'))) {
return $this->assignment->portfolio_get_expected_time();
}
if (is_array($this->files)) {