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_notification.inc.php

    r1639 r1677  
    3131
    3232/*
     33 * get standard sql where in order to
     34 * restict an filter caregories and images
     35 *
     36 * IMAGE_CATEGORY_TABLE muste named ic in the query
     37 *
     38 * @param none
     39 *
     40 * @return string sql where
     41 */
     42function get_std_sql_where_restrict_filter($prefix_condition, $force_one_condition = false)
     43{
     44  return get_sql_condition_FandF
     45          (
     46            array
     47              (
     48                'forbidden_categories' => 'ic.category_id',
     49                'visible_categories' => 'ic.category_id',
     50                'visible_images' => 'ic.image_id'
     51              ),
     52            $prefix_condition,
     53            $force_one_condition
     54          );
     55}
     56
     57/*
    3358 * Execute custom notification query
    3459 *
     
    5479    AND c.validation_date > \''.$start.'\'
    5580    AND c.validation_date <= \''.$end.'\'
    56     AND category_id NOT IN ('.$user['forbidden_categories'].')
     81      '.get_std_sql_where_restrict_filter('AND').'
    5782;';
    5883      break;
     
    6792    case 'new_elements':
    6893      $query = '
    69   FROM '.IMAGES_TABLE.' INNER JOIN '.IMAGE_CATEGORY_TABLE.' ON image_id = id
     94  FROM '.IMAGES_TABLE.' INNER JOIN '.IMAGE_CATEGORY_TABLE.' AS ic ON image_id = id
    7095  WHERE date_available > \''.$start.'\'
    7196    AND date_available <= \''.$end.'\'
    72     AND category_id NOT IN ('.$user['forbidden_categories'].')
     97      '.get_std_sql_where_restrict_filter('AND').'
    7398;';
    7499      break;
    75100    case 'updated_categories':
    76101      $query = '
    77   FROM '.IMAGES_TABLE.' INNER JOIN '.IMAGE_CATEGORY_TABLE.' ON image_id = id
     102  FROM '.IMAGES_TABLE.' INNER JOIN '.IMAGE_CATEGORY_TABLE.' AS ic ON image_id = id
    78103  WHERE date_available > \''.$start.'\'
    79104    AND date_available <= \''.$end.'\'
    80     AND category_id NOT IN ('.$user['forbidden_categories'].')
     105      '.get_std_sql_where_restrict_filter('AND').'
    81106;';
    82107      break;
     
    424449  global $conf, $user;
    425450
    426   $where_sql = 'WHERE category_id NOT IN ('.$user['forbidden_categories'].')';
     451  $where_sql = get_std_sql_where_restrict_filter('WHERE', true);
    427452
    428453  $query = '
     
    430455      COUNT(DISTINCT id) nb_elements,
    431456      COUNT(DISTINCT category_id) nb_cats
    432   FROM '.IMAGES_TABLE.' INNER JOIN '.IMAGE_CATEGORY_TABLE.' ON id=image_id
     457  FROM '.IMAGES_TABLE.' INNER JOIN '.IMAGE_CATEGORY_TABLE.' AS ic ON id=image_id
    433458  '.$where_sql.'
    434459  GROUP BY date_available
     
    449474      $query = '
    450475SELECT DISTINCT id, path, name, tn_ext
    451   FROM '.IMAGES_TABLE.' INNER JOIN '.IMAGE_CATEGORY_TABLE.' ON id=image_id
     476  FROM '.IMAGES_TABLE.' INNER JOIN '.IMAGE_CATEGORY_TABLE.' AS ic ON id=image_id
    452477  '.$where_sql.'
    453478    AND date_available="'.$dates[$i]['date_available'].'"
     
    467492      $query = '
    468493SELECT DISTINCT c.uppercats, COUNT(DISTINCT i.id) img_count
    469   FROM '.IMAGES_TABLE.' i INNER JOIN '.IMAGE_CATEGORY_TABLE.' ON i.id=image_id
     494  FROM '.IMAGES_TABLE.' i INNER JOIN '.IMAGE_CATEGORY_TABLE.' AS ic ON i.id=image_id
    470495    INNER JOIN '.CATEGORIES_TABLE.' c ON c.id=category_id
    471496  '.$where_sql.'
Note: See TracChangeset for help on using the changeset viewer.