Changeset 24817


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

add batch manager prefilter

Location:
extensions/instagram2piwigo
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • extensions/instagram2piwigo/admin/config.php

    r19561 r24817  
    1010  unset($_SESSION['phpinstagram_auth_token']);
    1111  conf_update_param('Instagram2Piwigo', serialize($conf['Instagram2Piwigo']));
     12  $page['infos'][] = l10n('Information data registered in database');
    1213}
    1314
  • extensions/instagram2piwigo/admin/import.php

    r19711 r24817  
    142142    if ($duplicates>0)
    143143    {
    144       array_push($page['infos'], l10n_dec('One picture is not displayed because already existing in the database.', '%d pictures are not displayed because already existing in the database.', $duplicates));
     144      $page['infos'][] = '<a href="admin.php?page=batch_manager&amp;prefilter=instagram">'
     145          .l10n_dec('One picture is not displayed because already existing in the database.', '%d pictures are not displayed because already existing in the database.', $duplicates)
     146        .'</a>';
    145147    }
    146148   
  • extensions/instagram2piwigo/main.inc.php

    r19561 r24817  
    33Plugin Name: Instagram2Piwigo
    44Version: auto
    5 Description: Import pictures from your Flickr account
    6 Plugin URI: http://piwigo.org/ext/extension_view.php?eid=612
     5Description: Import pictures from your instagram account
     6Plugin URI: auto
    77Author: Mistic
    88Author URI: http://www.strangeplanet.fr
     
    2121{
    2222  add_event_handler('get_admin_plugin_menu_links', 'instagram_admin_menu');
     23  add_event_handler('get_batch_manager_prefilters', 'instagram_add_batch_manager_prefilters');
     24  add_event_handler('perform_batch_manager_prefilters', 'instagram_perform_batch_manager_prefilters', EVENT_HANDLER_PRIORITY_NEUTRAL, 2);
     25  add_event_handler('loc_begin_admin_page', 'instagram_prefilter_from_url');
    2326
    2427  function instagram_admin_menu($menu)
     
    3033    return $menu;
    3134  }
     35 
     36  function instagram_add_batch_manager_prefilters($prefilters)
     37  {
     38    array_push($prefilters, array(
     39      'ID' => 'instagram',
     40      'NAME' => l10n('Imported from Instagram'),
     41    ));
     42    return $prefilters;
     43  }
     44
     45  function instagram_perform_batch_manager_prefilters($filter_sets, $prefilter)
     46  {
     47    if ($prefilter == 'instagram')
     48    {
     49      $query = '
     50  SELECT id
     51    FROM '.IMAGES_TABLE.'
     52    WHERE file LIKE "instagram-%"
     53  ;';
     54      $filter_sets[] = array_from_query($query, 'id');
     55    }
     56   
     57    return $filter_sets;
     58  }
     59 
     60  function instagram_prefilter_from_url()
     61  {
     62    global $page;
     63    if ($page['page'] == 'batch_manager' && @$_GET['prefilter'] == 'instagram')
     64    {
     65      $_SESSION['bulk_manager_filter'] = array('prefilter' => 'instagram');
     66      unset($_GET['prefilter']);
     67    }
     68  }
    3269}
    3370
  • extensions/instagram2piwigo/maintain.inc.php

    r19561 r24817  
    3939  global $conf;
    4040 
    41   pwg_query('DELETE FROM `'. CONFIG_TABLE .'` WHERE param = "Instagram2Piwigo" LIMIT 1;');
     41  pwg_query('DELETE FROM `'. CONFIG_TABLE .'` WHERE param = "Instagram2Piwigo";');
     42  unset($conf['Instagram2Piwigo']);
    4243 
    4344  rrmdir($conf['data_location'].'instagram_cache/');
Note: See TracChangeset for help on using the changeset viewer.