source: moodle/trunk/fuentes/admin/tool/generator/maketestcourse.php @ 136

Last change on this file since 136 was 136, checked in by mabarracus, 4 years ago

Ported code to xenial

File size: 2.3 KB
Line 
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().
27define('NO_OUTPUT_BUFFERING', true);
28
29require('../../../config.php');
30
31require_once($CFG->libdir . '/adminlib.php');
32
33// Initialise page and check permissions.
34admin_externalpage_setup('toolgeneratorcourse');
35
36// Start page.
37echo $OUTPUT->header();
38echo $OUTPUT->heading(get_string('maketestcourse', 'tool_generator'));
39
40// Information message.
41$context = context_system::instance();
42echo $OUTPUT->box(format_text(get_string('courseexplanation', 'tool_generator'),
43        FORMAT_MARKDOWN, array('context' => $context)));
44
45// Check debugging is set to DEVELOPER.
46if (!debugging('', DEBUG_DEVELOPER)) {
47    echo $OUTPUT->notification(get_string('error_notdebugging', 'tool_generator'));
48    echo $OUTPUT->footer();
49    exit;
50}
51
52// Set up the form.
53$mform = new tool_generator_make_course_form('maketestcourse.php');
54if ($data = $mform->get_data()) {
55    // Do actual work.
56    echo $OUTPUT->heading(get_string('creating', 'tool_generator'));
57    $backend = new tool_generator_course_backend($data->shortname, $data->size);
58    $id = $backend->make();
59
60    echo html_writer::div(
61            html_writer::link(new moodle_url('/course/view.php', array('id' => $id)),
62                get_string('continue')));
63} else {
64    // Display form.
65    $mform->display();
66}
67
68// Finish page.
69echo $OUTPUT->footer();
Note: See TracBrowser for help on using the repository browser.