mirror of
https://github.com/Piwigo/Piwigo.git
synced 2026-06-02 04:15:05 +02:00
issue #2227 like for date_posted, display all presets for date_created
This commit is contained in:
@@ -485,11 +485,11 @@ SELECT
|
||||
$has_filters_filled = true;
|
||||
|
||||
$options = array(
|
||||
'24h' => '24 HOUR',
|
||||
'7d' => '7 DAY',
|
||||
'30d' => '30 DAY',
|
||||
'3m' => '3 MONTH',
|
||||
'6m' => '6 MONTH',
|
||||
'12m' => '12 MONTH',
|
||||
);
|
||||
|
||||
if (isset($options[ $search['fields']['date_created']['preset'] ]) and 'custom' != $search['fields']['date_created']['preset'])
|
||||
|
||||
@@ -229,11 +229,11 @@ SELECT
|
||||
{
|
||||
$query = '
|
||||
SELECT
|
||||
SUBDATE(NOW(), INTERVAL 24 HOUR) AS 24h,
|
||||
SUBDATE(NOW(), INTERVAL 7 DAY) AS 7d,
|
||||
SUBDATE(NOW(), INTERVAL 30 DAY) AS 30d,
|
||||
SUBDATE(NOW(), INTERVAL 3 MONTH) AS 3m,
|
||||
SUBDATE(NOW(), INTERVAL 6 MONTH) AS 6m
|
||||
SUBDATE(NOW(), INTERVAL 6 MONTH) AS 6m,
|
||||
SUBDATE(NOW(), INTERVAL 12 MONTH) AS 12m
|
||||
;';
|
||||
$thresholds = query2array($query)[0];
|
||||
|
||||
@@ -285,23 +285,20 @@ SELECT
|
||||
}
|
||||
|
||||
$label_for_threshold = array(
|
||||
'24h' => l10n('last 24 hours'),
|
||||
'7d' => l10n('last 7 days'),
|
||||
'30d' => l10n('last 30 days'),
|
||||
'3m' => l10n('last 3 months'),
|
||||
'6m' => l10n('last 6 months'),
|
||||
'12m' => l10n('last 12 months'),
|
||||
);
|
||||
|
||||
$counters = array();
|
||||
foreach (array_keys($label_for_threshold) as $threshold)
|
||||
{
|
||||
if (isset($date_created['pre_counters'][$threshold]))
|
||||
{
|
||||
$counters[$threshold] = array(
|
||||
'label' => $label_for_threshold[$threshold],
|
||||
'counter' => $date_created['pre_counters'][$threshold],
|
||||
);
|
||||
}
|
||||
$counters[$threshold] = array(
|
||||
'label' => $label_for_threshold[$threshold],
|
||||
'counter' => $date_created['pre_counters'][$threshold] ?? 0,
|
||||
);
|
||||
}
|
||||
|
||||
foreach (array_keys($date_created['list_of_dates']) as $y)
|
||||
|
||||
@@ -927,7 +927,7 @@ function ws_images_filteredSearch_create($params, $service)
|
||||
|
||||
if (isset($params['date_created_preset']))
|
||||
{
|
||||
if (!preg_match('/^(24h|7d|30d|3m|6m|custom|)$/', $params['date_created_preset']))
|
||||
if (!preg_match('/^(7d|30d|3m|6m|12m|custom|)$/', $params['date_created_preset']))
|
||||
{
|
||||
return new PwgError(WS_ERR_INVALID_PARAM, 'Invalid parameter date_created_preset');
|
||||
}
|
||||
|
||||
@@ -449,5 +449,5 @@ $lang['Only the first %d albums are displayed, out of %d.'] = 'Only the first %d
|
||||
$lang['Pages'] = "Pages";
|
||||
$lang['The PDF you requested is too large to display on this page.']= 'The PDF you requested is too large to display on this page.';
|
||||
$lang['Click here to display it']= 'Click here to display it';
|
||||
|
||||
$lang['last 12 months'] = 'Last 12 months';
|
||||
?>
|
||||
|
||||
@@ -454,3 +454,5 @@ $lang['Album already selected'] = 'Album déjà sélectionné';
|
||||
$lang['Pages'] = "Pages";
|
||||
$lang['The PDF you requested is too large to display on this page.']= 'Le PDF que vous avez demandé est trop volumineux pour être affiché sur cette page.';
|
||||
$lang['Click here to display it']= 'Cliquez ici pour le voir';
|
||||
$lang['last 12 months'] = '12 derniers mois';
|
||||
|
||||
|
||||
@@ -174,6 +174,7 @@
|
||||
.ratios-option.disabled label .ratio-name,
|
||||
.filetypes-option.disabled label .ext-name,
|
||||
.date_posted-option.disabled label .date-period,
|
||||
.date_created-option.disabled label .date-period,
|
||||
.ratings-option.disabled label .ratings-name{
|
||||
color:#888
|
||||
}
|
||||
|
||||
@@ -151,6 +151,7 @@
|
||||
.ratios-option.disabled label .ratio-name,
|
||||
.filetypes-option.disabled label .ext-name,
|
||||
.date_posted-option.disabled label .date-period,
|
||||
.date_created-option.disabled label .date-period,
|
||||
.ratings-option.disabled label .ratings-name{
|
||||
color:#888
|
||||
}
|
||||
|
||||
@@ -381,12 +381,12 @@ const prefix_icon = 'gallery-icon-';
|
||||
<div class="date_created-option-container">
|
||||
<div class="preset_created_date">
|
||||
{foreach from=$DATE_CREATED item=date_created key=k}
|
||||
<div class="date_created-option">
|
||||
<input type="radio" id="date_created-{$k}" value={$k} name="date_created-period">
|
||||
<div class="date_created-option {if 0 == $date_created.counter}disabled{/if}">
|
||||
{if 0 != $date_created.counter}<input type="radio" id="date_created-{$k}" value={$k} name="date_created-period">{/if}
|
||||
<label for="date_created-{$k}" id="{$k}">
|
||||
<span class="mcs-icon gallery-icon-checkmark checked-icon"></span>
|
||||
<span class="date-period">{$date_created.label}</span>
|
||||
<span class="date_created-badge">{$date_created.counter}</span>
|
||||
{if 0 != $date_created.counter}<span class="date_created-badge">{$date_created.counter}</span>{/if}
|
||||
</label>
|
||||
</div>
|
||||
{/foreach}
|
||||
|
||||
@@ -1464,7 +1464,7 @@ enabled_high, registration_date, registration_date_string, registration_date_sin
|
||||
),
|
||||
'date_created_preset' => array(
|
||||
'flags' => WS_PARAM_OPTIONAL,
|
||||
'info' => 'files created within 24 hours, 7 days, 30 days, 3 months, 6 months or custom. Value among 24h|7d|30d|3m|6m|custom.',
|
||||
'info' => 'files created within 7 days, 30 days, 3 months, 6 months, 12 months or custom. Value among 7d|30d|3m|6m|12m|custom.',
|
||||
),
|
||||
'date_created_custom' => array(
|
||||
'flags' => WS_PARAM_OPTIONAL|WS_PARAM_FORCE_ARRAY,
|
||||
|
||||
Reference in New Issue
Block a user