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
 * Processor file for user exclusion by file uploads
19
 *
20
 * File         upload.php
21
 * Encoding     UTF-8
22
 *
23
 * @package     tool_usersuspension
24
 *
25
 * @copyright   Sebsoft.nl
26
 * @author      R.J. van Dongen <rogier@sebsoft.nl>
27
 * @license     http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
28
 */
29
 
30
require_once(dirname(__FILE__) . '/../../../../config.php');
31
require_once($CFG->libdir.'/adminlib.php');
32
 
33
admin_externalpage_setup('toolusersuspension');
34
$context       = \context_system::instance();
35
 
36
require_capability('tool/usersuspension:administration', $context);
37
require_capability('moodle/user:update', context_system::instance());
38
 
39
$overviewurl = new moodle_url('/' . $CFG->admin . '/tool/usersuspension/view/statuslist.php');
40
$thispageurl = new moodle_url('/' . $CFG->admin . '/tool/usersuspension/view/upload.php');
41
if (!(bool)\tool_usersuspension\config::get('enablefromupload')) {
42
    echo $OUTPUT->header();
43
    echo '<div id="tool-usersuspension-container">';
44
    echo '<div>';
45
    \tool_usersuspension\util::print_view_tabs(array(), 'upload');
46
    echo '</div>';
47
    echo '<div class="tool-usersuspension-warning">' . get_string('config:tool:disabled', 'tool_usersuspension') . '</div>';
48
    echo '</div>';
49
    echo $OUTPUT->footer();
50
} else {
51
    $mform = new \tool_usersuspension\forms\upload($thispageurl);
52
    if ($mform->is_cancelled()) {
53
        redirect($overviewurl);
54
    } else if ($data = $mform->get_data()) {
55
        echo $OUTPUT->header();
56
        echo '<div id="tool-usersuspension-form-container">';
57
        $mform->process();
58
        echo '<br/>';
59
        echo \tool_usersuspension\util::continue_button($thispageurl, get_string('button:backtouploadform', 'tool_usersuspension'));
60
        echo \tool_usersuspension\util::continue_button($overviewurl, get_string('button:backtoexclusions', 'tool_usersuspension'));
61
        echo '</div>';
62
        echo $OUTPUT->footer();
63
    } else {
64
        echo $OUTPUT->header();
65
        echo '<div id="tool-usersuspension-form-container">';
66
        echo '<div>';
67
        \tool_usersuspension\util::print_view_tabs(array(), 'upload');
68
        echo '</div>';
69
        echo $mform->display();
70
        echo '</div>';
71
        echo $OUTPUT->footer();
72
    }
73
}