Ignore:
Timestamp:
Dec 16, 2012, 3:21:10 PM (11 years ago)
Author:
mistic100
Message:
  • add regex for phot name, author
  • add dimensions filter
  • rewrite javascript algorithms
  • add auto update on timeout (default 3 days)
  • display photos count on plugin albums list
File:
1 edited

Legend:

Unmodified
Added
Removed
  • extensions/SmartAlbums/admin/cat_list.php

    r16104 r19446  
    2121    permalink,
    2222    dir,
    23     rank,
    24     status
     23    smart_update
    2524  FROM '.CATEGORIES_TABLE.' AS cat
    2625  INNER JOIN '.CATEGORY_FILTERS_TABLE.' AS cf
     
    124123// +-----------------------------------------------------------------------+
    125124
    126 // get the categories containing images directly
    127 $categories_with_images = array();
     125$categories_count_images = array();
    128126if ( count($categories) )
    129127{
    130128  $query = '
    131 SELECT DISTINCT category_id
     129SELECT
     130    category_id,
     131    COUNT(image_id) AS total_images
    132132  FROM '.IMAGE_CATEGORY_TABLE.'
    133   WHERE category_id IN ('.implode(',', array_keys($categories)).')';
    134   $categories_with_images = array_flip( array_from_query($query, 'category_id') );
     133  WHERE category_id IN ('.implode(',', array_keys($categories)).')
     134  GROUP BY category_id
     135;';
     136  $categories_count_images = simple_hash_from_query($query, 'category_id', 'total_images');
    135137}
    136138
     
    141143  $tpl_cat =
    142144    array(
    143       'NAME'       => get_cat_display_name_from_id($category['id'], $base_url.'album-'),
    144       'ID'         => $category['id'],
    145       'RANK'       => $category['rank']*10,
     145      'NAME'        => get_cat_display_name_from_id($category['id'], $base_url.'album-'),
     146      'ID'          => $category['id'],
     147      'IMG_COUNT'   => !empty($categories_count_images[ $category['id'] ]) ? $categories_count_images[ $category['id'] ] : 0,
     148      'LAST_UPDATE' => format_date($category['smart_update'], true),
    146149
    147       'U_JUMPTO'   => make_index_url(
    148         array(
    149           'category' => $category
    150           )
    151         ),
    152 
    153       'U_EDIT'     => $base_url.'album-'.$category['id'],
    154       'U_DELETE'   => $self_url.'&delete='.$category['id'].'&pwg_token='.get_pwg_token(),
    155       'U_SMART'    => $self_url.'&smart_generate='.$category['id'],
     150      'U_JUMPTO'    => make_index_url(array('category' => $category)),
     151      'U_EDIT'      => SMART_ADMIN.'-album&cat_id='.$category['id'],
     152      'U_DELETE'    => $self_url.'&delete='.$category['id'].'&pwg_token='.get_pwg_token(),
     153      'U_SMART'     => $self_url.'&smart_generate='.$category['id'],
    156154    );
    157 
    158   if ( array_key_exists($category['id'], $categories_with_images) )
    159   {
    160     $tpl_cat['U_MANAGE_ELEMENTS'] =
    161       $base_url.'batch_manager&cat='.$category['id'];
    162   }
    163155 
    164156  $template->append('categories', $tpl_cat);
Note: See TracChangeset for help on using the changeset viewer.