mirror of
https://github.com/PlagiarismCheck/moodle-plagiarism_pchkorg.git
synced 2024-12-22 12:10:08 +00:00
Change capability name. Add information into README file #1 . Add PHPDOC. Version 2.3.
This commit is contained in:
parent
079d44e31b
commit
ce4f497868
57
README.md
57
README.md
@ -1,9 +1,54 @@
|
|||||||
[![Build Status](https://travis-ci.org/PlagiarismCheck/moodle-plagiarism_pchkorg.svg?branch=master)](https://travis-ci.org/PlagiarismCheck/moodle-plagiarism_pchkorg)
|
Plagiarism Check Plugin. [![Build Status](https://travis-ci.org/PlagiarismCheck/moodle-plagiarism_pchkorg.svg?branch=master)](https://travis-ci.org/PlagiarismCheck/moodle-plagiarism_pchkorg)
|
||||||
|
---------------------
|
||||||
|
|
||||||
Plagiarism Check Plugin.
|
|
||||||
|
|
||||||
This plugin provide functionality for Plagiarismcheck.org service.
|
This plugin provide functionality for Plagiarismcheck.org service.
|
||||||
|
|
||||||
Plagiarismcheck.org is a sophisticated similarity search engine.
|
Plagiarismcheck.org is a sophisticated similarity search engine.
|
||||||
We advocate for bringing technology into academics to help instructors save time and motivate students write better papers.
|
We advocate for bringing technology into academics to help instructors save time and motivate students write better papers.
|
||||||
|
|
||||||
|
PlagiarismCheck.org has subscription-based pricing model. More information is available here.
|
||||||
|
|
||||||
|
http://plagiarismcheck.org
|
||||||
|
|
||||||
|
### With PlagiarismCheck you get:
|
||||||
|
|
||||||
|
1) AI Algorithm.
|
||||||
|
|
||||||
|
The algorithm that searches not only for word-to-word match, but also covers:
|
||||||
|
* word rearrangements
|
||||||
|
* word substitutions / synonymization
|
||||||
|
* changes from passive to active voice
|
||||||
|
* poor paraphrasing
|
||||||
|
* changes of alphabet from Latin to Cyrillic and vice versa
|
||||||
|
how_we_detect
|
||||||
|
|
||||||
|
2) Smart report.
|
||||||
|
|
||||||
|
* user can access all sources where similarity has been detected
|
||||||
|
* similarity found in quotes are highlighted in a different color and can be included/excluded from the total similarity percentage
|
||||||
|
* similarity found in references are highlighted in a different color and can be included/excluded from the total similarity percentage
|
||||||
|
|
||||||
|
3) Search database.
|
||||||
|
|
||||||
|
Depending on the type of subscription, there are several search options available:
|
||||||
|
* search via all publicly available resources
|
||||||
|
* create a personal archive for your school and search through it
|
||||||
|
* search in closed depositories and libraries
|
||||||
|
|
||||||
|
4) Usability.
|
||||||
|
* integration can be easily set up by an administrator of a Moodle account
|
||||||
|
* integration gives a chance to set up who will have an access to the software
|
||||||
|
* though the integration both students and instructors will have an access to the similarity reports
|
||||||
|
5) Resubmissions.
|
||||||
|
|
||||||
|
In case an instructor allows to resubmit works, PlagiarismCheck will be able to check all submissions without giving a false positive result
|
||||||
|
|
||||||
|
6) Throughput
|
||||||
|
* no restrictions on daily usage
|
||||||
|
* minimum downtime
|
||||||
|
* no limitations on how soon one can resubmit a work
|
||||||
|
|
||||||
|
7) Excellent customer service
|
||||||
|
response to clients' requests within 24 hours
|
||||||
|
24/7 admin support.
|
||||||
|
|
||||||
|
|
||||||
|
@ -14,16 +14,32 @@
|
|||||||
// You should have received a copy of the GNU General Public License
|
// You should have received a copy of the GNU General Public License
|
||||||
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @package plagiarism_pchkorg
|
||||||
|
* @category plagiarism
|
||||||
|
* @copyright PlagiarismCheck.org, https://plagiarismcheck.org/
|
||||||
|
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||||
|
*/
|
||||||
|
|
||||||
defined('MOODLE_INTERNAL') || die();
|
defined('MOODLE_INTERNAL') || die();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class plagiarism_pchkorg_api_provider
|
||||||
|
*/
|
||||||
class plagiarism_pchkorg_api_provider {
|
class plagiarism_pchkorg_api_provider {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var
|
||||||
|
*/
|
||||||
private $token;
|
private $token;
|
||||||
/**
|
/**
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
private $endpoint;
|
private $endpoint;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var
|
||||||
|
*/
|
||||||
private $lasterror;
|
private $lasterror;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -40,11 +56,28 @@ class plagiarism_pchkorg_api_provider {
|
|||||||
$this->lasterror = $lasterror;
|
$this->lasterror = $lasterror;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* plagiarism_pchkorg_api_provider constructor.
|
||||||
|
*
|
||||||
|
* @param $token
|
||||||
|
* @param string $endpoint
|
||||||
|
*/
|
||||||
public function __construct($token, $endpoint = 'https://plagiarismcheck.org') {
|
public function __construct($token, $endpoint = 'https://plagiarismcheck.org') {
|
||||||
$this->token = $token;
|
$this->token = $token;
|
||||||
$this->endpoint = $endpoint;
|
$this->endpoint = $endpoint;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param $authorhash
|
||||||
|
* @param $cousereid
|
||||||
|
* @param $assignmentid
|
||||||
|
* @param $submissionid
|
||||||
|
* @param $attachmentid
|
||||||
|
* @param $content
|
||||||
|
* @param $mime
|
||||||
|
* @param $filename
|
||||||
|
* @return |null
|
||||||
|
*/
|
||||||
public function send_group_text($authorhash, $cousereid, $assignmentid, $submissionid, $attachmentid, $content, $mime,
|
public function send_group_text($authorhash, $cousereid, $assignmentid, $submissionid, $attachmentid, $content, $mime,
|
||||||
$filename) {
|
$filename) {
|
||||||
|
|
||||||
@ -88,6 +121,18 @@ class plagiarism_pchkorg_api_provider {
|
|||||||
return $id;
|
return $id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param $boundary
|
||||||
|
* @param $authorhash
|
||||||
|
* @param $cousereid
|
||||||
|
* @param $assignmentid
|
||||||
|
* @param $submissionid
|
||||||
|
* @param $attachmentid
|
||||||
|
* @param $content
|
||||||
|
* @param $mime
|
||||||
|
* @param $filename
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
private function get_body_for_group($boundary,
|
private function get_body_for_group($boundary,
|
||||||
$authorhash,
|
$authorhash,
|
||||||
$cousereid,
|
$cousereid,
|
||||||
@ -114,6 +159,12 @@ class plagiarism_pchkorg_api_provider {
|
|||||||
return $body;
|
return $body;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param $content
|
||||||
|
* @param $mime
|
||||||
|
* @param $filename
|
||||||
|
* @return |null
|
||||||
|
*/
|
||||||
public function send_text($content, $mime, $filename) {
|
public function send_text($content, $mime, $filename) {
|
||||||
$boundary = sprintf('PLAGCHECKBOUNDARY-%s', uniqid(time()));
|
$boundary = sprintf('PLAGCHECKBOUNDARY-%s', uniqid(time()));
|
||||||
|
|
||||||
@ -147,6 +198,12 @@ class plagiarism_pchkorg_api_provider {
|
|||||||
return $id;
|
return $id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param $name
|
||||||
|
* @param $value
|
||||||
|
* @param $boundary
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
private function get_part($name, $value, $boundary) {
|
private function get_part($name, $value, $boundary) {
|
||||||
$eol = "\r\n";
|
$eol = "\r\n";
|
||||||
|
|
||||||
@ -157,6 +214,14 @@ class plagiarism_pchkorg_api_provider {
|
|||||||
return $part;
|
return $part;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param $name
|
||||||
|
* @param $value
|
||||||
|
* @param $mime
|
||||||
|
* @param $filename
|
||||||
|
* @param $boundary
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
private function get_file_part($name, $value, $mime, $filename, $boundary) {
|
private function get_file_part($name, $value, $mime, $filename, $boundary) {
|
||||||
$eol = "\r\n";
|
$eol = "\r\n";
|
||||||
|
|
||||||
@ -169,6 +234,13 @@ class plagiarism_pchkorg_api_provider {
|
|||||||
return $part;
|
return $part;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param $boundary
|
||||||
|
* @param $content
|
||||||
|
* @param $mime
|
||||||
|
* @param $filename
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
private function get_body($boundary, $content, $mime, $filename) {
|
private function get_body($boundary, $content, $mime, $filename) {
|
||||||
$eol = "\r\n";
|
$eol = "\r\n";
|
||||||
|
|
||||||
@ -180,14 +252,25 @@ class plagiarism_pchkorg_api_provider {
|
|||||||
return $body;
|
return $body;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param $email
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
public function user_email_to_hash($email) {
|
public function user_email_to_hash($email) {
|
||||||
return hash('sha256', $this->token . $email);
|
return hash('sha256', $this->token . $email);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
public function is_group_token() {
|
public function is_group_token() {
|
||||||
return 'G-' === \substr($this->token, 0, 2);
|
return 'G-' === \substr($this->token, 0, 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param string $email
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
public function is_group_member($email = '') {
|
public function is_group_member($email = '') {
|
||||||
if (!$this->is_group_token()) {
|
if (!$this->is_group_token()) {
|
||||||
return true;
|
return true;
|
||||||
@ -213,6 +296,10 @@ class plagiarism_pchkorg_api_provider {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param $textid
|
||||||
|
* @return |null
|
||||||
|
*/
|
||||||
public function check_text($textid) {
|
public function check_text($textid) {
|
||||||
$curl = new curl();
|
$curl = new curl();
|
||||||
$response = $curl->get($this->endpoint . '/api/v1/text/' . $textid, array(), array(
|
$response = $curl->get($this->endpoint . '/api/v1/text/' . $textid, array(), array(
|
||||||
@ -235,10 +322,17 @@ class plagiarism_pchkorg_api_provider {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param $id
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
public function get_report_action($id) {
|
public function get_report_action($id) {
|
||||||
return "{$this->endpoint}/lms/public-report/{$id}/";
|
return "{$this->endpoint}/lms/public-report/{$id}/";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
public function generate_api_token() {
|
public function generate_api_token() {
|
||||||
global $USER;
|
global $USER;
|
||||||
|
|
||||||
@ -249,6 +343,10 @@ class plagiarism_pchkorg_api_provider {
|
|||||||
return $this->token;
|
return $this->token;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param $mime
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
public function is_supported_mime($mime) {
|
public function is_supported_mime($mime) {
|
||||||
return in_array($mime, array(
|
return in_array($mime, array(
|
||||||
'application/msword',
|
'application/msword',
|
||||||
|
@ -14,21 +14,47 @@
|
|||||||
// You should have received a copy of the GNU General Public License
|
// You should have received a copy of the GNU General Public License
|
||||||
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @package plagiarism_pchkorg
|
||||||
|
* @category plagiarism
|
||||||
|
* @copyright PlagiarismCheck.org, https://plagiarismcheck.org/
|
||||||
|
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||||
|
*/
|
||||||
|
|
||||||
defined('MOODLE_INTERNAL') || die();
|
defined('MOODLE_INTERNAL') || die();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class plagiarism_pchkorg_config_model
|
||||||
|
*/
|
||||||
class plagiarism_pchkorg_config_model {
|
class plagiarism_pchkorg_config_model {
|
||||||
|
/**
|
||||||
|
* @var
|
||||||
|
*/
|
||||||
private $db;
|
private $db;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* plagiarism_pchkorg_config_model constructor.
|
||||||
|
*
|
||||||
|
* @param $DB
|
||||||
|
*/
|
||||||
public function __construct($DB) {
|
public function __construct($DB) {
|
||||||
$this->db = $DB;
|
$this->db = $DB;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param $module
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
public function fetch_by_module($module) {
|
public function fetch_by_module($module) {
|
||||||
return $this->db->get_records('plagiarism_pchkorg_config', array(
|
return $this->db->get_records('plagiarism_pchkorg_config', array(
|
||||||
'cm' => $module,
|
'cm' => $module,
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param $module
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
public function is_enabled_for_module($module) {
|
public function is_enabled_for_module($module) {
|
||||||
$configs = $this->fetch_by_module($module);
|
$configs = $this->fetch_by_module($module);
|
||||||
$enabled = false;
|
$enabled = false;
|
||||||
@ -45,6 +71,10 @@ class plagiarism_pchkorg_config_model {
|
|||||||
return $enabled;
|
return $enabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param $name
|
||||||
|
* @param $value
|
||||||
|
*/
|
||||||
public function set_system_config($name, $value) {
|
public function set_system_config($name, $value) {
|
||||||
$this->db->delete_records('plagiarism_pchkorg_config', array(
|
$this->db->delete_records('plagiarism_pchkorg_config', array(
|
||||||
'cm' => 0,
|
'cm' => 0,
|
||||||
@ -59,6 +89,10 @@ class plagiarism_pchkorg_config_model {
|
|||||||
$this->db->insert_record('plagiarism_pchkorg_config', $record);
|
$this->db->insert_record('plagiarism_pchkorg_config', $record);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param $name
|
||||||
|
* @return |null
|
||||||
|
*/
|
||||||
public function get_system_config($name) {
|
public function get_system_config($name) {
|
||||||
$records = $this->db->get_records('plagiarism_pchkorg_config', array(
|
$records = $this->db->get_records('plagiarism_pchkorg_config', array(
|
||||||
'cm' => 0,
|
'cm' => 0,
|
||||||
@ -72,6 +106,9 @@ class plagiarism_pchkorg_config_model {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
public function get_all_system_config() {
|
public function get_all_system_config() {
|
||||||
$records = $this->db->get_records('plagiarism_pchkorg_config', array(
|
$records = $this->db->get_records('plagiarism_pchkorg_config', array(
|
||||||
'cm' => 0,
|
'cm' => 0,
|
||||||
|
@ -1,21 +0,0 @@
|
|||||||
<?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/>.
|
|
||||||
|
|
||||||
defined('MOODLE_INTERNAL') || die();
|
|
||||||
|
|
||||||
class plagiarism_pchkorg_file_loader {
|
|
||||||
|
|
||||||
}
|
|
@ -14,9 +14,25 @@
|
|||||||
// You should have received a copy of the GNU General Public License
|
// You should have received a copy of the GNU General Public License
|
||||||
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @package plagiarism_pchkorg
|
||||||
|
* @category plagiarism
|
||||||
|
* @copyright PlagiarismCheck.org, https://plagiarismcheck.org/
|
||||||
|
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||||
|
*/
|
||||||
|
|
||||||
defined('MOODLE_INTERNAL') || die();
|
defined('MOODLE_INTERNAL') || die();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class plagiarism_pchkorg_url_generator
|
||||||
|
*/
|
||||||
class plagiarism_pchkorg_url_generator {
|
class plagiarism_pchkorg_url_generator {
|
||||||
|
/**
|
||||||
|
* @param $cmid
|
||||||
|
* @param $fileid
|
||||||
|
* @return moodle_url
|
||||||
|
* @throws moodle_exception
|
||||||
|
*/
|
||||||
public function get_check_url($cmid, $fileid) {
|
public function get_check_url($cmid, $fileid) {
|
||||||
return new moodle_url(sprintf(
|
return new moodle_url(sprintf(
|
||||||
'/plagiarism/pchkorg/page/report.php?cmid=%s&file=%s',
|
'/plagiarism/pchkorg/page/report.php?cmid=%s&file=%s',
|
||||||
@ -26,6 +42,10 @@ class plagiarism_pchkorg_url_generator {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return moodle_url
|
||||||
|
* @throws moodle_exception
|
||||||
|
*/
|
||||||
public function get_status_url() {
|
public function get_status_url() {
|
||||||
return new moodle_url('/plagiarism/pchkorg/page/status.php');
|
return new moodle_url('/plagiarism/pchkorg/page/status.php');
|
||||||
}
|
}
|
||||||
|
@ -14,12 +14,24 @@
|
|||||||
// You should have received a copy of the GNU General Public License
|
// You should have received a copy of the GNU General Public License
|
||||||
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @package plagiarism_pchkorg
|
||||||
|
* @category plagiarism
|
||||||
|
* @copyright PlagiarismCheck.org, https://plagiarismcheck.org/
|
||||||
|
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||||
|
*/
|
||||||
|
|
||||||
namespace plagiarism_pchkorg\privacy;
|
namespace plagiarism_pchkorg\privacy;
|
||||||
|
|
||||||
defined('MOODLE_INTERNAL') || die();
|
defined('MOODLE_INTERNAL') || die();
|
||||||
|
|
||||||
use core_privacy\local\metadata\collection;
|
use core_privacy\local\metadata\collection;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class provider
|
||||||
|
*
|
||||||
|
* @package plagiarism_pchkorg\privacy
|
||||||
|
*/
|
||||||
class provider implements
|
class provider implements
|
||||||
\core_privacy\local\metadata\provider,
|
\core_privacy\local\metadata\provider,
|
||||||
\core_privacy\local\request\plugin\provider {
|
\core_privacy\local\request\plugin\provider {
|
||||||
@ -27,6 +39,10 @@ class provider implements
|
|||||||
// This trait must be included.
|
// This trait must be included.
|
||||||
use \core_privacy\local\legacy_polyfill;
|
use \core_privacy\local\legacy_polyfill;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param collection $collection
|
||||||
|
* @return collection
|
||||||
|
*/
|
||||||
public static function _get_metadata(collection $collection) {
|
public static function _get_metadata(collection $collection) {
|
||||||
|
|
||||||
$collection->add_subsystem_link(
|
$collection->add_subsystem_link(
|
||||||
|
@ -1,32 +0,0 @@
|
|||||||
<?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/>.
|
|
||||||
|
|
||||||
if (!defined('MOODLE_INTERNAL')) {
|
|
||||||
die('Direct access to this script is forbidden.');
|
|
||||||
}
|
|
||||||
|
|
||||||
$capabilities = array(
|
|
||||||
'plagiarism/pchkorg:check' => array(
|
|
||||||
'riskbitmask' => RISK_PERSONAL,
|
|
||||||
'captype' => 'write',
|
|
||||||
'contextlevel' => CONTEXT_MODULE,
|
|
||||||
'archetypes' => array(
|
|
||||||
'editingteacher' => CAP_ALLOW,
|
|
||||||
'teacher' => CAP_ALLOW,
|
|
||||||
'manager' => CAP_ALLOW,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
);
|
|
@ -14,6 +14,13 @@
|
|||||||
// You should have received a copy of the GNU General Public License
|
// You should have received a copy of the GNU General Public License
|
||||||
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @package plagiarism_pchkorg
|
||||||
|
* @category plagiarism
|
||||||
|
* @copyright PlagiarismCheck.org, https://plagiarismcheck.org/
|
||||||
|
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||||
|
*/
|
||||||
|
|
||||||
defined('MOODLE_INTERNAL') || die();
|
defined('MOODLE_INTERNAL') || die();
|
||||||
|
|
||||||
function xmldb_plagiarism_pchkorg_install() {
|
function xmldb_plagiarism_pchkorg_install() {
|
||||||
|
@ -14,10 +14,23 @@
|
|||||||
// You should have received a copy of the GNU General Public License
|
// You should have received a copy of the GNU General Public License
|
||||||
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @package plagiarism_pchkorg
|
||||||
|
* @category plagiarism
|
||||||
|
* @copyright PlagiarismCheck.org, https://plagiarismcheck.org/
|
||||||
|
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||||
|
*/
|
||||||
|
|
||||||
defined('MOODLE_INTERNAL') || die();
|
defined('MOODLE_INTERNAL') || die();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class plagiarism_pchkorg_setup_form
|
||||||
|
*/
|
||||||
class plagiarism_pchkorg_setup_form extends moodleform {
|
class plagiarism_pchkorg_setup_form extends moodleform {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @throws coding_exception
|
||||||
|
*/
|
||||||
public function definition() {
|
public function definition() {
|
||||||
|
|
||||||
$mform = &$this->_form;
|
$mform = &$this->_form;
|
||||||
@ -42,6 +55,12 @@ class plagiarism_pchkorg_setup_form extends moodleform {
|
|||||||
$this->add_action_buttons(true);
|
$this->add_action_buttons(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param $message
|
||||||
|
* @param null $param
|
||||||
|
* @return string
|
||||||
|
* @throws coding_exception
|
||||||
|
*/
|
||||||
public static function trans($message, $param = null) {
|
public static function trans($message, $param = null) {
|
||||||
return get_string($message, 'plagiarism_pchkorg', $param);
|
return get_string($message, 'plagiarism_pchkorg', $param);
|
||||||
}
|
}
|
||||||
|
@ -14,12 +14,25 @@
|
|||||||
// You should have received a copy of the GNU General Public License
|
// You should have received a copy of the GNU General Public License
|
||||||
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @package plagiarism_pchkorg
|
||||||
|
* @category plagiarism
|
||||||
|
* @copyright PlagiarismCheck.org, https://plagiarismcheck.org/
|
||||||
|
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||||
|
*/
|
||||||
|
|
||||||
defined('MOODLE_INTERNAL') || die();
|
defined('MOODLE_INTERNAL') || die();
|
||||||
|
|
||||||
require_once($CFG->libdir . '/formslib.php');
|
require_once($CFG->libdir . '/formslib.php');
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class send_text_form
|
||||||
|
*/
|
||||||
class send_text_form extends moodleform {
|
class send_text_form extends moodleform {
|
||||||
// Add elements to form.
|
|
||||||
|
/**
|
||||||
|
* @throws coding_exception
|
||||||
|
*/
|
||||||
public function definition() {
|
public function definition() {
|
||||||
$mform = $this->_form; // Don't forget the underscore!
|
$mform = $this->_form; // Don't forget the underscore!
|
||||||
|
|
||||||
@ -29,6 +42,5 @@ class send_text_form extends moodleform {
|
|||||||
$mform->setType('cmid', PARAM_INT);
|
$mform->setType('cmid', PARAM_INT);
|
||||||
|
|
||||||
$this->add_action_buttons(false, get_string('pchkorg_submit', 'plagiarism_pchkorg'));
|
$this->add_action_buttons(false, get_string('pchkorg_submit', 'plagiarism_pchkorg'));
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
36
lib.php
36
lib.php
@ -14,6 +14,13 @@
|
|||||||
// You should have received a copy of the GNU General Public License
|
// You should have received a copy of the GNU General Public License
|
||||||
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @package plagiarism_pchkorg
|
||||||
|
* @category plagiarism
|
||||||
|
* @copyright PlagiarismCheck.org, https://plagiarismcheck.org/
|
||||||
|
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||||
|
*/
|
||||||
|
|
||||||
defined('MOODLE_INTERNAL') || die();
|
defined('MOODLE_INTERNAL') || die();
|
||||||
|
|
||||||
global $CFG;
|
global $CFG;
|
||||||
@ -25,6 +32,9 @@ require_once(__DIR__ . '/classes/plagiarism_pchkorg_config_model.php');
|
|||||||
require_once(__DIR__ . '/classes/plagiarism_pchkorg_url_generator.php');
|
require_once(__DIR__ . '/classes/plagiarism_pchkorg_url_generator.php');
|
||||||
require_once(__DIR__ . '/classes/plagiarism_pchkorg_api_provider.php');
|
require_once(__DIR__ . '/classes/plagiarism_pchkorg_api_provider.php');
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class plagiarism_plugin_pchkorg
|
||||||
|
*/
|
||||||
class plagiarism_plugin_pchkorg extends plagiarism_plugin {
|
class plagiarism_plugin_pchkorg extends plagiarism_plugin {
|
||||||
/**
|
/**
|
||||||
* hook to allow plagiarism specific information to be displayed beside a submission
|
* hook to allow plagiarism specific information to be displayed beside a submission
|
||||||
@ -46,6 +56,10 @@ class plagiarism_plugin_pchkorg extends plagiarism_plugin {
|
|||||||
|
|
||||||
$cmid = $linkarray['cmid'];
|
$cmid = $linkarray['cmid'];
|
||||||
$file = $linkarray['file'];
|
$file = $linkarray['file'];
|
||||||
|
$context = null;
|
||||||
|
if (!empty($cmid)) {
|
||||||
|
$context = context_module::instance($cmid);// Get context of course.
|
||||||
|
}
|
||||||
|
|
||||||
if (!$pchkorgconfigmodel->is_enabled_for_module($cmid)) {
|
if (!$pchkorgconfigmodel->is_enabled_for_module($cmid)) {
|
||||||
return '';
|
return '';
|
||||||
@ -59,6 +73,11 @@ class plagiarism_plugin_pchkorg extends plagiarism_plugin {
|
|||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$isgranted = !empty($context) && has_capability('mod/assign:view', $context, null);
|
||||||
|
if (!$isgranted) {
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
|
||||||
$where = new \stdClass();
|
$where = new \stdClass();
|
||||||
$where->cm = $cmid;
|
$where->cm = $cmid;
|
||||||
$where->fileid = $file->get_id();
|
$where->fileid = $file->get_id();
|
||||||
@ -81,6 +100,10 @@ class plagiarism_plugin_pchkorg extends plagiarism_plugin {
|
|||||||
/* hook to save plagiarism specific settings on a module settings page
|
/* hook to save plagiarism specific settings on a module settings page
|
||||||
* @param object $data - data from an mform submission.
|
* @param object $data - data from an mform submission.
|
||||||
*/
|
*/
|
||||||
|
/**
|
||||||
|
* @param $data
|
||||||
|
* @throws dml_exception
|
||||||
|
*/
|
||||||
public function save_form_elements($data) {
|
public function save_form_elements($data) {
|
||||||
global $DB;
|
global $DB;
|
||||||
|
|
||||||
@ -113,6 +136,13 @@ class plagiarism_plugin_pchkorg extends plagiarism_plugin {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param object $mform
|
||||||
|
* @param object $context
|
||||||
|
* @param string $modulename
|
||||||
|
* @throws coding_exception
|
||||||
|
* @throws dml_exception
|
||||||
|
*/
|
||||||
public function get_form_elements_module($mform, $context, $modulename = '') {
|
public function get_form_elements_module($mform, $context, $modulename = '') {
|
||||||
if (!$context || !isset($modulename)) {
|
if (!$context || !isset($modulename)) {
|
||||||
return;
|
return;
|
||||||
@ -174,6 +204,12 @@ class plagiarism_plugin_pchkorg extends plagiarism_plugin {
|
|||||||
echo $OUTPUT->box_end();
|
echo $OUTPUT->box_end();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param $message
|
||||||
|
* @param null $param
|
||||||
|
* @return string
|
||||||
|
* @throws coding_exception
|
||||||
|
*/
|
||||||
public static function trans($message, $param = null) {
|
public static function trans($message, $param = null) {
|
||||||
return get_string($message, 'plagiarism_pchkorg', $param);
|
return get_string($message, 'plagiarism_pchkorg', $param);
|
||||||
}
|
}
|
||||||
|
@ -14,6 +14,13 @@
|
|||||||
// You should have received a copy of the GNU General Public License
|
// You should have received a copy of the GNU General Public License
|
||||||
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @package plagiarism_pchkorg
|
||||||
|
* @category plagiarism
|
||||||
|
* @copyright PlagiarismCheck.org, https://plagiarismcheck.org/
|
||||||
|
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||||
|
*/
|
||||||
|
|
||||||
require_once(__DIR__ . '/../../../config.php');
|
require_once(__DIR__ . '/../../../config.php');
|
||||||
require_once(__DIR__ . '/../lib.php');
|
require_once(__DIR__ . '/../lib.php');
|
||||||
require_once(__DIR__ . '/../form/send_text_form.php');
|
require_once(__DIR__ . '/../form/send_text_form.php');
|
||||||
@ -37,7 +44,7 @@ $cm = get_coursemodule_from_id('', $cmid);
|
|||||||
require_login($cm->course, true, $cm);
|
require_login($cm->course, true, $cm);
|
||||||
$context = context_module::instance($cm->id);
|
$context = context_module::instance($cm->id);
|
||||||
header('Content-Type: application/json');
|
header('Content-Type: application/json');
|
||||||
$isgranted = is_viewing($context, null, 'plagiarism/pchkorg:check');
|
$isgranted = has_capability('mod/assign:view', $context, null);
|
||||||
if (!$isgranted) {
|
if (!$isgranted) {
|
||||||
die('{error: "access denied"}');
|
die('{error: "access denied"}');
|
||||||
}
|
}
|
||||||
|
@ -14,6 +14,13 @@
|
|||||||
// You should have received a copy of the GNU General Public License
|
// You should have received a copy of the GNU General Public License
|
||||||
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @package plagiarism_pchkorg
|
||||||
|
* @category plagiarism
|
||||||
|
* @copyright PlagiarismCheck.org, https://plagiarismcheck.org/
|
||||||
|
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||||
|
*/
|
||||||
|
|
||||||
require_once(__DIR__ . '/../../../config.php');
|
require_once(__DIR__ . '/../../../config.php');
|
||||||
require_once(__DIR__ . '/../lib.php');
|
require_once(__DIR__ . '/../lib.php');
|
||||||
require_once(__DIR__ . '/../form/send_text_form.php');
|
require_once(__DIR__ . '/../form/send_text_form.php');
|
||||||
@ -36,7 +43,8 @@ $cm = get_coursemodule_from_id('', $cmid, 0, false, MUST_EXIST);
|
|||||||
require_login($cm->course, true, $cm);
|
require_login($cm->course, true, $cm);
|
||||||
$context = context_module::instance($cm->id);// Get context of course.
|
$context = context_module::instance($cm->id);// Get context of course.
|
||||||
|
|
||||||
$isgranted = is_viewing($context, null, 'plagiarism/pchkorg:check');
|
$isgranted = has_capability('mod/assign:view', $context, null);
|
||||||
|
|
||||||
if (!$isgranted) {
|
if (!$isgranted) {
|
||||||
die('403 permission denied');
|
die('403 permission denied');
|
||||||
}
|
}
|
||||||
|
@ -13,10 +13,11 @@
|
|||||||
//
|
//
|
||||||
// You should have received a copy of the GNU General Public License
|
// You should have received a copy of the GNU General Public License
|
||||||
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* pl * plagiarism.php - allows the admin to configure plagiarism stuff
|
|
||||||
*
|
|
||||||
* @package plagiarism_pchkorg
|
* @package plagiarism_pchkorg
|
||||||
|
* @category plagiarism
|
||||||
|
* @copyright PlagiarismCheck.org, https://plagiarismcheck.org/
|
||||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -26,9 +26,9 @@ defined('MOODLE_INTERNAL') || die();
|
|||||||
if (!isset($plugin)) {
|
if (!isset($plugin)) {
|
||||||
$plugin = new stdClass();
|
$plugin = new stdClass();
|
||||||
}
|
}
|
||||||
$plugin->version = 2019020501;
|
$plugin->version = 2019020601;
|
||||||
$plugin->requires = 2017051501; // Requires Moodle 3.3 .
|
$plugin->requires = 2017051501; // Requires Moodle 3.3 .
|
||||||
$plugin->release = 'v2.2';
|
$plugin->release = 'v2.3';
|
||||||
$plugin->maturity = MATURITY_STABLE;
|
$plugin->maturity = MATURITY_STABLE;
|
||||||
|
|
||||||
$plugin->component = 'plagiarism_pchkorg';
|
$plugin->component = 'plagiarism_pchkorg';
|
||||||
|
@ -14,6 +14,13 @@
|
|||||||
// You should have received a copy of the GNU General Public License
|
// You should have received a copy of the GNU General Public License
|
||||||
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @package plagiarism_pchkorg
|
||||||
|
* @category plagiarism
|
||||||
|
* @copyright PlagiarismCheck.org, https://plagiarismcheck.org/
|
||||||
|
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||||
|
*/
|
||||||
|
|
||||||
defined('MOODLE_INTERNAL') || die();
|
defined('MOODLE_INTERNAL') || die();
|
||||||
|
|
||||||
$ajaxurl = new moodle_url('/plagiarism/pchkorg/page/check.php');
|
$ajaxurl = new moodle_url('/plagiarism/pchkorg/page/check.php');
|
||||||
|
@ -14,6 +14,13 @@
|
|||||||
// You should have received a copy of the GNU General Public License
|
// You should have received a copy of the GNU General Public License
|
||||||
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @package plagiarism_pchkorg
|
||||||
|
* @category plagiarism
|
||||||
|
* @copyright PlagiarismCheck.org, https://plagiarismcheck.org/
|
||||||
|
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||||
|
*/
|
||||||
|
|
||||||
defined('MOODLE_INTERNAL') || die();
|
defined('MOODLE_INTERNAL') || die();
|
||||||
|
|
||||||
if (empty($error)) {
|
if (empty($error)) {
|
||||||
|
@ -14,6 +14,13 @@
|
|||||||
// You should have received a copy of the GNU General Public License
|
// You should have received a copy of the GNU General Public License
|
||||||
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @package plagiarism_pchkorg
|
||||||
|
* @category plagiarism
|
||||||
|
* @copyright PlagiarismCheck.org, https://plagiarismcheck.org/
|
||||||
|
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||||
|
*/
|
||||||
|
|
||||||
defined('MOODLE_INTERNAL') || die();
|
defined('MOODLE_INTERNAL') || die();
|
||||||
|
|
||||||
echo $OUTPUT->header();
|
echo $OUTPUT->header();
|
||||||
|
Loading…
Reference in New Issue
Block a user