Skip to content

Commit

Permalink
Merge pull request #4347 from bozana/9666
Browse files Browse the repository at this point in the history
pkp/pkp-lib#9666 COUNTER R5 TSV reports
  • Loading branch information
bozana authored Oct 15, 2024
2 parents 94f8793 + 02f09cc commit 4fadada
Show file tree
Hide file tree
Showing 10 changed files with 692 additions and 36 deletions.
9 changes: 5 additions & 4 deletions api/v1/stats/sushi/StatsSushiController.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
use Illuminate\Http\JsonResponse;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Route;
use Symfony\Component\HttpFoundation\StreamedResponse;

class StatsSushiController extends \PKP\API\v1\stats\sushi\PKPStatsSushiController
{
Expand Down Expand Up @@ -52,7 +53,7 @@ public function getGroupRoutes(): void
* A customizable report detailing activity at the journal level
* that allows the user to apply filters and select other configuration options for the report.
*/
public function getReportsTR(Request $illuminateRequest): JsonResponse
public function getReportsTR(Request $illuminateRequest): JsonResponse|StreamedResponse
{
return $this->getReportResponse(new TR(), $illuminateRequest);
}
Expand All @@ -61,7 +62,7 @@ public function getReportsTR(Request $illuminateRequest): JsonResponse
* COUNTER 'Journal Usage by Access Type' [TR_J3].
* This is a Standard View of Title Master Report that reports on usage of journal content for all Metric_Types broken down by Access_Type.
*/
public function getReportsTRJ3(Request $illuminateRequest): JsonResponse
public function getReportsTRJ3(Request $illuminateRequest): JsonResponse|StreamedResponse
{
return $this->getReportResponse(new TR_J3(), $illuminateRequest);
}
Expand All @@ -71,7 +72,7 @@ public function getReportsTRJ3(Request $illuminateRequest): JsonResponse
* A customizable report detailing activity at the article level
* that allows the user to apply filters and select other configuration options for the report.
*/
public function getReportsIR(Request $illuminateRequest): JsonResponse
public function getReportsIR(Request $illuminateRequest): JsonResponse|StreamedResponse
{
return $this->getReportResponse(new IR(), $illuminateRequest);
}
Expand All @@ -80,7 +81,7 @@ public function getReportsIR(Request $illuminateRequest): JsonResponse
* COUNTER 'Journal Article Requests' [IR_A1].
* This is a Standard View of Item Master Report that reports on journal article requests at the article level.
*/
public function getReportsIRA1(Request $illuminateRequest): JsonResponse
public function getReportsIRA1(Request $illuminateRequest): JsonResponse|StreamedResponse
{
return $this->getReportResponse(new IR_A1(), $illuminateRequest);
}
Expand Down
66 changes: 66 additions & 0 deletions classes/components/forms/counter/CounterReportForm.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
<?php
/**
* @file classes/components/form/counter/CounterReportForm.php
*
* Copyright (c) 2024 Simon Fraser University
* Copyright (c) 2024 John Willinsky
* Distributed under the GNU GPL v3. For full terms see the file docs/COPYING.
*
* @class CounterReportForm
*
* @ingroup classes_controllers_form
*
* @brief A form for setting a counter report
*/

namespace APP\components\forms\counter;

use APP\sushi\IR;
use APP\sushi\IR_A1;
use APP\sushi\PR;
use APP\sushi\PR_P1;
use APP\sushi\TR;
use APP\sushi\TR_J3;
use PKP\components\forms\counter\PKPCounterReportForm;

class CounterReportForm extends PKPCounterReportForm
{
public function setReportFields(): void
{
$formFieldsPR = PR::getReportSettingsFormFields();
$this->reportFields['PR'] = array_map(function ($field) {
$field->groupId = 'default';
return $field;
}, $formFieldsPR);

$formFieldsPR_P1 = PR_P1::getReportSettingsFormFields();
$this->reportFields['PR_P1'] = array_map(function ($field) {
$field->groupId = 'default';
return $field;
}, $formFieldsPR_P1);

$formFieldsTR = TR::getReportSettingsFormFields();
$this->reportFields['TR'] = array_map(function ($field) {
$field->groupId = 'default';
return $field;
}, $formFieldsTR);

$formFieldsTR_J3 = TR_J3::getReportSettingsFormFields();
$this->reportFields['TR_J3'] = array_map(function ($field) {
$field->groupId = 'default';
return $field;
}, $formFieldsTR_J3);

$formFieldsIR = IR::getReportSettingsFormFields();
$this->reportFields['IR'] = array_map(function ($field) {
$field->groupId = 'default';
return $field;
}, $formFieldsIR);

$formFieldsIR_A1 = IR_A1::getReportSettingsFormFields();
$this->reportFields['IR_A1'] = array_map(function ($field) {
$field->groupId = 'default';
return $field;
}, $formFieldsIR_A1);
}
}
Loading

0 comments on commit 4fadada

Please sign in to comment.