MDL-36088 questions: Add new events
[moodle.git] / question / import.php
index 56faf52..0f68d1e 100644 (file)
@@ -129,13 +129,13 @@ if ($form = $import_form->get_data()) {
         print_error('cannotimport', '', $thispageurl->out());
     }
 
-        // Log the import into this category.
-        $eventparams = array(
-            'contextid' => $category->contextid,
-            'other' => array('format' => $form->format, 'categoryid' => $category->id)
-        );
-        $event = \core\event\questions_imported::create($eventparams);
-        $event->trigger();
+    // Log the import into this category.
+    $eventparams = [
+            'contextid' => $qformat->category->contextid,
+            'other' => ['format' => $form->format, 'categoryid' => $qformat->category->id],
+    ];
+    $event = \core\event\questions_imported::create($eventparams);
+    $event->trigger();
 
     $params = $thispageurl->params() + array(
         'category' => $qformat->category->id . ',' . $qformat->category->contextid);