first commit

This commit is contained in:
CHIEFSOFT\ameye
2024-09-30 18:11:26 -04:00
commit e592ca6823
27270 changed files with 5002257 additions and 0 deletions
@@ -0,0 +1,68 @@
<?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/>.
/**
* This file contains the polyfill to allow a plugin to operate with Moodle 3.3 up.
*
* @package core_plagiarism
* @copyright 2018 Jake Dallimore <jrhdallimore@gmail.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
namespace core_plagiarism\privacy;
defined('MOODLE_INTERNAL') || die();
use \core_privacy\local\metadata\collection;
/**
* The trait used to provide a backwards compatibility for third-party plugins.
*
* @copyright 2018 Jake Dallimore <jrhdallimore@gmail.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
trait legacy_polyfill {
/**
* Export all plagiarism data from each plagiarism plugin for the specified userid and context.
*
* @param int $userid The user to export.
* @param \context $context The context to export.
* @param array $subcontext The subcontext within the context to export this information to.
* @param array $linkarray The weird and wonderful link array used to display information for a specific item
*/
public static function export_plagiarism_user_data(int $userid, \context $context, array $subcontext, array $linkarray) {
static::_export_plagiarism_user_data($userid, $context, $subcontext, $linkarray);
}
/**
* Delete all user information for the provided context.
*
* @param \context $context The context to delete user data for.
*/
public static function delete_plagiarism_for_context(\context $context) {
static::_delete_plagiarism_for_context($context);
}
/**
* Delete all user information for the provided user and context.
*
* @param int $userid The user to delete
* @param \context $context The context to refine the deletion.
*/
public static function delete_plagiarism_for_user(int $userid, \context $context) {
static::_delete_plagiarism_for_user($userid, $context);
}
}
@@ -0,0 +1,63 @@
<?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_plagiarism
* @copyright 2018 Andrew Nicols <andrew@nicols.co.uk>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
namespace core_plagiarism\privacy;
defined('MOODLE_INTERNAL') || die();
/**
* Provider for the plagiarism API.
*
* @copyright 2018 Andrew Nicols <andrew@nicols.co.uk>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
interface plagiarism_provider extends
// The plagiarism_provider should be implemented by plugins which only provide information to a subsystem.
\core_privacy\local\request\plugin\subsystem_provider {
/**
* Export all plagiarism data from each plagiarism plugin for the specified userid and context.
*
* @param int $userid The user to export.
* @param \context $context The context to export.
* @param array $subcontext The subcontext within the context to export this information to.
* @param array $linkarray The weird and wonderful link array used to display information for a specific item
*/
public static function export_plagiarism_user_data(int $userid, \context $context, array $subcontext, array $linkarray);
/**
* Delete all user information for the provided context.
*
* @param \context $context The context to delete user data for.
*/
public static function delete_plagiarism_for_context(\context $context);
/**
* Delete all user information for the provided user and context.
*
* @param int $userid The user to delete
* @param \context $context The context to refine the deletion.
*/
public static function delete_plagiarism_for_user(int $userid, \context $context);
}
@@ -0,0 +1,47 @@
<?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/>.
/**
* Interface for deleting users related to a context.
*
* @package core_plagiarism
* @copyright 2018 Adrian Greeve <adriangreeve.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
namespace core_plagiarism\privacy;
defined('MOODLE_INTERNAL') || die();
/**
* Interface for the plagiarism system.
*
* @copyright 2018 Adrian Greeve <adriangreeve.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
interface plagiarism_user_provider extends
// The plagiarism_provider should be implemented by plugins which only provide information to a subsystem.
\core_privacy\local\request\plugin\subsystem_provider,
\core_privacy\local\request\shared_userlist_provider {
/**
* Delete all user information for the provided users and context.
*
* @param array $userids The users to delete
* @param \context $context The context to refine the deletion.
*/
public static function delete_plagiarism_for_users(array $userids, \context $context);
}
+110
View File
@@ -0,0 +1,110 @@
<?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_plagiarism
* @copyright 2018 Andrew Nicols <andrew@nicols.co.uk>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
namespace core_plagiarism\privacy;
defined('MOODLE_INTERNAL') || die();
use \core_privacy\local\metadata\collection;
/**
* Provider for the plagiarism API.
*
* @copyright 2018 Andrew Nicols <andrew@nicols.co.uk>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class provider implements
// The Plagiarism subsystem does not store any data itself.
// It has no database tables, and it purely acts as a conduit to the various plagiarism plugins.
\core_privacy\local\metadata\provider,
// The Plagiarism subsystem will be called by other components and will forward requests to each plagiarism plugin implementing its APIs.
\core_privacy\local\request\subsystem\plugin_provider,
\core_privacy\local\request\shared_userlist_provider
{
/**
* Returns meta data about this system.
*
* @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_metadata(collection $collection): collection {
$collection->link_plugintype('plagiarism', 'privacy:metadata:plagiarism');
return $collection;
}
/**
* Export all plagiarism data from each plagiarism plugin for the specified userid and context.
*
* @param int $userid The user to export.
* @param \context $context The context to export.
* @param array $subcontext The subcontext within the context to export this information to.
* @param array $linkarray The weird and wonderful link array used to display information for a specific item
*/
public static function export_plagiarism_user_data(int $userid, \context $context, array $subcontext, array $linkarray) {
static::call_plugin_method('export_plagiarism_user_data', [$userid, $context, $subcontext, $linkarray]);
}
/**
* Deletes all user content for a context in all plagiarism plugins.
*
* @param \context $context The context to delete user data for.
*/
public static function delete_plagiarism_for_context(\context $context) {
static::call_plugin_method('delete_plagiarism_for_context', [$context]);
}
/**
* Deletes all user content for a user in a context in all plagiarism plugins.
*
* @param int $userid The user to delete
* @param \context $context The context to refine the deletion.
*/
public static function delete_plagiarism_for_user(int $userid, \context $context) {
static::call_plugin_method('delete_plagiarism_for_user', [$userid, $context]);
}
/**
* Deletes all user content for a user in a context in all plagiarism plugins.
*
* @param array $userids The users to delete
* @param \context $context The context to refine the deletion.
*/
public static function delete_plagiarism_for_users(array $userids, \context $context) {
static::call_plugin_method('delete_plagiarism_for_users', [$userids, $context]);
}
/**
* Internal method for looping through all of the plagiarism plugins and calling a method.
*
* @param string $methodname Name of the method to call on the plugins.
* @param array $params The parameters that go with the method being called.
*/
protected static function call_plugin_method($methodname, $params) {
// Note: Even if plagiarism is _now_ disabled, there may be legacy data to export.
\core_privacy\manager::plugintype_class_callback('plagiarism', plagiarism_provider::class, $methodname, $params);
}
}