moodle-mod_htmlcert/settings.php

97 lines
4.5 KiB
PHP
Raw Permalink Normal View History

<?php
// This file is part of the Certificate module for 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/>.
/**
* Creates a link to the upload form on the settings page.
*
2021-11-24 07:29:43 +00:00
* @package mod_htmlcert
* @copyright 2013 Mark Nelson <markn@moodle.com>, 2021 Klaus-Uwe Mitterer <kumitterer@kumi.systems>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
defined('MOODLE_INTERNAL') || die;
2021-11-24 07:29:43 +00:00
$url = $CFG->wwwroot . '/mod/htmlcert/verify_certificate.php';
2021-11-24 07:29:43 +00:00
$ADMIN->add('modsettings', new admin_category('htmlcert', get_string('pluginname', 'mod_htmlcert')));
$settings = new admin_settingpage('modsettinghtmlcert', new lang_string('htmlcertsettings', 'mod_htmlcert'));
2021-11-24 07:29:43 +00:00
$settings->add(new admin_setting_configcheckbox('htmlcert/verifyallcertificates',
get_string('verifyallcertificates', 'htmlcert'),
get_string('verifyallcertificates_desc', 'htmlcert', $url),
0));
2021-11-24 07:29:43 +00:00
$settings->add(new admin_setting_configcheckbox('htmlcert/showposxy',
get_string('showposxy', 'htmlcert'),
get_string('showposxy_desc', 'htmlcert'),
0));
2021-11-24 07:29:43 +00:00
$settings->add(new \mod_htmlcert\admin_setting_link('htmlcert/verifycertificate',
get_string('verifycertificate', 'htmlcert'), get_string('verifycertificatedesc', 'htmlcert'),
get_string('verifycertificate', 'htmlcert'), new moodle_url('/mod/htmlcert/verify_certificate.php'), ''));
2021-11-24 07:29:43 +00:00
$settings->add(new \mod_htmlcert\admin_setting_link('htmlcert/managetemplates',
get_string('managetemplates', 'htmlcert'), get_string('managetemplatesdesc', 'htmlcert'),
get_string('managetemplates', 'htmlcert'), new moodle_url('/mod/htmlcert/manage_templates.php'), ''));
2021-11-24 07:29:43 +00:00
$settings->add(new \mod_htmlcert\admin_setting_link('htmlcert/uploadimage',
get_string('uploadimage', 'htmlcert'), get_string('uploadimagedesc', 'htmlcert'),
get_string('uploadimage', 'htmlcert'), new moodle_url('/mod/htmlcert/upload_image.php'), ''));
$settings->add(new admin_setting_heading('defaults',
get_string('modeditdefaults', 'admin'), get_string('condifmodeditdefaults', 'admin')));
$yesnooptions = [
0 => get_string('no'),
1 => get_string('yes'),
];
2021-11-24 07:29:43 +00:00
$settings->add(new admin_setting_configselect('htmlcert/emailstudents',
get_string('emailstudents', 'htmlcert'), get_string('emailstudents_help', 'htmlcert'), 0, $yesnooptions));
$settings->add(new admin_setting_configselect('htmlcert/emailteachers',
get_string('emailteachers', 'htmlcert'), get_string('emailteachers_help', 'htmlcert'), 0, $yesnooptions));
$settings->add(new admin_setting_configtext('htmlcert/emailothers',
get_string('emailothers', 'htmlcert'), get_string('emailothers_help', 'htmlcert'), '', PARAM_TEXT));
$settings->add(new admin_setting_configselect('htmlcert/verifyany',
get_string('verifycertificateanyone', 'htmlcert'), get_string('verifycertificateanyone_help', 'htmlcert'),
0, $yesnooptions));
2021-11-24 07:29:43 +00:00
$settings->add(new admin_setting_configtext('htmlcert/requiredtime',
get_string('coursetimereq', 'htmlcert'), get_string('coursetimereq_help', 'htmlcert'), 0, PARAM_INT));
$settings->add(new admin_setting_configcheckbox('htmlcert/protection_print',
get_string('preventprint', 'htmlcert'),
get_string('preventprint_desc', 'htmlcert'),
0));
2021-11-24 07:29:43 +00:00
$settings->add(new admin_setting_configcheckbox('htmlcert/protection_modify',
get_string('preventmodify', 'htmlcert'),
get_string('preventmodify_desc', 'htmlcert'),
0));
2021-11-24 07:29:43 +00:00
$settings->add(new admin_setting_configcheckbox('htmlcert/protection_copy',
get_string('preventcopy', 'htmlcert'),
get_string('preventcopy_desc', 'htmlcert'),
0));
2021-11-24 07:29:43 +00:00
$ADMIN->add('htmlcert', $settings);
// Element plugin settings.
2021-11-24 07:29:43 +00:00
$ADMIN->add('htmlcert', new admin_category('htmlcertelements', get_string('elementplugins', 'htmlcert')));
$plugins = \core_plugin_manager::instance()->get_plugins_of_type('htmlcertelement');
foreach ($plugins as $plugin) {
2021-11-24 07:29:43 +00:00
$plugin->load_settings($ADMIN, 'htmlcertelements', $hassiteconfig);
}
// Tell core we already added the settings structure.
$settings = null;