Add new filters in system settings

This commit is contained in:
Jane Adelmann 2022-05-04 18:04:10 +03:00
parent dfb8593114
commit 3917e133c4
No known key found for this signature in database
GPG Key ID: 4CCF39DF30B8AF72
4 changed files with 95 additions and 8 deletions

59
.phpcs Normal file
View File

@ -0,0 +1,59 @@
<?php
/*
* This file is part of the Moodle Plugin CI package.
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*
* Copyright (c) 2017 Blackboard Inc. (http://www.blackboard.com)
* License http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
$header = <<<'EOF'
This file is part of the Moodle Plugin CI package.
For the full copyright and license information, please view the LICENSE
file that was distributed with this source code.
Copyright (c) 2018 Blackboard Inc. (http://www.blackboard.com)
License http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
EOF;
return PhpCsFixer\Config::create()
->setRiskyAllowed(true)
->setRules([
'@Symfony' => true,
'@Symfony:risky' => true,
'array_syntax' => ['syntax' => 'short'],
'combine_consecutive_unsets' => true,
'combine_consecutive_issets' => true,
'general_phpdoc_annotation_remove' => ['expectedException', 'expectedExceptionMessage', 'expectedExceptionMessageRegExp'],
'header_comment' => ['header' => $header],
'heredoc_to_nowdoc' => true,
'no_extra_consecutive_blank_lines' => ['break', 'continue', 'extra', 'return', 'throw', 'use', 'parenthesis_brace_block', 'square_brace_block', 'curly_brace_block'],
'no_short_echo_tag' => true,
'no_unreachable_default_argument_value' => true,
'no_useless_else' => true,
'no_useless_return' => true,
'ordered_imports' => true,
'php_unit_strict' => true,
'phpdoc_add_missing_param_annotation' => true,
'phpdoc_order' => true,
'semicolon_after_instruction' => true,
'strict_comparison' => true,
'strict_param' => true,
'binary_operator_spaces' => ['align_equals' => true, 'align_double_arrow' => true],
'align_multiline_comment' => true,
'yoda_style' => false,
'compact_nullable_typehint' => true,
'native_function_invocation' => false,
])
->setFinder(
PhpCsFixer\Finder::create()
->exclude('tests/Fixture')
->exclude('moodle')
->exclude('moodledata')
->name('moodle-plugin-ci')
->in(__DIR__)
);

View File

@ -30,8 +30,7 @@ if (!defined('MOODLE_INTERNAL')) {
die('Direct access to this script is forbidden.'); // It must be included from a Moodle page.
}
class capability
{
class capability {
/**
* ENABLE
*/

View File

@ -23,12 +23,6 @@
defined('MOODLE_INTERNAL') || die();
//function pchkorg_check_pchkorg_min_percent($value)
//{
// return 0 <= $value && $value < 100;
//}
/**
* Class defined plugin settings form.
*/
@ -55,6 +49,18 @@ class plagiarism_pchkorg_setup_form extends moodleform {
if (!isset($mform->exportValues()['pchkorg_use']) || is_null($mform->exportValues()['pchkorg_use'])) {
$mform->setDefault('pchkorg_use', false);
}
if (!isset($mform->exportValues()['pchkorg_exclude_self_plagiarism'])
|| is_null($mform->exportValues()['pchkorg_exclude_self_plagiarism'])) {
$mform->setDefault('pchkorg_exclude_self_plagiarism', 1);
}
if (!isset($mform->exportValues()['pchkorg_include_referenced'])
|| is_null($mform->exportValues()['pchkorg_include_referenced'])) {
$mform->setDefault('pchkorg_include_referenced', 0);
}
if (!isset($mform->exportValues()['pchkorg_include_citation'])
|| is_null($mform->exportValues()['pchkorg_include_citation'])) {
$mform->setDefault('pchkorg_include_citation', 0);
}
$mform->addElement('password', 'pchkorg_token', get_string('pchkorg_token', 'plagiarism_pchkorg'));
$mform->addHelpButton('pchkorg_token', 'pchkorg_token', 'plagiarism_pchkorg');
@ -74,6 +80,26 @@ class plagiarism_pchkorg_setup_form extends moodleform {
$mform->addRule('pchkorg_min_percent', get_string('pchkorg_min_percent_range', 'plagiarism_pchkorg'), 'check_pchkorg_min_percent');
$mform->setType('pchkorg_min_percent', PARAM_INT);
$mform->addElement(
'select',
'pchkorg_exclude_self_plagiarism',
get_string('pchkorg_exclude_self_plagiarism', 'plagiarism_pchkorg'),
array(get_string('no'), get_string('yes'))
);
$mform->addElement(
'select',
'pchkorg_include_referenced',
get_string('pchkorg_include_referenced', 'plagiarism_pchkorg'),
array(get_string('no'), get_string('yes'))
);
$mform->addElement(
'select',
'pchkorg_include_citation',
get_string('pchkorg_include_citation', 'plagiarism_pchkorg'),
array(get_string('no'), get_string('yes'))
);
$this->add_action_buttons(true);
}

View File

@ -39,6 +39,9 @@ $string['pchkorg_check_for_plagiarism'] = 'Check for plagiarism';
$string['pchkorg_min_percent'] = 'Exclude sources below X% similarity';
$string['pchkorg_min_percent_help'] = 'Exclude sources below X% similarity';
$string['pchkorg_min_percent_range'] = 'Must be between 0 and 99';
$string['pchkorg_exclude_self_plagiarism'] = 'Exclude self-plagiarism';
$string['pchkorg_include_referenced'] = 'Include References';
$string['pchkorg_include_citation'] = 'Include Quotes';
$string['pchkorg_disclosure'] = 'Submission will be sent to <a target="_blank" href="https://plagiarismcheck.org/">PlagiarismCheck.org</a> for check.
<br />
By submitting assignment I agree with <a target="_blank" href="https://plagiarismcheck.org/terms-of-service/">Terms &amp; Conditions</a>