Feature Issue ID 0000601: Filter all public pages with only recent elements

It's a finalized version.
Obsolete code of draft are removed.

You can filter categories and images with recent date period on your screen selection.
In the future, filter could be easy done on other type data (plugin?)

You can flat categories and sub-categories with a recent date period of your choice.

Next, perhaps, a panel to choice recent date for the 2 features.

On draft, there have problem with MySql 5, be careful!

Css problem not resolved:
  - Menu "Categories" is bad centered
  - Icon on dark too on the top


git-svn-id: http://piwigo.org/svn/trunk@1677 68402e56-0260-453c-a942-63ccdbb3a9ee
This commit is contained in:
rub 2006-12-21 21:38:20 +00:00
commit cab8f98c4a
40 changed files with 889 additions and 344 deletions

View file

@ -335,7 +335,7 @@ function get_qsearch_like_clause($q, $field)
*/
function get_quick_search_results($q)
{
global $user, $page;
global $user, $page, $filter;
$search_results = array();
// first search tag names corresponding to the query $q. we could also search
@ -384,7 +384,16 @@ FROM (
)
INNER JOIN
'.CATEGORIES_TABLE.' c on c.id=ic.category_id
WHERE category_id NOT IN ('.$user['forbidden_categories'].')
'.get_sql_condition_FandF
(
array
(
'forbidden_categories' => 'category_id',
'visible_categories' => 'category_id',
'visible_images' => 'ic.image_id'
),
'WHERE'
).'
GROUP BY i.id';
$query = 'SELECT id, MATCH(ft) AGAINST( "'.$q.'" IN BOOLEAN MODE) AS q FROM ('.$query.') AS Y
@ -427,8 +436,16 @@ SELECT DISTINCT(id)
FROM '.IMAGES_TABLE.'
INNER JOIN '.IMAGE_CATEGORY_TABLE.' AS ic ON id = ic.image_id
WHERE id IN ('.implode(',', array_keys($by_tag_weights) ).')
AND category_id NOT IN ('.$user['forbidden_categories'].')';
'.get_sql_condition_FandF
(
array
(
'forbidden_categories' => 'category_id',
'visible_categories' => 'category_id',
'visible_images' => 'ic.image_id'
),
'AND'
);
$allowed_image_ids = array_from_query( $query, 'id');
$by_tag_weights = array_intersect_key($by_tag_weights, array_flip($allowed_image_ids));
arsort($by_tag_weights, SORT_NUMERIC);