Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add translation strings for the dropdown list items #1530

Open
wants to merge 18 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/build-container.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
build:
name: Build Containers
if: github.repository == 'xibosignage/xibo-cms'
runs-on: ubuntu-18.04
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@v1
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/build-cypress.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ on:
jobs:
build:
name: Build
runs-on: ubuntu-18.04
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@v1
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/build-tag.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:
build:
name: Build Containers
if: github.repository == 'xibosignage/xibo-cms'
runs-on: ubuntu-18.04
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@v1
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test-suite.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ on:
jobs:
test-suite:
name: Build Containers and Run Tests
runs-on: ubuntu-18.04
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@v1
Expand Down
534 changes: 499 additions & 35 deletions lib/Connector/XiboAudienceReportingConnector.php

Large diffs are not rendered by default.

9 changes: 8 additions & 1 deletion lib/Controller/Stats.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
use Carbon\Carbon;
use Slim\Http\Response as Response;
use Slim\Http\ServerRequest as Request;
use Xibo\Event\ConnectorReportEvent;
use Xibo\Factory\DisplayFactory;
use Xibo\Factory\DisplayGroupFactory;
use Xibo\Factory\LayoutFactory;
Expand Down Expand Up @@ -90,13 +91,19 @@ public function __construct($store, $timeSeriesStore, $reportService, $displayFa
*/
function displayReportPage(Request $request, Response $response)
{
// ------------
// Dispatch an event to get connector reports
$event = new ConnectorReportEvent();
$this->getDispatcher()->dispatch($event, ConnectorReportEvent::$NAME);

$data = [
// List of Displays this user has permission for
'defaults' => [
'fromDate' => Carbon::now()->subSeconds(86400 * 35)->format(DateFormatHelper::getSystemFormat()),
'fromDateOneDay' => Carbon::now()->subSeconds(86400)->format(DateFormatHelper::getSystemFormat()),
'toDate' => Carbon::now()->format(DateFormatHelper::getSystemFormat()),
'availableReports' => $this->reportService->listReports()
'availableReports' => $this->reportService->listReports(),
'connectorReports' => $event->getReports()
]
];

Expand Down
14 changes: 12 additions & 2 deletions lib/Entity/ReportResult.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,12 @@ class ReportResult implements \JsonSerializable
*/
public $chart;

/**
* Error message
* @var null|string
*/
public $error;

/**
* Metadata that is used in the report preview or in the email template
* @var array
Expand All @@ -59,17 +65,20 @@ class ReportResult implements \JsonSerializable
* @param array $table
* @param int $recordsTotal
* @param array $chart
* @param null|string $error
*/
public function __construct(
array $metadata = [],
array $table = [],
int $recordsTotal = 0,
array $chart = []
array $chart = [],
string $error = null
) {
$this->metadata = $metadata;
$this->table = $table;
$this->recordsTotal = $recordsTotal;
$this->chart = $chart;
$this->error = $error;

return $this;
}
Expand All @@ -95,7 +104,8 @@ public function jsonSerialize()
'metadata' => $this->metadata,
'table' => $this->table,
'recordsTotal' => $this->recordsTotal,
'chart' => $this->chart
'chart' => $this->chart,
'error' => $this->error
];
}
}
45 changes: 45 additions & 0 deletions lib/Event/ConnectorReportEvent.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
<?php
/**
* Copyright (C) 2022 Xibo Signage Ltd
*
* Xibo - Digital Signage - http://www.xibo.org.uk
*
* This file is part of Xibo.
*
* Xibo is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* any later version.
*
* Xibo 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 Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with Xibo. If not, see <http://www.gnu.org/licenses/>.
*/
namespace Xibo\Event;

/**
* Event used to get list of connector reports
*/
class ConnectorReportEvent extends Event
{
public static $NAME = 'connector.report.event';

/** @var array */
private $reports = [];

public function getReports()
{
return $this->reports;
}

public function addReports($reports)
{
$this->reports = array_merge_recursive($this->reports, $reports);

return $this;
}
}
3 changes: 3 additions & 0 deletions lib/Event/ReportDataEvent.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@
*/
namespace Xibo\Event;

