mirror of
https://github.com/moodle/moodle.git
synced 2025-01-17 13:38:32 +01:00
Merge branch 'MDL-62535-master' of git://github.com/abgreeve/moodle
This commit is contained in:
commit
cf76059eda
@ -76,6 +76,16 @@ class metadata_registry {
|
||||
if (isset($contributedplugins[$plugintype][$shortname])) {
|
||||
$internaldata['external'] = true;
|
||||
}
|
||||
|
||||
// Check if the interface is deprecated.
|
||||
if (!$manager->is_empty_subsystem($component)) {
|
||||
$classname = $manager->get_provider_classname_for_component($component);
|
||||
$componentclass = new $classname();
|
||||
if ($componentclass instanceof \core_privacy\local\deprecated) {
|
||||
$internaldata['deprecated'] = true;
|
||||
}
|
||||
}
|
||||
|
||||
return $internaldata;
|
||||
}, $leaves['plugins']);
|
||||
$fullyrichtree[$branch]['plugin_type_raw'] = $plugintype;
|
||||
|
@ -86,6 +86,8 @@ $string['deletepurposetext'] = 'Are you sure you want to delete the purpose \'{$
|
||||
$string['defaultssaved'] = 'Defaults saved';
|
||||
$string['deny'] = 'Deny';
|
||||
$string['denyrequest'] = 'Deny request';
|
||||
$string['deprecated'] = 'Deprecated';
|
||||
$string['deprecatedexplanation'] = 'This plugin is using an old version of one of the privacy interfaces and should be updated.';
|
||||
$string['download'] = 'Download';
|
||||
$string['downloadexpireduser'] = 'Download has expired. Submit a new request if you wish to export your personal data.';
|
||||
$string['dporolemapping'] = 'Privacy officer role mapping';
|
||||
|
@ -61,6 +61,9 @@
|
||||
{{#external}}
|
||||
<span class="badge badge-pill badge-notice">{{#str}}external, tool_dataprivacy{{/str}}</span>
|
||||
{{/external}}
|
||||
{{#deprecated}}
|
||||
<span class="badge badge-pill badge-warning">{{#str}}deprecated, tool_dataprivacy{{/str}}</span>
|
||||
{{/deprecated}}
|
||||
</div>
|
||||
|
||||
{{#compliant}}
|
||||
|
@ -45,6 +45,8 @@
|
||||
<dd>{{#str}}requiresattentionexplanation, tool_dataprivacy{{/str}}</dd>
|
||||
<dt><span class="badge badge-pill badge-notice">{{#str}}external, tool_dataprivacy{{/str}}</span></dt>
|
||||
<dd>{{#str}}externalexplanation, tool_dataprivacy{{/str}}</dd>
|
||||
<dt><span class="badge badge-pill badge-warning">{{#str}}deprecated, tool_dataprivacy{{/str}}</span></dt>
|
||||
<dd>{{#str}}deprecatedexplanation, tool_dataprivacy{{/str}}</dd>
|
||||
</dl>
|
||||
<hr />
|
||||
<div class="clearfix"><a class="tool_dataprivacy-expand-all pull-right" href="#" data-visibility-state='visible'>{{#str}}visible, tool_dataprivacy{{/str}}</a></div>
|
||||
|
@ -26,8 +26,6 @@ namespace core_grading\privacy;
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
use core_privacy\local\request\approved_contextlist;
|
||||
|
||||
/**
|
||||
* The trait used to provide backwards compatability for third-party plugins.
|
||||
*
|
||||
@ -36,9 +34,32 @@ use core_privacy\local\request\approved_contextlist;
|
||||
*/
|
||||
trait gradingform_legacy_polyfill {
|
||||
|
||||
/**
|
||||
* Export user data relating to an instance ID.
|
||||
*
|
||||
* @param \context $context Context to use with the export writer.
|
||||
* @param int $instanceid The instance ID to export data for.
|
||||
* @param array $subcontext The directory to export this data to.
|
||||
*/
|
||||
public static function export_gradingform_instance_data(\context $context, int $instanceid, array $subcontext) {
|
||||
static::_export_gradingform_instance_data($context, $instanceid, $subcontext);
|
||||
}
|
||||
|
||||
/**
|
||||
* Deletes all user data related to the provided instance IDs.
|
||||
*
|
||||
* @param array $instanceids The instance IDs to delete information from.
|
||||
*/
|
||||
public static function delete_gradingform_for_instances(array $instanceids) {
|
||||
static::_delete_gradingform_for_instances($instanceids);
|
||||
}
|
||||
|
||||
/**
|
||||
* This method is used to export any user data this sub-plugin has using the object to get the context and userid.
|
||||
*
|
||||
* @deprecated Since Moodle 3.6 MDL-62535 Please use the methods in the gradingform_provider_v2 interface.
|
||||
* @todo MDL-63137 remove this method.
|
||||
*
|
||||
* @param context $context Context owner of the data.
|
||||
* @param stdClass $definition Grading definition entry to export.
|
||||
* @param int $userid The user whose information is to be exported.
|
||||
@ -46,25 +67,34 @@ trait gradingform_legacy_polyfill {
|
||||
* @return stdClass The data to export.
|
||||
*/
|
||||
public static function get_gradingform_export_data(\context $context, $definition, int $userid) {
|
||||
debugging('This method is deprecated. Please use the gradingform_provider_v2 interface', DEBUG_DEVELOPER);
|
||||
return static::_get_gradingform_export_data($context, $definition, $userid);
|
||||
}
|
||||
|
||||
/**
|
||||
* Any call to this method should delete all user data for the context defined.
|
||||
*
|
||||
* @deprecated Since Moodle 3.6 MDL-62535 Please use the methods in the gradingform_provider_v2 interface.
|
||||
* @todo MDL-63137 remove this method.
|
||||
*
|
||||
* @param context $context Context owner of the data.
|
||||
*/
|
||||
public static function delete_gradingform_for_context(\context $context) {
|
||||
debugging('This method is deprecated. Please use the gradingform_provider_v2 interface', DEBUG_DEVELOPER);
|
||||
static::_delete_gradingform_for_context($context);
|
||||
}
|
||||
|
||||
/**
|
||||
* A call to this method should delete user data (where practicle) from the userid and context.
|
||||
*
|
||||
* @deprecated Since Moodle 3.6 MDL-62535 Please use the methods in the gradingform_provider_v2 interface.
|
||||
* @todo MDL-63137 remove this method.
|
||||
*
|
||||
* @param int $userid The user whose information is to be deleted.
|
||||
* @param context $context Context owner of the data.
|
||||
*/
|
||||
public static function delete_gradingform_for_userid(int $userid, \context $context) {
|
||||
debugging('This method is deprecated. Please use the gradingform_provider_v2 interface', DEBUG_DEVELOPER);
|
||||
static::_delete_gradingform_for_userid($userid, $context);
|
||||
}
|
||||
}
|
||||
|
@ -19,6 +19,9 @@
|
||||
*
|
||||
* Grading method plugins should implement this if they store personal information.
|
||||
*
|
||||
* @deprecated since Moodle 3.6 MDL-62535 Please use the gradingform_provider_v2 interface
|
||||
* @todo MDL-63167 Remove this file.
|
||||
*
|
||||
* @package core_grading
|
||||
* @copyright 2018 Sara Arjona <sara@moodle.com>
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
@ -31,11 +34,15 @@ defined('MOODLE_INTERNAL') || die();
|
||||
use core_privacy\local\request\approved_contextlist;
|
||||
|
||||
interface gradingform_provider extends
|
||||
\core_privacy\local\request\plugin\subsystem_provider {
|
||||
\core_privacy\local\request\plugin\subsystem_provider,
|
||||
\core_privacy\local\deprecated {
|
||||
|
||||
/**
|
||||
* This method is used to export any user data this sub-plugin has using the object to get the context and userid.
|
||||
*
|
||||
* @deprecated since Moodle 3.6 MDL-62535 Please use the methods in the gradingform_provider_v2 interface
|
||||
* @todo MDL-63167 Remove this file.
|
||||
*
|
||||
* @param \context $context Context owner of the data.
|
||||
* @param \stdClass $definition Grading definition entry to export.
|
||||
* @param int $userid The user whose information is to be exported.
|
||||
@ -47,6 +54,9 @@ interface gradingform_provider extends
|
||||
/**
|
||||
* Any call to this method should delete all user data for the context defined.
|
||||
*
|
||||
* @deprecated since Moodle 3.6 MDL-62535 Please use the methods in the gradingform_provider_v2 interface
|
||||
* @todo MDL-63167 Remove this file.
|
||||
*
|
||||
* @param \context $context Context owner of the data.
|
||||
*/
|
||||
public static function delete_gradingform_for_context(\context $context);
|
||||
@ -54,6 +64,9 @@ interface gradingform_provider extends
|
||||
/**
|
||||
* A call to this method should delete user data (where practicle) from the userid and context.
|
||||
*
|
||||
* @deprecated since Moodle 3.6 MDL-62535 Please use the methods in the gradingform_provider_v2 interface
|
||||
* @todo MDL-63167 Remove this file.
|
||||
*
|
||||
* @param int $userid The user to delete.
|
||||
* @param \context $context the context to refine the deletion.
|
||||
*/
|
||||
|
46
grade/grading/classes/privacy/gradingform_provider_v2.php
Normal file
46
grade/grading/classes/privacy/gradingform_provider_v2.php
Normal file
@ -0,0 +1,46 @@
|
||||
<?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/>.
|
||||
|
||||
/**
|
||||
* Privacy class for requesting user data.
|
||||
*
|
||||
* @package core_grading
|
||||
* @copyright 2018 Adrian Greeve <adriangreeve.com>
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
namespace core_grading\privacy;
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
interface gradingform_provider_v2 extends
|
||||
\core_privacy\local\request\plugin\subsystem_provider {
|
||||
|
||||
/**
|
||||
* Export user data relating to an instance ID.
|
||||
*
|
||||
* @param \context $context Context to use with the export writer.
|
||||
* @param int $instanceid The instance ID to export data for.
|
||||
* @param array $subcontext The directory to export this data to.
|
||||
*/
|
||||
public static function export_gradingform_instance_data(\context $context, int $instanceid, array $subcontext);
|
||||
|
||||
/**
|
||||
* Deletes all user data related to the provided instance IDs.
|
||||
*
|
||||
* @param array $instanceids The instance IDs to delete information from.
|
||||
*/
|
||||
public static function delete_gradingform_for_instances(array $instanceids);
|
||||
}
|
@ -133,6 +133,73 @@ class provider implements
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Export all user data related to a context and itemid.
|
||||
*
|
||||
* @param \context $context Context to export on.
|
||||
* @param int $itemid Item ID to export on.
|
||||
* @param array $subcontext Directory location to export to.
|
||||
*/
|
||||
public static function export_item_data(\context $context, int $itemid, array $subcontext) {
|
||||
global $DB;
|
||||
|
||||
$sql = "SELECT gi.id AS instanceid, gd.id AS definitionid, gd.method
|
||||
FROM {grading_areas} ga
|
||||
JOIN {grading_definitions} gd ON gd.areaid = ga.id
|
||||
JOIN {grading_instances} gi ON gi.definitionid = gd.id AND gi.itemid = :itemid
|
||||
WHERE ga.contextid = :contextid";
|
||||
$params = [
|
||||
'itemid' => $itemid,
|
||||
'contextid' => $context->id,
|
||||
];
|
||||
$records = $DB->get_recordset_sql($sql, $params);
|
||||
foreach ($records as $record) {
|
||||
$instancedata = manager::component_class_callback(
|
||||
"gradingform_{$record->method}",
|
||||
gradingform_provider_v2::class,
|
||||
'export_gradingform_instance_data',
|
||||
[$context, $record->instanceid, $subcontext]
|
||||
);
|
||||
}
|
||||
$records->close();
|
||||
}
|
||||
|
||||
/**
|
||||
* Deletes all user data related to a context and possibly an itemid.
|
||||
*
|
||||
* @param \context $context The context to delete on.
|
||||
* @param int|null $itemid An optional item ID to refine the deletion.
|
||||
*/
|
||||
public static function delete_instance_data(\context $context, int $itemid = null) {
|
||||
global $DB;
|
||||
$itemsql = '';
|
||||
$params = ['contextid' => $context->id];
|
||||
if (isset($itemid)) {
|
||||
$params['itemid'] = $itemid;
|
||||
$itemsql = 'AND gi.itemid = :itemid';
|
||||
}
|
||||
$sql = "SELECT gi.id AS instanceid, gd.id, gd.method
|
||||
FROM {grading_definitions} gd
|
||||
JOIN {grading_instances} gi ON gi.definitionid = gd.id
|
||||
JOIN {grading_areas} ga ON ga.id = gd.areaid
|
||||
WHERE ga.contextid = :contextid $itemsql";
|
||||
$records = $DB->get_records_sql($sql, $params);
|
||||
if ($records) {
|
||||
$firstrecord = current($records);
|
||||
$method = $firstrecord->method;
|
||||
$instanceids = array_map(function($record) {
|
||||
return $record->instanceid;
|
||||
}, $records);
|
||||
manager::component_class_callback(
|
||||
"gradingform_{$method}",
|
||||
gradingform_provider_v2::class,
|
||||
'delete_gradingform_for_instances',
|
||||
[$instanceids]);
|
||||
// Delete grading_instances rows.
|
||||
$DB->delete_records_list('grading_instances', 'id', $instanceids);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Exports the data related to grading definitions within the specified context/subcontext.
|
||||
*
|
||||
@ -191,6 +258,8 @@ class provider implements
|
||||
if (!empty($definition->timecopied)) {
|
||||
$tmpdata['timecopied'] = transform::datetime($definition->timecopied);
|
||||
}
|
||||
|
||||
// MDL-63167 - This section is to be removed with the final deprecation of the gradingform_provider interface.
|
||||
// Export gradingform information (if needed).
|
||||
$instancedata = manager::component_class_callback(
|
||||
"gradingform_{$definition->method}",
|
||||
@ -201,6 +270,7 @@ class provider implements
|
||||
if (null !== $instancedata) {
|
||||
$tmpdata = array_merge($tmpdata, $instancedata);
|
||||
}
|
||||
// End of section to be removed with deprecation.
|
||||
|
||||
$defdata[] = (object) $tmpdata;
|
||||
|
||||
@ -258,34 +328,35 @@ class provider implements
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete all use data which matches the specified $context.
|
||||
* No deletion of the advanced grading is done.
|
||||
*
|
||||
* We never delete grading content.
|
||||
*
|
||||
* @param context $context A user context.
|
||||
* @param \context $context the context to delete in.
|
||||
*/
|
||||
public static function delete_data_for_all_users_in_context(\context $context) {
|
||||
// MDL-63167 - This section is to be removed with the final deprecation of the gradingform_provider interface.
|
||||
manager::plugintype_class_callback(
|
||||
'gradingform',
|
||||
gradingform_provider::class,
|
||||
'delete_gradingform_for_context',
|
||||
[$context]
|
||||
);
|
||||
// End of section to be removed for final deprecation.
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete all user data for the specified user, in the specified contexts.
|
||||
* Deletion of data in this provider is only related to grades and so can not be
|
||||
* deleted for the creator of the advanced grade criteria.
|
||||
*
|
||||
* We never delete grading content.
|
||||
*
|
||||
* @param approved_contextlist $contextlist The approved contexts and user information to delete information for.
|
||||
* @param approved_contextlist $contextlist a list of contexts approved for deletion.
|
||||
*/
|
||||
public static function delete_data_for_user(approved_contextlist $contextlist) {
|
||||
// MDL-63167 - This section is to be removed with the final deprecation of the gradingform_provider interface.
|
||||
manager::plugintype_class_callback(
|
||||
'gradingform',
|
||||
gradingform_provider::class,
|
||||
'delete_gradingform_for_userid',
|
||||
[$contextlist]
|
||||
);
|
||||
// End of section to be removed for final deprecation.
|
||||
}
|
||||
}
|
||||
|
@ -38,6 +38,7 @@ use \core_privacy\local\request\writer;
|
||||
*/
|
||||
class provider implements
|
||||
\core_privacy\local\metadata\provider,
|
||||
\core_grading\privacy\gradingform_provider_v2,
|
||||
\core_privacy\local\request\user_preference_provider {
|
||||
|
||||
/**
|
||||
@ -47,6 +48,12 @@ class provider implements
|
||||
* @return collection A listing of user data stored through this system.
|
||||
*/
|
||||
public static function get_metadata(collection $collection) : collection {
|
||||
$collection->add_database_table('gradingform_guide_fillings', [
|
||||
'instanceid' => 'privacy:metadata:instanceid',
|
||||
'criterionid' => 'privacy:metadata:criterionid',
|
||||
'remark' => 'privacy:metadata:remark',
|
||||
'score' => 'privacy:metadata:score'
|
||||
], 'privacy:metadata:fillingssummary');
|
||||
$collection->add_user_preference(
|
||||
'gradingform_guide-showmarkerdesc',
|
||||
'privacy:metadata:preference:showmarkerdesc'
|
||||
@ -59,6 +66,38 @@ class provider implements
|
||||
return $collection;
|
||||
}
|
||||
|
||||
/**
|
||||
* Export user data relating to an instance ID.
|
||||
*
|
||||
* @param \context $context Context to use with the export writer.
|
||||
* @param int $instanceid The instance ID to export data for.
|
||||
* @param array $subcontext The directory to export this data to.
|
||||
*/
|
||||
public static function export_gradingform_instance_data(\context $context, int $instanceid, array $subcontext) {
|
||||
global $DB;
|
||||
// Get records from the provided params.
|
||||
$params = ['instanceid' => $instanceid];
|
||||
$sql = "SELECT gc.shortname, gc.description, gc.maxscore, gf.score, gf.remark
|
||||
FROM {gradingform_guide_fillings} gf
|
||||
JOIN {gradingform_guide_criteria} gc ON gc.id = gf.criterionid
|
||||
WHERE gf.instanceid = :instanceid";
|
||||
$records = $DB->get_records_sql($sql, $params);
|
||||
if ($records) {
|
||||
$subcontext = array_merge($subcontext, [get_string('guide', 'gradingform_guide')]);
|
||||
writer::with_context($context)->export_data($subcontext, (object) $records);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Deletes all user data related to the provided instance IDs.
|
||||
*
|
||||
* @param array $instanceids The instance IDs to delete information from.
|
||||
*/
|
||||
public static function delete_gradingform_for_instances(array $instanceids) {
|
||||
global $DB;
|
||||
$DB->delete_records_list('gradingform_guide_fillings', 'instanceid', $instanceids);
|
||||
}
|
||||
|
||||
/**
|
||||
* Store all user preferences for the plugin.
|
||||
*
|
||||
|
@ -75,8 +75,13 @@ $string['name'] = 'Name';
|
||||
$string['needregrademessage'] = 'The marking guide definition was changed after this student had been graded. The student can not see this marking guide until you check the marking guide and update the grade.';
|
||||
$string['pluginname'] = 'Marking guide';
|
||||
$string['previewmarkingguide'] = 'Preview marking guide';
|
||||
$string['privacy:metadata:criterionid'] = 'An identifier to a criterion for advanced marking.';
|
||||
$string['privacy:metadata:fillingssummary'] = 'Stores information about a user\'s grade and feedback for the marking guide.';
|
||||
$string['privacy:metadata:instanceid'] = 'An identifier to a grade used by an activity.';
|
||||
$string['privacy:metadata:preference:showmarkerdesc'] = 'Whether to show marker criterion descriptions';
|
||||
$string['privacy:metadata:preference:showstudentdesc'] = 'Whether to show student criterion descriptions';
|
||||
$string['privacy:metadata:remark'] = 'Remarks related to this grade criterion.';
|
||||
$string['privacy:metadata:score'] = 'A score for this grade criterion.';
|
||||
$string['regrademessage1'] = 'You are about to save changes to a marking guide that has already been used for grading. Please indicate if existing grades need to be reviewed. If you set this then the marking guide will be hidden from students until their item is regraded.';
|
||||
$string['regrademessage5'] = 'You are about to save significant changes to a marking guide that has already been used for grading. The gradebook value will be unchanged, but the marking guide will be hidden from students until their item is regraded.';
|
||||
$string['regradeoption0'] = 'Do not mark for regrade';
|
||||
|
@ -25,6 +25,9 @@
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
global $CFG;
|
||||
require_once($CFG->dirroot . '/grade/grading/tests/fixtures/marking_guide.php');
|
||||
|
||||
use \core_privacy\tests\provider_testcase;
|
||||
use \core_privacy\local\request\writer;
|
||||
use \gradingform_guide\privacy\provider;
|
||||
@ -74,4 +77,149 @@ class gradingform_guide_privacy_testcase extends provider_testcase {
|
||||
$this->assertEquals(get_string('no'), $prefs->{'gradingform_guide-showmarkerdesc'}->value);
|
||||
$this->assertEquals(get_string('yes'), $prefs->{'gradingform_guide-showstudentdesc'}->value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test the export of rubric data.
|
||||
*/
|
||||
public function test_get_gradingform_export_data() {
|
||||
global $DB;
|
||||
$this->resetAfterTest();
|
||||
$course = $this->getDataGenerator()->create_course();
|
||||
$module = $this->getDataGenerator()->create_module('assign', ['course' => $course]);
|
||||
$user = $this->getDataGenerator()->create_user();
|
||||
|
||||
$this->setUser($user);
|
||||
|
||||
$modulecontext = context_module::instance($module->cmid);
|
||||
$guide = new test_guide($modulecontext, 'testrubrib', 'Description text');
|
||||
$guide->add_criteria(
|
||||
'Spelling mistakes',
|
||||
'Full marks will be given for no spelling mistakes.',
|
||||
'Deduct 5 points per spelling mistake made.',
|
||||
25
|
||||
);
|
||||
$guide->add_criteria(
|
||||
'Pictures',
|
||||
'Full marks will be given for including 3 pictures.',
|
||||
'Give 5 points for each picture present',
|
||||
15
|
||||
);
|
||||
$guide->create_guide();
|
||||
|
||||
$controller = $guide->manager->get_controller('guide');
|
||||
// In the situation of mod_assign this would be the id from assign_grades.
|
||||
$itemid = 1;
|
||||
$instance = $controller->create_instance($user->id, $itemid);
|
||||
// I need the ids for the criteria and there doesn't seem to be a nice method to get it.
|
||||
$criteria = $DB->get_records('gradingform_guide_criteria');
|
||||
$data = ['criteria' => []];
|
||||
foreach ($criteria as $key => $value) {
|
||||
if ($value->shortname == 'Spelling mistakes') {
|
||||
$data['criteria'][$key]['remark'] = 'This user made several mistakes.';
|
||||
$data['criteria'][$key]['remarkformat'] = 0;
|
||||
$data['criteria'][$key]['score'] = 5;
|
||||
} else {
|
||||
$data['criteria'][$key]['remark'] = 'This user has two pictures.';
|
||||
$data['criteria'][$key]['remarkformat'] = 0;
|
||||
$data['criteria'][$key]['score'] = 10;
|
||||
}
|
||||
}
|
||||
$data['itemid'] = $itemid;
|
||||
|
||||
// Update this instance with data.
|
||||
$instance->update($data);
|
||||
|
||||
// Let's try the method we are testing.
|
||||
provider::export_gradingform_instance_data($modulecontext, $instance->get_id(), ['Test']);
|
||||
$data = (array) writer::with_context($modulecontext)->get_data(['Test', 'Marking guide']);
|
||||
$this->assertCount(2, $data);
|
||||
$this->assertEquals('Spelling mistakes', $data['Spelling mistakes']->shortname);
|
||||
$this->assertEquals('This user made several mistakes.', $data['Spelling mistakes']->remark);
|
||||
$this->assertEquals('Pictures', $data['Pictures']->shortname);
|
||||
$this->assertEquals('This user has two pictures.', $data['Pictures']->remark);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test the deletion of rubric user information via the instance ID.
|
||||
*/
|
||||
public function test_delete_gradingform_for_instances() {
|
||||
global $DB;
|
||||
$this->resetAfterTest();
|
||||
$course = $this->getDataGenerator()->create_course();
|
||||
$module = $this->getDataGenerator()->create_module('assign', ['course' => $course]);
|
||||
$user = $this->getDataGenerator()->create_user();
|
||||
|
||||
$this->setUser($user);
|
||||
|
||||
$modulecontext = context_module::instance($module->cmid);
|
||||
$guide = new test_guide($modulecontext, 'testrubrib', 'Description text');
|
||||
$guide->add_criteria(
|
||||
'Spelling mistakes',
|
||||
'Full marks will be given for no spelling mistakes.',
|
||||
'Deduct 5 points per spelling mistake made.',
|
||||
25
|
||||
);
|
||||
$guide->add_criteria(
|
||||
'Pictures',
|
||||
'Full marks will be given for including 3 pictures.',
|
||||
'Give 5 points for each picture present',
|
||||
15
|
||||
);
|
||||
$guide->create_guide();
|
||||
|
||||
$controller = $guide->manager->get_controller('guide');
|
||||
// In the situation of mod_assign this would be the id from assign_grades.
|
||||
$itemid = 1;
|
||||
$instance = $controller->create_instance($user->id, $itemid);
|
||||
// I need the ids for the criteria and there doesn't seem to be a nice method to get it.
|
||||
$criteria = $DB->get_records('gradingform_guide_criteria');
|
||||
$data = ['criteria' => []];
|
||||
foreach ($criteria as $key => $value) {
|
||||
if ($value->shortname == 'Spelling mistakes') {
|
||||
$data['criteria'][$key]['remark'] = 'This user made several mistakes.';
|
||||
$data['criteria'][$key]['remarkformat'] = 0;
|
||||
$data['criteria'][$key]['score'] = 5;
|
||||
} else {
|
||||
$data['criteria'][$key]['remark'] = 'This user has two pictures.';
|
||||
$data['criteria'][$key]['remarkformat'] = 0;
|
||||
$data['criteria'][$key]['score'] = 10;
|
||||
}
|
||||
}
|
||||
$data['itemid'] = $itemid;
|
||||
|
||||
// Update this instance with data.
|
||||
$instance->update($data);
|
||||
|
||||
$itemid = 2;
|
||||
$instance = $controller->create_instance($user->id, $itemid);
|
||||
// I need the ids for the criteria and there doesn't seem to be a nice method to get it.
|
||||
$criteria = $DB->get_records('gradingform_guide_criteria');
|
||||
$data = ['criteria' => []];
|
||||
foreach ($criteria as $key => $value) {
|
||||
if ($value->shortname == 'Spelling mistakes') {
|
||||
$data['criteria'][$key]['remark'] = 'This user made no mistakes.';
|
||||
$data['criteria'][$key]['remarkformat'] = 0;
|
||||
$data['criteria'][$key]['score'] = 25;
|
||||
} else {
|
||||
$data['criteria'][$key]['remark'] = 'This user has one pictures.';
|
||||
$data['criteria'][$key]['remarkformat'] = 0;
|
||||
$data['criteria'][$key]['score'] = 5;
|
||||
}
|
||||
}
|
||||
$data['itemid'] = $itemid;
|
||||
|
||||
// Update this instance with data.
|
||||
$instance->update($data);
|
||||
|
||||
// Check how many records we have in the fillings table.
|
||||
$records = $DB->get_records('gradingform_guide_fillings');
|
||||
$this->assertCount(4, $records);
|
||||
// Let's delete one of the instances (the last one would be the easiest).
|
||||
provider::delete_gradingform_for_instances([$instance->get_id()]);
|
||||
$records = $DB->get_records('gradingform_guide_fillings');
|
||||
$this->assertCount(2, $records);
|
||||
foreach ($records as $record) {
|
||||
$this->assertNotEquals($instance->get_id(), $record->instanceid);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -26,6 +26,8 @@ namespace gradingform_rubric\privacy;
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
use \core_privacy\local\metadata\collection;
|
||||
|
||||
/**
|
||||
* Privacy class for requesting user data.
|
||||
*
|
||||
@ -33,15 +35,55 @@ defined('MOODLE_INTERNAL') || die();
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
class provider implements
|
||||
\core_privacy\local\metadata\null_provider {
|
||||
\core_privacy\local\metadata\provider,
|
||||
\core_grading\privacy\gradingform_provider_v2 {
|
||||
|
||||
/**
|
||||
* Get the language string identifier with the component's language
|
||||
* file to explain why this plugin stores no data.
|
||||
* Returns meta data about this system.
|
||||
*
|
||||
* @return string
|
||||
* @param collection $collection The initialised collection to add items to.
|
||||
* @return collection A listing of user data stored through this system.
|
||||
*/
|
||||
public static function get_reason() : string {
|
||||
return 'privacy:metadata';
|
||||
public static function get_metadata(collection $collection) : collection {
|
||||
$collection->add_database_table('gradingform_rubric_fillings', [
|
||||
'instanceid' => 'privacy:metadata:instanceid',
|
||||
'criterionid' => 'privacy:metadata:criterionid',
|
||||
'levelid' => 'privacy:metadata:levelid',
|
||||
'remark' => 'privacy:metadata:remark'
|
||||
], 'privacy:metadata:fillingssummary');
|
||||
return $collection;
|
||||
}
|
||||
|
||||
/**
|
||||
* Export user data relating to an instance ID.
|
||||
*
|
||||
* @param \context $context Context to use with the export writer.
|
||||
* @param int $instanceid The instance ID to export data for.
|
||||
* @param array $subcontext The directory to export this data to.
|
||||
*/
|
||||
public static function export_gradingform_instance_data(\context $context, int $instanceid, array $subcontext) {
|
||||
global $DB;
|
||||
// Get records from the provided params.
|
||||
$params = ['instanceid' => $instanceid];
|
||||
$sql = "SELECT rc.description, rl.definition, rl.score, rf.remark
|
||||
FROM {gradingform_rubric_fillings} rf
|
||||
JOIN {gradingform_rubric_criteria} rc ON rc.id = rf.criterionid
|
||||
JOIN {gradingform_rubric_levels} rl ON rf.levelid = rl.id
|
||||
WHERE rf.instanceid = :instanceid";
|
||||
$records = $DB->get_records_sql($sql, $params);
|
||||
if ($records) {
|
||||
$subcontext = array_merge($subcontext, [get_string('rubric', 'gradingform_rubric')]);
|
||||
\core_privacy\local\request\writer::with_context($context)->export_data($subcontext, (object) $records);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Deletes all user data related to the provided instance IDs.
|
||||
*
|
||||
* @param array $instanceids The instance IDs to delete information from.
|
||||
*/
|
||||
public static function delete_gradingform_for_instances(array $instanceids) {
|
||||
global $DB;
|
||||
$DB->delete_records_list('gradingform_rubric_fillings', 'instanceid', $instanceids);
|
||||
}
|
||||
}
|
||||
|
@ -59,7 +59,11 @@ $string['name'] = 'Name';
|
||||
$string['needregrademessage'] = 'The rubric definition was changed after this student had been graded. The student can not see this rubric until you check the rubric and update the grade.';
|
||||
$string['pluginname'] = 'Rubric';
|
||||
$string['previewrubric'] = 'Preview rubric';
|
||||
$string['privacy:metadata'] = 'The rubric grading form plugin does not store any personal data.';
|
||||
$string['privacy:metadata:criterionid'] = 'An identifier for a specific criterion being graded.';
|
||||
$string['privacy:metadata:fillingssummary'] = 'Stores information about the user\'s grade created by the rubric.';
|
||||
$string['privacy:metadata:instanceid'] = 'An identifier relating to a grade in an activity.';
|
||||
$string['privacy:metadata:levelid'] = 'The level obtained in the rubric.';
|
||||
$string['privacy:metadata:remark'] = 'Remarks related to the rubric criterion being assessed.';
|
||||
$string['regrademessage1'] = 'You are about to save changes to a rubric that has already been used for grading. Please indicate if existing grades need to be reviewed. If you set this then the rubric will be hidden from students until their item is regraded.';
|
||||
$string['regrademessage5'] = 'You are about to save significant changes to a rubric that has already been used for grading. The gradebook value will be unchanged, but the rubric will be hidden from students until their item is regraded.';
|
||||
$string['regradeoption0'] = 'Do not mark for regrade';
|
||||
|
312
grade/grading/form/rubric/tests/privacy_test.php
Normal file
312
grade/grading/form/rubric/tests/privacy_test.php
Normal file
@ -0,0 +1,312 @@
|
||||
<?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/>.
|
||||
|
||||
/**
|
||||
* Privacy tests for gradingform_rubric
|
||||
*
|
||||
* @package gradingform_rubric
|
||||
* @category test
|
||||
* @copyright 2018 Adrian Greeve <adriangreeve.com>
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
use \core_privacy\tests\provider_testcase;
|
||||
use \core_privacy\local\request\writer;
|
||||
use \gradingform_rubric\privacy\provider;
|
||||
|
||||
/**
|
||||
* Privacy tests for gradingform_rubric
|
||||
*
|
||||
* @copyright 2018 Adrian Greeve <adriangreeve.com>
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
class gradingform_rubric_privacy_testcase extends provider_testcase {
|
||||
|
||||
/**
|
||||
* Test the export of rubric data.
|
||||
*/
|
||||
public function test_get_gradingform_export_data() {
|
||||
global $DB;
|
||||
$this->resetAfterTest();
|
||||
$course = $this->getDataGenerator()->create_course();
|
||||
$module = $this->getDataGenerator()->create_module('assign', ['course' => $course]);
|
||||
$user = $this->getDataGenerator()->create_user();
|
||||
|
||||
$this->setUser($user);
|
||||
|
||||
$modulecontext = context_module::instance($module->cmid);
|
||||
$rubric = new test_rubric($modulecontext, 'testrubrib', 'Description text');
|
||||
$criterion = new test_criterion('Spelling is important');
|
||||
$criterion->add_level('Nothing but mistakes', 0);
|
||||
$criterion->add_level('Several mistakes', 1);
|
||||
$criterion->add_level('No mistakes', 2);
|
||||
$rubric->add_criteria($criterion);
|
||||
$criterion = new test_criterion('Pictures');
|
||||
$criterion->add_level('No pictures', 0);
|
||||
$criterion->add_level('One picture', 1);
|
||||
$criterion->add_level('More than one picture', 2);
|
||||
$rubric->add_criteria($criterion);
|
||||
$rubric->create_rubric();
|
||||
|
||||
$controller = $rubric->manager->get_controller('rubric');
|
||||
// In the situation of mod_assign this would be the id from assign_grades.
|
||||
$itemid = 1;
|
||||
$instance = $controller->create_instance($user->id, $itemid);
|
||||
// I need the ids for the criteria and there doesn't seem to be a nice method to get it.
|
||||
$criteria = $DB->get_records('gradingform_rubric_criteria');
|
||||
$data = ['criteria' => []];
|
||||
foreach ($criteria as $key => $value) {
|
||||
if ($value->description == 'Spelling is important') {
|
||||
$level = $DB->get_record('gradingform_rubric_levels', ['criterionid' => $key, 'score' => 1]);
|
||||
$data['criteria'][$key]['levelid'] = $level->id;
|
||||
$data['criteria'][$key]['remark'] = 'This user made several mistakes.';
|
||||
} else {
|
||||
$level = $DB->get_record('gradingform_rubric_levels', ['criterionid' => $key, 'score' => 0]);
|
||||
$data['criteria'][$key]['levelid'] = $level->id;
|
||||
$data['criteria'][$key]['remark'] = 'Please add more pictures.';
|
||||
}
|
||||
}
|
||||
$data['itemid'] = $itemid;
|
||||
|
||||
// Update this instance with data.
|
||||
$instance->update($data);
|
||||
|
||||
// Let's try the method we are testing.
|
||||
provider::export_gradingform_instance_data($modulecontext, $instance->get_id(), ['Test']);
|
||||
$data = (array) writer::with_context($modulecontext)->get_data(['Test', 'Rubric']);
|
||||
$this->assertCount(2, $data);
|
||||
$this->assertEquals('Spelling is important', $data['Spelling is important']->description);
|
||||
$this->assertEquals('This user made several mistakes.', $data['Spelling is important']->remark);
|
||||
$this->assertEquals('Pictures', $data['Pictures']->description);
|
||||
$this->assertEquals('Please add more pictures.', $data['Pictures']->remark);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test the deletion of rubric user information via the instance ID.
|
||||
*/
|
||||
public function test_delete_gradingform_for_instances() {
|
||||
global $DB;
|
||||
$this->resetAfterTest();
|
||||
$course = $this->getDataGenerator()->create_course();
|
||||
$module = $this->getDataGenerator()->create_module('assign', ['course' => $course]);
|
||||
$user = $this->getDataGenerator()->create_user();
|
||||
|
||||
$this->setUser($user);
|
||||
|
||||
$modulecontext = context_module::instance($module->cmid);
|
||||
$rubric = new test_rubric($modulecontext, 'testrubrib', 'Description text');
|
||||
$criterion = new test_criterion('Spelling is important');
|
||||
$criterion->add_level('Nothing but mistakes', 0);
|
||||
$criterion->add_level('Several mistakes', 1);
|
||||
$criterion->add_level('No mistakes', 2);
|
||||
$rubric->add_criteria($criterion);
|
||||
$criterion = new test_criterion('Pictures');
|
||||
$criterion->add_level('No pictures', 0);
|
||||
$criterion->add_level('One picture', 1);
|
||||
$criterion->add_level('More than one picture', 2);
|
||||
$rubric->add_criteria($criterion);
|
||||
$rubric->create_rubric();
|
||||
|
||||
$controller = $rubric->manager->get_controller('rubric');
|
||||
// In the situation of mod_assign this would be the id from assign_grades.
|
||||
$itemid = 1;
|
||||
$instance = $controller->create_instance($user->id, $itemid);
|
||||
// I need the ids for the criteria and there doesn't seem to be a nice method to get it.
|
||||
$criteria = $DB->get_records('gradingform_rubric_criteria');
|
||||
$data = ['criteria' => []];
|
||||
foreach ($criteria as $key => $value) {
|
||||
if ($value->description == 'Spelling is important') {
|
||||
$level = $DB->get_record('gradingform_rubric_levels', ['criterionid' => $key, 'score' => 1]);
|
||||
$data['criteria'][$key]['levelid'] = $level->id;
|
||||
$data['criteria'][$key]['remark'] = 'This user made several mistakes.';
|
||||
} else {
|
||||
$level = $DB->get_record('gradingform_rubric_levels', ['criterionid' => $key, 'score' => 0]);
|
||||
$data['criteria'][$key]['levelid'] = $level->id;
|
||||
$data['criteria'][$key]['remark'] = 'Please add more pictures.';
|
||||
}
|
||||
}
|
||||
$data['itemid'] = $itemid;
|
||||
|
||||
// Update this instance with data.
|
||||
$instance->update($data);
|
||||
|
||||
// Second instance.
|
||||
$itemid = 2;
|
||||
$instance = $controller->create_instance($user->id, $itemid);
|
||||
// I need the ids for the criteria and there doesn't seem to be a nice method to get it.
|
||||
$criteria = $DB->get_records('gradingform_rubric_criteria');
|
||||
$data = ['criteria' => []];
|
||||
foreach ($criteria as $key => $value) {
|
||||
if ($value->description == 'Spelling is important') {
|
||||
$level = $DB->get_record('gradingform_rubric_levels', ['criterionid' => $key, 'score' => 0]);
|
||||
$data['criteria'][$key]['levelid'] = $level->id;
|
||||
$data['criteria'][$key]['remark'] = 'Too many mistakes. Please try again.';
|
||||
} else {
|
||||
$level = $DB->get_record('gradingform_rubric_levels', ['criterionid' => $key, 'score' => 2]);
|
||||
$data['criteria'][$key]['levelid'] = $level->id;
|
||||
$data['criteria'][$key]['remark'] = 'Great number of pictures. Well done.';
|
||||
}
|
||||
}
|
||||
$data['itemid'] = $itemid;
|
||||
|
||||
// Update this instance with data.
|
||||
$instance->update($data);
|
||||
|
||||
// Check how many records we have in the fillings table.
|
||||
$records = $DB->get_records('gradingform_rubric_fillings');
|
||||
$this->assertCount(4, $records);
|
||||
// Let's delete one of the instances (the last one would be the easiest).
|
||||
provider::delete_gradingform_for_instances([$instance->get_id()]);
|
||||
$records = $DB->get_records('gradingform_rubric_fillings');
|
||||
$this->assertCount(2, $records);
|
||||
foreach ($records as $record) {
|
||||
$this->assertNotEquals($instance->get_id(), $record->instanceid);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Convenience class to create rubrics.
|
||||
*
|
||||
* @copyright 2018 Adrian Greeve <adriangreeve.com>
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
class test_rubric {
|
||||
|
||||
/** @var array $criteria The criteria for this rubric. */
|
||||
protected $criteria = [];
|
||||
/** @var context The context that this rubric is in. */
|
||||
protected $context;
|
||||
/** @var string The name of this rubric. */
|
||||
protected $name;
|
||||
/** @var string A description for this rubric. */
|
||||
protected $text;
|
||||
/** @var integer The current criterion ID. This is incremented when a new criterion is added. */
|
||||
protected $criterionid = 0;
|
||||
/** @var grading_manager An object for managing the rubric. */
|
||||
public $manager;
|
||||
|
||||
/**
|
||||
* Constuctor for this rubric.
|
||||
*
|
||||
* @param context $context The context that this rubric is being used in.
|
||||
* @param string $name Name of the rubric.
|
||||
* @param string $text Description of the rubric.
|
||||
*/
|
||||
public function __construct($context, $name, $text) {
|
||||
$this->context = $context;
|
||||
$this->name = $name;
|
||||
$this->text = $text;
|
||||
$this->manager = get_grading_manager();
|
||||
$this->manager->set_context($context);
|
||||
$this->manager->set_component('mod_assign');
|
||||
$this->manager->set_area('submission');
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates the rubric using the appropriate APIs.
|
||||
*/
|
||||
public function create_rubric() {
|
||||
|
||||
$data = (object) [
|
||||
'areaid' => $this->context->id,
|
||||
'returnurl' => '',
|
||||
'name' => $this->name,
|
||||
'description_editor' => [
|
||||
'text' => $this->text,
|
||||
'format' => 1,
|
||||
'itemid' => 1
|
||||
],
|
||||
'rubric' => [
|
||||
'criteria' => $this->criteria,
|
||||
'options' => [
|
||||
'sortlevelsasc' => 1,
|
||||
'lockzeropoints' => 1,
|
||||
'showdescriptionteacher' => 1,
|
||||
'showdescriptionstudent' => 1,
|
||||
'showscoreteacher' => 1,
|
||||
'showscorestudent' => 1,
|
||||
'enableremarks' => 1,
|
||||
'showremarksstudent' => 1
|
||||
]
|
||||
],
|
||||
'saverubric' => 'Save rubric and make it ready',
|
||||
'status' => 20
|
||||
];
|
||||
|
||||
$controller = $this->manager->get_controller('rubric');
|
||||
$controller->update_definition($data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a criterion to the rubric.
|
||||
*
|
||||
* @param test_criterion $criterion The criterion object (class below).
|
||||
*/
|
||||
public function add_criteria($criterion) {
|
||||
|
||||
$this->criterionid++;
|
||||
$this->criteria['NEWID' . $this->criterionid] = [
|
||||
'description' => $criterion->description,
|
||||
'sortorder' => $this->criterionid,
|
||||
'levels' => $criterion->levels
|
||||
];
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Convenience class to create rubric criterion.
|
||||
*
|
||||
* @copyright 2018 Adrian Greeve <adriangreeve.com>
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
class test_criterion {
|
||||
|
||||
/** @var string $description A description of the criterion. */
|
||||
public $description;
|
||||
/** @var integer $sortorder sort order of the criterion. */
|
||||
public $sortorder = 0;
|
||||
/** @var integer $levelid The current level id for this level*/
|
||||
public $levelid = 0;
|
||||
/** @var array $levels The levels for this criterion. */
|
||||
public $levels = [];
|
||||
|
||||
/**
|
||||
* Constructor for this test_criterion object
|
||||
*
|
||||
* @param string $description A description of this criterion.
|
||||
*/
|
||||
public function __construct($description) {
|
||||
$this->description = $description;
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds levels to the criterion.
|
||||
*
|
||||
* @param string $definition The definition for this level.
|
||||
* @param int $score The score received if this level is selected.
|
||||
*/
|
||||
public function add_level($definition, $score) {
|
||||
$this->levelid++;
|
||||
$this->levels['NEWID' . $this->levelid] = [
|
||||
'definition' => $definition,
|
||||
'score' => $score
|
||||
];
|
||||
}
|
||||
}
|
@ -1,6 +1,11 @@
|
||||
This files describes API changes in /grade/grading/form/* - Advanced grading methods
|
||||
information provided here is intended especially for developers.
|
||||
|
||||
=== 3.6 ===
|
||||
|
||||
* The privacy interface gradingform_provider has been deprecated. Please use
|
||||
gradingform_provider_v2 instead.
|
||||
|
||||
=== 2.5.2 ===
|
||||
|
||||
* Grading methods now can return grade with decimals. See API functions
|
||||
|
118
grade/grading/tests/fixtures/marking_guide.php
vendored
Normal file
118
grade/grading/tests/fixtures/marking_guide.php
vendored
Normal file
@ -0,0 +1,118 @@
|
||||
<?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/>.
|
||||
|
||||
/**
|
||||
* A test guide class fixture.
|
||||
*
|
||||
* @package core_grading
|
||||
* @category test
|
||||
* @copyright 2018 Adrian Greeve <adriangreeve.com>
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
/**
|
||||
* Convenience class to create marking guides.
|
||||
*
|
||||
* @copyright 2018 Adrian Greeve <adriangreeve.com>
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
class test_guide {
|
||||
|
||||
/** @var array $criteria Criteria for this marking guide. */
|
||||
protected $criteria = [];
|
||||
/** @var context $context The context that this marking guide is used in. */
|
||||
protected $context;
|
||||
/** @var string $name The name of this marking guide. */
|
||||
protected $name;
|
||||
/** @var string $text A description of this marking guide. */
|
||||
protected $text;
|
||||
/** @var integer $criterionid The current id for the criterion. */
|
||||
protected $criterionid = 0;
|
||||
/** @var integer $sortorder The current id for the sort order. */
|
||||
protected $sortorder = 0;
|
||||
|
||||
/** @var grading_manager $manager The grading manager to handle creating the real marking guide. */
|
||||
public $manager;
|
||||
|
||||
/**
|
||||
* The constuctor for this test_guide object.
|
||||
*
|
||||
* @param context $context The context that this marking guide is used in.
|
||||
* @param string $name The name of the marking guide.
|
||||
* @param string $text The description of the marking guide.
|
||||
*/
|
||||
public function __construct($context, $name, $text) {
|
||||
$this->context = $context;
|
||||
$this->name = $name;
|
||||
$this->text = $text;
|
||||
$this->manager = get_grading_manager();
|
||||
$this->manager->set_context($context);
|
||||
$this->manager->set_component('mod_assign');
|
||||
$this->manager->set_area('submission');
|
||||
}
|
||||
|
||||
/**
|
||||
* Uses the appropriate data and APIs to create a marking guide.
|
||||
*/
|
||||
public function create_guide() {
|
||||
|
||||
$data = (object) [
|
||||
'areaid' => $this->context->id,
|
||||
'returnurl' => '',
|
||||
'name' => $this->name,
|
||||
'description_editor' => [
|
||||
'text' => $this->text,
|
||||
'format' => 1,
|
||||
'itemid' => 1
|
||||
],
|
||||
'guide' => [
|
||||
'criteria' => $this->criteria,
|
||||
'options' => [
|
||||
'alwaysshowdefinition' => 1,
|
||||
'showmarkspercriterionstudents' => 1
|
||||
],
|
||||
'comments' => []
|
||||
],
|
||||
'saveguide' => 'Continue',
|
||||
'status' => 20
|
||||
];
|
||||
|
||||
$controller = $this->manager->get_controller('guide');
|
||||
$controller->update_definition($data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds criteria to the marking guide.
|
||||
*
|
||||
* @param string $shortname The shortname for the criterion.
|
||||
* @param string $description The description for the criterion.
|
||||
* @param string $descriptionmarkers The description for the marker for this criterion.
|
||||
* @param int $maxscore The maximum score possible for this criterion.
|
||||
*/
|
||||
public function add_criteria($shortname, $description, $descriptionmarkers, $maxscore) {
|
||||
$this->criterionid++;
|
||||
$this->sortorder++;
|
||||
$this->criteria['NEWID' . $this->criterionid] = [
|
||||
'sortorder' => $this->sortorder,
|
||||
'shortname' => $shortname,
|
||||
'description' => $description,
|
||||
'descriptionmarkers' => $descriptionmarkers,
|
||||
'maxscore' => $maxscore
|
||||
];
|
||||
}
|
||||
}
|
@ -33,7 +33,45 @@ defined('MOODLE_INTERNAL') || die();
|
||||
*/
|
||||
class gradeform_privacy_legacy_polyfill_test extends advanced_testcase {
|
||||
/**
|
||||
* Test that the core_grading\privacy\legacy_polyfill works and that the static _get_grading_export_data can be called.
|
||||
* Test that the core_grading\privacy\legacy_polyfill works and that the static _export_gradingform_instance_data can be called.
|
||||
*/
|
||||
public function test_export_gradingform_instance_data() {
|
||||
$context = context_system::instance();
|
||||
|
||||
$mock = $this->createMock(test_gradingform_legacy_polyfill_mock_wrapper::class);
|
||||
$mock->expects($this->once())
|
||||
->method('get_return_value')
|
||||
->with('_export_gradingform_instance_data', [$context, 3, ['subcontext']]);
|
||||
|
||||
test_legacy_polyfill_gradingform_provider::$mock = $mock;
|
||||
test_legacy_polyfill_gradingform_provider::export_gradingform_instance_data($context, 3, ['subcontext']);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test for _get_metadata shim.
|
||||
*/
|
||||
public function test_get_metadata() {
|
||||
$collection = new \core_privacy\local\metadata\collection('core_gradingform');
|
||||
$this->assertSame($collection, test_legacy_polyfill_gradingform_provider::get_metadata($collection));
|
||||
}
|
||||
|
||||
/**
|
||||
* Test the _delete_gradingform_for_instances shim.
|
||||
*/
|
||||
public function test_delete_gradingform_for_instances() {
|
||||
$context = context_system::instance();
|
||||
|
||||
$mock = $this->createMock(test_gradingform_legacy_polyfill_mock_wrapper::class);
|
||||
$mock->expects($this->once())
|
||||
->method('get_return_value')
|
||||
->with('_delete_gradingform_for_instances', [[3, 17]]);
|
||||
|
||||
test_legacy_polyfill_gradingform_provider::$mock = $mock;
|
||||
test_legacy_polyfill_gradingform_provider::delete_gradingform_for_instances([3, 17]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test the __get_gradingform_export_data shim.
|
||||
*/
|
||||
public function test_get_gradingform_export_data() {
|
||||
$userid = 476;
|
||||
@ -46,14 +84,7 @@ class gradeform_privacy_legacy_polyfill_test extends advanced_testcase {
|
||||
|
||||
test_legacy_polyfill_gradingform_provider::$mock = $mock;
|
||||
test_legacy_polyfill_gradingform_provider::get_gradingform_export_data($context, (object)[], $userid);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test for _get_metadata shim.
|
||||
*/
|
||||
public function test_get_metadata() {
|
||||
$collection = new \core_privacy\local\metadata\collection('core_gradingform');
|
||||
$this->assertSame($collection, test_legacy_polyfill_gradingform_provider::get_metadata($collection));
|
||||
$this->assertDebuggingCalled();
|
||||
}
|
||||
|
||||
/**
|
||||
@ -69,10 +100,11 @@ class gradeform_privacy_legacy_polyfill_test extends advanced_testcase {
|
||||
|
||||
test_legacy_polyfill_gradingform_provider::$mock = $mock;
|
||||
test_legacy_polyfill_gradingform_provider::delete_gradingform_for_context($context);
|
||||
$this->assertDebuggingCalled();
|
||||
}
|
||||
|
||||
/**
|
||||
* Test the _delete_gradingform_for_context shim.
|
||||
* Test the _delete_gradingform_for_userid shim.
|
||||
*/
|
||||
public function test_delete_gradingform_for_user() {
|
||||
$userid = 696;
|
||||
@ -85,6 +117,7 @@ class gradeform_privacy_legacy_polyfill_test extends advanced_testcase {
|
||||
|
||||
test_legacy_polyfill_gradingform_provider::$mock = $mock;
|
||||
test_legacy_polyfill_gradingform_provider::delete_gradingform_for_userid($userid, $context);
|
||||
$this->assertDebuggingCalled();
|
||||
}
|
||||
}
|
||||
|
||||
@ -96,7 +129,8 @@ class gradeform_privacy_legacy_polyfill_test extends advanced_testcase {
|
||||
*/
|
||||
class test_legacy_polyfill_gradingform_provider implements
|
||||
\core_privacy\local\metadata\provider,
|
||||
\core_grading\privacy\gradingform_provider {
|
||||
\core_grading\privacy\gradingform_provider,
|
||||
\core_grading\privacy\gradingform_provider_v2 {
|
||||
|
||||
use \core_grading\privacy\gradingform_legacy_polyfill;
|
||||
use \core_privacy\local\legacy_polyfill;
|
||||
@ -107,32 +141,22 @@ class test_legacy_polyfill_gradingform_provider implements
|
||||
public static $mock = null;
|
||||
|
||||
/**
|
||||
* Export all user data for the gradingform plugin.
|
||||
* Export user data relating to an instance ID.
|
||||
*
|
||||
* @param context $context
|
||||
* @param stdClass $definition
|
||||
* @param int $userid
|
||||
* @param \context $context Context to use with the export writer.
|
||||
* @param int $instanceid The instance ID to export data for.
|
||||
* @param array $subcontext The directory to export this data to.
|
||||
*/
|
||||
protected static function _get_gradingform_export_data(\context $context, $definition, $userid) {
|
||||
protected static function _export_gradingform_instance_data(\context $context, $instanceid, $subcontext) {
|
||||
static::$mock->get_return_value(__FUNCTION__, func_get_args());
|
||||
}
|
||||
|
||||
/**
|
||||
* Deletes all user data for the given context.
|
||||
* Deletes all user data related to the provided instance IDs.
|
||||
*
|
||||
* @param context $context
|
||||
* @param array $instanceids The instance IDs to delete information from.
|
||||
*/
|
||||
protected static function _delete_gradingform_for_context(\context $context) {
|
||||
static::$mock->get_return_value(__FUNCTION__, func_get_args());
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete personal data for the given user and context.
|
||||
*
|
||||
* @param int $userid
|
||||
* @param context $context
|
||||
*/
|
||||
protected static function _delete_gradingform_for_userid($userid, \context $context) {
|
||||
protected static function _delete_gradingform_for_instances($instanceids) {
|
||||
static::$mock->get_return_value(__FUNCTION__, func_get_args());
|
||||
}
|
||||
|
||||
@ -145,6 +169,47 @@ class test_legacy_polyfill_gradingform_provider implements
|
||||
protected static function _get_metadata(\core_privacy\local\metadata\collection $collection) {
|
||||
return $collection;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method is used to export any user data this sub-plugin has using the object to get the context and userid.
|
||||
*
|
||||
* @deprecated Since Moodle 3.6 MDL-62535 Please use the methods in the gradingform_provider_v2 interface.
|
||||
* @todo MDL-63137 remove this method.
|
||||
*
|
||||
* @param context $context Context owner of the data.
|
||||
* @param stdClass $definition Grading definition entry to export.
|
||||
* @param int $userid The user whose information is to be exported.
|
||||
*
|
||||
* @return stdClass The data to export.
|
||||
*/
|
||||
protected static function _get_gradingform_export_data(\context $context, $definition, int $userid) {
|
||||
static::$mock->get_return_value(__FUNCTION__, func_get_args());
|
||||
}
|
||||
|
||||
/**
|
||||
* Any call to this method should delete all user data for the context defined.
|
||||
*
|
||||
* @deprecated Since Moodle 3.6 MDL-62535 Please use the methods in the gradingform_provider_v2 interface.
|
||||
* @todo MDL-63137 remove this method.
|
||||
*
|
||||
* @param context $context Context owner of the data.
|
||||
*/
|
||||
protected static function _delete_gradingform_for_context(\context $context) {
|
||||
static::$mock->get_return_value(__FUNCTION__, func_get_args());
|
||||
}
|
||||
|
||||
/**
|
||||
* A call to this method should delete user data (where practicle) from the userid and context.
|
||||
*
|
||||
* @deprecated Since Moodle 3.6 MDL-62535 Please use the methods in the gradingform_provider_v2 interface.
|
||||
* @todo MDL-63137 remove this method.
|
||||
*
|
||||
* @param int $userid The user whose information is to be deleted.
|
||||
* @param context $context Context owner of the data.
|
||||
*/
|
||||
protected static function _delete_gradingform_for_userid(int $userid, \context $context) {
|
||||
static::$mock->get_return_value(__FUNCTION__, func_get_args());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -25,6 +25,9 @@
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
global $CFG;
|
||||
require_once($CFG->dirroot . '/grade/grading/tests/fixtures/marking_guide.php');
|
||||
|
||||
use \core_privacy\tests\provider_testcase;
|
||||
use \core_privacy\local\request\approved_contextlist;
|
||||
use \core_privacy\local\request\transform;
|
||||
@ -243,6 +246,154 @@ class core_grading_privacy_testcase extends provider_testcase {
|
||||
$this->assertCount(2, $DB->get_records('grading_definitions'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Test exporting user data relating to an item ID.
|
||||
*/
|
||||
public function test_export_item_data() {
|
||||
global $DB;
|
||||
$this->resetAfterTest();
|
||||
$course = $this->getDataGenerator()->create_course();
|
||||
$module = $this->getDataGenerator()->create_module('assign', ['course' => $course]);
|
||||
$user = $this->getDataGenerator()->create_user();
|
||||
|
||||
$this->setUser($user);
|
||||
|
||||
$modulecontext = context_module::instance($module->cmid);
|
||||
$guide = new test_guide($modulecontext, 'testrubrib', 'Description text');
|
||||
$guide->add_criteria(
|
||||
'Spelling mistakes',
|
||||
'Full marks will be given for no spelling mistakes.',
|
||||
'Deduct 5 points per spelling mistake made.',
|
||||
25
|
||||
);
|
||||
$guide->add_criteria(
|
||||
'Pictures',
|
||||
'Full marks will be given for including 3 pictures.',
|
||||
'Give 5 points for each picture present',
|
||||
15
|
||||
);
|
||||
$guide->create_guide();
|
||||
|
||||
$controller = $guide->manager->get_controller('guide');
|
||||
// In the situation of mod_assign this would be the id from assign_grades.
|
||||
$itemid = 1;
|
||||
$instance = $controller->create_instance($user->id, $itemid);
|
||||
// I need the ids for the criteria and there doesn't seem to be a nice method to get it.
|
||||
$criteria = $DB->get_records('gradingform_guide_criteria');
|
||||
$data = ['criteria' => []];
|
||||
foreach ($criteria as $key => $value) {
|
||||
if ($value->shortname == 'Spelling mistakes') {
|
||||
$data['criteria'][$key]['remark'] = 'This user made several mistakes.';
|
||||
$data['criteria'][$key]['remarkformat'] = 0;
|
||||
$data['criteria'][$key]['score'] = 5;
|
||||
} else {
|
||||
$data['criteria'][$key]['remark'] = 'This user has two pictures.';
|
||||
$data['criteria'][$key]['remarkformat'] = 0;
|
||||
$data['criteria'][$key]['score'] = 10;
|
||||
}
|
||||
}
|
||||
$data['itemid'] = $itemid;
|
||||
|
||||
// Update this instance with data.
|
||||
$instance->update($data);
|
||||
|
||||
provider::export_item_data($modulecontext, $itemid, ['Test']);
|
||||
$data = (array) writer::with_context($modulecontext)->get_data(['Test', 'Marking guide']);
|
||||
$this->assertCount(2, $data);
|
||||
$this->assertEquals('This user made several mistakes.', $data['Spelling mistakes']->remark);
|
||||
$this->assertEquals(5, $data['Spelling mistakes']->score);
|
||||
$this->assertEquals('This user has two pictures.', $data['Pictures']->remark);
|
||||
$this->assertEquals(10, $data['Pictures']->score);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test deleting user data related to a context and item ID.
|
||||
*/
|
||||
public function test_delete_instance_data() {
|
||||
global $DB;
|
||||
$this->resetAfterTest();
|
||||
$course = $this->getDataGenerator()->create_course();
|
||||
$module = $this->getDataGenerator()->create_module('assign', ['course' => $course]);
|
||||
$user = $this->getDataGenerator()->create_user();
|
||||
|
||||
$this->setUser($user);
|
||||
|
||||
$modulecontext = context_module::instance($module->cmid);
|
||||
$guide = new test_guide($modulecontext, 'testrubrib', 'Description text');
|
||||
$guide->add_criteria(
|
||||
'Spelling mistakes',
|
||||
'Full marks will be given for no spelling mistakes.',
|
||||
'Deduct 5 points per spelling mistake made.',
|
||||
25
|
||||
);
|
||||
$guide->add_criteria(
|
||||
'Pictures',
|
||||
'Full marks will be given for including 3 pictures.',
|
||||
'Give 5 points for each picture present',
|
||||
15
|
||||
);
|
||||
$guide->create_guide();
|
||||
|
||||
$controller = $guide->manager->get_controller('guide');
|
||||
// In the situation of mod_assign this would be the id from assign_grades.
|
||||
$itemid = 1;
|
||||
$instance = $controller->create_instance($user->id, $itemid);
|
||||
// I need the ids for the criteria and there doesn't seem to be a nice method to get it.
|
||||
$criteria = $DB->get_records('gradingform_guide_criteria');
|
||||
$data = ['criteria' => []];
|
||||
foreach ($criteria as $key => $value) {
|
||||
if ($value->shortname == 'Spelling mistakes') {
|
||||
$data['criteria'][$key]['remark'] = 'This user made several mistakes.';
|
||||
$data['criteria'][$key]['remarkformat'] = 0;
|
||||
$data['criteria'][$key]['score'] = 5;
|
||||
} else {
|
||||
$data['criteria'][$key]['remark'] = 'This user has two pictures.';
|
||||
$data['criteria'][$key]['remarkformat'] = 0;
|
||||
$data['criteria'][$key]['score'] = 10;
|
||||
}
|
||||
}
|
||||
$data['itemid'] = $itemid;
|
||||
|
||||
// Update this instance with data.
|
||||
$instance->update($data);
|
||||
|
||||
$itemid = 2;
|
||||
$instance = $controller->create_instance($user->id, $itemid);
|
||||
// I need the ids for the criteria and there doesn't seem to be a nice method to get it.
|
||||
$criteria = $DB->get_records('gradingform_guide_criteria');
|
||||
$data = ['criteria' => []];
|
||||
foreach ($criteria as $key => $value) {
|
||||
if ($value->shortname == 'Spelling mistakes') {
|
||||
$data['criteria'][$key]['remark'] = 'This user made no mistakes.';
|
||||
$data['criteria'][$key]['remarkformat'] = 0;
|
||||
$data['criteria'][$key]['score'] = 25;
|
||||
} else {
|
||||
$data['criteria'][$key]['remark'] = 'This user has one pictures.';
|
||||
$data['criteria'][$key]['remarkformat'] = 0;
|
||||
$data['criteria'][$key]['score'] = 5;
|
||||
}
|
||||
}
|
||||
$data['itemid'] = $itemid;
|
||||
|
||||
// Update this instance with data.
|
||||
$instance->update($data);
|
||||
|
||||
// Check how many records we have in the fillings table.
|
||||
$records = $DB->get_records('gradingform_guide_fillings');
|
||||
$this->assertCount(4, $records);
|
||||
// Let's delete one of the instances (the last one would be the easiest).
|
||||
provider::delete_instance_data($modulecontext, $itemid);
|
||||
$records = $DB->get_records('gradingform_guide_fillings');
|
||||
$this->assertCount(2, $records);
|
||||
foreach ($records as $record) {
|
||||
$this->assertNotEquals($instance->get_id(), $record->instanceid);
|
||||
}
|
||||
// This will delete all the rest of the instances for this context.
|
||||
provider::delete_instance_data($modulecontext);
|
||||
$records = $DB->get_records('gradingform_guide_fillings');
|
||||
$this->assertEmpty($records);
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper function to setup the environment.
|
||||
*
|
||||
|
@ -238,7 +238,7 @@ class provider implements metadataprovider, pluginprovider, preference_provider
|
||||
/**
|
||||
* Delete all use data which matches the specified context.
|
||||
*
|
||||
* @param context $context The module context.
|
||||
* @param \context $context The module context.
|
||||
*/
|
||||
public static function delete_data_for_all_users_in_context(\context $context) {
|
||||
global $DB;
|
||||
@ -257,6 +257,13 @@ class provider implements metadataprovider, pluginprovider, preference_provider
|
||||
'delete_feedback_for_context', [$requestdata]);
|
||||
$DB->delete_records('assign_grades', ['assignment' => $assign->get_instance()->id]);
|
||||
|
||||
// Delete advanced grading information.
|
||||
$gradingmanager = get_grading_manager($context, 'mod_assign', 'submissions');
|
||||
$controller = $gradingmanager->get_active_controller();
|
||||
if (isset($controller)) {
|
||||
\core_grading\privacy\provider::delete_instance_data($context);
|
||||
}
|
||||
|
||||
// Time to roll my own method for deleting overrides.
|
||||
static::delete_user_overrides($assign);
|
||||
$DB->delete_records('assign_submission', ['assignment' => $assign->get_instance()->id]);
|
||||
@ -292,10 +299,16 @@ class provider implements metadataprovider, pluginprovider, preference_provider
|
||||
}
|
||||
|
||||
$grades = $DB->get_records('assign_grades', ['assignment' => $assignid, 'userid' => $user->id]);
|
||||
$gradingmanager = get_grading_manager($context, 'mod_assign', 'submissions');
|
||||
$controller = $gradingmanager->get_active_controller();
|
||||
foreach ($grades as $grade) {
|
||||
$requestdata = new assign_plugin_request_data($context, $assign, $grade, [], $user);
|
||||
manager::plugintype_class_callback('assignfeedback', self::ASSIGNFEEDBACK_INTERFACE,
|
||||
'delete_feedback_for_grade', [$requestdata]);
|
||||
// Delete advanced grading information.
|
||||
if (isset($controller)) {
|
||||
\core_grading\privacy\provider::delete_instance_data($context, $grade->id);
|
||||
}
|
||||
}
|
||||
|
||||
static::delete_user_overrides($assign, $user);
|
||||
@ -497,6 +510,8 @@ class provider implements metadataprovider, pluginprovider, preference_provider
|
||||
bool $exportforteacher = false) {
|
||||
$submissions = $assign->get_all_submissions($user->id);
|
||||
$teacher = ($exportforteacher) ? $user : null;
|
||||
$gradingmanager = get_grading_manager($context, 'mod_assign', 'submissions');
|
||||
$controller = $gradingmanager->get_active_controller();
|
||||
foreach ($submissions as $submission) {
|
||||
// Attempt numbers start at zero, which is fine for programming, but doesn't make as much sense
|
||||
// for users.
|
||||
@ -516,6 +531,10 @@ class provider implements metadataprovider, pluginprovider, preference_provider
|
||||
[$params]);
|
||||
|
||||
self::export_grade_data($grade, $context, $submissionpath);
|
||||
// Check for advanced grading and retrieve that information.
|
||||
if (isset($controller)) {
|
||||
\core_grading\privacy\provider::export_item_data($context, $grade->id, $submissionpath);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
37
privacy/classes/local/deprecated.php
Normal file
37
privacy/classes/local/deprecated.php
Normal file
@ -0,0 +1,37 @@
|
||||
<?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/>.
|
||||
|
||||
/**
|
||||
* File containing a class for deprecated interfaces.
|
||||
*
|
||||
* Plugins should implement this if their interface is now deprecated.
|
||||
*
|
||||
* @package core_privacy
|
||||
* @copyright 2018 Adrian Greeve <adriangreeve.com>
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
namespace core_privacy\local;
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
/**
|
||||
* The deprecated interface.
|
||||
*
|
||||
* @copyright 2018 Adrian Greeve <adriangreeve.com>
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
interface deprecated {
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user