1
0
mirror of https://github.com/PlagiarismCheck/moodle-plagiarism_pchkorg.git synced 2024-12-22 04:10:07 +00:00

v 3.14.5 add new option and fix quiz

This commit is contained in:
Jane Adelmann 2023-10-12 16:37:14 +03:00
parent 04a22a1d3d
commit aa44efdf0b
No known key found for this signature in database
GPG Key ID: 4CCF39DF30B8AF72
4 changed files with 27 additions and 6 deletions

View File

@ -86,6 +86,14 @@ class plagiarism_pchkorg_setup_form extends moodleform {
array(get_string('no'), get_string('yes')) array(get_string('no'), get_string('yes'))
); );
$mform->addElement(
'select',
'pchkorg_enabled_by_default',
get_string('pchkorg:enabledbydefault', 'plagiarism_pchkorg'),
array(get_string('no'), get_string('yes'))
);
$mform->setDefault('pchkorg_enabled_by_default', '1');
$this->add_action_buttons(true); $this->add_action_buttons(true);
} }

View File

@ -97,3 +97,4 @@ $string['pchkorg_label_queued'] = 'In queue';
$string['pchkorg:enable'] = 'Allow to enable/disable PlagiarismCheck.org inside an activity'; $string['pchkorg:enable'] = 'Allow to enable/disable PlagiarismCheck.org inside an activity';
$string['pchkorg:viewsimilarity'] = 'Allow to view similarity value from PlagiarismCheck.org'; $string['pchkorg:viewsimilarity'] = 'Allow to view similarity value from PlagiarismCheck.org';
$string['pchkorg:changeminpercentfilter'] = 'Allow changing "Exclude sources below X% similarity"'; $string['pchkorg:changeminpercentfilter'] = 'Allow changing "Exclude sources below X% similarity"';
$string['pchkorg:enabledbydefault'] = 'Enable PlagiarismCheck in Activities by default';

20
lib.php
View File

@ -97,7 +97,13 @@ function plagiarism_pchkorg_coursemodule_standard_elements($formwrapper, $mform)
if (null === $cm) { if (null === $cm) {
if (!isset($exportedvalues['pchkorg_module_use']) if (!isset($exportedvalues['pchkorg_module_use'])
|| is_null($exportedvalues['pchkorg_module_use'])) { || is_null($exportedvalues['pchkorg_module_use'])) {
$mform->setDefault('pchkorg_module_use', '1'); $enabledbydefault = $pchkorgconfigmodel->get_system_config('pchkorg_enabled_by_default');
if ('1' === $enabledbydefault || null === $enabledbydefault) {
$mform->setDefault('pchkorg_module_use', '1');
}
if ('0' === $enabledbydefault) {
$mform->setDefault('pchkorg_module_use', '0');
}
} }
} else { } else {
$records = $DB->get_records('plagiarism_pchkorg_config', array( $records = $DB->get_records('plagiarism_pchkorg_config', array(
@ -284,7 +290,11 @@ class plagiarism_plugin_pchkorg extends plagiarism_plugin {
$isdebugenabled = $pchkorgconfigmodel->get_system_config('pchkorg_enable_debug') === '1'; $isdebugenabled = $pchkorgconfigmodel->get_system_config('pchkorg_enable_debug') === '1';
$apiprovider = new plagiarism_pchkorg_api_provider($apitoken); $apiprovider = new plagiarism_pchkorg_api_provider($apitoken);
$cmid = $linkarray['cmid']; $cmid = null;
if (array_key_exists('cmid', $linkarray)) {
$cmid = $linkarray['cmid'];
}
if (array_key_exists('file', $linkarray)) { if (array_key_exists('file', $linkarray)) {
$file = $linkarray['file']; $file = $linkarray['file'];
} else { } else {
@ -1159,11 +1169,13 @@ display: inline-block;"
if ($cm->modname === 'quiz') { if ($cm->modname === 'quiz') {
if ($filedb->fileid === null) { if ($filedb->fileid === null) {
$questionanswers = $DB->get_records_sql( $questionanswers = $DB->get_records_sql(
"SELECT {question_attempts}.responsesummary " "SELECT {question_attempts}.responsesummary "
." FROM {question_attempts} " ." FROM {question_attempts} "
." INNER JOIN {question} on {question}.id = {question_attempts}.questionid " ." INNER JOIN {question} on {question}.id = {question_attempts}.questionid "
." WHERE {question_attempts}.questionusageid = ? AND {question}.qtype = 'essay' ", array( ." INNER JOIN {quiz_attempts} on {quiz_attempts}.uniqueid = {question_attempts}.questionusageid "
." WHERE {quiz_attempts}.id= ? AND {question}.qtype = 'essay' ", array(
$filedb->itemid $filedb->itemid
) )
); );

View File

@ -26,9 +26,9 @@ defined('MOODLE_INTERNAL') || die();
if (!isset($plugin)) { if (!isset($plugin)) {
$plugin = new stdClass(); $plugin = new stdClass();
} }
$plugin->version = 2023070415; $plugin->version = 2023101216;
$plugin->requires = 2020061501; // Requires Moodle 3.9 . $plugin->requires = 2020061501; // Requires Moodle 3.9 .
$plugin->release = 'v3.14.4'; $plugin->release = 'v3.14.5';
$plugin->component = 'plagiarism_pchkorg'; $plugin->component = 'plagiarism_pchkorg';
$plugin->maturity = MATURITY_STABLE; $plugin->maturity = MATURITY_STABLE;
$plugin->dependencies = array( $plugin->dependencies = array(