3
* Xibo - Digital Signage - http://www.xibo.org.uk
4
* Copyright (C) 2015 Spring Signage Ltd
6
* This file (WidgetMediaFactory.php) is part of Xibo.
8
* Xibo is free software: you can redistribute it and/or modify
9
* it under the terms of the GNU Affero General Public License as published by
10
* the Free Software Foundation, either version 3 of the License, or
13
* Xibo is distributed in the hope that it will be useful,
14
* but WITHOUT ANY WARRANTY; without even the implied warranty of
15
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16
* GNU Affero General Public License for more details.
18
* You should have received a copy of the GNU Affero General Public License
19
* along with Xibo. If not, see <http://www.gnu.org/licenses/>.
23
namespace Xibo\Factory;
26
use Xibo\Entity\WidgetAudio;
27
use Xibo\Service\LogServiceInterface;
28
use Xibo\Service\SanitizerServiceInterface;
29
use Xibo\Storage\StorageServiceInterface;
32
* Class WidgetAudioFactory
33
* @package Xibo\Factory
35
class WidgetAudioFactory extends BaseFactory
39
* @param StorageServiceInterface $store
40
* @param LogServiceInterface $log
41
* @param SanitizerServiceInterface $sanitizerService
43
public function __construct($store, $log, $sanitizerService)
45
$this->setCommonDependencies($store, $log, $sanitizerService);
52
public function createEmpty()
54
return new WidgetAudio($this->getStore(), $this->getLog());
58
* Media Linked to Widgets by WidgetId
59
* @param int $widgetId
62
public function getByWidgetId($widgetId)
64
return $this->query(null, array('widgetId' => $widgetId));
68
* Query Media Linked to Widgets
69
* @param array $sortOrder
70
* @param array $filterBy
73
public function query($sortOrder = null, $filterBy = [])
76
$sql = 'SELECT `mediaId`, `widgetId`, `volume`, `loop` FROM `lkwidgetaudio` WHERE widgetId = :widgetId AND mediaId <> 0 ';
78
foreach ($this->getStore()->select($sql, ['widgetId' => $this->getSanitizer()->getInt('widgetId', $filterBy)]) as $row) {
79
$entries[] = $this->createEmpty()->hydrate($row, ['intProperties' => ['duration']]);
b'\\ No newline at end of file'