mirror of
https://github.com/Piwigo/Piwigo.git
synced 2026-07-06 01:42:29 +02:00
fixes #2193 [search] add 5 new widgets
add ratings, ratios, filesize, width and height widgets - in functions_search add clauses according to each new filter - in ws_functions add new api parameters - in index.php add queries to get data for filters - in admin.lang add missing translations for filters - in css add basic style to work for modus newspaper - in js add script for new filters - in tpl combine script + CSS for double slider & jquery Ui. Add slider conf, template for new widgets TODO - adapt css to different themes and skins
This commit is contained in:
@@ -375,6 +375,60 @@ SELECT
|
||||
$clauses[] = $local_clause;
|
||||
}
|
||||
|
||||
if (!empty($search['fields']['ratios']))
|
||||
{
|
||||
foreach ($search['fields']['ratios'] as $r)
|
||||
{
|
||||
switch($r)
|
||||
{
|
||||
case 'portrait':
|
||||
$clauses[] = '(FLOOR(width / height * 100) / 100) < 0.96';
|
||||
break;
|
||||
|
||||
case'square':
|
||||
$clauses[] = '(FLOOR(width / height * 100) / 100) BETWEEN 0.95 AND 1.06';
|
||||
break;
|
||||
|
||||
case'landscape':
|
||||
$clauses[] = '(FLOOR(width / height * 100) / 100) BETWEEN 1.05 AND 2.01';
|
||||
break;
|
||||
|
||||
case'panorama':
|
||||
$clauses[] = '(FLOOR(width / height * 100) / 100) > 2.01';
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(!empty($search['fields']['ratings']))
|
||||
{
|
||||
foreach ($search['fields']['ratings'] as $r)
|
||||
{
|
||||
if (0 == $r)
|
||||
{
|
||||
$clauses[] = 'rating_score IS NULL';
|
||||
}
|
||||
else{
|
||||
$clauses[] = 'rating_score BETWEEN '.(intval($r)-1).' AND '.$r;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!empty($search['fields']['filesize_min']) && !empty($search['fields']['filesize_max']))
|
||||
{
|
||||
$clauses[] = 'filesize BETWEEN '.$search['fields']['filesize_min'].' AND '.$search['fields']['filesize_max'];
|
||||
}
|
||||
|
||||
if (!empty($search['fields']['height_min']) && !empty($search['fields']['height_max']))
|
||||
{
|
||||
$clauses[] = 'height BETWEEN '.$search['fields']['height_min'].' AND '.$search['fields']['height_max'];
|
||||
}
|
||||
|
||||
if (!empty($search['fields']['width_min']) && !empty($search['fields']['width_max']))
|
||||
{
|
||||
$clauses[] = 'width BETWEEN '.$search['fields']['width_min'].' AND '.$search['fields']['width_max'];
|
||||
}
|
||||
|
||||
// adds brackets around where clauses
|
||||
$clauses = prepend_append_array_items($clauses, '(', ')');
|
||||
|
||||
|
||||
Reference in New Issue
Block a user