source: extensions/UserCollections/admin/export.php @ 21739

Last change on this file since 21739 was 20099, checked in by mistic100, 12 years ago

compatible with Simple, new export options

File size: 1.6 KB
Line 
1<?php
2if (!defined('USER_COLLEC_PATH')) die('Hacking attempt!');
3
4try {
5  $UserCollection = new UserCollection($_GET['col_id']);
6 
7  $template->assign('COL_ID', $_GET['col_id']);
8}
9catch (Exception $e)
10{
11  array_push($page['errors'], $e->getMessage());
12}
13
14// pwg_unset_session_var('uc_export_active_fields');
15// pwg_unset_session_var('uc_export_inactive_fields');
16
17if (isset($_POST['download']))
18{
19  pwg_set_session_var('uc_export_active_fields', $_POST['active']);
20  pwg_set_session_var('uc_export_inactive_fields', $_POST['inactive']);
21 
22  $content = $UserCollection->serialize($_POST['active']);
23  $filename = 'collection_'.$_GET['col_id'].'_'.date('Ymd-Hi').'.csv';
24 
25  header('Content-Type: application/force-download; name="'.$filename.'"');
26  header('Content-Disposition: attachment; filename="'.$filename.'"');
27  header('Content-Description: File Transfer');
28  header('Content-Transfer-Encoding: binary');
29  header('Content-Length: '.strlen($content).'');
30
31  header('Cache-Control: no-cache, must-revalidate');
32  header('Pragma: no-cache');
33  header('Expires: 0');
34 
35  echo $content;
36  exit;
37}
38
39$default_active_fields = array(
40  'id',
41  'name',
42  'path',
43  );
44$default_inactive_fields = array(
45  'file',
46  'url',
47  'date_creation',
48  'collection_add_date',
49  'filesize',
50  'width',
51  'height',
52  );
53
54$template->assign('active_fields', pwg_get_session_var('uc_export_active_fields', $default_active_fields));
55$template->assign('inactive_fields', pwg_get_session_var('uc_export_inactive_fields', $default_inactive_fields));
56
57$template->set_filename('user_collections', dirname(__FILE__) . '/template/export.tpl');
58
59?>
Note: See TracBrowser for help on using the repository browser.