Ignore:
Timestamp:
Dec 21, 2006, 10:38:20 PM (17 years ago)
Author:
rub
Message:

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
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/functions_category.inc.php

    r1651 r1677  
    33// | PhpWebGallery - a PHP based picture gallery                           |
    44// | Copyright (C) 2002-2003 Pierrick LE GALL - pierrick@phpwebgallery.net |
    5 // | Copyright (C) 2003-2005 PhpWebGallery Team - http://phpwebgallery.net |
     5// | Copyright (C) 2003-2006 PhpWebGallery Team - http://phpwebgallery.net |
    66// +-----------------------------------------------------------------------+
    77// | branch        : BSF (Best So Far)
     
    4545  global $user;
    4646
     47  // $filter['visible_categories'] and $filter['visible_images']
     48  // are not used because it's not necessary (filter <> restriction)
    4749  if (in_array($category_id, explode(',', $user['forbidden_categories'])))
    4850  {
     
    5355function get_categories_menu()
    5456{
    55   global $page, $user;
     57  global $page, $user, $filter;
    5658
    5759  $query = '
     
    6668  // $user['forbidden_categories'] including with USER_CACHE_CATEGORIES_TABLE
    6769  $query.= '
    68   FROM '.CATEGORIES_TABLE.' INNER JOIN '.USER_CACHE_CATEGORIES_TABLE.'
     70FROM '.CATEGORIES_TABLE.' INNER JOIN '.USER_CACHE_CATEGORIES_TABLE.'
    6971  ON id = cat_id and user_id = '.$user['id'];
    70   if ($page['filter_local_mode'])
     72
     73  // Always expand when filter is activated
     74  if (!$user['expand'] and !$filter['enabled'])
    7175  {
    7276    $query.= '
    73 where max_date_last > SUBDATE(
    74   CURRENT_DATE,INTERVAL '.$user['recent_period'].' DAY)';
     77WHERE
     78(id_uppercat is NULL';
     79    if (isset($page['category']))
     80    {
     81      $query.= ' OR id_uppercat IN ('.$page['uppercats'].')';
     82    }
     83    $query.= ')';
    7584  }
    7685  else
    7786  {
    78     // Always expand when filter_local_mode is activated
    79     if (!$user['expand'] and !$user['filter_global_mode'])
    80     {
    81       $query.= '
    82       WHERE (id_uppercat is NULL';
    83       if (isset($page['category']))
    84       {
    85         $query.= ' OR id_uppercat IN ('.$page['uppercats'].')';
    86       }
    87       $query.= ')';
    88     }
    89   }
     87    $query.= '
     88  '.get_sql_condition_FandF
     89    (
     90      array
     91        (
     92          'visible_categories' => 'id',
     93        ),
     94      'WHERE'
     95    );
     96  }
     97
    9098  $query.= '
    9199;';
     
    98106  }
    99107  usort($cats, 'global_rank_compare');
     108
     109  // Update filtered data
     110  update_cats_with_filtered_data($cats);
    100111
    101112  return get_html_menu_category($cats);
Note: See TracChangeset for help on using the changeset viewer.