From a97bcd684c46067ca1e0448b6ecf09bdfe080b5e Mon Sep 17 00:00:00 2001 From: mjollnir_ Date: Tue, 9 Sep 2008 21:06:19 +0000 Subject: [PATCH] MDL-15758: fixing regressions i introduced in lib.php v 1.359 --- lang/en_utf8/assignment.php | 1 + mod/assignment/lib.php | 12 +++++++++--- mod/assignment/type/upload/assignment.class.php | 1 + 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/lang/en_utf8/assignment.php b/lang/en_utf8/assignment.php index 37fef80e28..685b2f8ca6 100644 --- a/lang/en_utf8/assignment.php +++ b/lang/en_utf8/assignment.php @@ -89,6 +89,7 @@ $string['itemstocount'] = 'Count'; $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'; diff --git a/mod/assignment/lib.php b/mod/assignment/lib.php index 1c46a6ad80..ce62cc3710 100644 --- a/mod/assignment/lib.php +++ b/mod/assignment/lib.php @@ -1707,6 +1707,7 @@ class assignment_base { 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(); @@ -3145,7 +3146,6 @@ class assignment_portfolio_caller extends portfolio_module_caller_base { private $assignment; private $assignmentfile; - private $userid; private $file; private $files; @@ -3160,10 +3160,16 @@ class assignment_portfolio_caller extends portfolio_module_caller_base { 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()); } @@ -3211,7 +3217,7 @@ class assignment_portfolio_caller extends portfolio_module_caller_base { } 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)) { diff --git a/mod/assignment/type/upload/assignment.class.php b/mod/assignment/type/upload/assignment.class.php index 922986bb93..59dfc3c846 100644 --- a/mod/assignment/type/upload/assignment.class.php +++ b/mod/assignment/type/upload/assignment.class.php @@ -344,6 +344,7 @@ class assignment_upload extends assignment_base { 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(); -- 2.39.5