Skip to content

Commit

Permalink
Layouts: add modified since filter to the advanced tab (#2396)
Browse files Browse the repository at this point in the history
fixes xibosignageltd/xibo-private#637
  • Loading branch information
dasgarner authored Feb 28, 2024
1 parent c6113ae commit bf70e98
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 1 deletion.
1 change: 1 addition & 0 deletions lib/Controller/Layout.php
Original file line number Diff line number Diff line change
Expand Up @@ -1453,6 +1453,7 @@ public function grid(Request $request, Response $response)
'logicalOperator' => $parsedQueryParams->getString('logicalOperator'),
'logicalOperatorName' => $parsedQueryParams->getString('logicalOperatorName'),
'campaignType' => 'list',
'modifiedSinceDt' => $parsedQueryParams->getDate('modifiedSinceDt'),
], $parsedQueryParams));

foreach ($layouts as $layout) {
Expand Down
10 changes: 9 additions & 1 deletion lib/Factory/LayoutFactory.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php
/*
* Copyright (C) 2023 Xibo Signage Ltd
* Copyright (C) 2024 Xibo Signage Ltd
*
* Xibo - Digital Signage - https://xibosignage.com
*
Expand Down Expand Up @@ -33,6 +33,7 @@
use Xibo\Entity\Region;
use Xibo\Entity\User;
use Xibo\Entity\Widget;
use Xibo\Helper\DateFormatHelper;
use Xibo\Service\ConfigServiceInterface;
use Xibo\Service\MediaServiceInterface;
use Xibo\Support\Exception\ConfigurationException;
Expand Down Expand Up @@ -2400,6 +2401,13 @@ public function query($sortOrder = null, $filterBy = [])
$params['retired'] = $parsedFilter->getInt('retired',['default' => 0]);
}

// Modified Since?
if ($parsedFilter->getDate('modifiedSinceDt') != null) {
$body .= ' AND layout.modifiedDt > :modifiedSinceDt ';
$params['modifiedSinceDt'] = $parsedFilter->getDate('modifiedSinceDt')
->format(DateFormatHelper::getSystemFormat());
}

if ($parsedFilter->getInt('ownerCampaignId') !== null) {
// Join Campaign back onto it again
$body .= " AND `campaign`.campaignId = :ownerCampaignId ";
Expand Down
3 changes: 3 additions & 0 deletions views/layout-page.twig
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,9 @@

{% set title %}{% trans "Layout ID" %}{% endset %}
{{ inline.number("layoutId", title) }}

{% set title %}{% trans "Modified Since" %}{% endset %}
{{ inline.date("modifiedSinceDt", title) }}
</div>
</div>
</form>
Expand Down

0 comments on commit bf70e98

Please sign in to comment.