/**
* Event used to get report results
*/
class ReportDataEvent extends Event
{
public static $NAME = 'audience.report.data.event';
Expand Down
4 changes: 3 additions & 1 deletion lib/Middleware/State.php
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ public static function setState(App $app, Request $request): Request

// Register the report service
$container->set('reportService', function (ContainerInterface $container) {
return new ReportService(
$reportService = new ReportService(
$container,
$container->get('store'),
$container->get('timeSeriesStore'),
Expand All @@ -159,6 +159,8 @@ public static function setState(App $app, Request $request): Request
$container->get('sanitizerService'),
$container->get('savedReportFactory')
);
$reportService->setDispatcher($container->get('dispatcher'));
return $reportService;
});

// Set some public routes
Expand Down
33 changes: 11 additions & 22 deletions lib/Report/CampaignProofOfPlay.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,11 +61,6 @@ class CampaignProofOfPlay implements ReportInterface
*/
private $displayFactory;

/**
* @var MediaFactory
*/
private $mediaFactory;

/**
* @var LayoutFactory
*/
Expand All @@ -91,21 +86,11 @@ class CampaignProofOfPlay implements ReportInterface
*/
private $state;

private $table = 'stat';

private $tagsType = [
'dg' => 'Display group',
'media' => 'Media',
'layout' => 'Layout'
];

/** @inheritdoc */
public function setFactories(ContainerInterface $container)
{
$this->campaignFactory = $container->get('campaignFactory');
$this->displayFactory = $container->get('displayFactory');
$this->mediaFactory = $container->get('mediaFactory');
$this->layoutFactory = $container->get('layoutFactory');
$this->reportScheduleFactory = $container->get('reportScheduleFactory');
$this->sanitizer = $container->get('sanitizerService');
$this->dispatcher = $container->get('dispatcher');
Expand All @@ -130,7 +115,7 @@ public function getReportForm()
return new ReportForm(
'campaign-proofofplay-report-form',
'campaignProofOfPlay',
'Campaign Proof of Play',
'Connector Reports',
[
'fromDateOneDay' => Carbon::now()->subSeconds(86400)->format(DateFormatHelper::getSystemFormat()),
'toDate' => Carbon::now()->format(DateFormatHelper::getSystemFormat())
Expand Down Expand Up @@ -220,6 +205,10 @@ public function restructureSavedReportOldJson($result)
/** @inheritdoc */
public function getSavedReportResults($json, $savedReport)
{
// Get filter criteria
$rs = $this->reportScheduleFactory->getById($savedReport->reportScheduleId, 1)->filterCriteria;
$filterCriteria = json_decode($rs, true);

// Show filter criteria
$metadata = [];

Expand Down Expand Up @@ -345,23 +334,21 @@ public function getResults(SanitizerInterface $sanitizedParams)

// --------
// ReportDataEvent
$event = new ReportDataEvent('proofofplay');
$event = new ReportDataEvent('campaignProofofplay');

// Set query params for audience proof of play report
$event->setParams($params);

// Dispatch the event - listened by Audience Report Connector
$this->dispatcher->dispatch($event, ReportDataEvent::$NAME);

// Get results from the event
$result['result'] = $event->getResults();
$results = $event->getResults();

$result['periodStart'] = $params['fromDt'];
$result['periodEnd'] = $params['toDt'];

// Sanitize results??
$rows = [];
foreach ($result['result'] as $row) {
foreach ($results['json'] as $row) {
$entry = [];

$entry['labelDate'] = $row['labelDate'];
Expand All @@ -387,7 +374,9 @@ public function getResults(SanitizerInterface $sanitizedParams)
return new ReportResult(
$metadata,
$rows,
$recordsTotal
$recordsTotal,
[],
$results['error'] ?? null
);
}
}
Loading