310
310
* @param int $parentWidgetId this tracks the top level widgetId
311
311
* @return Widget[] $widgets
312
312
* @throws \Xibo\Exception\NotFoundException
313
* @throws \Xibo\Exception\InvalidArgumentException
314
315
public function getSubPlaylistResolvedWidgets($parentWidgetId = 0)
340
341
$playlist = $this->playlistFactory->getById($playlistId)->setModuleFactory($this->moduleFactory);
341
342
$expanded = $playlist->expandWidgets($parentWidgetId);
342
343
$countExpanded = count($expanded);
343
$playlistEnableStat = $playlist->enableStat;
345
if (($playlistEnableStat === null) || ($playlistEnableStat === "")) {
346
$playlistEnableStat = $this->getConfig()->getSetting('PLAYLIST_STATS_ENABLED_DEFAULT');
349
// Go through widgets assigned to this Playlist, if their enableStat is set to Inherit, then change that option according to the Playlist enableStat value.
345
// Handle proof of play settings
346
// -----------------------------
347
// Go through widgets assigned to this Playlist, if their enableStat is set to Inherit alter that option
348
// in memory for this widget.
349
// this is not a saved change, we assess this every time
350
$playlistEnableStat = empty($playlist->enableStat)
351
? $this->getConfig()->getSetting('PLAYLIST_STATS_ENABLED_DEFAULT')
352
: $playlist->enableStat;
350
354
foreach ($expanded as $subPlaylistWidget) {
352
$subPlaylistWidgetEnableStat = $subPlaylistWidget->getOptionValue('enableStat', $this->getConfig()->getSetting('WIDGET_STATS_ENABLED_DEFAULT'));
356
$subPlaylistWidgetEnableStat = $subPlaylistWidget->getOptionValue('enableStat',
357
$this->getConfig()->getSetting('WIDGET_STATS_ENABLED_DEFAULT')
354
360
if ($subPlaylistWidgetEnableStat == 'Inherit') {
361
$this->getLog()->debug('For widget ID ' . $subPlaylistWidget->widgetId . ' enableStat was Inherit, changed to Playlist enableStat value - ' . $playlistEnableStat);
355
362
$subPlaylistWidget->setOptionValue('enableStat', 'attrib', $playlistEnableStat);
356
$subPlaylistWidget->save();
357
$this->getLog()->debug('For widget ID ' . $subPlaylistWidget->widgetId . ' enableStat was Inherit, changed to Playlist enableStat value - ' . $playlistEnableStat);