-
Notifications
You must be signed in to change notification settings - Fork 34
/
PlagiarismSubmissionSubmitListener.php
60 lines (52 loc) · 1.58 KB
/
PlagiarismSubmissionSubmitListener.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
<?php
/**
* @file plugins/generic/plagiarism/PlagiarismSubmissionSubmitListener.php
*
* Copyright (c) 2013-2024 Simon Fraser University
* Copyright (c) 2013-2024 John Willinsky
* Distributed under the GNU GPL v3. For full terms see the file docs/COPYING.
*
* @class PlagiarismSubmissionSubmitListener
*
* @brief Listener class to handle event on submission being submitted
*/
namespace APP\plugins\generic\plagiarism;
use APP\core\Application;
use APP\facades\Repo;
use PKP\observers\events\SubmissionSubmitted;
use APP\plugins\generic\plagiarism\PlagiarismPlugin;
use Illuminate\Events\Dispatcher;
class PlagiarismSubmissionSubmitListener
{
protected PlagiarismPlugin $plugin;
public function __construct(PlagiarismPlugin $plugin)
{
$this->plugin = $plugin;
}
/**
* Maps methods with correspondent events to listen
*/
public function subscribe(Dispatcher $events): void
{
$events->listen(
SubmissionSubmitted::class,
[static::class, 'handle']
);
}
/**
* Handle the listener call
*/
public function handle(SubmissionSubmitted $event): void
{
$this->plugin->stampEulaToSubmission($event->context, $event->submission);
$this->plugin->stampEulaToSubmittingUser(
$event->context,
$event->submission,
Application::get()->getRequest()->getUser()
);
$this->plugin->submitForPlagiarismCheck(
$event->context,
Repo::submission()->get($event->submission->getId())
);
}
}