Changeset 28105


Ignore:
Timestamp:
04/07/14 10:29:14 (5 years ago)
Author:
plg
Message:

export photos (with tags list)

Location:
extensions/export_data
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • extensions/export_data/admin.php

    r27092 r28105  
    3232// +-----------------------------------------------------------------------+ 
    3333 
    34 if (isset($_GET['type']) and 'albums' == $_GET['type']) 
     34if (isset($_GET['type'])) 
    3535{ 
    3636  // output headers so that the file is downloaded rather than displayed 
     
    4040  // create a file pointer connected to the output stream 
    4141  $output = fopen('php://output', 'w'); 
    42    
    43   $query = ' 
     42 
     43  if ('albums' == $_GET['type']) 
     44  { 
     45    $query = ' 
    4446SELECT 
    4547    id, 
     
    4951  ORDER BY id ASC 
    5052;'; 
    51   $result = pwg_query($query); 
     53    $result = pwg_query($query); 
    5254 
    53   set_make_full_url(); 
    54   while ($row = pwg_db_fetch_assoc($result)) 
     55    set_make_full_url(); 
     56    while ($row = pwg_db_fetch_assoc($result)) 
     57    { 
     58      fputcsv($output, array('url' => make_index_url(array('category' => $row)))); 
     59    } 
     60  } 
     61 
     62  if ('photos' == $_GET['type']) 
    5563  { 
    56     fputcsv($output, array('url' => make_index_url(array('category' => $row)))); 
     64    $query = ' 
     65SELECT 
     66    i.id, 
     67    file, 
     68    date_available, 
     69    date_creation, 
     70    i.name AS title, 
     71    author, 
     72    hit, 
     73    filesize, 
     74    width, 
     75    height, 
     76    latitude, 
     77    longitude, 
     78    group_concat(t.name) AS tags, 
     79    comment AS description 
     80  FROM '.IMAGES_TABLE.' AS i 
     81    LEFT JOIN '.IMAGE_TAG_TABLE.' ON image_id=i.id 
     82    LEFT JOIN '.TAGS_TABLE.' AS t ON tag_id=t.id 
     83  GROUP BY i.id 
     84  ORDER BY i.id 
     85;'; 
     86    $result = pwg_query($query); 
     87 
     88    $is_first = true; 
     89    while ($row = pwg_db_fetch_assoc($result)) 
     90    { 
     91      if ($is_first) 
     92      { 
     93        fputcsv($output, array_keys($row)); 
     94        $is_first = false; 
     95      } 
     96       
     97      fputcsv($output, $row); 
     98    } 
    5799  } 
     100   
    58101  exit(); 
    59102} 
  • extensions/export_data/admin.tpl

    r27092 r28105  
    1010 
    1111<a href="{$EXPORT_DATA_ADMIN}&amp;type=albums">{'Export albums'|@translate}</a> 
     12| <a href="{$EXPORT_DATA_ADMIN}&amp;type=photos">{'Export photos'|@translate}</a> 
  • extensions/export_data/language/en_UK/plugin.lang.php

    r27092 r28105  
    22$lang['Export Data'] = 'Export Data'; 
    33$lang['Export albums'] = 'Export albums'; 
     4$lang['Export photos'] = 'Export photos'; 
    45?> 
  • extensions/export_data/language/fr_FR/plugin.lang.php

    r27092 r28105  
    22$lang['Export Data'] = 'Extraction de données'; 
    33$lang['Export albums'] = 'Extraire les albums'; 
     4$lang['Export photos'] = 'Extraire les photos'; 
    45?> 
Note: See TracChangeset for help on using the changeset viewer.