Changeset 19446 for extensions/SmartAlbums/admin/cat_list.php
- Timestamp:
- Dec 16, 2012, 3:21:10 PM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/SmartAlbums/admin/cat_list.php
r16104 r19446 21 21 permalink, 22 22 dir, 23 rank, 24 status 23 smart_update 25 24 FROM '.CATEGORIES_TABLE.' AS cat 26 25 INNER JOIN '.CATEGORY_FILTERS_TABLE.' AS cf … … 124 123 // +-----------------------------------------------------------------------+ 125 124 126 // get the categories containing images directly 127 $categories_with_images = array(); 125 $categories_count_images = array(); 128 126 if ( count($categories) ) 129 127 { 130 128 $query = ' 131 SELECT DISTINCT category_id 129 SELECT 130 category_id, 131 COUNT(image_id) AS total_images 132 132 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'); 135 137 } 136 138 … … 141 143 $tpl_cat = 142 144 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), 146 149 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'], 156 154 ); 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 }163 155 164 156 $template->append('categories', $tpl_cat);
Note: See TracChangeset
for help on using the changeset viewer.