mirror of
https://github.com/moodle/moodle.git
synced 2025-04-13 20:42:22 +02:00
MDL-67526 plagiarism: Final deprecation of plagiarism functions
Following MDL-65835 this now finally deprecates and removes the functions: - plagiarism_save_form_elements(), please use {plugin name}_coursemodule_edit_post_actions() instead - plagiarism_get_form_elements_module(), please use {plugin name}_coursemodule_standard_elements() instead. - plagiarism_plugin::get_form_elements_module(), please use {plugin name}_coursemodule_edit_post_actions() instead. - plagiarism_plugin::save_form_elements(), please use {plugin name}_coursemodule_standard_elements() instead. Signed-off-by: Daniel Ziegenberg <daniel@ziegenberg.at>
This commit is contained in:
parent
5e1df25566
commit
3018036ebd
@ -405,10 +405,6 @@ function edit_module_post_actions($moduleinfo, $course) {
|
||||
}
|
||||
}
|
||||
|
||||
// To be removed (deprecated) with MDL-67526 (both lines).
|
||||
require_once($CFG->libdir.'/plagiarismlib.php');
|
||||
plagiarism_save_form_elements($moduleinfo);
|
||||
|
||||
// Allow plugins to extend the course module form.
|
||||
$moduleinfo = plugin_extend_coursemodule_edit_post_actions($moduleinfo, $course);
|
||||
|
||||
|
@ -3187,6 +3187,27 @@ function user_get_participants($courseid, $groupid, $accesssince, $roleid, $enro
|
||||
return $DB->get_recordset_sql("$select $from $where $sort", $params, $limitfrom, $limitnum);
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated Since Moodle 3.9. MDL-65835
|
||||
*/
|
||||
function plagiarism_save_form_elements() {
|
||||
throw new coding_exception(
|
||||
'Function plagiarism_save_form_elements() has been removed. ' .
|
||||
'Please use {plugin name}_coursemodule_edit_post_actions() instead.'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated Since Moodle 3.9. MDL-65835
|
||||
*/
|
||||
function plagiarism_get_form_elements_module() {
|
||||
throw new coding_exception(
|
||||
'Function plagiarism_get_form_elements_module() has been removed. ' .
|
||||
'Please use {plugin name}_coursemodule_standard_elements() instead.'
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns the list of full course categories to be used in html_writer::select()
|
||||
*
|
||||
|
@ -82,65 +82,6 @@ function plagiarism_get_file_results($cmid, $userid, $file) {
|
||||
return $allresults;
|
||||
}
|
||||
|
||||
/**
|
||||
* saves/updates plagiarism settings from a modules config page - called by course/modedit.php
|
||||
*
|
||||
* @deprecated Since Moodle 3.9. MDL-65835 Please use {plugin name}_coursemodule_edit_post_actions() instead.
|
||||
* @todo MDL-67526 This is to be moved from here to deprecatedlib.php in Moodle 4.1
|
||||
* @param object $data - form data
|
||||
*/
|
||||
function plagiarism_save_form_elements($data) {
|
||||
global $CFG;
|
||||
if (empty($CFG->enableplagiarism)) {
|
||||
return '';
|
||||
}
|
||||
$plagiarismplugins = plagiarism_load_available_plugins();
|
||||
foreach ($plagiarismplugins as $plugin => $dir) {
|
||||
require_once($dir.'/lib.php');
|
||||
$plagiarismclass = "plagiarism_plugin_$plugin";
|
||||
$plagiarismplugin = new $plagiarismclass;
|
||||
|
||||
$reflectionmethod = new ReflectionMethod($plagiarismplugin, 'save_form_elements');
|
||||
if ($reflectionmethod->getDeclaringClass()->getName() == get_class($plagiarismplugin)) {
|
||||
$text = 'plagiarism_plugin::save_form_elements() is deprecated.';
|
||||
$text .= ' Use plagiarism_' . $plugin . '_coursemodule_edit_post_actions() instead';
|
||||
debugging($text, DEBUG_DEVELOPER);
|
||||
}
|
||||
|
||||
$plagiarismplugin->save_form_elements($data);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* adds the list of plagiarism settings to a form - called inside modules that have enabled plagiarism
|
||||
*
|
||||
* @deprecated Since Moodle 3.9. MDL-65835 Please use {plugin name}_coursemodule_standard_elements() instead.
|
||||
* @todo MDL-67526 This is to be moved from here to deprecatedlib.php in Moodle 4.1
|
||||
* @param object $mform - Moodle form object
|
||||
* @param object $context - context object
|
||||
* @param string $modulename - Name of the module
|
||||
*/
|
||||
function plagiarism_get_form_elements_module($mform, $context, $modulename = "") {
|
||||
global $CFG;
|
||||
if (empty($CFG->enableplagiarism)) {
|
||||
return '';
|
||||
}
|
||||
$plagiarismplugins = plagiarism_load_available_plugins();
|
||||
foreach ($plagiarismplugins as $plugin => $dir) {
|
||||
require_once($dir.'/lib.php');
|
||||
$plagiarismclass = "plagiarism_plugin_$plugin";
|
||||
$plagiarismplugin = new $plagiarismclass;
|
||||
|
||||
$reflectionmethod = new ReflectionMethod($plagiarismplugin, 'get_form_elements_module');
|
||||
if ($reflectionmethod->getDeclaringClass()->getName() == get_class($plagiarismplugin)) {
|
||||
$text = 'plagiarism_plugin::get_form_elements_module() is deprecated.';
|
||||
$text .= ' Use plagiarism_' . $plugin . '_coursemodule_standard_elements() instead';
|
||||
debugging($text, DEBUG_DEVELOPER);
|
||||
}
|
||||
|
||||
$plagiarismplugin->get_form_elements_module($mform, $context, $modulename);
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Allows a plagiarism plugin to print a button/link at the top of activity overview report pages.
|
||||
*
|
||||
@ -197,12 +138,10 @@ function plagiarism_print_disclosure($cmid) {
|
||||
/**
|
||||
* Helper function - also loads lib file of plagiarism plugin
|
||||
*
|
||||
* @todo MDL-67872 the deprecated code in this function to be removed in Moodle 4.1
|
||||
* @return array of available plugins
|
||||
*/
|
||||
function plagiarism_load_available_plugins() {
|
||||
global $CFG;
|
||||
static $showndeprecatedmessage = array(); // Only show message once per page load.
|
||||
|
||||
if (empty($CFG->enableplagiarism)) {
|
||||
return array();
|
||||
@ -211,18 +150,7 @@ function plagiarism_load_available_plugins() {
|
||||
$availableplugins = array();
|
||||
foreach ($plagiarismplugins as $plugin => $dir) {
|
||||
// Check this plugin is enabled and a lib file exists.
|
||||
if (get_config('plagiarism', $plugin."_use")) {
|
||||
// Deprecated Since Moodle 3.9.
|
||||
$pluginenabled = true;
|
||||
if (empty($showndeprecatedmessage[$plugin])) {
|
||||
$text = 'The setting plagiarism:'.$plugin.'_use is deprecated.';
|
||||
$text .= ' Use plagiarism_' . $plugin . ':enabled instead';
|
||||
debugging($text, DEBUG_DEVELOPER);
|
||||
$showndeprecatedmessage[$plugin] = true;
|
||||
}
|
||||
} else {
|
||||
$pluginenabled = get_config('plagiarism_'.$plugin, 'enabled');
|
||||
}
|
||||
$pluginenabled = get_config('plagiarism_'.$plugin, 'enabled');
|
||||
if ($pluginenabled && file_exists($dir."/lib.php")) {
|
||||
require_once($dir.'/lib.php');
|
||||
$plagiarismclass = "plagiarism_plugin_$plugin";
|
||||
|
@ -202,12 +202,6 @@ class mod_assign_mod_form extends moodleform_mod {
|
||||
$mform->addElement('selectyesno', 'sendstudentnotifications', $name);
|
||||
$mform->addHelpButton('sendstudentnotifications', 'sendstudentnotificationsdefault', 'assign');
|
||||
|
||||
// Plagiarism enabling form. To be removed (deprecated) with MDL-67526.
|
||||
if (!empty($CFG->enableplagiarism)) {
|
||||
require_once($CFG->libdir . '/plagiarismlib.php');
|
||||
plagiarism_get_form_elements_module($mform, $ctx->get_course_context(), 'mod_assign');
|
||||
}
|
||||
|
||||
$this->standard_grading_coursemodule_elements();
|
||||
$name = get_string('blindmarking', 'assign');
|
||||
$mform->addElement('selectyesno', 'blindmarking', $name);
|
||||
|
@ -205,10 +205,6 @@ class mod_forum_mod_form extends moodleform_mod {
|
||||
$mform->addHelpButton('warnafter', 'warnafter', 'forum');
|
||||
$mform->hideIf('warnafter', 'blockperiod', 'eq', 0);
|
||||
|
||||
$coursecontext = context_course::instance($COURSE->id);
|
||||
// To be removed (deprecated) with MDL-67526.
|
||||
plagiarism_get_form_elements_module($mform, $coursecontext, 'mod_forum');
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
|
||||
// Add the whole forum grading options.
|
||||
|
@ -247,10 +247,6 @@ class mod_workshop_mod_form extends moodleform_mod {
|
||||
$label = get_string('assessmentend', 'workshop');
|
||||
$mform->addElement('date_time_selector', 'assessmentend', $label, array('optional' => true));
|
||||
|
||||
$coursecontext = context_course::instance($this->course->id);
|
||||
// To be removed (deprecated) with MDL-67526.
|
||||
plagiarism_get_form_elements_module($mform, $coursecontext, 'mod_workshop');
|
||||
|
||||
// Common module settings, Restrict availability, Activity completion etc. ----
|
||||
$features = array('groups' => true, 'groupings' => true,
|
||||
'outcomes' => true, 'gradecat' => false, 'idnumber' => false);
|
||||
|
@ -72,24 +72,6 @@ abstract class plagiarism_plugin {
|
||||
public function get_file_results($cmid, $userid, $file) {
|
||||
return array('analyzed' => '', 'score' => '', 'reporturl' => '');
|
||||
}
|
||||
/**
|
||||
* hook to add plagiarism specific settings to a module settings page
|
||||
* @deprecated Since Moodle 3.9. MDL-65835 Please use {plugin name}_coursemodule_edit_post_actions() instead.
|
||||
* @todo MDL-67526 Remove this method.
|
||||
* @param object $mform - Moodle form
|
||||
* @param object $context - current context
|
||||
* @param string $modulename - Name of the module
|
||||
*/
|
||||
public function get_form_elements_module($mform, $context, $modulename = "") {
|
||||
}
|
||||
/**
|
||||
* hook to save plagiarism specific settings on a module settings page
|
||||
* @deprecated Since Moodle 3.9. MDL-65835 Please use {plugin name}_coursemodule_standard_elements() instead.
|
||||
* @todo MDL-67526 Remove this method.
|
||||
* @param object $data - data from an mform submission.
|
||||
*/
|
||||
public function save_form_elements($data) {
|
||||
}
|
||||
/**
|
||||
* hook to allow a disclosure to be printed notifying users what will happen with their submission
|
||||
* @param int $cmid - course module id
|
||||
|
@ -1,5 +1,12 @@
|
||||
This files describes API changes for code that uses the plagiarism API.
|
||||
|
||||
=== 4.2 ===
|
||||
* Final deprecation and removal of the following functions:
|
||||
- plagiarism_save_form_elements(), please use {plugin name}_coursemodule_edit_post_actions() instead.
|
||||
- plagiarism_get_form_elements_module(), please use {plugin name}_coursemodule_standard_elements() instead.
|
||||
- plagiarism_plugin::get_form_elements_module(), please use {plugin name}_coursemodule_edit_post_actions() instead.
|
||||
- plagiarism_plugin::save_form_elements(), please use {plugin name}_coursemodule_standard_elements() instead.
|
||||
|
||||
=== 4.0 ===
|
||||
* The method update_status() has been deprecated. Please use {plugin name}_before_standard_top_of_body_html() instead.
|
||||
* The method get_configs() has been deprecated and will be removed from the abstract class as it was not used in core.
|
||||
|
Loading…
x
Reference in New Issue
Block a user