]> git.mjollnir.org Git - moodle.git/commitdiff
MDL-15758: fixing regressions i introduced in lib.php v 1.359
authormjollnir_ <mjollnir_>
Tue, 9 Sep 2008 21:06:19 +0000 (21:06 +0000)
committermjollnir_ <mjollnir_>
Tue, 9 Sep 2008 21:06:19 +0000 (21:06 +0000)
lang/en_utf8/assignment.php
mod/assignment/lib.php
mod/assignment/type/upload/assignment.class.php

index 37fef80e2822ef88b8873aa25eb4876455792b26..685b2f8ca647a10c58bf525e60cc5e66711757ee 100644 (file)
@@ -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';
index 1c46a6ad80d0d2e61a95a9ade0958f41ef79d203..ce62cc371026f1906c051dc79e6e36d6260710e8 100644 (file)
@@ -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)) {
index 922986bb938321cc32f9f55799bce67ea8d33c6d..59dfc3c8463c0a9270d5a782812f01eba4aa82d7 100644 (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)) {
             $p = array(
                 'assignmentid' => $this->cm->id,
+                'userid'       => $USER->id,
             );
             foreach ($files as $file) {
                 $filename = $file->get_filename();