source: trunk/include/functions_filter.inc.php @ 1685

Last change on this file since 1685 was 1677, checked in by rub, 17 years ago

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 size: 2.5 KB
Line 
1<?php
2// +-----------------------------------------------------------------------+
3// | PhpWebGallery - a PHP based picture gallery                           |
4// | Copyright (C) 2006-2007 PhpWebGallery Team - http://phpwebgallery.net |
5// +-----------------------------------------------------------------------+
6// | branch        : BSF (Best So Far)
7// | file          : $Id: functions_filter.inc.php 1651 2006-12-13 00:05:16Z rub $
8// | last update   : $Date: 2006-12-13 01:05:16 +0100 (mer., 13 déc. 2006) $
9// | last modifier : $Author: rub $
10// | revision      : $Revision: 1651 $
11// +-----------------------------------------------------------------------+
12// | This program is free software; you can redistribute it and/or modify  |
13// | it under the terms of the GNU General Public License as published by  |
14// | the Free Software Foundation                                          |
15// |                                                                       |
16// | This program is distributed in the hope that it will be useful, but   |
17// | WITHOUT ANY WARRANTY; without even the implied warranty of            |
18// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU      |
19// | General Public License for more details.                              |
20// |                                                                       |
21// | You should have received a copy of the GNU General Public License     |
22// | along with this program; if not, write to the Free Software           |
23// | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
24// | USA.                                                                  |
25// +-----------------------------------------------------------------------+
26
27
28/**
29 * Get a check key for filtered data
30 * Check key are composed of elements witch force to compute data
31 *
32 * @param null
33 * @return strinf check_key
34 */
35function get_filter_check_key()
36{
37  global $user;
38 
39  return $user['id'].$user['recent_period'].date('Ymd');
40}
41
42/**
43 * update data of categories with filtered values
44 *
45 * @param array list of categories
46 * @return null
47 */
48function update_cats_with_filtered_data(&$cats)
49{
50  global $filter;
51
52  if ($filter['enabled'])
53  {
54    $upd_fields = array('max_date_last', 'count_images', 'count_categories', 'nb_images');
55
56    foreach ($cats as $cat_id => $category)
57    {
58      foreach ($upd_fields as $upd_field)
59      {
60        $cats[$cat_id][$upd_field] = $filter['categories'][$category['id']][$upd_field];
61      }
62    }
63  }
64}
65
66?>
Note: See TracBrowser for help on using the repository browser.