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/category_cats.inc.php

    r1651 r1677  
    4343  WHERE date_last > SUBDATE(
    4444    CURRENT_DATE,INTERVAL '.$user['recent_period'].' DAY
    45   );';
     45  )
     46'.get_sql_condition_FandF
     47  (
     48    array
     49      (
     50        'visible_categories' => 'id',
     51      ),
     52    'AND'
     53  ).'
     54;';
    4655}
    4756else
     
    5564  ON id = cat_id and user_id = '.$user['id'].'
    5665  WHERE id_uppercat '.
    57   (!isset($page['category']) ? 'is NULL' : '= '.$page['category']);
    58   if ($page['filter_local_mode'])
    59   {
    60     $query.= '
    61     AND max_date_last > SUBDATE(
    62       CURRENT_DATE,INTERVAL '.$user['recent_period'].' DAY)';
    63   }
    64   $query.= '
     66  (!isset($page['category']) ? 'is NULL' : '= '.$page['category']).'
     67'.get_sql_condition_FandF
     68  (
     69    array
     70      (
     71        'visible_categories' => 'id',
     72      ),
     73    'AND'
     74  ).'
    6575  ORDER BY rank
    6676;';
     
    8696  FROM '.CATEGORIES_TABLE.' AS c INNER JOIN '.IMAGE_CATEGORY_TABLE.' AS ic
    8797    ON ic.category_id = c.id';
    88     if ($page['filter_local_mode'] or $user['filter_global_mode'])
    89     {
    90       $query.= '
    91     INNER JOIN '.IMAGES_TABLE.' AS i on ic.image_id = i.id ';
    92     }
    9398    $query.= '
    9499  WHERE uppercats REGEXP \'(^|,)'.$row['id'].'(,|$)\'
    95     AND c.id NOT IN ('.$user['forbidden_categories'].')';
    96     if ($page['filter_local_mode'] or $user['filter_global_mode'])
    97     {
    98       $query.= '
    99     AND i.date_available  > SUBDATE(
    100       CURRENT_DATE,INTERVAL '.$user['recent_period'].' DAY)';
    101     }
    102     $query.= '
     100'.get_sql_condition_FandF
     101  (
     102    array
     103      (
     104        'forbidden_categories' => 'c.id',
     105        'visible_categories' => 'c.id',
     106        'visible_images' => 'image_id'
     107      ),
     108    'AND'
     109  ).'
    103110  ORDER BY RAND()
    104111  LIMIT 0,1
     
    117124  ON id = cat_id and user_id = '.$user['id'].'
    118125  WHERE uppercats REGEXP \'(^|,)'.$row['id'].'(,|$)\'
    119     AND representative_picture_id IS NOT NULL';
    120     if ($page['filter_local_mode'] or $user['filter_global_mode'])
    121     {
    122       $query.= '
    123       AND max_date_last > SUBDATE(
    124         CURRENT_DATE,INTERVAL '.$user['recent_period'].' DAY)';
    125     }
    126     $query.= '
     126    AND representative_picture_id IS NOT NULL
     127'.get_sql_condition_FandF
     128  (
     129    array
     130      (
     131        'visible_categories' => 'id',
     132      ),
     133    'AND'
     134  ).'
    127135  ORDER BY RAND()
    128136  LIMIT 0,1
     
    162170if (count($categories) > 0)
    163171{
     172  // Update filtered data
     173  update_cats_with_filtered_data($categories);
     174
    164175  if ($conf['subcatify'])
    165176  {
Note: See TracChangeset for help on using the changeset viewer.