Ignore:
Timestamp:
Oct 9, 2013, 3:18:02 PM (11 years ago)
Author:
mistic100
Message:

fix bug with quotes, add batch manager prefilter

File:
1 edited

Legend:

Unmodified
Added
Removed
  • extensions/flickr2piwigo/main.inc.php

    r24660 r24815  
    2121{
    2222  add_event_handler('get_admin_plugin_menu_links', 'flickr_admin_menu');
     23  add_event_handler('get_batch_manager_prefilters', 'flickr_add_batch_manager_prefilters');
     24  add_event_handler('perform_batch_manager_prefilters', 'flickr_perform_batch_manager_prefilters', EVENT_HANDLER_PRIORITY_NEUTRAL, 2);
     25  add_event_handler('loc_begin_admin_page', 'flickr_prefilter_from_url');
    2326
    2427  function flickr_admin_menu($menu)
     
    3033    return $menu;
    3134  }
     35 
     36  function flickr_add_batch_manager_prefilters($prefilters)
     37  {
     38    array_push($prefilters, array(
     39      'ID' => 'flickr',
     40      'NAME' => l10n('Imported from Flickr'),
     41    ));
     42    return $prefilters;
     43  }
     44
     45  function flickr_perform_batch_manager_prefilters($filter_sets, $prefilter)
     46  {
     47    if ($prefilter == 'flickr')
     48    {
     49      $query = '
     50  SELECT id
     51    FROM '.IMAGES_TABLE.'
     52    WHERE file LIKE "flickr-%"
     53  ;';
     54      $filter_sets[] = array_from_query($query, 'id');
     55    }
     56   
     57    return $filter_sets;
     58  }
     59 
     60  function flickr_prefilter_from_url()
     61  {
     62    global $page;
     63    if ($page['page'] == 'batch_manager' && @$_GET['prefilter'] == 'flickr')
     64    {
     65      $_SESSION['bulk_manager_filter'] = array('prefilter' => 'flickr');
     66      unset($_GET['prefilter']);
     67    }
     68  }
    3269}
    3370
Note: See TracChangeset for help on using the changeset viewer.