1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
// This file is part of Moodle - http://moodle.org/ |
4
|
|
|
// |
5
|
|
|
// Moodle is free software: you can redistribute it and/or modify |
6
|
|
|
// it under the terms of the GNU General Public License as published by |
7
|
|
|
// the Free Software Foundation, either version 3 of the License, or |
8
|
|
|
// (at your option) any later version. |
9
|
|
|
// |
10
|
|
|
// Moodle is distributed in the hope that it will be useful, |
11
|
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of |
12
|
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
13
|
|
|
// GNU General Public License for more details. |
14
|
|
|
// |
15
|
|
|
// You should have received a copy of the GNU General Public License |
16
|
|
|
// along with Moodle. If not, see <http://www.gnu.org/licenses/>. |
17
|
|
|
|
18
|
|
|
/** |
19
|
|
|
* pagseguro enrolments plugin settings and presets. |
20
|
|
|
* |
21
|
|
|
* @package enrol |
22
|
|
|
* @subpackage pagseguro |
23
|
|
|
* @copyright 2010 Eugene Venter |
24
|
|
|
* @author Eugene Venter - based on code by Petr Skoda and others |
25
|
|
|
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later |
26
|
|
|
*/ |
27
|
|
|
|
28
|
|
|
defined('MOODLE_INTERNAL') || die(); |
29
|
|
|
|
30
|
|
|
if ($ADMIN->fulltree) { |
31
|
|
|
|
32
|
|
|
$settings->add(new admin_setting_heading('enrol_pagseguro_settings', '', get_string('pluginname_desc', 'enrol_pagseguro'))); |
33
|
|
|
|
34
|
|
|
$settings->add(new admin_setting_configtext('enrol_pagseguro/pagsegurobusiness', get_string('businessemail', 'enrol_pagseguro'), get_string('businessemail_desc', 'enrol_pagseguro'), '', PARAM_EMAIL)); |
35
|
|
|
|
36
|
|
|
$settings->add(new admin_setting_configtext('enrol_pagseguro/pagsegurotoken', get_string('businesstoken', 'enrol_pagseguro'), get_string('businesstoken_desc', 'enrol_pagseguro'), '', PARAM_RAW)); |
37
|
|
|
|
38
|
|
|
$settings->add(new admin_setting_configcheckbox('enrol_pagseguro/mailstudents', get_string('mailstudents', 'enrol_pagseguro'), '', 0)); |
39
|
|
|
|
40
|
|
|
$settings->add(new admin_setting_configcheckbox('enrol_pagseguro/mailteachers', get_string('mailteachers', 'enrol_pagseguro'), '', 0)); |
41
|
|
|
|
42
|
|
|
$settings->add(new admin_setting_configcheckbox('enrol_pagseguro/mailadmins', get_string('mailadmins', 'enrol_pagseguro'), '', 0)); |
43
|
|
|
|
44
|
|
|
$settings->add(new admin_setting_heading('enrol_pagseguro_defaults', |
45
|
|
|
get_string('enrolinstancedefaults', 'admin'), get_string('enrolinstancedefaults_desc', 'admin'))); |
46
|
|
|
|
47
|
|
|
$options = array(ENROL_INSTANCE_ENABLED => get_string('yes'), |
48
|
|
|
ENROL_INSTANCE_DISABLED => get_string('no')); |
49
|
|
|
$settings->add(new admin_setting_configselect('enrol_pagseguro/status', |
50
|
|
|
get_string('status', 'enrol_pagseguro'), get_string('status_desc', 'enrol_pagseguro'), ENROL_INSTANCE_DISABLED, $options)); |
51
|
|
|
|
52
|
|
|
$settings->add(new admin_setting_configtext('enrol_pagseguro/cost', get_string('cost', 'enrol_pagseguro'), '', 0, PARAM_FLOAT, 4)); |
53
|
|
|
|
54
|
|
|
$settings->add(new admin_setting_configtext('enrol_pagseguro/currency', get_string('currency', 'enrol_pagseguro'), get_string('currency_desc', 'enrol_pagseguro'), 'BRL', PARAM_RAW)); |
55
|
|
|
|
56
|
|
|
/*$pagsegurocurrencies = array('BRL' => 'Brazilian Real', |
|
|
|
|
57
|
|
|
'USD' => 'US Dollars', |
58
|
|
|
'EUR' => 'Euros', |
59
|
|
|
'JPY' => 'Japanese Yen', |
60
|
|
|
'GBP' => 'British Pounds', |
61
|
|
|
'CAD' => 'Canadian Dollars', |
62
|
|
|
'AUD' => 'Australian Dollars' |
63
|
|
|
); |
64
|
|
|
$settings->add(new admin_setting_configselect('enrol_pagseguro/currency', get_string('currency', 'enrol_pagseguro'), '', 'BRL', $pagsegurocurrencies)); |
65
|
|
|
*/ |
66
|
|
|
|
67
|
|
|
if (!during_initial_install()) { |
68
|
|
|
$options = get_default_enrol_roles(context_system::instance()); |
69
|
|
|
$student = get_archetype_roles('student'); |
70
|
|
|
$student = reset($student); |
71
|
|
|
$settings->add(new admin_setting_configselect('enrol_pagseguro/roleid', |
72
|
|
|
get_string('defaultrole', 'enrol_pagseguro'), get_string('defaultrole_desc', 'enrol_pagseguro'), $student->id, $options)); |
73
|
|
|
} |
74
|
|
|
|
75
|
|
|
$settings->add(new admin_setting_configtext('enrol_pagseguro/enrolperiod', |
76
|
|
|
get_string('enrolperiod', 'enrol_pagseguro'), get_string('enrolperiod_desc', 'enrol_pagseguro'), 0, PARAM_INT)); |
77
|
|
|
} |
78
|
|
|
|
Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.
The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.
This check looks for comments that seem to be mostly valid code and reports them.