MDL-42150 Edit PDF: Fix error on saving annotations + comments.
authorDamyon Wiese <damyon@moodle.com>
Fri, 4 Oct 2013 07:15:58 +0000 (15:15 +0800)
committerDamyon Wiese <damyon@moodle.com>
Fri, 4 Oct 2013 07:15:58 +0000 (15:15 +0800)
Everything is an instanceof stdClass - need to reverse the logic.

mod/assign/feedback/editpdf/classes/page_editor.php

index ed95f62..e02b205 100644 (file)
@@ -73,7 +73,7 @@ class page_editor {
         $added = 0;
         foreach ($comments as $record) {
             // Force these.
         $added = 0;
         foreach ($comments as $record) {
             // Force these.
-            if ($record instanceof stdClass) {
+            if (!($record instanceof comment)) {
                 $comment = new comment($record);
             } else {
                 $comment = $record;
                 $comment = new comment($record);
             } else {
                 $comment = $record;
@@ -163,7 +163,7 @@ class page_editor {
         $added = 0;
         foreach ($annotations as $record) {
             // Force these.
         $added = 0;
         foreach ($annotations as $record) {
             // Force these.
-            if ($record instanceof stdClass) {
+            if (!($record instanceof annotation)) {
                 $annotation = new annotation($record);
             } else {
                 $annotation = $record;
                 $annotation = new annotation($record);
             } else {
                 $annotation = $record;