2018-11-01 14:21:14 +00:00
|
|
|
<?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/>.
|
2019-02-06 13:38:23 +00:00
|
|
|
|
2018-11-01 14:21:14 +00:00
|
|
|
/**
|
|
|
|
* @package plagiarism_pchkorg
|
2019-02-06 13:38:23 +00:00
|
|
|
* @category plagiarism
|
|
|
|
* @copyright PlagiarismCheck.org, https://plagiarismcheck.org/
|
2018-11-01 14:21:14 +00:00
|
|
|
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
|
|
|
*/
|
|
|
|
|
2019-01-17 16:51:22 +00:00
|
|
|
require_once(__DIR__ . '/../../config.php');
|
2018-11-01 14:21:14 +00:00
|
|
|
require_once($CFG->libdir . '/adminlib.php');
|
|
|
|
require_once($CFG->libdir . '/plagiarismlib.php');
|
2019-01-17 16:51:22 +00:00
|
|
|
require_once($CFG->dirroot . '/lib/formslib.php');
|
2018-11-01 14:21:14 +00:00
|
|
|
require_once($CFG->dirroot . '/plagiarism/pchkorg/lib.php');
|
2019-01-17 16:51:22 +00:00
|
|
|
require_once($CFG->dirroot . '/plagiarism/pchkorg/form/plagiarism_pchkorg_setup_form.php');
|
|
|
|
require_once(__DIR__ . '/classes/plagiarism_pchkorg_config_model.php');
|
|
|
|
require_once(__DIR__ . '/lib.php');
|
2018-11-01 14:21:14 +00:00
|
|
|
|
2019-02-28 13:17:56 +00:00
|
|
|
$pchkorgconfigmodel = new plagiarism_pchkorg_config_model();
|
2018-11-01 14:21:14 +00:00
|
|
|
|
|
|
|
require_login();
|
|
|
|
admin_externalpage_setup('plagiarismpchkorg');
|
|
|
|
|
2019-04-05 16:25:06 +00:00
|
|
|
$context = context_system::instance();
|
2018-11-01 14:21:14 +00:00
|
|
|
|
|
|
|
require_capability('moodle/site:config', $context, $USER->id, true, "nopermissions");
|
|
|
|
|
2019-01-17 16:51:22 +00:00
|
|
|
$mform = new plagiarism_pchkorg_setup_form();
|
2018-11-01 14:21:14 +00:00
|
|
|
$plagiarismplugin = new plagiarism_plugin_pchkorg();
|
|
|
|
|
|
|
|
if ($mform->is_cancelled()) {
|
|
|
|
redirect('');
|
|
|
|
}
|
|
|
|
echo $OUTPUT->header();
|
|
|
|
|
|
|
|
if (($data = $mform->get_data()) && confirm_sesskey()) {
|
|
|
|
|
|
|
|
if (!isset($data->pchkorg_use)) {
|
|
|
|
$data->pchkorg_use = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
foreach ($data as $field => $value) {
|
|
|
|
if (strpos($field, 'pchkorg') === 0) {
|
2023-06-06 16:04:59 +00:00
|
|
|
if ('pchkorg_use' === $field) {
|
|
|
|
set_config('enabled', $value, 'plagiarism_pchkorg');
|
|
|
|
}
|
|
|
|
set_config($field, $value, 'plagiarism_pchkorg');
|
2019-01-17 16:51:22 +00:00
|
|
|
$pchkorgconfigmodel->set_system_config($field, $value);
|
2018-11-01 14:21:14 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
$OUTPUT->notification(get_string('savedconfigsuccess', 'plagiarism_pchkorg'), 'notifysuccess');
|
|
|
|
}
|
|
|
|
|
2019-01-17 16:51:22 +00:00
|
|
|
$plagiarismsettings = $pchkorgconfigmodel->get_all_system_config();
|
2018-11-01 14:21:14 +00:00
|
|
|
|
|
|
|
$mform->set_data($plagiarismsettings);
|
|
|
|
|
|
|
|
echo $OUTPUT->box_start('generalbox boxaligncenter', 'intro');
|
|
|
|
$mform->display();
|
|
|
|
echo $OUTPUT->box_end();
|
|
|
|
echo $OUTPUT->footer();
|