Ignore:
Timestamp:
Dec 31, 2010, 12:58:14 PM (13 years ago)
Author:
plg
Message:

feature 2089: add the "not_linked" feature as "with no virtual album" in the
new Batch Manager.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/admin/batch_manager.php

    r8399 r8403  
    5555  if (isset($_POST['filter_prefilter_use']))
    5656  {
    57     $prefilters = array('caddie', 'last import', 'with no album', 'with no tag');
     57    $prefilters = array('caddie', 'last import', 'with no album', 'with no tag', 'with no virtual album');
    5858    if (in_array($_POST['filter_prefilter'], $prefilters))
    5959    {
     
    144144        );
    145145    }
     146  }
     147
     148  if ('with no virtual album' == $_SESSION['bulk_manager_filter']['prefilter'])
     149  {
     150    // we are searching elements not linked to any virtual category
     151    $query = '
     152 SELECT id
     153   FROM '.IMAGES_TABLE.'
     154 ;';
     155    $all_elements = array_from_query($query, 'id');
     156 
     157    $query = '
     158 SELECT id
     159   FROM '.CATEGORIES_TABLE.'
     160   WHERE dir IS NULL
     161 ;';
     162    $virtual_categories = array_from_query($query, 'id');
     163    if (!empty($virtual_categories))
     164    {
     165      $query = '
     166 SELECT DISTINCT(image_id)
     167   FROM '.IMAGE_CATEGORY_TABLE.'
     168   WHERE category_id IN ('.implode(',', $virtual_categories).')
     169 ;';
     170      $linked_to_virtual = array_from_query($query, 'image_id');
     171    }
     172
     173    array_push(
     174      $filter_sets,
     175      array_diff($all_elements, $linked_to_virtual)
     176      );
    146177  }
    147178}
     
    195226//  $page['cat_elements_id'] = array();
    196227
    197 //  else if ('not_linked' == $_GET['cat'])
    198 //  {
    199 //    $page['title'] = l10n('Not linked elements');
    200 //    $template->assign(array('U_ACTIVE_MENU' => 5 ));
    201 // 
    202 //    // we are searching elements not linked to any virtual category
    203 //    $query = '
    204 //  SELECT id
    205 //    FROM '.IMAGES_TABLE.'
    206 //  ;';
    207 //    $all_elements = array_from_query($query, 'id');
    208 // 
    209 //    $linked_to_virtual = array();
    210 // 
    211 //    $query = '
    212 //  SELECT id
    213 //    FROM '.CATEGORIES_TABLE.'
    214 //    WHERE dir IS NULL
    215 //  ;';
    216 //    $virtual_categories = array_from_query($query, 'id');
    217 //    if (!empty($virtual_categories))
    218 //    {
    219 //      $query = '
    220 //  SELECT DISTINCT(image_id)
    221 //    FROM '.IMAGE_CATEGORY_TABLE.'
    222 //    WHERE category_id IN ('.implode(',', $virtual_categories).')
    223 //  ;';
    224 //      $linked_to_virtual = array_from_query($query, 'image_id');
    225 //    }
    226 // 
    227 //    $page['cat_elements_id'] = array_diff($all_elements, $linked_to_virtual);
    228 //  }
    229228//  else if ('duplicates' == $_GET['cat'])
    230229//  {
Note: See TracChangeset for help on using the changeset viewer.