first commit

This commit is contained in:
CHIEFSOFT\ameye
2024-06-08 17:09:23 -04:00
commit df3a033196
17887 changed files with 8637778 additions and 0 deletions
+74
View File
@@ -0,0 +1,74 @@
<?php
/**
* @file classes/observers/events/UsageEvent.php
*
* Copyright (c) 2022 Simon Fraser University
* Copyright (c) 2022 John Willinsky
* Distributed under the GNU GPL v3. For full terms see the file docs/COPYING.
*
* @class Usage
*
* @ingroup observers_events
*
* @brief Adds issue tracking to the usage event data.
*
*/
namespace APP\observers\events;
use APP\core\Application;
use APP\issue\Issue;
use APP\issue\IssueGalley;
use APP\submission\Submission;
use Exception;
use PKP\context\Context;
use PKP\submission\Representation;
use PKP\submissionFile\SubmissionFile;
class UsageEvent extends \PKP\observers\events\UsageEvent
{
public ?Issue $issue;
public ?IssueGalley $issueGalley;
public function __construct(
int $assocType,
Context $context,
Submission $submission = null,
Representation $galley = null,
SubmissionFile $submissionFile = null,
Issue $issue = null,
IssueGalley $issueGalley = null
) {
$this->issue = $issue;
$this->issueGalley = $issueGalley;
parent::__construct($assocType, $context, $submission, $galley, $submissionFile);
}
/**
* Get the canonical URL for the usage object
*
* @throws Exception
*/
protected function getCanonicalUrl(): string
{
if (in_array($this->assocType, [Application::ASSOC_TYPE_ISSUE, Application::ASSOC_TYPE_ISSUE_GALLEY])) {
$canonicalUrlPage = $canonicalUrlOp = null;
$canonicalUrlParams = [];
switch ($this->assocType) {
case Application::ASSOC_TYPE_ISSUE_GALLEY:
$canonicalUrlOp = 'download';
$canonicalUrlParams = [$this->issue->getId(), $this->issueGalley->getId()];
break;
case Application::ASSOC_TYPE_ISSUE:
$canonicalUrlOp = 'view';
$canonicalUrlParams = [$this->issue->getId()];
break;
}
$canonicalUrl = $this->getRouterCanonicalUrl($this->request, $canonicalUrlPage, $canonicalUrlOp, $canonicalUrlParams);
return $canonicalUrl;
} else {
return parent::getCanonicalUrl();
}
}
}
@@ -0,0 +1,34 @@
<?php
/**
* @file classes/observers/listeners/SendSubmissionAcknowledgement.php
*
* Copyright (c) 2014-2022 Simon Fraser University
* Copyright (c) 2000-2022 John Willinsky
* Distributed under the GNU GPL v3. For full terms see the file docs/COPYING.
*
* @class SendSubmissionAcknowledgement
*
* @ingroup observers_listeners
*
* @brief Send an email acknowledgement to the submitting author when a new submission is submitted
*
* Sends an email to all users with author stage assignments and
* sends a separate email to all other contributors named on the
* submission.
*/
namespace APP\observers\listeners;
use Illuminate\Events\Dispatcher;
use PKP\observers\events\SubmissionSubmitted;
class SendSubmissionAcknowledgement extends \PKP\observers\listeners\SendSubmissionAcknowledgement
{
public function subscribe(Dispatcher $events): void
{
$events->listen(
SubmissionSubmitted::class,
SendSubmissionAcknowledgement::class
);
}
}