init commit
This commit is contained in:
44
lib/Event/CommandDeleteEvent.php
Normal file
44
lib/Event/CommandDeleteEvent.php
Normal file
@@ -0,0 +1,44 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright (C) 2021 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;
|
||||
|
||||
use Xibo\Entity\Command;
|
||||
|
||||
class CommandDeleteEvent extends Event
|
||||
{
|
||||
public static $NAME = 'command.delete.event';
|
||||
/**
|
||||
* @var Command
|
||||
*/
|
||||
private $command;
|
||||
|
||||
public function __construct(Command $command)
|
||||
{
|
||||
$this->command = $command;
|
||||
}
|
||||
|
||||
public function getCommand(): Command
|
||||
{
|
||||
return $this->command;
|
||||
}
|
||||
}
|
||||
33
lib/Event/ConnectorDeletingEvent.php
Normal file
33
lib/Event/ConnectorDeletingEvent.php
Normal file
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
|
||||
namespace Xibo\Event;
|
||||
|
||||
use Xibo\Entity\Connector;
|
||||
use Xibo\Service\ConfigServiceInterface;
|
||||
|
||||
class ConnectorDeletingEvent extends Event
|
||||
{
|
||||
public static $NAME = 'connector.deleting.event';
|
||||
|
||||
/** @var \Xibo\Entity\Connector */
|
||||
private $connector;
|
||||
|
||||
/** @var ConfigServiceInterface */
|
||||
private $configService;
|
||||
|
||||
public function __construct(Connector $connector, ConfigServiceInterface $configService)
|
||||
{
|
||||
$this->connector = $connector;
|
||||
$this->configService = $configService;
|
||||
}
|
||||
|
||||
public function getConnector(): Connector
|
||||
{
|
||||
return $this->connector;
|
||||
}
|
||||
|
||||
public function getConfigService(): ConfigServiceInterface
|
||||
{
|
||||
return $this->configService;
|
||||
}
|
||||
}
|
||||
33
lib/Event/ConnectorEnabledChangeEvent.php
Normal file
33
lib/Event/ConnectorEnabledChangeEvent.php
Normal file
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
|
||||
namespace Xibo\Event;
|
||||
|
||||
use Xibo\Entity\Connector;
|
||||
use Xibo\Service\ConfigServiceInterface;
|
||||
|
||||
class ConnectorEnabledChangeEvent extends Event
|
||||
{
|
||||
public static $NAME = 'connector.enabled.change.event';
|
||||
|
||||
/** @var \Xibo\Entity\Connector */
|
||||
private $connector;
|
||||
|
||||
/** @var ConfigServiceInterface */
|
||||
private $configService;
|
||||
|
||||
public function __construct(Connector $connector, ConfigServiceInterface $configService)
|
||||
{
|
||||
$this->connector = $connector;
|
||||
$this->configService = $configService;
|
||||
}
|
||||
|
||||
public function getConnector(): Connector
|
||||
{
|
||||
return $this->connector;
|
||||
}
|
||||
|
||||
public function getConfigService(): ConfigServiceInterface
|
||||
{
|
||||
return $this->configService;
|
||||
}
|
||||
}
|
||||
45
lib/Event/ConnectorReportEvent.php
Normal file
45
lib/Event/ConnectorReportEvent.php
Normal file
@@ -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;
|
||||
}
|
||||
}
|
||||
47
lib/Event/DashboardDataRequestEvent.php
Normal file
47
lib/Event/DashboardDataRequestEvent.php
Normal file
@@ -0,0 +1,47 @@
|
||||
<?php
|
||||
/*
|
||||
* Copyright (C) 2023 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;
|
||||
|
||||
use Xibo\Widget\Provider\DataProviderInterface;
|
||||
|
||||
class DashboardDataRequestEvent extends Event
|
||||
{
|
||||
public static $NAME = 'dashboard.data.request.event';
|
||||
|
||||
/** @var DataProviderInterface */
|
||||
private $dataProvider;
|
||||
|
||||
public function __construct(DataProviderInterface $dataProvider)
|
||||
{
|
||||
$this->dataProvider = $dataProvider;
|
||||
}
|
||||
|
||||
/**
|
||||
* The data provider should be updated with data for its Widget.
|
||||
* @return DataProviderInterface
|
||||
*/
|
||||
public function getDataProvider(): DataProviderInterface
|
||||
{
|
||||
return $this->dataProvider;
|
||||
}
|
||||
}
|
||||
68
lib/Event/DataConnectorScriptRequestEvent.php
Normal file
68
lib/Event/DataConnectorScriptRequestEvent.php
Normal file
@@ -0,0 +1,68 @@
|
||||
<?php
|
||||
/*
|
||||
* Copyright (C) 2024 Xibo Signage Ltd
|
||||
*
|
||||
* Xibo - Digital Signage - https://xibosignage.com
|
||||
*
|
||||
* 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;
|
||||
|
||||
use Xibo\Connector\DataConnectorScriptProviderInterface;
|
||||
use Xibo\Entity\DataSet;
|
||||
|
||||
/**
|
||||
* Event triggered to retrieve the Data Connector JavaScript from a connector.
|
||||
*/
|
||||
class DataConnectorScriptRequestEvent extends Event implements DataConnectorScriptProviderInterface
|
||||
{
|
||||
public static $NAME = 'data.connector.script.request';
|
||||
|
||||
/**
|
||||
* @var DataSet
|
||||
*/
|
||||
private $dataSet;
|
||||
|
||||
/**
|
||||
* @param DataSet $dataSet
|
||||
*/
|
||||
public function __construct(DataSet $dataSet)
|
||||
{
|
||||
$this->dataSet = $dataSet;
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public function getConnectorId(): string
|
||||
{
|
||||
return $this->dataSet->dataConnectorSource;
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public function setScript(string $script): void
|
||||
{
|
||||
if ($this->dataSet->isRealTime == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Save the script.
|
||||
$this->dataSet->saveScript($script);
|
||||
}
|
||||
}
|
||||
80
lib/Event/DataConnectorSourceRequestEvent.php
Normal file
80
lib/Event/DataConnectorSourceRequestEvent.php
Normal file
@@ -0,0 +1,80 @@
|
||||
<?php
|
||||
/*
|
||||
* Copyright (C) 2024 Xibo Signage Ltd
|
||||
*
|
||||
* Xibo - Digital Signage - https://xibosignage.com
|
||||
*
|
||||
* 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;
|
||||
|
||||
use InvalidArgumentException;
|
||||
use Xibo\Connector\DataConnectorSourceProviderInterface;
|
||||
|
||||
/**
|
||||
* Event triggered to retrieve a list of data connector sources.
|
||||
*
|
||||
* This event collects metadata (names and IDs) of connectors that provides data connector.
|
||||
*/
|
||||
class DataConnectorSourceRequestEvent extends Event implements DataConnectorSourceProviderInterface
|
||||
{
|
||||
public static $NAME = 'data.connector.source.request';
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
private $dataConnectorSources = [];
|
||||
|
||||
/**
|
||||
* Initializes the dataConnectorSources with default value.
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
$this->dataConnectorSources[] = [
|
||||
'id' => 'user_defined',
|
||||
'name' => __('User-Defined JavaScript')
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public function addDataConnectorSource(string $id, string $name): void
|
||||
{
|
||||
// ensure that there are no duplicate id or name
|
||||
foreach ($this->dataConnectorSources as $dataConnectorSource) {
|
||||
if ($dataConnectorSource['id'] == $id) {
|
||||
throw new InvalidArgumentException('Duplicate Connector ID found.');
|
||||
}
|
||||
if ($dataConnectorSource['name'] == $name) {
|
||||
throw new InvalidArgumentException('Duplicate Connector Name found.');
|
||||
}
|
||||
}
|
||||
|
||||
$this->dataConnectorSources[] = ['id' => $id, 'name' => $name];
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves the list of data connector sources.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getDataConnectorSources(): array
|
||||
{
|
||||
return $this->dataConnectorSources;
|
||||
}
|
||||
}
|
||||
49
lib/Event/DataSetDataRequestEvent.php
Normal file
49
lib/Event/DataSetDataRequestEvent.php
Normal file
@@ -0,0 +1,49 @@
|
||||
<?php
|
||||
/*
|
||||
* Copyright (C) 2023 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;
|
||||
|
||||
use Xibo\Widget\Provider\DataProviderInterface;
|
||||
|
||||
/**
|
||||
* Event raised when a widget requests data.
|
||||
*/
|
||||
class DataSetDataRequestEvent extends Event
|
||||
{
|
||||
public static $NAME = 'dataset.data.request.event';
|
||||
|
||||
/** @var \Xibo\Widget\Provider\DataProviderInterface */
|
||||
private $dataProvider;
|
||||
|
||||
public function __construct(DataProviderInterface $dataProvider)
|
||||
{
|
||||
$this->dataProvider = $dataProvider;
|
||||
}
|
||||
|
||||
/**
|
||||
* The data provider should be updated with data for its widget.
|
||||
* @return \Xibo\Widget\Provider\DataProviderInterface
|
||||
*/
|
||||
public function getDataProvider(): DataProviderInterface
|
||||
{
|
||||
return $this->dataProvider;
|
||||
}
|
||||
}
|
||||
71
lib/Event/DataSetDataTypeRequestEvent.php
Normal file
71
lib/Event/DataSetDataTypeRequestEvent.php
Normal file
@@ -0,0 +1,71 @@
|
||||
<?php
|
||||
/*
|
||||
* Copyright (C) 2023 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;
|
||||
|
||||
use Xibo\Widget\Definition\DataType;
|
||||
|
||||
/**
|
||||
* Event raised when a data set widget requests its datatype.
|
||||
*/
|
||||
class DataSetDataTypeRequestEvent extends Event
|
||||
{
|
||||
public static $NAME = 'dataset.datatype.request.event';
|
||||
|
||||
/** @var int */
|
||||
private $dataSetId;
|
||||
|
||||
/** @var \Xibo\Widget\Definition\DataType */
|
||||
private $dataType;
|
||||
|
||||
public function __construct(int $dataSetId)
|
||||
{
|
||||
$this->dataSetId = $dataSetId;
|
||||
}
|
||||
|
||||
/**
|
||||
* The data provider should be updated with data for its widget.
|
||||
* @return int
|
||||
*/
|
||||
public function getDataSetId(): int
|
||||
{
|
||||
return $this->dataSetId;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param \Xibo\Widget\Definition\DataType $dataType
|
||||
* @return $this
|
||||
*/
|
||||
public function setDataType(DataType $dataType): DataSetDataTypeRequestEvent
|
||||
{
|
||||
$this->dataType = $dataType;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the data type
|
||||
* @return \Xibo\Widget\Definition\DataType
|
||||
*/
|
||||
public function getDataType(): ?DataType
|
||||
{
|
||||
return $this->dataType;
|
||||
}
|
||||
}
|
||||
59
lib/Event/DataSetModifiedDtRequestEvent.php
Normal file
59
lib/Event/DataSetModifiedDtRequestEvent.php
Normal file
@@ -0,0 +1,59 @@
|
||||
<?php
|
||||
/*
|
||||
* Copyright (C) 2023 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;
|
||||
|
||||
use Carbon\Carbon;
|
||||
|
||||
/**
|
||||
* Event raised when a widget requests data.
|
||||
*/
|
||||
class DataSetModifiedDtRequestEvent extends Event
|
||||
{
|
||||
public static $NAME = 'dataset.modifiedDt.request.event';
|
||||
|
||||
/** @var int */
|
||||
private $dataSetId;
|
||||
|
||||
/** @var Carbon */
|
||||
private $modifiedDt;
|
||||
|
||||
public function __construct(int $dataSetId)
|
||||
{
|
||||
$this->dataSetId = $dataSetId;
|
||||
}
|
||||
|
||||
public function getDataSetId(): int
|
||||
{
|
||||
return $this->dataSetId;
|
||||
}
|
||||
|
||||
public function setModifiedDt(Carbon $modifiedDt): DataSetModifiedDtRequestEvent
|
||||
{
|
||||
$this->modifiedDt = $modifiedDt;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getModifiedDt(): ?Carbon
|
||||
{
|
||||
return $this->modifiedDt;
|
||||
}
|
||||
}
|
||||
41
lib/Event/DayPartDeleteEvent.php
Normal file
41
lib/Event/DayPartDeleteEvent.php
Normal file
@@ -0,0 +1,41 @@
|
||||
<?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;
|
||||
|
||||
use Xibo\Entity\DayPart;
|
||||
|
||||
class DayPartDeleteEvent extends Event
|
||||
{
|
||||
public static $NAME = 'dayPart.delete.event';
|
||||
|
||||
private $dayPart;
|
||||
|
||||
public function __construct(DayPart $dayPart)
|
||||
{
|
||||
$this->dayPart = $dayPart;
|
||||
}
|
||||
|
||||
public function getDayPart(): DayPart
|
||||
{
|
||||
return $this->dayPart;
|
||||
}
|
||||
}
|
||||
25
lib/Event/DependencyFileSizeEvent.php
Normal file
25
lib/Event/DependencyFileSizeEvent.php
Normal file
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
namespace Xibo\Event;
|
||||
|
||||
class DependencyFileSizeEvent extends Event
|
||||
{
|
||||
public static $NAME = 'dependency.file.size.event';
|
||||
/** @var array */
|
||||
private $results;
|
||||
|
||||
public function __construct($results)
|
||||
{
|
||||
$this->results = $results;
|
||||
}
|
||||
|
||||
public function addResult($result)
|
||||
{
|
||||
$this->results[] = $result;
|
||||
}
|
||||
|
||||
public function getResults()
|
||||
{
|
||||
return $this->results;
|
||||
}
|
||||
}
|
||||
44
lib/Event/DisplayGroupLoadEvent.php
Normal file
44
lib/Event/DisplayGroupLoadEvent.php
Normal file
@@ -0,0 +1,44 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright (C) 2021 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;
|
||||
|
||||
use Xibo\Entity\DisplayGroup;
|
||||
|
||||
class DisplayGroupLoadEvent extends Event
|
||||
{
|
||||
public static $NAME = 'display.group.load.event';
|
||||
/**
|
||||
* @var DisplayGroup
|
||||
*/
|
||||
private $displayGroup;
|
||||
|
||||
public function __construct(DisplayGroup $displayGroup)
|
||||
{
|
||||
$this->displayGroup = $displayGroup;
|
||||
}
|
||||
|
||||
public function getDisplayGroup(): DisplayGroup
|
||||
{
|
||||
return $this->displayGroup;
|
||||
}
|
||||
}
|
||||
55
lib/Event/DisplayProfileLoadedEvent.php
Normal file
55
lib/Event/DisplayProfileLoadedEvent.php
Normal file
@@ -0,0 +1,55 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright (C) 2021 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;
|
||||
|
||||
use Xibo\Entity\DisplayProfile;
|
||||
|
||||
/**
|
||||
* Class DisplayProfileLoadedEvent
|
||||
* @package Xibo\Event
|
||||
*/
|
||||
class DisplayProfileLoadedEvent extends Event
|
||||
{
|
||||
const NAME = 'displayProfile.load';
|
||||
|
||||
/** @var DisplayProfile */
|
||||
protected $displayProfile;
|
||||
|
||||
/**
|
||||
* DisplayProfileLoadedEvent constructor.
|
||||
* @param $displayProfile
|
||||
*/
|
||||
public function __construct($displayProfile)
|
||||
{
|
||||
$this->displayProfile = $displayProfile;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return DisplayProfile
|
||||
*/
|
||||
public function getDisplayProfile()
|
||||
{
|
||||
return $this->displayProfile;
|
||||
}
|
||||
}
|
||||
39
lib/Event/Event.php
Normal file
39
lib/Event/Event.php
Normal file
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright (C) 2021 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;
|
||||
|
||||
/**
|
||||
* An event
|
||||
*/
|
||||
abstract class Event extends \Symfony\Component\EventDispatcher\Event
|
||||
{
|
||||
private static $NAME = 'generic.event';
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getName()
|
||||
{
|
||||
return $this::$NAME;
|
||||
}
|
||||
}
|
||||
44
lib/Event/FolderMovingEvent.php
Normal file
44
lib/Event/FolderMovingEvent.php
Normal file
@@ -0,0 +1,44 @@
|
||||
<?php
|
||||
|
||||
namespace Xibo\Event;
|
||||
|
||||
use Xibo\Entity\Folder;
|
||||
|
||||
class FolderMovingEvent extends Event
|
||||
{
|
||||
public static $NAME = 'folder.moving.event';
|
||||
/**
|
||||
* @var Folder
|
||||
*/
|
||||
private $folder;
|
||||
/**
|
||||
* @var Folder
|
||||
*/
|
||||
private $newFolder;
|
||||
/**
|
||||
* @var bool
|
||||
*/
|
||||
private $merge;
|
||||
|
||||
public function __construct(Folder $folder, Folder $newFolder, bool $merge)
|
||||
{
|
||||
$this->folder = $folder;
|
||||
$this->newFolder = $newFolder;
|
||||
$this->merge = $merge;
|
||||
}
|
||||
|
||||
public function getFolder(): Folder
|
||||
{
|
||||
return $this->folder;
|
||||
}
|
||||
|
||||
public function getNewFolder(): Folder
|
||||
{
|
||||
return $this->newFolder;
|
||||
}
|
||||
|
||||
public function getIsMerge(): bool
|
||||
{
|
||||
return $this->merge;
|
||||
}
|
||||
}
|
||||
58
lib/Event/LayoutBuildEvent.php
Normal file
58
lib/Event/LayoutBuildEvent.php
Normal file
@@ -0,0 +1,58 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright (C) 2021 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;
|
||||
|
||||
use Xibo\Entity\Layout;
|
||||
|
||||
/**
|
||||
* Class LayoutBuildEvent
|
||||
* @package Xibo\Event
|
||||
*/
|
||||
class LayoutBuildEvent extends Event
|
||||
{
|
||||
const NAME = 'layout.build';
|
||||
|
||||
/** @var Layout */
|
||||
protected $layout;
|
||||
|
||||
/** @var \DOMDocument */
|
||||
protected $document;
|
||||
|
||||
/**
|
||||
* LayoutBuildEvent constructor.
|
||||
* @param $layout
|
||||
* @param $document
|
||||
*/
|
||||
public function __construct($layout, $document)
|
||||
{
|
||||
$this->layout = $layout;
|
||||
$this->document = $document;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \DOMDocument
|
||||
*/
|
||||
public function getDocument()
|
||||
{
|
||||
return $this->document;
|
||||
}
|
||||
}
|
||||
56
lib/Event/LayoutBuildRegionEvent.php
Normal file
56
lib/Event/LayoutBuildRegionEvent.php
Normal file
@@ -0,0 +1,56 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright (C) 2021 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;
|
||||
|
||||
/**
|
||||
* Class LayoutBuildRegionEvent
|
||||
* @package Xibo\Event
|
||||
*/
|
||||
class LayoutBuildRegionEvent extends Event
|
||||
{
|
||||
const NAME = 'layout.build.region';
|
||||
|
||||
/** @var int */
|
||||
protected $regionId;
|
||||
|
||||
/** @var \DOMElement */
|
||||
protected $regionNode;
|
||||
|
||||
/**
|
||||
* LayoutBuildEvent constructor.
|
||||
* @param int $regionId
|
||||
* @param \DOMElement $regionNode
|
||||
*/
|
||||
public function __construct($regionId, $regionNode)
|
||||
{
|
||||
$this->regionId = $regionId;
|
||||
$this->regionNode = $regionNode;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \DOMElement
|
||||
*/
|
||||
public function getRegionNode()
|
||||
{
|
||||
return $this->regionNode;
|
||||
}
|
||||
}
|
||||
57
lib/Event/LayoutOwnerChangeEvent.php
Normal file
57
lib/Event/LayoutOwnerChangeEvent.php
Normal file
@@ -0,0 +1,57 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright (C) 2021 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;
|
||||
|
||||
class LayoutOwnerChangeEvent extends Event
|
||||
{
|
||||
public static $NAME = 'layout.owner.change.event';
|
||||
|
||||
/** @var int */
|
||||
private $campaignId;
|
||||
|
||||
/** @var int */
|
||||
private $ownerId;
|
||||
|
||||
/**
|
||||
* LayoutOwnerChangeEvent constructor.
|
||||
* @param $campaignId
|
||||
*/
|
||||
public function __construct($campaignId, $ownerId)
|
||||
{
|
||||
$this->campaignId = $campaignId;
|
||||
$this->ownerId = $ownerId;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
public function getCampaignId() : int
|
||||
{
|
||||
return $this->campaignId;
|
||||
}
|
||||
|
||||
public function getOwnerId() : int
|
||||
{
|
||||
return $this->ownerId;
|
||||
}
|
||||
}
|
||||
68
lib/Event/LayoutSharingChangeEvent.php
Normal file
68
lib/Event/LayoutSharingChangeEvent.php
Normal file
@@ -0,0 +1,68 @@
|
||||
<?php
|
||||
/*
|
||||
* Copyright (C) 2024 Xibo Signage Ltd
|
||||
*
|
||||
* Xibo - Digital Signage - https://xibosignage.com
|
||||
*
|
||||
* 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 raised when a Layout's sharing has been changed.
|
||||
*/
|
||||
class LayoutSharingChangeEvent extends Event
|
||||
{
|
||||
public static string $NAME = 'layout.sharing.change.event';
|
||||
|
||||
/** @var int[] */
|
||||
private array $canvasRegionIds;
|
||||
|
||||
/**
|
||||
* LayoutSharingChangeEvent constructor.
|
||||
* @param int $campaignId
|
||||
*/
|
||||
public function __construct(private readonly int $campaignId)
|
||||
{
|
||||
$this->canvasRegionIds = [];
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
public function getCampaignId(): int
|
||||
{
|
||||
return $this->campaignId;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the Canvas Region ID
|
||||
* @return int[]
|
||||
*/
|
||||
public function getCanvasRegionIds(): array
|
||||
{
|
||||
return $this->canvasRegionIds;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the Canvas Region ID
|
||||
*/
|
||||
public function addCanvasRegionId(int $regionId): void
|
||||
{
|
||||
$this->canvasRegionIds[] = $regionId;
|
||||
}
|
||||
}
|
||||
132
lib/Event/LibraryProviderEvent.php
Normal file
132
lib/Event/LibraryProviderEvent.php
Normal file
@@ -0,0 +1,132 @@
|
||||
<?php
|
||||
/*
|
||||
* Copyright (C) 2021 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;
|
||||
|
||||
use Xibo\Entity\SearchResult;
|
||||
use Xibo\Entity\SearchResults;
|
||||
|
||||
/**
|
||||
* LibraryProviderEvent
|
||||
*/
|
||||
class LibraryProviderEvent extends Event
|
||||
{
|
||||
protected static $NAME = 'connector.provider.library';
|
||||
|
||||
/** @var \Xibo\Entity\SearchResults */
|
||||
private $results;
|
||||
|
||||
/** @var int Record count to start from */
|
||||
private $start;
|
||||
|
||||
/** @var int Number of records to return */
|
||||
private $length;
|
||||
|
||||
/** @var string */
|
||||
private $search;
|
||||
|
||||
/** @var array */
|
||||
private $types;
|
||||
|
||||
/** @var string landspace|portrait or empty */
|
||||
private $orientation;
|
||||
/** @var string provider name */
|
||||
private $provider;
|
||||
|
||||
/**
|
||||
* @param \Xibo\Entity\SearchResults $results
|
||||
* @param $start
|
||||
* @param $length
|
||||
* @param $search
|
||||
* @param $types
|
||||
* @param $orientation
|
||||
* @param $provider
|
||||
*/
|
||||
public function __construct(SearchResults $results, $start, $length, $search, $types, $orientation, $provider)
|
||||
{
|
||||
$this->results = $results;
|
||||
$this->start = $start;
|
||||
$this->length = $length;
|
||||
$this->search = $search;
|
||||
$this->types = $types;
|
||||
$this->orientation = $orientation;
|
||||
$this->provider = $provider;
|
||||
}
|
||||
|
||||
public function addResult(SearchResult $result): LibraryProviderEvent
|
||||
{
|
||||
$this->results->data[] = $result;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getResults(): SearchResults
|
||||
{
|
||||
return $this->results;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get starting record
|
||||
* @return int
|
||||
*/
|
||||
public function getStart(): int
|
||||
{
|
||||
return $this->start;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get number of records to return
|
||||
* @return int
|
||||
*/
|
||||
public function getLength(): int
|
||||
{
|
||||
return $this->length;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getSearch()
|
||||
{
|
||||
return $this->search;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function getTypes()
|
||||
{
|
||||
return $this->types;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getOrientation()
|
||||
{
|
||||
return $this->orientation;
|
||||
}
|
||||
|
||||
public function getProviderName()
|
||||
{
|
||||
return $this->provider;
|
||||
}
|
||||
}
|
||||
48
lib/Event/LibraryProviderImportEvent.php
Normal file
48
lib/Event/LibraryProviderImportEvent.php
Normal file
@@ -0,0 +1,48 @@
|
||||
<?php
|
||||
/*
|
||||
* Copyright (C) 2021 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;
|
||||
|
||||
use Xibo\Connector\ProviderImport;
|
||||
|
||||
/**
|
||||
* Event raised when one or more provider search results have been chosen for importing on a layout
|
||||
*/
|
||||
class LibraryProviderImportEvent extends Event
|
||||
{
|
||||
protected static $NAME = 'connector.provider.library.import';
|
||||
|
||||
/** @var ProviderImport[] */
|
||||
private $ids;
|
||||
|
||||
/**
|
||||
* @param ProviderImport[] $ids
|
||||
*/
|
||||
public function __construct(array $ids)
|
||||
{
|
||||
$this->ids = $ids;
|
||||
}
|
||||
|
||||
public function getItems(): array
|
||||
{
|
||||
return $this->ids;
|
||||
}
|
||||
}
|
||||
57
lib/Event/LibraryProviderListEvent.php
Normal file
57
lib/Event/LibraryProviderListEvent.php
Normal file
@@ -0,0 +1,57 @@
|
||||
<?php
|
||||
/*
|
||||
* Copyright (C) 2024 Xibo Signage Ltd
|
||||
*
|
||||
* Xibo - Digital Signage - https://xibosignage.com
|
||||
*
|
||||
* 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;
|
||||
|
||||
use Xibo\Connector\ProviderDetails;
|
||||
|
||||
class LibraryProviderListEvent extends Event
|
||||
{
|
||||
protected static $NAME = 'connector.provider.library.list';
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
private mixed $providers;
|
||||
|
||||
public function __construct($providers = [])
|
||||
{
|
||||
$this->providers = $providers;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param ProviderDetails $provider
|
||||
* @return LibraryProviderListEvent
|
||||
*/
|
||||
public function addProvider(ProviderDetails $provider): LibraryProviderListEvent
|
||||
{
|
||||
$this->providers[] = $provider;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return ProviderDetails[]
|
||||
*/
|
||||
public function getProviders(): array
|
||||
{
|
||||
return $this->providers;
|
||||
}
|
||||
}
|
||||
76
lib/Event/LibraryReplaceEvent.php
Normal file
76
lib/Event/LibraryReplaceEvent.php
Normal file
@@ -0,0 +1,76 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright (C) 2021 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;
|
||||
|
||||
use Xibo\Entity\Media;
|
||||
use Xibo\Widget\ModuleWidget;
|
||||
|
||||
class LibraryReplaceEvent extends Event
|
||||
{
|
||||
public static $NAME = 'library.replace.event';
|
||||
|
||||
/** @var ModuleWidget */
|
||||
protected $module;
|
||||
|
||||
/** @var Media */
|
||||
protected $newMedia;
|
||||
|
||||
/** @var Media */
|
||||
protected $oldMedia;
|
||||
|
||||
/**
|
||||
* WidgetEditEvent constructor.
|
||||
* @param ModuleWidget $module
|
||||
* @param Media $newMedia
|
||||
* @param Media $oldMedia
|
||||
*/
|
||||
public function __construct($module, $newMedia, $oldMedia)
|
||||
{
|
||||
$this->module = $module;
|
||||
$this->newMedia = $newMedia;
|
||||
$this->oldMedia = $oldMedia;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return ModuleWidget
|
||||
*/
|
||||
public function getModule()
|
||||
{
|
||||
return $this->module;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Media
|
||||
*/
|
||||
public function getOldMedia()
|
||||
{
|
||||
return $this->oldMedia;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Media
|
||||
*/
|
||||
public function getNewMedia()
|
||||
{
|
||||
return $this->newMedia;
|
||||
}
|
||||
}
|
||||
89
lib/Event/LibraryReplaceWidgetEvent.php
Normal file
89
lib/Event/LibraryReplaceWidgetEvent.php
Normal file
@@ -0,0 +1,89 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright (C) 2021 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;
|
||||
|
||||
use Xibo\Entity\Media;
|
||||
use Xibo\Widget\ModuleWidget;
|
||||
|
||||
class LibraryReplaceWidgetEvent extends Event
|
||||
{
|
||||
public static $NAME = 'library.replace.widget.event';
|
||||
|
||||
/** @var ModuleWidget */
|
||||
protected $module;
|
||||
|
||||
/** @var \Xibo\Entity\Widget */
|
||||
protected $widget;
|
||||
|
||||
/** @var Media */
|
||||
protected $newMedia;
|
||||
|
||||
/** @var Media */
|
||||
protected $oldMedia;
|
||||
|
||||
/**
|
||||
* WidgetEditEvent constructor.
|
||||
* @param ModuleWidget $module The Module for the item being uploaded (the replacement)
|
||||
* @param \Xibo\Entity\Widget $widget The Widget - it will already have the new media assigned.
|
||||
* @param Media $newMedia The replacement Media record
|
||||
* @param Media $oldMedia The old Media record
|
||||
*/
|
||||
public function __construct($module, $widget, $newMedia, $oldMedia)
|
||||
{
|
||||
$this->module = $module;
|
||||
$this->widget = $widget;
|
||||
$this->newMedia = $newMedia;
|
||||
$this->oldMedia = $oldMedia;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return ModuleWidget
|
||||
*/
|
||||
public function getModule()
|
||||
{
|
||||
return $this->module;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Media
|
||||
*/
|
||||
public function getOldMedia()
|
||||
{
|
||||
return $this->oldMedia;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Media
|
||||
*/
|
||||
public function getNewMedia()
|
||||
{
|
||||
return $this->newMedia;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \Xibo\Entity\Widget
|
||||
*/
|
||||
public function getWidget()
|
||||
{
|
||||
return $this->widget;
|
||||
}
|
||||
}
|
||||
52
lib/Event/LibraryUploadCompleteEvent.php
Normal file
52
lib/Event/LibraryUploadCompleteEvent.php
Normal file
@@ -0,0 +1,52 @@
|
||||
<?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;
|
||||
|
||||
use Xibo\Entity\Media;
|
||||
|
||||
/**
|
||||
* An event fired when library media has completed upload.
|
||||
*/
|
||||
class LibraryUploadCompleteEvent extends Event
|
||||
{
|
||||
public static $NAME = 'library.upload.complete.event';
|
||||
|
||||
/** @var Media */
|
||||
protected $media;
|
||||
|
||||
/**
|
||||
* @param \Xibo\Entity\Media $media
|
||||
*/
|
||||
public function __construct(Media $media)
|
||||
{
|
||||
$this->media = $media;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Media
|
||||
*/
|
||||
public function getMedia(): Media
|
||||
{
|
||||
return $this->media;
|
||||
}
|
||||
}
|
||||
28
lib/Event/MaintenanceDailyEvent.php
Normal file
28
lib/Event/MaintenanceDailyEvent.php
Normal file
@@ -0,0 +1,28 @@
|
||||
<?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;
|
||||
|
||||
class MaintenanceDailyEvent extends Event
|
||||
{
|
||||
public static $NAME = 'maintenance.daily.event';
|
||||
use MaintenanceEventTrait;
|
||||
}
|
||||
46
lib/Event/MaintenanceEventTrait.php
Normal file
46
lib/Event/MaintenanceEventTrait.php
Normal file
@@ -0,0 +1,46 @@
|
||||
<?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;
|
||||
|
||||
trait MaintenanceEventTrait
|
||||
{
|
||||
private $messages = [];
|
||||
|
||||
/**
|
||||
* Add a message to be recorded in the run log
|
||||
* @param string $message
|
||||
* @return \Xibo\Event\Event|\Xibo\Event\MaintenanceEventTrait
|
||||
*/
|
||||
public function addMessage(string $message)
|
||||
{
|
||||
$this->messages[] = $message;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string[]
|
||||
*/
|
||||
public function getMessages(): array
|
||||
{
|
||||
return $this->messages;
|
||||
}
|
||||
}
|
||||
28
lib/Event/MaintenanceRegularEvent.php
Normal file
28
lib/Event/MaintenanceRegularEvent.php
Normal file
@@ -0,0 +1,28 @@
|
||||
<?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;
|
||||
|
||||
class MaintenanceRegularEvent extends Event
|
||||
{
|
||||
public static $NAME = 'maintenance.regular.event';
|
||||
use MaintenanceEventTrait;
|
||||
}
|
||||
70
lib/Event/MediaDeleteEvent.php
Normal file
70
lib/Event/MediaDeleteEvent.php
Normal file
@@ -0,0 +1,70 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright (C) 2021 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;
|
||||
|
||||
use phpDocumentor\Reflection\Types\Boolean;
|
||||
use Xibo\Entity\Media;
|
||||
|
||||
class MediaDeleteEvent extends Event
|
||||
{
|
||||
public static $NAME = 'library.media.delete.event';
|
||||
|
||||
/** @var Media */
|
||||
private $media;
|
||||
/**
|
||||
* @var Media|null
|
||||
*/
|
||||
private $parentMedia;
|
||||
|
||||
/** @var Boolean */
|
||||
private $purge;
|
||||
|
||||
/**
|
||||
* MediaDeleteEvent constructor.
|
||||
* @param $media
|
||||
*/
|
||||
public function __construct($media, $parentMedia = null, $purge = false)
|
||||
{
|
||||
$this->media = $media;
|
||||
$this->parentMedia = $parentMedia;
|
||||
$this->purge = $purge;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Media
|
||||
*/
|
||||
public function getMedia() : Media
|
||||
{
|
||||
return $this->media;
|
||||
}
|
||||
|
||||
public function getParentMedia()
|
||||
{
|
||||
return $this->parentMedia;
|
||||
}
|
||||
|
||||
public function isSetToPurge()
|
||||
{
|
||||
return $this->purge;
|
||||
}
|
||||
}
|
||||
50
lib/Event/MediaFullLoadEvent.php
Normal file
50
lib/Event/MediaFullLoadEvent.php
Normal file
@@ -0,0 +1,50 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright (C) 2021 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;
|
||||
|
||||
use Xibo\Entity\Media;
|
||||
|
||||
class MediaFullLoadEvent extends Event
|
||||
{
|
||||
public static $NAME = 'library.media.full.load.event';
|
||||
|
||||
/** @var Media */
|
||||
private $media;
|
||||
|
||||
/**
|
||||
* MediaDeleteEvent constructor.
|
||||
* @param $media
|
||||
*/
|
||||
public function __construct($media)
|
||||
{
|
||||
$this->media = $media;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Media
|
||||
*/
|
||||
public function getMedia() : Media
|
||||
{
|
||||
return $this->media;
|
||||
}
|
||||
}
|
||||
50
lib/Event/MenuBoardCategoryRequest.php
Normal file
50
lib/Event/MenuBoardCategoryRequest.php
Normal file
@@ -0,0 +1,50 @@
|
||||
<?php
|
||||
/*
|
||||
* Copyright (C) 2023 Xibo Signage Ltd
|
||||
*
|
||||
* Xibo - Digital Signage - https://xibosignage.com
|
||||
*
|
||||
* 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;
|
||||
|
||||
use Xibo\Widget\Provider\DataProviderInterface;
|
||||
|
||||
/**
|
||||
* Menu Board Category Request.
|
||||
*/
|
||||
class MenuBoardCategoryRequest extends Event
|
||||
{
|
||||
public static $NAME = 'menuboard.category.request.event';
|
||||
|
||||
/** @var \Xibo\Widget\Provider\DataProviderInterface */
|
||||
private DataProviderInterface $dataProvider;
|
||||
|
||||
public function __construct(DataProviderInterface $dataProvider)
|
||||
{
|
||||
$this->dataProvider = $dataProvider;
|
||||
}
|
||||
|
||||
/**
|
||||
* The data provider should be updated with data for its widget.
|
||||
* @return \Xibo\Widget\Provider\DataProviderInterface
|
||||
*/
|
||||
public function getDataProvider(): DataProviderInterface
|
||||
{
|
||||
return $this->dataProvider;
|
||||
}
|
||||
}
|
||||
60
lib/Event/MenuBoardModifiedDtRequest.php
Normal file
60
lib/Event/MenuBoardModifiedDtRequest.php
Normal file
@@ -0,0 +1,60 @@
|
||||
<?php
|
||||
/*
|
||||
* Copyright (C) 2023 Xibo Signage Ltd
|
||||
*
|
||||
* Xibo - Digital Signage - https://xibosignage.com
|
||||
*
|
||||
* 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;
|
||||
|
||||
use Carbon\Carbon;
|
||||
|
||||
/**
|
||||
* Menu Board Product Request.
|
||||
*/
|
||||
class MenuBoardModifiedDtRequest extends Event
|
||||
{
|
||||
public static $NAME = 'menuboard.modifiedDt.request.event';
|
||||
|
||||
/** @var int */
|
||||
private $menuId;
|
||||
|
||||
/** @var Carbon */
|
||||
private $modifiedDt;
|
||||
|
||||
public function __construct(int $menuId)
|
||||
{
|
||||
$this->menuId = $menuId;
|
||||
}
|
||||
|
||||
public function getDataSetId(): int
|
||||
{
|
||||
return $this->menuId;
|
||||
}
|
||||
|
||||
public function setModifiedDt(Carbon $modifiedDt): MenuBoardModifiedDtRequest
|
||||
{
|
||||
$this->modifiedDt = $modifiedDt;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getModifiedDt(): ?Carbon
|
||||
{
|
||||
return $this->modifiedDt;
|
||||
}
|
||||
}
|
||||
50
lib/Event/MenuBoardProductRequest.php
Normal file
50
lib/Event/MenuBoardProductRequest.php
Normal file
@@ -0,0 +1,50 @@
|
||||
<?php
|
||||
/*
|
||||
* Copyright (C) 2023 Xibo Signage Ltd
|
||||
*
|
||||
* Xibo - Digital Signage - https://xibosignage.com
|
||||
*
|
||||
* 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;
|
||||
|
||||
use Xibo\Widget\Provider\DataProviderInterface;
|
||||
|
||||
/**
|
||||
* Menu Board Product Request.
|
||||
*/
|
||||
class MenuBoardProductRequest extends Event
|
||||
{
|
||||
public static $NAME = 'menuboard.product.request.event';
|
||||
|
||||
/** @var \Xibo\Widget\Provider\DataProviderInterface */
|
||||
private DataProviderInterface $dataProvider;
|
||||
|
||||
public function __construct(DataProviderInterface $dataProvider)
|
||||
{
|
||||
$this->dataProvider = $dataProvider;
|
||||
}
|
||||
|
||||
/**
|
||||
* The data provider should be updated with data for its widget.
|
||||
* @return \Xibo\Widget\Provider\DataProviderInterface
|
||||
*/
|
||||
public function getDataProvider(): DataProviderInterface
|
||||
{
|
||||
return $this->dataProvider;
|
||||
}
|
||||
}
|
||||
47
lib/Event/NotificationDataRequestEvent.php
Normal file
47
lib/Event/NotificationDataRequestEvent.php
Normal file
@@ -0,0 +1,47 @@
|
||||
<?php
|
||||
/*
|
||||
* Copyright (C) 2023 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;
|
||||
|
||||
use Xibo\Widget\Provider\DataProviderInterface;
|
||||
|
||||
class NotificationDataRequestEvent extends Event
|
||||
{
|
||||
public static $NAME = 'notification.data.request.event';
|
||||
|
||||
/** @var DataProviderInterface */
|
||||
private $dataProvider;
|
||||
|
||||
public function __construct(DataProviderInterface $dataProvider)
|
||||
{
|
||||
$this->dataProvider = $dataProvider;
|
||||
}
|
||||
|
||||
/**
|
||||
* The data provider should be updated with data for its Widget.
|
||||
* @return DataProviderInterface
|
||||
*/
|
||||
public function getDataProvider(): DataProviderInterface
|
||||
{
|
||||
return $this->dataProvider;
|
||||
}
|
||||
}
|
||||
60
lib/Event/NotificationModifiedDtRequestEvent.php
Normal file
60
lib/Event/NotificationModifiedDtRequestEvent.php
Normal file
@@ -0,0 +1,60 @@
|
||||
<?php
|
||||
/*
|
||||
* Copyright (C) 2023 Xibo Signage Ltd
|
||||
*
|
||||
* Xibo - Digital Signage - https://xibosignage.com
|
||||
*
|
||||
* 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;
|
||||
|
||||
use Carbon\Carbon;
|
||||
|
||||
/**
|
||||
* Request for the latest released notification.
|
||||
*/
|
||||
class NotificationModifiedDtRequestEvent extends Event
|
||||
{
|
||||
public static $NAME = 'notification.modifiedDt.request.event';
|
||||
|
||||
/** @var int displayId */
|
||||
private $displayId;
|
||||
|
||||
/** @var Carbon */
|
||||
private $modifiedDt;
|
||||
|
||||
public function __construct(int $displayId)
|
||||
{
|
||||
$this->displayId = $displayId;
|
||||
}
|
||||
|
||||
public function getDisplayId(): int
|
||||
{
|
||||
return $this->displayId;
|
||||
}
|
||||
|
||||
public function setModifiedDt(Carbon $modifiedDt): NotificationModifiedDtRequestEvent
|
||||
{
|
||||
$this->modifiedDt = $modifiedDt;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getModifiedDt(): ?Carbon
|
||||
{
|
||||
return $this->modifiedDt;
|
||||
}
|
||||
}
|
||||
63
lib/Event/ParsePermissionEntityEvent.php
Normal file
63
lib/Event/ParsePermissionEntityEvent.php
Normal file
@@ -0,0 +1,63 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright (C) 2021 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;
|
||||
|
||||
class ParsePermissionEntityEvent extends Event
|
||||
{
|
||||
public static $NAME = 'parse.permission.entity.event.';
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
private $entity;
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
private $objectId;
|
||||
private $object;
|
||||
|
||||
public function __construct(string $entity, int $objectId)
|
||||
{
|
||||
$this->entity = $entity;
|
||||
$this->objectId = $objectId;
|
||||
}
|
||||
|
||||
public function getEntity()
|
||||
{
|
||||
return $this->entity;
|
||||
}
|
||||
|
||||
public function getObjectId()
|
||||
{
|
||||
return $this->objectId;
|
||||
}
|
||||
|
||||
public function setObject($object)
|
||||
{
|
||||
$this->object = $object;
|
||||
}
|
||||
|
||||
public function getObject()
|
||||
{
|
||||
return $this->object;
|
||||
}
|
||||
}
|
||||
50
lib/Event/PlaylistDeleteEvent.php
Normal file
50
lib/Event/PlaylistDeleteEvent.php
Normal file
@@ -0,0 +1,50 @@
|
||||
<?php
|
||||
/*
|
||||
* Copyright (C) 2023 Xibo Signage Ltd
|
||||
*
|
||||
* Xibo - Digital Signage - https://xibosignage.com
|
||||
*
|
||||
* 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;
|
||||
|
||||
use Xibo\Entity\Playlist;
|
||||
|
||||
class PlaylistDeleteEvent extends Event
|
||||
{
|
||||
public static $NAME = 'playlist.delete.event';
|
||||
|
||||
/** @var Playlist */
|
||||
private $playlist;
|
||||
|
||||
/**
|
||||
* PlaylistDeleteEvent constructor.
|
||||
* @param $playlist
|
||||
*/
|
||||
public function __construct(Playlist $playlist)
|
||||
{
|
||||
$this->playlist = $playlist;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Playlist
|
||||
*/
|
||||
public function getPlaylist() : Playlist
|
||||
{
|
||||
return $this->playlist;
|
||||
}
|
||||
}
|
||||
40
lib/Event/PlaylistMaxNumberChangedEvent.php
Normal file
40
lib/Event/PlaylistMaxNumberChangedEvent.php
Normal file
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright (C) 2021 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;
|
||||
|
||||
class PlaylistMaxNumberChangedEvent extends Event
|
||||
{
|
||||
public static $NAME = 'playlist.max.item.number.change.event';
|
||||
/** @var int */
|
||||
private $newLimit;
|
||||
|
||||
public function __construct(int $newLimit)
|
||||
{
|
||||
$this->newLimit = $newLimit;
|
||||
}
|
||||
|
||||
public function getNewLimit(): int
|
||||
{
|
||||
return $this->newLimit;
|
||||
}
|
||||
}
|
||||
56
lib/Event/RegionAddedEvent.php
Normal file
56
lib/Event/RegionAddedEvent.php
Normal file
@@ -0,0 +1,56 @@
|
||||
<?php
|
||||
/*
|
||||
* Copyright (C) 2023 Xibo Signage Ltd
|
||||
*
|
||||
* Xibo - Digital Signage - https://xibosignage.com
|
||||
*
|
||||
* 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;
|
||||
|
||||
use Xibo\Entity\Layout;
|
||||
use Xibo\Entity\Region;
|
||||
|
||||
/**
|
||||
* Event fired when a region is being added (before save)
|
||||
*/
|
||||
class RegionAddedEvent extends Event
|
||||
{
|
||||
public static string $NAME = 'region.added.event';
|
||||
|
||||
/** @var Layout */
|
||||
private Layout $layout;
|
||||
|
||||
/** @var Region */
|
||||
private Region $region;
|
||||
|
||||
public function __construct(Layout $layout, Region $region)
|
||||
{
|
||||
$this->layout = $layout;
|
||||
$this->region = $region;
|
||||
}
|
||||
|
||||
public function getLayout(): Layout
|
||||
{
|
||||
return $this->layout;
|
||||
}
|
||||
|
||||
public function getRegion(): Region
|
||||
{
|
||||
return $this->region;
|
||||
}
|
||||
}
|
||||
74
lib/Event/ReportDataEvent.php
Normal file
74
lib/Event/ReportDataEvent.php
Normal file
@@ -0,0 +1,74 @@
|
||||
<?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 report results
|
||||
*/
|
||||
class ReportDataEvent extends Event
|
||||
{
|
||||
public static $NAME = 'audience.report.data.event';
|
||||
|
||||
private $type;
|
||||
|
||||
private $params;
|
||||
|
||||
private $results;
|
||||
|
||||
/**
|
||||
* ReportDataEvent constructor.
|
||||
* @param $type
|
||||
*/
|
||||
public function __construct($type)
|
||||
{
|
||||
$this->type = $type;
|
||||
}
|
||||
|
||||
public function getReportType()
|
||||
{
|
||||
return $this->type;
|
||||
}
|
||||
|
||||
public function getParams()
|
||||
{
|
||||
return $this->params;
|
||||
}
|
||||
|
||||
public function setParams($params)
|
||||
{
|
||||
$this->params = $params;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getResults()
|
||||
{
|
||||
return $this->results;
|
||||
}
|
||||
|
||||
public function setResults($results)
|
||||
{
|
||||
$this->results = $results;
|
||||
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
277
lib/Event/ScheduleCriteriaRequestEvent.php
Normal file
277
lib/Event/ScheduleCriteriaRequestEvent.php
Normal file
@@ -0,0 +1,277 @@
|
||||
<?php
|
||||
/*
|
||||
* Copyright (C) 2024 Xibo Signage Ltd
|
||||
*
|
||||
* Xibo - Digital Signage - https://xibosignage.com
|
||||
*
|
||||
* 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;
|
||||
|
||||
use Xibo\Support\Exception\ConfigurationException;
|
||||
|
||||
/**
|
||||
* This class represents a schedule criteria request event. It is responsible for initializing,
|
||||
* managing, and retrieving schedule criteria. The class provides methods for adding types,
|
||||
* metrics, and their associated conditions and values.
|
||||
*/
|
||||
class ScheduleCriteriaRequestEvent extends Event implements ScheduleCriteriaRequestInterface
|
||||
{
|
||||
public static $NAME = 'schedule.criteria.request';
|
||||
private array $criteria = [];
|
||||
private ?int $currentTypeIndex = null;
|
||||
private array $currentMetric = [];
|
||||
private array $defaultConditions = [];
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
// Initialize default conditions in key-value format
|
||||
$this->defaultConditions = [
|
||||
'set' => __('Is set'),
|
||||
'lt' => __('Less than'),
|
||||
'lte' => __('Less than or equal to'),
|
||||
'eq' => __('Equal to'),
|
||||
'neq' => __('Not equal to'),
|
||||
'gte' => __('Greater than or equal to'),
|
||||
'gt' => __('Greater than'),
|
||||
'contains' => __('Contains'),
|
||||
'ncontains' => __('Not contains'),
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public function addType(string $id, string $type): self
|
||||
{
|
||||
// Ensure that 'types' key exists
|
||||
if (!isset($this->criteria['types'])) {
|
||||
$this->criteria['types'] = [];
|
||||
}
|
||||
|
||||
// Check if the type already exists
|
||||
foreach ($this->criteria['types'] as $index => $existingType) {
|
||||
if ($existingType['id'] === $id) {
|
||||
// If the type exists, update currentTypeIndex and return
|
||||
$this->currentTypeIndex = $index;
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
|
||||
// If the type doesn't exist, add it in the criteria array
|
||||
$this->criteria['types'][] = [
|
||||
'id' => $id,
|
||||
'name' => $type,
|
||||
'metrics' => []
|
||||
];
|
||||
|
||||
// Set the current type index for chaining
|
||||
$this->currentTypeIndex = count($this->criteria['types']) - 1;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public function addMetric(string $id, string $name): self
|
||||
{
|
||||
// Ensure the current type is set
|
||||
if (!isset($this->criteria['types'][$this->currentTypeIndex])) {
|
||||
throw new ConfigurationException(__('Current type is not set.'));
|
||||
}
|
||||
|
||||
// initialize the metric to add
|
||||
$metric = [
|
||||
'id' => $id,
|
||||
'name' => $name,
|
||||
'conditions' => $this->formatConditions($this->defaultConditions),
|
||||
'isUsingDefaultConditions' => true,
|
||||
'values' => null
|
||||
];
|
||||
|
||||
// Reference the current type's metrics
|
||||
$metrics = &$this->criteria['types'][$this->currentTypeIndex]['metrics'];
|
||||
|
||||
// Check if the metric already exists
|
||||
foreach ($metrics as &$existingMetric) {
|
||||
if ($existingMetric['id'] === $id) {
|
||||
// If the metric exists, set currentMetric and return
|
||||
$this->currentMetric = $existingMetric;
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
|
||||
// If the metric doesn't exist, add it to the metrics array
|
||||
$metrics[] = $metric;
|
||||
|
||||
// Set the current metric for chaining
|
||||
$this->currentMetric = $metric;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public function addCondition(array $conditions): self
|
||||
{
|
||||
// Retain default conditions if provided condition array is empty
|
||||
if (empty($conditions)) {
|
||||
return $this;
|
||||
}
|
||||
|
||||
// Ensure current type is set
|
||||
if (!isset($this->criteria['types'][$this->currentTypeIndex])) {
|
||||
throw new ConfigurationException(__('Current type is not set.'));
|
||||
}
|
||||
|
||||
// Validate conditions
|
||||
foreach ($conditions as $id => $name) {
|
||||
if (!array_key_exists($id, $this->defaultConditions)) {
|
||||
throw new ConfigurationException(__('Invalid condition ID: %s', $id));
|
||||
}
|
||||
}
|
||||
|
||||
// Reference the current type's metrics
|
||||
$metrics = &$this->criteria['types'][$this->currentTypeIndex]['metrics'];
|
||||
|
||||
// Find the current metric and handle conditions
|
||||
foreach ($metrics as &$metric) {
|
||||
if ($metric['id'] === $this->currentMetric['id']) {
|
||||
if ($metric['isUsingDefaultConditions']) {
|
||||
// If metric is using default conditions, replace with new ones
|
||||
$metric['conditions'] = $this->formatConditions($conditions);
|
||||
$metric['isUsingDefaultConditions'] = false;
|
||||
} else {
|
||||
// Merge the new conditions with existing ones, avoiding duplicates
|
||||
$existingConditions = $metric['conditions'];
|
||||
$newConditions = $this->formatConditions($conditions);
|
||||
|
||||
// Combine the two condition arrays
|
||||
$mergedConditions = array_merge($existingConditions, $newConditions);
|
||||
|
||||
// Remove duplicates
|
||||
$finalConditions = array_unique($mergedConditions, SORT_REGULAR);
|
||||
|
||||
$metric['conditions'] = array_values($finalConditions);
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Format conditions from key-value to the required array structure.
|
||||
*
|
||||
* @param array $conditions
|
||||
* @return array
|
||||
*/
|
||||
private function formatConditions(array $conditions): array
|
||||
{
|
||||
$formattedConditions = [];
|
||||
foreach ($conditions as $id => $name) {
|
||||
$formattedConditions[] = [
|
||||
'id' => $id,
|
||||
'name' => $name,
|
||||
];
|
||||
}
|
||||
|
||||
return $formattedConditions;
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public function addValues(string $inputType, array $values): self
|
||||
{
|
||||
// Ensure current type is set
|
||||
if (!isset($this->criteria['types'][$this->currentTypeIndex])) {
|
||||
throw new ConfigurationException(__('Current type is not set.'));
|
||||
}
|
||||
|
||||
// Restrict input types to 'dropdown', 'number', 'text' and 'date'
|
||||
$allowedInputTypes = ['dropdown', 'number', 'text', 'date'];
|
||||
if (!in_array($inputType, $allowedInputTypes)) {
|
||||
throw new ConfigurationException(__('Invalid input type.'));
|
||||
}
|
||||
|
||||
// Reference the metrics of the current type
|
||||
$metrics = &$this->criteria['types'][$this->currentTypeIndex]['metrics'];
|
||||
|
||||
// Find the current metric and add or update values
|
||||
foreach ($metrics as &$metric) {
|
||||
if ($metric['id'] === $this->currentMetric['id']) {
|
||||
// Check if the input type matches the existing one (if any)
|
||||
if (isset($metric['values']['inputType']) && $metric['values']['inputType'] !== $inputType) {
|
||||
throw new ConfigurationException(__('Input type does not match.'));
|
||||
}
|
||||
|
||||
// Format the new values
|
||||
$formattedValues = [];
|
||||
foreach ($values as $id => $title) {
|
||||
$formattedValues[] = [
|
||||
'id' => $id,
|
||||
'title' => $title
|
||||
];
|
||||
}
|
||||
|
||||
// Merge new values with existing ones, avoiding duplicates
|
||||
$existingValues = $metric['values']['values'] ?? [];
|
||||
|
||||
// Combine the two value arrays
|
||||
$mergedValues = array_merge($existingValues, $formattedValues);
|
||||
|
||||
// Remove duplicates
|
||||
$uniqueFormattedValues = array_unique($mergedValues, SORT_REGULAR);
|
||||
|
||||
// Update the metric's values
|
||||
$metric['values'] = [
|
||||
'inputType' => $inputType,
|
||||
'values' => array_values($uniqueFormattedValues)
|
||||
];
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the criteria array.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getCriteria(): array
|
||||
{
|
||||
return $this->criteria;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the default conditions array.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getCriteriaDefaultCondition(): array
|
||||
{
|
||||
return $this->formatConditions($this->defaultConditions);
|
||||
}
|
||||
}
|
||||
172
lib/Event/ScheduleCriteriaRequestInterface.php
Normal file
172
lib/Event/ScheduleCriteriaRequestInterface.php
Normal file
@@ -0,0 +1,172 @@
|
||||
<?php
|
||||
/*
|
||||
* Copyright (C) 2024 Xibo Signage Ltd
|
||||
*
|
||||
* Xibo - Digital Signage - https://xibosignage.com
|
||||
*
|
||||
* 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;
|
||||
|
||||
use Xibo\Support\Exception\ConfigurationException;
|
||||
|
||||
/**
|
||||
* Interface for managing schedule criteria types, metrics, conditions, and values.
|
||||
*
|
||||
* Allows the addition of types, metrics, conditions, and values in a chained manner:
|
||||
* - Start with `addType()` to add a new type. Call `addType()` multiple times to add multiple types.
|
||||
* - Follow with `addMetric()` to add metrics under the specified type. Call `addMetric()` multiple times to add
|
||||
* multiple metrics to the current type.
|
||||
* - Optionally, call `addCondition()` after `addMetric()` to specify a set of conditions for the metric. If not called,
|
||||
* the system will automatically apply default conditions, which include all supported conditions.
|
||||
* - Conclude with `addValues()` immediately after `addMetric()` or `addCondition()` to specify a set of values for the
|
||||
* metric. Each metric can have one set of values.
|
||||
*
|
||||
* The added criteria are then parsed and displayed in the Schedule Criteria Form, enabling users to configure
|
||||
* scheduling conditions based on the specified parameters.
|
||||
*/
|
||||
interface ScheduleCriteriaRequestInterface
|
||||
{
|
||||
/**
|
||||
* Adds a new type to the criteria.
|
||||
*
|
||||
* **Important Notes:**
|
||||
* - If the type already exists, the existing type is selected to allow method
|
||||
* chaining.
|
||||
*
|
||||
* Example usage:
|
||||
* ```
|
||||
* $event->addType('weather', 'Weather Data')
|
||||
* ->addMetric('temp', 'Temperature')
|
||||
* ->addCondition([
|
||||
* 'eq' => 'Equal to',
|
||||
* 'gt' => 'Greater than'
|
||||
* ])
|
||||
* ->addValues('dropdown', [
|
||||
* 'active' => 'Active',
|
||||
* 'inactive' => 'Inactive'
|
||||
* ]);
|
||||
* ```
|
||||
*
|
||||
* @param string $id Unique identifier for the type.
|
||||
* @param string $type Name of the type.
|
||||
* @return self Returns the current instance for method chaining.
|
||||
*/
|
||||
public function addType(string $id, string $type): self;
|
||||
|
||||
/**
|
||||
* Adds a new metric to the current type.
|
||||
*
|
||||
* **Important Notes:**
|
||||
* - If the metric already exists, it sets the metric as the current metric for chaining instead.
|
||||
* - `addType` must be called before this method to define the current type.
|
||||
*
|
||||
* **Example Usage:**
|
||||
* ```
|
||||
* $event->addType('weather', 'Weather Data')
|
||||
* ->addMetric('temp', 'Temperature')
|
||||
* ->addCondition([
|
||||
* 'eq' => 'Equal to',
|
||||
* 'gt' => 'Greater than'
|
||||
* ])
|
||||
* ->addValues('dropdown', [
|
||||
* 'active' => 'Active',
|
||||
* 'inactive' => 'Inactive'
|
||||
* ]);
|
||||
* ```
|
||||
*
|
||||
* @param string $id Unique identifier for the metric.
|
||||
* @param string $name Name of the metric.
|
||||
* @return self Returns the current instance for method chaining.
|
||||
* @throws ConfigurationException If the current type is not set.
|
||||
*/
|
||||
public function addMetric(string $id, string $name): self;
|
||||
|
||||
/**
|
||||
* Add conditions to the current metric.
|
||||
*
|
||||
* This method allows you to specify conditions for the current metric.
|
||||
* The list of accepted conditions includes:
|
||||
* - 'set' => 'Is set'
|
||||
* - 'lt' => 'Less than'
|
||||
* - 'lte' => 'Less than or equal to'
|
||||
* - 'eq' => 'Equal to'
|
||||
* - 'neq' => 'Not equal to'
|
||||
* - 'gte' => 'Greater than or equal to'
|
||||
* - 'gt' => 'Greater than'
|
||||
* - 'contains' => 'Contains'
|
||||
* - 'ncontains' => 'Not contains'
|
||||
*
|
||||
* **Important Notes:**
|
||||
* - The `addMetric` method **must** be called before using `addCondition`.
|
||||
* - If this method is **not called** for a metric, the system will automatically
|
||||
* provide the default conditions, which include **all the accepted conditions** listed above.
|
||||
* - New conditions will be merged if they already exist under the same type and metric, avoiding duplicates.
|
||||
*
|
||||
* Example usage:
|
||||
* ```
|
||||
* $event->addType('weather', 'Weather Data')
|
||||
* ->addMetric('temp', 'Temperature')
|
||||
* ->addCondition([
|
||||
* 'eq' => 'Equal to',
|
||||
* 'gt' => 'Greater than'
|
||||
* ])
|
||||
* ->addValues('dropdown', [
|
||||
* 'active' => 'Active',
|
||||
* 'inactive' => 'Inactive'
|
||||
* ]);
|
||||
* ```
|
||||
*
|
||||
* @param array $conditions An associative array of conditions, where the key is the condition ID and the value is
|
||||
* its name.
|
||||
* @return $this Returns the current instance for method chaining.
|
||||
* @throws ConfigurationException If the current metric is not set.
|
||||
*/
|
||||
public function addCondition(array $conditions): self;
|
||||
|
||||
/**
|
||||
* Add values to the current metric. The input type must be either "dropdown", "string", "date", or "number".
|
||||
*
|
||||
* For "dropdown" input type, provide an array of values. For other input types ("string", "date", "number"),
|
||||
* the values array should be empty "[]".
|
||||
* The values array should be formatted such that the index is the id and the value is the title/name of the value.
|
||||
*
|
||||
* **Important Notes:**
|
||||
* - The `addMetric` method **must** be called before using `addValues`.
|
||||
* - If values already exist for the same type and metric, new values will be merged, avoiding duplicates.
|
||||
*
|
||||
* Example usage:
|
||||
* ```
|
||||
* $event->addType('weather', 'Weather Data')
|
||||
* ->addMetric('temp', 'Temperature')
|
||||
* ->addCondition([
|
||||
* 'eq' => 'Equal to',
|
||||
* 'gt' => 'Greater than'
|
||||
* ])
|
||||
* ->addValues('dropdown', [
|
||||
* 'active' => 'Active',
|
||||
* 'inactive' => 'Inactive'
|
||||
* ]);
|
||||
* ```
|
||||
*
|
||||
* @param string $inputType Type of input for the values ("dropdown", "string", "date", "number").
|
||||
* @param array $values Array of values, which should be empty for input types other than "dropdown".
|
||||
* @return self Returns the current instance for method chaining.
|
||||
* @throws ConfigurationException If the current type or metric is not set.
|
||||
*/
|
||||
public function addValues(string $inputType, array $values): self;
|
||||
}
|
||||
75
lib/Event/SubPlaylistDurationEvent.php
Normal file
75
lib/Event/SubPlaylistDurationEvent.php
Normal file
@@ -0,0 +1,75 @@
|
||||
<?php
|
||||
/*
|
||||
* Copyright (C) 2023 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;
|
||||
|
||||
use Xibo\Entity\Widget;
|
||||
|
||||
/**
|
||||
* Widget Edit Event
|
||||
*/
|
||||
class SubPlaylistDurationEvent extends Event
|
||||
{
|
||||
public static $NAME = 'widget.sub-playlist.duration';
|
||||
|
||||
/** @var \Xibo\Entity\Widget */
|
||||
protected $widget;
|
||||
|
||||
/** @var int */
|
||||
private $duration;
|
||||
|
||||
/**
|
||||
* constructor.
|
||||
* @param \Xibo\Entity\Widget $widget
|
||||
*/
|
||||
public function __construct(\Xibo\Entity\Widget $widget)
|
||||
{
|
||||
$this->widget = $widget;
|
||||
$this->duration = 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \Xibo\Entity\Widget
|
||||
*/
|
||||
public function getWidget(): Widget
|
||||
{
|
||||
return $this->widget;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the duration
|
||||
* @return int
|
||||
*/
|
||||
public function getDuration(): int
|
||||
{
|
||||
return $this->duration;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $duration
|
||||
* @return $this
|
||||
*/
|
||||
public function appendDuration(int $duration): SubPlaylistDurationEvent
|
||||
{
|
||||
$this->duration += $duration;
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
74
lib/Event/SubPlaylistItemsEvent.php
Normal file
74
lib/Event/SubPlaylistItemsEvent.php
Normal file
@@ -0,0 +1,74 @@
|
||||
<?php
|
||||
/*
|
||||
* Copyright (C) 2023 Xibo Signage Ltd
|
||||
*
|
||||
* Xibo - Digital Signage - https://xibosignage.com
|
||||
*
|
||||
* 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;
|
||||
|
||||
use Xibo\Entity\Widget;
|
||||
use Xibo\Widget\SubPlaylistItem;
|
||||
|
||||
/**
|
||||
* Widget Edit Event
|
||||
*/
|
||||
class SubPlaylistItemsEvent extends Event
|
||||
{
|
||||
public static $NAME = 'widget.sub-playlist.items';
|
||||
|
||||
/** @var \Xibo\Entity\Widget */
|
||||
protected $widget;
|
||||
|
||||
/** @var SubPlaylistItem[] */
|
||||
private $items = [];
|
||||
|
||||
/**
|
||||
* constructor.
|
||||
* @param \Xibo\Entity\Widget $widget
|
||||
*/
|
||||
public function __construct(\Xibo\Entity\Widget $widget)
|
||||
{
|
||||
$this->widget = $widget;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Widget
|
||||
*/
|
||||
public function getWidget(): Widget
|
||||
{
|
||||
return $this->widget;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return SubPlaylistItem[]
|
||||
*/
|
||||
public function getItems(): array
|
||||
{
|
||||
return $this->items;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $items
|
||||
* @return $this
|
||||
*/
|
||||
public function setItems(array $items): SubPlaylistItemsEvent
|
||||
{
|
||||
$this->items += $items;
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
72
lib/Event/SubPlaylistValidityEvent.php
Normal file
72
lib/Event/SubPlaylistValidityEvent.php
Normal file
@@ -0,0 +1,72 @@
|
||||
<?php
|
||||
/*
|
||||
* Copyright (C) 2023 Xibo Signage Ltd
|
||||
*
|
||||
* Xibo - Digital Signage - https://xibosignage.com
|
||||
*
|
||||
* 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;
|
||||
|
||||
use Xibo\Entity\Widget;
|
||||
|
||||
/**
|
||||
* Sub Playlist Validity Check
|
||||
*/
|
||||
class SubPlaylistValidityEvent extends Event
|
||||
{
|
||||
public static $NAME = 'widget.sub-playlist.validity';
|
||||
|
||||
/** @var \Xibo\Entity\Widget */
|
||||
protected $widget;
|
||||
|
||||
private $isValid = true;
|
||||
|
||||
/**
|
||||
* constructor.
|
||||
* @param \Xibo\Entity\Widget $widget
|
||||
*/
|
||||
public function __construct(\Xibo\Entity\Widget $widget)
|
||||
{
|
||||
$this->widget = $widget;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \Xibo\Entity\Widget
|
||||
*/
|
||||
public function getWidget(): Widget
|
||||
{
|
||||
return $this->widget;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param bool $isValid
|
||||
* @return $this
|
||||
*/
|
||||
public function setIsValid(bool $isValid): SubPlaylistValidityEvent
|
||||
{
|
||||
$this->isValid = $isValid;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool true if valid
|
||||
*/
|
||||
public function isValid(): bool
|
||||
{
|
||||
return $this->isValid;
|
||||
}
|
||||
}
|
||||
87
lib/Event/SubPlaylistWidgetsEvent.php
Normal file
87
lib/Event/SubPlaylistWidgetsEvent.php
Normal file
@@ -0,0 +1,87 @@
|
||||
<?php
|
||||
/*
|
||||
* Copyright (C) 2023 Xibo Signage Ltd
|
||||
*
|
||||
* Xibo - Digital Signage - https://xibosignage.com
|
||||
*
|
||||
* 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;
|
||||
|
||||
use Xibo\Entity\Widget;
|
||||
|
||||
/**
|
||||
* Widget Edit Event
|
||||
*/
|
||||
class SubPlaylistWidgetsEvent extends Event
|
||||
{
|
||||
public static $NAME = 'widget.sub-playlist.widgets';
|
||||
|
||||
/** @var \Xibo\Entity\Widget */
|
||||
protected $widget;
|
||||
|
||||
/** @var Widget[] */
|
||||
private $widgets = [];
|
||||
|
||||
/** @var int */
|
||||
private $tempId;
|
||||
|
||||
/**
|
||||
* constructor.
|
||||
* @param \Xibo\Entity\Widget $widget
|
||||
* @param int|null $tempId
|
||||
*/
|
||||
public function __construct(\Xibo\Entity\Widget $widget, ?int $tempId)
|
||||
{
|
||||
$this->widget = $widget;
|
||||
$this->tempId = $tempId ?? 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \Xibo\Entity\Widget
|
||||
*/
|
||||
public function getWidget(): Widget
|
||||
{
|
||||
return $this->widget;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
public function getTempId(): int
|
||||
{
|
||||
return $this->tempId;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the duration
|
||||
* @return \Xibo\Entity\Widget[]
|
||||
*/
|
||||
public function getWidgets(): array
|
||||
{
|
||||
return $this->widgets;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Widget[] $widgets
|
||||
* @return $this
|
||||
*/
|
||||
public function setWidgets(array $widgets): SubPlaylistWidgetsEvent
|
||||
{
|
||||
$this->widgets += $widgets;
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
54
lib/Event/SystemUserChangedEvent.php
Normal file
54
lib/Event/SystemUserChangedEvent.php
Normal file
@@ -0,0 +1,54 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright (C) 2021 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;
|
||||
|
||||
use Xibo\Entity\User;
|
||||
|
||||
class SystemUserChangedEvent extends Event
|
||||
{
|
||||
public static $NAME = 'system.user.change.event';
|
||||
/**
|
||||
* @var User
|
||||
*/
|
||||
private $oldSystemUser;
|
||||
/**
|
||||
* @var User
|
||||
*/
|
||||
private $newSystemUser;
|
||||
|
||||
public function __construct(User $oldSystemUser, User $newSystemUser)
|
||||
{
|
||||
$this->oldSystemUser = $oldSystemUser;
|
||||
$this->newSystemUser = $newSystemUser;
|
||||
}
|
||||
|
||||
public function getOldSystemUser() : User
|
||||
{
|
||||
return $this->oldSystemUser;
|
||||
}
|
||||
|
||||
public function getNewSystemUser() : User
|
||||
{
|
||||
return $this->newSystemUser;
|
||||
}
|
||||
}
|
||||
45
lib/Event/TagAddEvent.php
Normal file
45
lib/Event/TagAddEvent.php
Normal file
@@ -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;
|
||||
|
||||
class TagAddEvent extends Event
|
||||
{
|
||||
public static $NAME = 'tag.add.event';
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
private $tagId;
|
||||
|
||||
public function __construct(int $tagId)
|
||||
{
|
||||
$this->tagId = $tagId;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
public function getTagId(): int
|
||||
{
|
||||
return $this->tagId;
|
||||
}
|
||||
}
|
||||
45
lib/Event/TagDeleteEvent.php
Normal file
45
lib/Event/TagDeleteEvent.php
Normal file
@@ -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;
|
||||
|
||||
class TagDeleteEvent extends Event
|
||||
{
|
||||
public static $NAME = 'tag.delete.event';
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
private $tagId;
|
||||
|
||||
public function __construct(int $tagId)
|
||||
{
|
||||
$this->tagId = $tagId;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
public function getTagId(): int
|
||||
{
|
||||
return $this->tagId;
|
||||
}
|
||||
}
|
||||
73
lib/Event/TagEditEvent.php
Normal file
73
lib/Event/TagEditEvent.php
Normal file
@@ -0,0 +1,73 @@
|
||||
<?php
|
||||
/*
|
||||
* Copyright (C) 2025 Xibo Signage Ltd
|
||||
*
|
||||
* Xibo - Digital Signage - https://xibosignage.com
|
||||
*
|
||||
* 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;
|
||||
|
||||
class TagEditEvent extends Event
|
||||
{
|
||||
public static $NAME = 'tag.edit.event';
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
private $tagId;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
private $oldTag;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
private $newTag;
|
||||
|
||||
public function __construct(int $tagId, ?string $oldTag = null, ?string $newTag = null)
|
||||
{
|
||||
$this->tagId = $tagId;
|
||||
$this->oldTag = $oldTag;
|
||||
$this->newTag = $newTag;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
public function getTagId(): int
|
||||
{
|
||||
return $this->tagId;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getOldTag(): string
|
||||
{
|
||||
return $this->oldTag;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getNewTag(): string
|
||||
{
|
||||
return $this->newTag;
|
||||
}
|
||||
}
|
||||
119
lib/Event/TemplateProviderEvent.php
Normal file
119
lib/Event/TemplateProviderEvent.php
Normal file
@@ -0,0 +1,119 @@
|
||||
<?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;
|
||||
|
||||
use Xibo\Entity\SearchResult;
|
||||
use Xibo\Entity\SearchResults;
|
||||
|
||||
/**
|
||||
* TemplateProviderEvent
|
||||
*/
|
||||
class TemplateProviderEvent extends Event
|
||||
{
|
||||
protected static $NAME = 'connector.provider.template';
|
||||
|
||||
/** @var \Xibo\Entity\SearchResults */
|
||||
private $results;
|
||||
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
private $start;
|
||||
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
private $length;
|
||||
|
||||
/** @var string|null */
|
||||
private $search;
|
||||
|
||||
/** @var string|null */
|
||||
private $orientation;
|
||||
|
||||
/**
|
||||
* @param \Xibo\Entity\SearchResults $results
|
||||
* @param int $start
|
||||
* @param int $length
|
||||
*/
|
||||
public function __construct(SearchResults $results, int $start, int $length, ?string $search, ?string $orientation)
|
||||
{
|
||||
$this->results = $results;
|
||||
$this->start = $start;
|
||||
$this->length = $length;
|
||||
$this->search = $search;
|
||||
$this->orientation = $orientation;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param SearchResult $result
|
||||
* @return $this
|
||||
*/
|
||||
public function addResult(SearchResult $result): TemplateProviderEvent
|
||||
{
|
||||
$this->results->data[] = $result;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return SearchResults
|
||||
*/
|
||||
public function getResults(): SearchResults
|
||||
{
|
||||
return $this->results;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get starting record
|
||||
* @return int
|
||||
*/
|
||||
public function getStart(): int
|
||||
{
|
||||
return $this->start;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get number of records to return
|
||||
* @return int
|
||||
*/
|
||||
public function getLength(): int
|
||||
{
|
||||
return $this->length;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string|null
|
||||
*/
|
||||
public function getSearch(): ?string
|
||||
{
|
||||
return $this->search;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string|null
|
||||
*/
|
||||
public function getOrientation(): ?string
|
||||
{
|
||||
return $this->orientation;
|
||||
}
|
||||
}
|
||||
78
lib/Event/TemplateProviderImportEvent.php
Normal file
78
lib/Event/TemplateProviderImportEvent.php
Normal file
@@ -0,0 +1,78 @@
|
||||
<?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 raised when one or more provider search results have been chosen for importing on a layout
|
||||
*/
|
||||
class TemplateProviderImportEvent extends Event
|
||||
{
|
||||
protected static $NAME = 'connector.provider.template.import';
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
private $downloadUrl;
|
||||
/** @var string */
|
||||
private $libraryLocation;
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
private $fileName;
|
||||
/** @var string */
|
||||
private $tempFile;
|
||||
|
||||
public function __construct(
|
||||
string $uri,
|
||||
string $fileName,
|
||||
string $libraryLocation
|
||||
) {
|
||||
$this->downloadUrl = $uri;
|
||||
$this->fileName = $fileName;
|
||||
$this->libraryLocation = $libraryLocation;
|
||||
}
|
||||
|
||||
public function getDownloadUrl(): string
|
||||
{
|
||||
return $this->downloadUrl;
|
||||
}
|
||||
|
||||
public function getFileName(): string
|
||||
{
|
||||
return $this->fileName;
|
||||
}
|
||||
|
||||
public function getLibraryLocation(): string
|
||||
{
|
||||
return $this->libraryLocation;
|
||||
}
|
||||
|
||||
public function setFilePath($tempFile)
|
||||
{
|
||||
$this->tempFile = $tempFile;
|
||||
}
|
||||
|
||||
public function getFilePath()
|
||||
{
|
||||
return $this->tempFile;
|
||||
}
|
||||
}
|
||||
60
lib/Event/TemplateProviderListEvent.php
Normal file
60
lib/Event/TemplateProviderListEvent.php
Normal file
@@ -0,0 +1,60 @@
|
||||
<?php
|
||||
/*
|
||||
* Copyright (C) 2024 Xibo Signage Ltd
|
||||
*
|
||||
* Xibo - Digital Signage - https://xibosignage.com
|
||||
*
|
||||
* 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;
|
||||
|
||||
use Xibo\Connector\ProviderDetails;
|
||||
|
||||
/**
|
||||
* Get a list of template providers
|
||||
*/
|
||||
class TemplateProviderListEvent extends Event
|
||||
{
|
||||
protected static $NAME = 'connector.provider.template.list';
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
private mixed $providers;
|
||||
|
||||
public function __construct($providers = [])
|
||||
{
|
||||
$this->providers = $providers;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param ProviderDetails $provider
|
||||
* @return TemplateProviderListEvent
|
||||
*/
|
||||
public function addProvider(ProviderDetails $provider): TemplateProviderListEvent
|
||||
{
|
||||
$this->providers[] = $provider;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return ProviderDetails[]
|
||||
*/
|
||||
public function getProviders(): array
|
||||
{
|
||||
return $this->providers;
|
||||
}
|
||||
}
|
||||
60
lib/Event/TriggerTaskEvent.php
Normal file
60
lib/Event/TriggerTaskEvent.php
Normal file
@@ -0,0 +1,60 @@
|
||||
<?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;
|
||||
|
||||
/**
|
||||
* An event which triggers the provided task to Run Now (at the next XTR poll)
|
||||
* optionally clears a cache key to provide further instructions to the task that's running
|
||||
*/
|
||||
class TriggerTaskEvent extends Event
|
||||
{
|
||||
public static string $NAME = 'trigger.task.event';
|
||||
|
||||
/**
|
||||
* @param string $className Class name of the task to be run
|
||||
* @param string $key Cache Key to be dropped
|
||||
*/
|
||||
public function __construct(
|
||||
private readonly string $className,
|
||||
private readonly string $key = ''
|
||||
) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the class name for the task to be run
|
||||
* @return string
|
||||
*/
|
||||
public function getClassName(): string
|
||||
{
|
||||
return $this->className;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the cache key to be dropped
|
||||
* @return string
|
||||
*/
|
||||
public function getKey(): string
|
||||
{
|
||||
return $this->key;
|
||||
}
|
||||
}
|
||||
90
lib/Event/UserDeleteEvent.php
Normal file
90
lib/Event/UserDeleteEvent.php
Normal file
@@ -0,0 +1,90 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright (C) 2021 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;
|
||||
|
||||
use Xibo\Entity\User;
|
||||
|
||||
class UserDeleteEvent extends Event
|
||||
{
|
||||
public static $NAME = 'user.delete.event';
|
||||
|
||||
/** @var User */
|
||||
private $user;
|
||||
|
||||
/** @var User */
|
||||
private $newUser;
|
||||
|
||||
/** @var string */
|
||||
private $function;
|
||||
|
||||
/** @var User */
|
||||
private $systemUser;
|
||||
|
||||
public $returnValue;
|
||||
|
||||
/**
|
||||
* UserDeleteEvent constructor.
|
||||
* @param $user
|
||||
* @param $function
|
||||
*/
|
||||
public function __construct($user, $function, $systemUser = null, $newUser = null)
|
||||
{
|
||||
$this->user = $user;
|
||||
$this->newUser = $newUser;
|
||||
$this->systemUser = $systemUser;
|
||||
$this->function = $function;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return User
|
||||
*/
|
||||
public function getUser() : User
|
||||
{
|
||||
return $this->user;
|
||||
}
|
||||
|
||||
public function getNewUser()
|
||||
{
|
||||
return $this->newUser;
|
||||
}
|
||||
|
||||
public function getSystemUser() : User
|
||||
{
|
||||
return $this->systemUser;
|
||||
}
|
||||
|
||||
public function getFunction(): string
|
||||
{
|
||||
return $this->function;
|
||||
}
|
||||
|
||||
public function setReturnValue($returnValue)
|
||||
{
|
||||
$this->returnValue = $returnValue;
|
||||
}
|
||||
|
||||
public function getReturnValue()
|
||||
{
|
||||
return $this->returnValue;
|
||||
}
|
||||
}
|
||||
68
lib/Event/WidgetAddEvent.php
Normal file
68
lib/Event/WidgetAddEvent.php
Normal file
@@ -0,0 +1,68 @@
|
||||
<?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;
|
||||
|
||||
use Xibo\Entity\Module;
|
||||
use Xibo\Entity\Widget;
|
||||
|
||||
/**
|
||||
* Widget Add
|
||||
* ----------
|
||||
* Call when a new non-file based widget is added to a Layout
|
||||
*/
|
||||
class WidgetAddEvent extends Event
|
||||
{
|
||||
public static $NAME = 'widget.add';
|
||||
|
||||
/** @var \Xibo\Entity\Module */
|
||||
protected $module;
|
||||
|
||||
/** @var \Xibo\Entity\Widget */
|
||||
protected $widget;
|
||||
|
||||
/**
|
||||
* WidgetEditEvent constructor.
|
||||
* @param \Xibo\Entity\Module $module
|
||||
* @param \Xibo\Entity\Widget $widget
|
||||
*/
|
||||
public function __construct(Module $module, Widget $widget)
|
||||
{
|
||||
$this->module = $module;
|
||||
$this->widget = $widget;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \Xibo\Entity\Module
|
||||
*/
|
||||
public function getModule(): Module
|
||||
{
|
||||
return $this->module;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \Xibo\Entity\Widget
|
||||
*/
|
||||
public function getWidget(): Widget
|
||||
{
|
||||
return $this->widget;
|
||||
}
|
||||
}
|
||||
49
lib/Event/WidgetDataRequestEvent.php
Normal file
49
lib/Event/WidgetDataRequestEvent.php
Normal file
@@ -0,0 +1,49 @@
|
||||
<?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;
|
||||
|
||||
use Xibo\Widget\Provider\DataProviderInterface;
|
||||
|
||||
/**
|
||||
* Event raised when a widget requests data.
|
||||
*/
|
||||
class WidgetDataRequestEvent extends Event
|
||||
{
|
||||
public static $NAME = 'widget.data.request.event';
|
||||
|
||||
/** @var \Xibo\Widget\Provider\DataProviderInterface */
|
||||
private $dataProvider;
|
||||
|
||||
public function __construct(DataProviderInterface $dataProvider)
|
||||
{
|
||||
$this->dataProvider = $dataProvider;
|
||||
}
|
||||
|
||||
/**
|
||||
* The data provider should be updated with data for its widget.
|
||||
* @return \Xibo\Widget\Provider\DataProviderInterface
|
||||
*/
|
||||
public function getDataProvider(): DataProviderInterface
|
||||
{
|
||||
return $this->dataProvider;
|
||||
}
|
||||
}
|
||||
52
lib/Event/WidgetDeleteEvent.php
Normal file
52
lib/Event/WidgetDeleteEvent.php
Normal file
@@ -0,0 +1,52 @@
|
||||
<?php
|
||||
/*
|
||||
* Copyright (C) 2023 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;
|
||||
|
||||
use Xibo\Entity\Widget;
|
||||
|
||||
/**
|
||||
* Widget Delete Event
|
||||
*/
|
||||
class WidgetDeleteEvent extends Event
|
||||
{
|
||||
public static $NAME = 'widget.delete';
|
||||
|
||||
/** @var \Xibo\Entity\Widget */
|
||||
protected $widget;
|
||||
|
||||
/**
|
||||
* constructor.
|
||||
* @param \Xibo\Entity\Widget $widget
|
||||
*/
|
||||
public function __construct(\Xibo\Entity\Widget $widget)
|
||||
{
|
||||
$this->widget = $widget;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \Xibo\Entity\Widget
|
||||
*/
|
||||
public function getWidget(): Widget
|
||||
{
|
||||
return $this->widget;
|
||||
}
|
||||
}
|
||||
52
lib/Event/WidgetEditEvent.php
Normal file
52
lib/Event/WidgetEditEvent.php
Normal file
@@ -0,0 +1,52 @@
|
||||
<?php
|
||||
/*
|
||||
* Copyright (C) 2023 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;
|
||||
|
||||
use Xibo\Entity\Widget;
|
||||
|
||||
/**
|
||||
* Widget Edit Event
|
||||
*/
|
||||
class WidgetEditEvent extends Event
|
||||
{
|
||||
public static $NAME = 'widget.edit';
|
||||
|
||||
/** @var \Xibo\Entity\Widget */
|
||||
protected $widget;
|
||||
|
||||
/**
|
||||
* constructor.
|
||||
* @param \Xibo\Entity\Widget $widget
|
||||
*/
|
||||
public function __construct(\Xibo\Entity\Widget $widget)
|
||||
{
|
||||
$this->widget = $widget;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \Xibo\Entity\Widget
|
||||
*/
|
||||
public function getWidget(): Widget
|
||||
{
|
||||
return $this->widget;
|
||||
}
|
||||
}
|
||||
101
lib/Event/WidgetEditOptionRequestEvent.php
Normal file
101
lib/Event/WidgetEditOptionRequestEvent.php
Normal file
@@ -0,0 +1,101 @@
|
||||
<?php
|
||||
/*
|
||||
* Copyright (c) 2023 Xibo Signage Ltd
|
||||
*
|
||||
* Xibo - Digital Signage - https://xibosignage.com
|
||||
*
|
||||
* 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;
|
||||
|
||||
use Xibo\Entity\Widget;
|
||||
|
||||
/**
|
||||
* An event fired by a widget when presenting its properties
|
||||
* should be used by a connector to provide additional options to a dropdown
|
||||
*/
|
||||
class WidgetEditOptionRequestEvent extends Event
|
||||
{
|
||||
public static $NAME = 'widget.edit.option.event';
|
||||
|
||||
/** @var \Xibo\Entity\Widget */
|
||||
private $widget;
|
||||
|
||||
/** @var string */
|
||||
private $propertyId;
|
||||
|
||||
/** @var mixed */
|
||||
private $propertyValue;
|
||||
|
||||
/** @var array|null */
|
||||
private $options;
|
||||
|
||||
public function __construct(Widget $widget, string $propertyId, $propertyValue)
|
||||
{
|
||||
$this->widget = $widget;
|
||||
$this->propertyId = $propertyId;
|
||||
$this->propertyValue = $propertyValue;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \Xibo\Entity\Widget|null
|
||||
*/
|
||||
public function getWidget(): ?Widget
|
||||
{
|
||||
return $this->widget;
|
||||
}
|
||||
|
||||
/**
|
||||
* Which property is making this request?
|
||||
* @return string|null The ID of the property `id=""`
|
||||
*/
|
||||
public function getPropertyId(): ?string
|
||||
{
|
||||
return $this->propertyId;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
public function getPropertyValue()
|
||||
{
|
||||
return $this->propertyValue;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the options array
|
||||
*/
|
||||
public function getOptions(): array
|
||||
{
|
||||
if ($this->options === null) {
|
||||
$this->options = [];
|
||||
}
|
||||
|
||||
return $this->options;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set a new options array
|
||||
* @return $this
|
||||
*/
|
||||
public function setOptions(array $options): WidgetEditOptionRequestEvent
|
||||
{
|
||||
$this->options = $options;
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
79
lib/Event/XmdsConnectorFileEvent.php
Normal file
79
lib/Event/XmdsConnectorFileEvent.php
Normal file
@@ -0,0 +1,79 @@
|
||||
<?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;
|
||||
|
||||
use Nyholm\Psr7\Factory\Psr17Factory;
|
||||
use Psr\Http\Message\ResponseInterface;
|
||||
use Xibo\Entity\Widget;
|
||||
|
||||
class XmdsConnectorFileEvent extends Event
|
||||
{
|
||||
public static $NAME = 'connector.xmds.file.event';
|
||||
private $widget;
|
||||
private $response;
|
||||
/**
|
||||
* @var boolean
|
||||
*/
|
||||
private $isDebug;
|
||||
|
||||
public function __construct($widget, $isDebug = false)
|
||||
{
|
||||
$this->widget = $widget;
|
||||
$this->isDebug = $isDebug;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \Xibo\Entity\Widget|null
|
||||
*/
|
||||
public function getWidget(): ?Widget
|
||||
{
|
||||
return $this->widget;
|
||||
}
|
||||
|
||||
public function isDebug(): bool
|
||||
{
|
||||
return $this->isDebug;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \Psr\Http\Message\ResponseInterface
|
||||
*/
|
||||
public function getResponse(): ResponseInterface
|
||||
{
|
||||
if ($this->response === null) {
|
||||
$psr17Factory = new Psr17Factory();
|
||||
$this->response = $psr17Factory->createResponse(404, 'Not Found');
|
||||
}
|
||||
return $this->response;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param \Psr\Http\Message\ResponseInterface $response
|
||||
* @return $this
|
||||
*/
|
||||
public function setResponse(ResponseInterface $response): XmdsConnectorFileEvent
|
||||
{
|
||||
$this->response = $response;
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
74
lib/Event/XmdsConnectorTokenEvent.php
Normal file
74
lib/Event/XmdsConnectorTokenEvent.php
Normal file
@@ -0,0 +1,74 @@
|
||||
<?php
|
||||
/*
|
||||
* Copyright (C) 2023 Xibo Signage Ltd
|
||||
*
|
||||
* Xibo - Digital Signage - https://xibosignage.com
|
||||
*
|
||||
* 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 generate a token for an XMDS request.
|
||||
*/
|
||||
class XmdsConnectorTokenEvent extends Event
|
||||
{
|
||||
public static $NAME = 'connector.xmds.token.event';
|
||||
private $displayId;
|
||||
private $widgetId;
|
||||
private $ttl;
|
||||
private $token;
|
||||
|
||||
public function setTargets(int $displayId, int $widgetId): XmdsConnectorTokenEvent
|
||||
{
|
||||
$this->displayId = $displayId;
|
||||
$this->widgetId = $widgetId;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getDisplayId(): int
|
||||
{
|
||||
return $this->displayId;
|
||||
}
|
||||
|
||||
public function getWidgetId(): ?int
|
||||
{
|
||||
return $this->widgetId;
|
||||
}
|
||||
|
||||
public function setTtl(int $ttl): XmdsConnectorTokenEvent
|
||||
{
|
||||
$this->ttl = $ttl;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getTtl(): int
|
||||
{
|
||||
return $this->ttl;
|
||||
}
|
||||
|
||||
public function setToken(string $token): XmdsConnectorTokenEvent
|
||||
{
|
||||
$this->token = $token;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getToken(): ?string
|
||||
{
|
||||
return $this->token;
|
||||
}
|
||||
}
|
||||
84
lib/Event/XmdsDependencyListEvent.php
Normal file
84
lib/Event/XmdsDependencyListEvent.php
Normal file
@@ -0,0 +1,84 @@
|
||||
<?php
|
||||
/*
|
||||
* Copyright (C) 2023 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;
|
||||
|
||||
use Xibo\Entity\Display;
|
||||
use Xibo\Xmds\Entity\Dependency;
|
||||
|
||||
/**
|
||||
* A dependency list event
|
||||
*/
|
||||
class XmdsDependencyListEvent extends Event
|
||||
{
|
||||
private static $NAME = 'xmds.dependency.list';
|
||||
|
||||
private $dependencies = [];
|
||||
|
||||
/** @var \Xibo\Entity\Display */
|
||||
private $display;
|
||||
|
||||
public function __construct(Display $display)
|
||||
{
|
||||
$this->display = $display;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Dependency[]
|
||||
*/
|
||||
public function getDependencies(): array
|
||||
{
|
||||
return $this->dependencies;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a dependency to the list.
|
||||
* @param string $fileType
|
||||
* @param int $id
|
||||
* @param string $path
|
||||
* @param int $size
|
||||
* @param string $md5
|
||||
* @param bool $isAvailableOverHttp
|
||||
* @param int $legacyId
|
||||
* @return $this
|
||||
*/
|
||||
public function addDependency(
|
||||
string $fileType,
|
||||
int $id,
|
||||
string $path,
|
||||
int $size,
|
||||
string $md5,
|
||||
bool $isAvailableOverHttp,
|
||||
int $legacyId
|
||||
): XmdsDependencyListEvent {
|
||||
$this->dependencies[] = new Dependency($fileType, $id, $legacyId, $path, $size, $md5, $isAvailableOverHttp);
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the display which raised this event
|
||||
* @return \Xibo\Entity\Display
|
||||
*/
|
||||
public function getDisplay(): Display
|
||||
{
|
||||
return $this->display;
|
||||
}
|
||||
}
|
||||
87
lib/Event/XmdsDependencyRequestEvent.php
Normal file
87
lib/Event/XmdsDependencyRequestEvent.php
Normal file
@@ -0,0 +1,87 @@
|
||||
<?php
|
||||
/*
|
||||
* Copyright (C) 2023 Xibo Signage Ltd
|
||||
*
|
||||
* Xibo - Digital Signage - https://xibosignage.com
|
||||
*
|
||||
* 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;
|
||||
|
||||
use Xibo\Entity\RequiredFile;
|
||||
|
||||
/**
|
||||
* Event raised when XMDS receives a request for a file.
|
||||
*/
|
||||
class XmdsDependencyRequestEvent extends Event
|
||||
{
|
||||
public static $NAME = 'xmds.dependency.request';
|
||||
|
||||
private $fileType;
|
||||
private $id;
|
||||
private $path;
|
||||
/**
|
||||
* @var string|null
|
||||
*/
|
||||
private $realId;
|
||||
|
||||
/**
|
||||
* @param RequiredFile $file
|
||||
*/
|
||||
public function __construct(RequiredFile $file)
|
||||
{
|
||||
$this->fileType = $file->fileType;
|
||||
$this->id = $file->itemId;
|
||||
$this->realId = $file->realId;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the relative path to this dependency, from the library folder forwards.
|
||||
* @param string $path
|
||||
* @return $this
|
||||
*/
|
||||
public function setRelativePathToLibrary(string $path): XmdsDependencyRequestEvent
|
||||
{
|
||||
$this->path = $path;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getRelativePath(): ?string
|
||||
{
|
||||
return $this->path;
|
||||
}
|
||||
|
||||
public function getFileType(): string
|
||||
{
|
||||
return $this->fileType;
|
||||
}
|
||||
|
||||
public function getId(): int
|
||||
{
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
/**
|
||||
* The Real ID of the dependency request
|
||||
* this will always be the ID of the item (asset/font/etc.) regardless of XMDS schema version being used.
|
||||
* @return string
|
||||
*/
|
||||
public function getRealId() : string
|
||||
{
|
||||
return $this->realId;
|
||||
}
|
||||
}
|
||||
92
lib/Event/XmdsWeatherRequestEvent.php
Normal file
92
lib/Event/XmdsWeatherRequestEvent.php
Normal file
@@ -0,0 +1,92 @@
|
||||
<?php
|
||||
/*
|
||||
* Copyright (C) 2024 Xibo Signage Ltd
|
||||
*
|
||||
* Xibo - Digital Signage - https://xibosignage.com
|
||||
*
|
||||
* 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 raised when XMDS receives a request for weather data.
|
||||
*/
|
||||
class XmdsWeatherRequestEvent extends Event
|
||||
{
|
||||
public static $NAME = 'xmds.weather.request';
|
||||
|
||||
/**
|
||||
* @var float
|
||||
*/
|
||||
private $latitude;
|
||||
|
||||
/**
|
||||
* @var float
|
||||
*/
|
||||
private $longitude;
|
||||
|
||||
/**
|
||||
* @var float
|
||||
*/
|
||||
private $weatherData;
|
||||
|
||||
/**
|
||||
* @param float $latitude
|
||||
* @param float $longitude
|
||||
*/
|
||||
public function __construct(float $latitude, float $longitude)
|
||||
{
|
||||
$this->latitude = $latitude;
|
||||
$this->longitude = $longitude;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return float
|
||||
*/
|
||||
public function getLatitude(): float
|
||||
{
|
||||
return $this->latitude;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return float
|
||||
*/
|
||||
public function getLongitude(): float
|
||||
{
|
||||
return $this->longitude;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the weather data.
|
||||
*
|
||||
* @param string $weatherData
|
||||
*/
|
||||
public function setWeatherData(string $weatherData): void
|
||||
{
|
||||
$this->weatherData = $weatherData;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the weather data.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getWeatherData(): string
|
||||
{
|
||||
return $this->weatherData;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user