Proyectos de Subversion Moodle

Rev

| Ultima modificación | Ver Log |

Rev Autor Línea Nro. Línea
1 efrain 1
<?php
2
// This file is part of Moodle - http://moodle.org/
3
//
4
// Moodle is free software: you can redistribute it and/or modify
5
// it under the terms of the GNU General Public License as published by
6
// the Free Software Foundation, either version 3 of the License, or
7
// (at your option) any later version.
8
//
9
// Moodle is distributed in the hope that it will be useful,
10
// but WITHOUT ANY WARRANTY; without even the implied warranty of
11
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12
// GNU General Public License for more details.
13
//
14
// You should have received a copy of the GNU General Public License
15
// along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
16
 
17
/**
18
 * Script creates a standardised large course for testing reliability and performance.
19
 *
20
 * @package tool_generator
21
 * @copyright 2013 The Open University
22
 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
23
 */
24
 
25
// Disable buffering so that the progress output displays gradually without
26
// needing to call flush().
27
define('NO_OUTPUT_BUFFERING', true);
28
 
29
require('../../../config.php');
30
 
31
require_once($CFG->libdir . '/adminlib.php');
32
 
33
// Initialise page and check permissions.
34
admin_externalpage_setup('toolgeneratorcourse');
35
 
36
// Start page.
37
echo $OUTPUT->header();
38
echo $OUTPUT->heading(get_string('maketestcourse', 'tool_generator'));
39
 
40
// Information message.
41
$context = context_system::instance();
42
echo $OUTPUT->box(format_text(get_string('courseexplanation', 'tool_generator'),
43
        FORMAT_MARKDOWN, array('context' => $context)));
44
 
45
// Check debugging is set to DEVELOPER.
46
if (!debugging('', DEBUG_DEVELOPER)) {
47
    echo $OUTPUT->notification(get_string('error_notdebugging', 'tool_generator'));
48
    echo $OUTPUT->footer();
49
    exit;
50
}
51
 
52
// Finish page.
53
echo $OUTPUT->footer();
54
echo $OUTPUT->select_element_for_append();
55
 
56
// Preemptively reset the navcache before closing, so it remains the same on shutdown.
57
navigation_cache::destroy_volatile_caches();
58
 
59
\core\session\manager::write_close();
60
 
61
// Set up the form.
62
$mform = new tool_generator_make_course_form('maketestcourse.php');
63
if ($data = $mform->get_data()) {
64
    // Do actual work.
65
    echo $OUTPUT->heading(get_string('creating', 'tool_generator'));
66
    $backend = new tool_generator_course_backend(
67
        $data->shortname,
68
        $data->size,
69
        false,
70
        false,
71
        true,
72
        $data->fullname,
73
        $data->summary['text'],
74
        $data->summary['format'],
75
        $data->additionalmodules
76
    );
77
    $id = $backend->make();
78
 
79
    echo html_writer::div(
80
            html_writer::link(new moodle_url('/course/view.php', array('id' => $id)),
81
                get_string('continue')));
82
} else {
83
    // Display form.
84
    $mform->display();
85
}
86