moodle-mod_htmlcert/settings.php

96 lines
4.5 KiB
PHP

<?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.
*
* @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;
$url = $CFG->wwwroot . '/mod/htmlcert/verify_certificate.php';
$ADMIN->add('modsettings', new admin_category('htmlcert', get_string('pluginname', 'mod_htmlcert')));
$settings = new admin_settingpage('modsettinghtmlcert', new lang_string('htmlcertsettings', 'mod_htmlcert'));
$settings->add(new admin_setting_configcheckbox('htmlcert/verifyallcertificates',
get_string('verifyallcertificates', 'htmlcert'),
get_string('verifyallcertificates_desc', 'htmlcert', $url),
0));
$settings->add(new admin_setting_configcheckbox('htmlcert/showposxy',
get_string('showposxy', 'htmlcert'),
get_string('showposxy_desc', 'htmlcert'),
0));
$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'), ''));
$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'), ''));
$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'),
];
$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));
$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));
$settings->add(new admin_setting_configcheckbox('htmlcert/protection_modify',
get_string('preventmodify', 'htmlcert'),
get_string('preventmodify_desc', 'htmlcert'),
0));
$settings->add(new admin_setting_configcheckbox('htmlcert/protection_copy',
get_string('preventcopy', 'htmlcert'),
get_string('preventcopy_desc', 'htmlcert'),
0));
$ADMIN->add('htmlcert', $settings);
// Element plugin settings.
$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) {
$plugin->load_settings($ADMIN, 'htmlcertelements', $hassiteconfig);
}
// Tell core we already added the settings structure.
$settings = null;