MDL-15758: fixing regressions i introduced in lib.php v 1.359

This commit is contained in:
mjollnir_ 2008-09-09 21:06:19 +00:00
parent 53aa4841c4
commit a97bcd684c
3 changed files with 11 additions and 3 deletions

View file

@ -89,6 +89,7 @@ $string['itemstocount'] = 'Count';
$string['invalidid'] = 'assignment ID was incorrect'; $string['invalidid'] = 'assignment ID was incorrect';
$string['invalidassignment'] = 'incorrect assignment'; $string['invalidassignment'] = 'incorrect assignment';
$string['invalidtype']= 'Incorrect assignment type'; $string['invalidtype']= 'Incorrect assignment type';
$string['invaliduserid'] = 'Invalid user ID';
$string['late'] = '$a late'; $string['late'] = '$a late';
$string['maximumgrade'] = 'Maximum grade'; $string['maximumgrade'] = 'Maximum grade';
$string['maximumsize'] = 'Maximum size'; $string['maximumsize'] = 'Maximum size';

View file

@ -1707,6 +1707,7 @@ class assignment_base {
if ($files = $fs->get_area_files($this->context->id, 'assignment_submission', $userid, "timemodified", false)) { if ($files = $fs->get_area_files($this->context->id, 'assignment_submission', $userid, "timemodified", false)) {
$p = array( $p = array(
'assignmentid' => $this->cm->id, 'assignmentid' => $this->cm->id,
'userid' => $USER->id,
); );
foreach ($files as $file) { foreach ($files as $file) {
$filename = $file->get_filename(); $filename = $file->get_filename();
@ -3145,7 +3146,6 @@ class assignment_portfolio_caller extends portfolio_module_caller_base {
private $assignment; private $assignment;
private $assignmentfile; private $assignmentfile;
private $userid;
private $file; private $file;
private $files; private $files;
@ -3160,10 +3160,16 @@ class assignment_portfolio_caller extends portfolio_module_caller_base {
throw new portfolio_caller_exception('invalidid', 'assignment'); 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'; $this->assignmentfile = $CFG->dirroot . '/mod/assignment/type/' . $assignment->assignmenttype . '/assignment.class.php';
require_once($this->assignmentfile); require_once($this->assignmentfile);
$assignmentclass = "assignment_$assignment->assignmenttype"; $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()) { if (!$this->assignment->portfolio_exportable()) {
throw new portfolio_caller_exception('notexportable', 'portfolio', $this->get_return_url()); throw new portfolio_caller_exception('notexportable', 'portfolio', $this->get_return_url());
} }
@ -3211,7 +3217,7 @@ class assignment_portfolio_caller extends portfolio_module_caller_base {
} }
public function expected_time() { 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(); return $this->assignment->portfolio_get_expected_time();
} }
if (is_array($this->files)) { if (is_array($this->files)) {

View file

@ -344,6 +344,7 @@ class assignment_upload extends assignment_base {
if ($files = $fs->get_area_files($this->context->id, 'assignment_submission', $userid, "timemodified", false)) { if ($files = $fs->get_area_files($this->context->id, 'assignment_submission', $userid, "timemodified", false)) {
$p = array( $p = array(
'assignmentid' => $this->cm->id, 'assignmentid' => $this->cm->id,
'userid' => $USER->id,
); );
foreach ($files as $file) { foreach ($files as $file) {
$filename = $file->get_filename(); $filename = $file->get_filename();