1 |
efrain |
1 |
<?php
|
|
|
2 |
// This file is part of the Certificate module for 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 |
* Creates a link to the upload form on the settings page.
|
|
|
19 |
*
|
|
|
20 |
* @package mod_customcert
|
|
|
21 |
* @copyright 2013 Mark Nelson <markn@moodle.com>
|
|
|
22 |
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
|
|
23 |
*/
|
|
|
24 |
|
|
|
25 |
defined('MOODLE_INTERNAL') || die;
|
|
|
26 |
|
|
|
27 |
$url = $CFG->wwwroot . '/mod/customcert/verify_certificate.php';
|
|
|
28 |
|
|
|
29 |
$ADMIN->add('modsettings', new admin_category('customcert', get_string('pluginname', 'mod_customcert')));
|
|
|
30 |
$settings = new admin_settingpage('modsettingcustomcert', new lang_string('customcertsettings', 'mod_customcert'));
|
|
|
31 |
|
|
|
32 |
$settings->add(new admin_setting_configcheckbox('customcert/verifyallcertificates',
|
|
|
33 |
get_string('verifyallcertificates', 'customcert'),
|
|
|
34 |
get_string('verifyallcertificates_desc', 'customcert', $url),
|
|
|
35 |
0));
|
|
|
36 |
|
|
|
37 |
$settings->add(new admin_setting_configcheckbox('customcert/showposxy',
|
|
|
38 |
get_string('showposxy', 'customcert'),
|
|
|
39 |
get_string('showposxy_desc', 'customcert'),
|
|
|
40 |
0));
|
|
|
41 |
|
|
|
42 |
$settings->add(new \mod_customcert\admin_setting_link('customcert/verifycertificate',
|
|
|
43 |
get_string('verifycertificate', 'customcert'), get_string('verifycertificatedesc', 'customcert'),
|
|
|
44 |
get_string('verifycertificate', 'customcert'), new moodle_url('/mod/customcert/verify_certificate.php'), ''));
|
|
|
45 |
|
|
|
46 |
$settings->add(new \mod_customcert\admin_setting_link('customcert/managetemplates',
|
|
|
47 |
get_string('managetemplates', 'customcert'), get_string('managetemplatesdesc', 'customcert'),
|
|
|
48 |
get_string('managetemplates', 'customcert'), new moodle_url('/mod/customcert/manage_templates.php'), ''));
|
|
|
49 |
|
|
|
50 |
$settings->add(new \mod_customcert\admin_setting_link('customcert/uploadimage',
|
|
|
51 |
get_string('uploadimage', 'customcert'), get_string('uploadimagedesc', 'customcert'),
|
|
|
52 |
get_string('uploadimage', 'customcert'), new moodle_url('/mod/customcert/upload_image.php'), ''));
|
|
|
53 |
|
|
|
54 |
if (has_capability('mod/customcert:viewallcertificates', context_system::instance())) {
|
|
|
55 |
$settings->add(new \mod_customcert\admin_setting_link('customcert/downloadallsitecerts',
|
|
|
56 |
get_string('downloadallsitecertificates', 'customcert'), get_string('downloadallsitecertificatesdesc', 'customcert'),
|
|
|
57 |
get_string('downloadallsitecertificates', 'customcert'),
|
|
|
58 |
new moodle_url('/mod/customcert/download_all_certificates.php'), ''));
|
|
|
59 |
}
|
|
|
60 |
|
|
|
61 |
$settings->add(new admin_setting_heading('defaults',
|
|
|
62 |
get_string('modeditdefaults', 'admin'), get_string('condifmodeditdefaults', 'admin')));
|
|
|
63 |
|
|
|
64 |
$yesnooptions = [
|
|
|
65 |
|
|
|
66 |
1 => get_string('yes'),
|
|
|
67 |
];
|
|
|
68 |
|
|
|
69 |
$settings->add(new admin_setting_configselect('customcert/emailstudents',
|
|
|
70 |
get_string('emailstudents', 'customcert'), get_string('emailstudents_help', 'customcert'), 0, $yesnooptions));
|
|
|
71 |
$settings->add(new admin_setting_configselect('customcert/emailteachers',
|
|
|
72 |
get_string('emailteachers', 'customcert'), get_string('emailteachers_help', 'customcert'), 0, $yesnooptions));
|
|
|
73 |
$settings->add(new admin_setting_configtext('customcert/emailothers',
|
|
|
74 |
get_string('emailothers', 'customcert'), get_string('emailothers_help', 'customcert'), '', PARAM_TEXT));
|
|
|
75 |
$settings->add(new admin_setting_configselect('customcert/verifyany',
|
|
|
76 |
get_string('verifycertificateanyone', 'customcert'), get_string('verifycertificateanyone_help', 'customcert'),
|
|
|
77 |
0, $yesnooptions));
|
|
|
78 |
$settings->add(new admin_setting_configtext('customcert/requiredtime',
|
|
|
79 |
get_string('coursetimereq', 'customcert'), get_string('coursetimereq_help', 'customcert'), 0, PARAM_INT));
|
|
|
80 |
$settings->add(new admin_setting_configcheckbox('customcert/protection_print',
|
|
|
81 |
get_string('preventprint', 'customcert'),
|
|
|
82 |
get_string('preventprint_desc', 'customcert'),
|
|
|
83 |
0));
|
|
|
84 |
$settings->add(new admin_setting_configcheckbox('customcert/protection_modify',
|
|
|
85 |
get_string('preventmodify', 'customcert'),
|
|
|
86 |
get_string('preventmodify_desc', 'customcert'),
|
|
|
87 |
0));
|
|
|
88 |
$settings->add(new admin_setting_configcheckbox('customcert/protection_copy',
|
|
|
89 |
get_string('preventcopy', 'customcert'),
|
|
|
90 |
get_string('preventcopy_desc', 'customcert'),
|
|
|
91 |
0));
|
|
|
92 |
|
|
|
93 |
$ADMIN->add('customcert', $settings);
|
|
|
94 |
|
|
|
95 |
// Element plugin settings.
|
|
|
96 |
$ADMIN->add('customcert', new admin_category('customcertelements', get_string('elementplugins', 'customcert')));
|
|
|
97 |
$plugins = \core_plugin_manager::instance()->get_plugins_of_type('customcertelement');
|
|
|
98 |
foreach ($plugins as $plugin) {
|
|
|
99 |
$plugin->load_settings($ADMIN, 'customcertelements', $hassiteconfig);
|
|
|
100 |
}
|
|
|
101 |
|
|
|
102 |
// Tell core we already added the settings structure.
|
|
|
103 |
$settings = null;
|