-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathexport.php
executable file
·70 lines (52 loc) · 2.36 KB
/
export.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* @package local_lom
* @copyright Zhifen Lin 2018 project OER Humboldt University Berlin
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
//defined('MOODLE_INTERNAL') || die();
require_once('../../config.php');
//require_once($CFG->dirroot.'/local/lom/classes/export_form.php');
require_once($CFG->dirroot.'/local/lom/export_form.php');
global $PAGE, $OUTPUT, $DB;
$id = required_param('id', PARAM_INT);
$PAGE->set_url($CFG->wwwroot.'/local/lom/export.php', array('id' => $id));
$PAGE->set_context(context_course::instance($id));
$title = get_string('oaipmhexport', 'local_lom');
$PAGE->set_title($title);
$PAGE->set_heading($title);
require_login($id);
echo $OUTPUT->header();
$coursename = $DB->get_field('course', 'fullname', ['id' => $id]);
echo $OUTPUT->heading('Generate LOM metadata export file for course '.'"'.$coursename.'"' .'. This file will be harvested through oai-pmh. Are you ready to export your course metadata?');
$mform = new export_form('/local/lom/xml_output.php', array('id'=>$id));
//Form processing and displaying is done here
if ($mform->is_cancelled()) {
//Handle form cancel operation, if cancel button is present on form
} else if ($fromform = $mform->get_data()) {
echo "xml file generated";
//In this case you process validated data. $mform->get_data() returns data posted in form.
} else {
// this branch is executed if the form is submitted but the data doesn't validate and the form should be redisplayed
// or on the first display of the form.
//Set default data (if any)
//$mform->set_data($toform);
//displays the form
$mform->set_data(array('id' => $id));
$mform->display();
}
echo $OUTPUT->footer();