diff --git a/grade/edit/outcome/import.php b/grade/edit/outcome/import.php
index f0c3aee..63455ff 100644
--- a/grade/edit/outcome/import.php
+++ b/grade/edit/outcome/import.php
@@ -24,9 +24,10 @@
// //
///////////////////////////////////////////////////////////////////////////
-require_once '../../../config.php';
-require_once $CFG->dirroot.'/grade/lib.php';
-require_once $CFG->libdir.'/gradelib.php';
+/// THIS SCRIPT IS CALLED WITH "require_once()" FROM index.php
+if (!defined('MOODLE_INTERNAL')) {
+ die('Direct access to this script is forbidden.');
+}
$courseid = optional_param('id', 0, PARAM_INT);
$action = optional_param('action', '', PARAM_ALPHA);
diff --git a/grade/edit/outcome/import_outcomes_form.php b/grade/edit/outcome/import_outcomes_form.php
new file mode 100644
index 0000000..06bd8a8
--- /dev/null
+++ b/grade/edit/outcome/import_outcomes_form.php
@@ -0,0 +1,34 @@
+dirroot.'/lib/formslib.php');
+
+class import_outcomes_form extends moodleform {
+
+ function definition() {
+ global $COURSE, $USER;
+
+ $mform =& $this->_form;
+ $this->set_upload_manager(new upload_manager('imagefile', false, false, null, false, 0, true, true, false));
+
+ $mform->addElement('hidden', 'action', 'upload');
+ $mform->addElement('hidden', 'id', $COURSE->id);
+
+ $scope = array();
+ if (($COURSE->id > 1) && has_capability('moodle/grade:manage', get_context_instance(CONTEXT_SYSTEM))) {
+ $scope[] =& $mform->createElement('radio', 'scope', null, get_string('importcustom', 'grades'), 'custom', 1);
+ $scope[] =& $mform->createElement('radio', 'scope', null, get_string('importstandard', 'grades'), 'global', 0);
+ $mform->addGroup($scope, 'scopegroup', null, '
', true);
+ }
+
+ $mform->addElement('file', 'importfile', get_string('importoutcomes', 'grades'));
+
+ $mform->addElement('submit', 'save', get_string('uploadthisfile'));
+
+ }
+
+ function get_um() {
+ return $this->_upload_manager;
+ }
+}
+
+?>
diff --git a/grade/edit/outcome/index.php b/grade/edit/outcome/index.php
index 9c4bb98..29357a4 100644
--- a/grade/edit/outcome/index.php
+++ b/grade/edit/outcome/index.php
@@ -25,6 +25,7 @@
///////////////////////////////////////////////////////////////////////////
require_once '../../../config.php';
+require_once($CFG->dirroot.'/lib/formslib.php');
require_once $CFG->dirroot.'/grade/lib.php';
require_once $CFG->libdir.'/gradelib.php';
@@ -52,6 +53,14 @@ if ($courseid) {
/// return tracking object
$gpr = new grade_plugin_return(array('type'=>'edit', 'plugin'=>'outcome', 'courseid'=>$courseid));
+require_once('import_outcomes_form.php');
+$upload_form = new import_outcomes_form();
+
+if ($upload_form_data = $upload_form->get_data()) {
+ require_once('import.php');
+ exit();
+}
+
$strgrades = get_string('grades');
$pagename = get_string('outcomes', 'grades');
@@ -118,7 +127,10 @@ if ($courseid) {
print('