-
Notifications
You must be signed in to change notification settings - Fork 0
/
config.php
84 lines (70 loc) · 3.94 KB
/
config.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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
<?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/>.
/**
* Tool to synchronize users between GTAF and Odissea. It download CSV files from
* specified SFTP server and process them
*
* @package tool
* @subpackage odisseagtafsync
* @copyright 2013 Departament d'Ensenyament de la Generalitat de Catalunya
* @author Sara Arjona Téllez <[email protected]>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
require_once dirname(__FILE__) . '/../../../config.php';
require_once $CFG->libdir . '/adminlib.php';
require_once dirname(__FILE__) . '/locallib.php';
require_once dirname(__FILE__) . '/classes/odissea_gtaf_synchronizer.class.php';
require_once dirname(__FILE__) . '/config_form.php';
// admin_externalpage_setup calls require_login and checks moodle/site:config
admin_externalpage_setup('gtafsettings');
$renderer = $PAGE->get_renderer('tool_odisseagtafsync');
$header = get_string('pluginname', 'tool_odisseagtafsync');
$form_config = new tool_odisseagtafsync_config_form(new moodle_url('/'. $CFG->admin . '/tool/odisseagtafsync/config.php'));
$form_config->set_data(get_config('tool_odisseagtafsync'));
if ($form_config->is_cancelled()) {
$returnurl = new moodle_url('/'. $CFG->admin . '/tool/odisseagtafsync/index.php');
redirect($returnurl);
} else if ($fromform = $form_config->get_data()) {
set_config('sftphost', $fromform->sftphost, 'tool_odisseagtafsync');
set_config('sftpusername', $fromform->sftpusername, 'tool_odisseagtafsync');
set_config('sftppassword', $fromform->sftppassword, 'tool_odisseagtafsync');
set_config('inputpath', $fromform->inputpath, 'tool_odisseagtafsync');
set_config('outputpath', $fromform->outputpath, 'tool_odisseagtafsync');
set_config('uutype', $fromform->uutype, 'tool_odisseagtafsync');
set_config('uuupdatetype', $fromform->uuupdatetype, 'tool_odisseagtafsync');
set_config('uunoemailduplicates', $fromform->uunoemailduplicates, 'tool_odisseagtafsync');
set_config('uustandardusernames', $fromform->uustandardusernames, 'tool_odisseagtafsync');
set_config('uulegacy1', $fromform->uulegacy1, 'tool_odisseagtafsync');
set_config('uulegacy2', $fromform->uulegacy2, 'tool_odisseagtafsync');
set_config('uulegacy3', $fromform->uulegacy3, 'tool_odisseagtafsync');
set_config('auth', $fromform->auth, 'tool_odisseagtafsync');
set_config('maildisplay', $fromform->maildisplay, 'tool_odisseagtafsync');
set_config('mailformat', $fromform->mailformat, 'tool_odisseagtafsync');
set_config('maildigest', $fromform->maildigest, 'tool_odisseagtafsync');
set_config('autosubscribe', $fromform->autosubscribe, 'tool_odisseagtafsync');
set_config('trackforums', $fromform->trackforums, 'tool_odisseagtafsync');
set_config('htmleditor', $fromform->htmleditor, 'tool_odisseagtafsync');
set_config('country', $fromform->country, 'tool_odisseagtafsync');
set_config('timezone', $fromform->timezone, 'tool_odisseagtafsync');
set_config('lang', $fromform->lang, 'tool_odisseagtafsync');
$returnurl = new moodle_url('/'. $CFG->admin . '/tool/odisseagtafsync/config.php');
redirect($returnurl);
}
echo $renderer->header();
echo $renderer->heading(get_string('pluginname', 'tool_odisseagtafsync'));
echo $renderer->box(get_string('paramsdesc', 'tool_odisseagtafsync'));
$form_config->display();
echo $renderer->footer();