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

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

There are no filter enabled if filter configuration is empty (no icon, no functions, ...)
New system for the filter page configuration

View mode flat_recent_cat becomes flat_cat (recent period is removed because global filter is sufficient)

Recent period of global filter must be defined "after" start parameter (default value is $userrecent_period).

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, $filter;
38
39  return $user['id'].$filter['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.