3 * Copyright (C) 2009 Alain Peyrat, Alcatel-Lucent
4 * Copyright 2012, Franck Villaume - TrivialDev
6 * This file is part of FusionForge. FusionForge is free software;
7 * you can redistribute it and/or modify it under the terms of the
8 * GNU General Public License as published by the Free Software
9 * Foundation; either version 2 of the Licence, or (at your option)
12 * FusionForge is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License along
18 * with FusionForge; if not, write to the Free Software Foundation, Inc.,
19 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
23 * Standard Alcatel-Lucent disclaimer for contributing to open source
25 * "The provided file ("Contribution") has not been tested and/or
26 * validated for release as or in products, combinations with products or
27 * other commercial use. Any use of the Contribution is entirely made at
28 * the user's own responsibility and the user can not rely on any features,
29 * functionalities or performances Alcatel-Lucent has attributed to the
32 * THE CONTRIBUTION BY ALCATEL-LUCENT IS PROVIDED AS IS, WITHOUT WARRANTY
33 * OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
34 * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, COMPLIANCE,
35 * NON-INTERFERENCE AND/OR INTERWORKING WITH THE SOFTWARE TO WHICH THE
36 * CONTRIBUTION HAS BEEN MADE, TITLE AND NON-INFRINGEMENT. IN NO EVENT SHALL
37 * ALCATEL-LUCENT BE LIABLE FOR ANY DAMAGES OR OTHER LIABLITY, WHETHER IN
38 * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
39 * CONTRIBUTION OR THE USE OR OTHER DEALINGS IN THE CONTRIBUTION, WHETHER
40 * TOGETHER WITH THE SOFTWARE TO WHICH THE CONTRIBUTION RELATES OR ON A STAND
45 // This page contains a form with a file-upload button
46 // so a user can choose a file to upload a .csv file and store it in task mgr
54 //pm_header(array('title'=>_('Upload data into the tasks.'),'group_project_id'=>$group_project_id));
55 $ath->header(array('atid'=>$ath->getID(), 'title'=>$ath->getName()));
57 $default = array('headers' => 1, 'sep' => ',');
59 if (session_loggedin()) {
60 $u = session_get_user();
61 $pref = $u->getPreference('csv');
63 $default = unserialize($pref);
67 $headers = getIntFromRequest('headers', $default['headers']);
68 $sep = getStringFromRequest('sep', $default['sep']);
70 if (session_loggedin()) {
71 if ( ($sep !== $default['sep']) || ($headers !== $default['headers']) ) {
72 $pref = array_merge( $default, array('headers' => $headers, 'sep' => $sep));
73 $u->setPreference('csv', serialize($pref));
77 $url_set_format = '/tracker/?group_id='.$group_id.'&atid='.$ath->getID().'&func=format_csv&sep='.urlencode($sep).'&headers='.$headers;
79 $url_export = '/tracker/?group_id='.$group_id.'&atid='.$ath->getID().'&func=downloadcsv&sep='.urlencode($sep).'&headers='.$headers;
81 $format = $headers ? ' with headers' : ' without headers';
82 $format .= " using '$sep' as separator.";
84 <p><?php echo _('This page allows you to export the items using a CSV (<a href="http://en.wikipedia.org/wiki/Comma-separated_values">Comma Separated Values</a>) File. This format can be used to view your entries using MS Excel.'); ?></p>
85 <h2><?php echo _('Export as a CSV file'); ?></h2>
87 <strong><?php echo _('Selected CSV Format :'); ?></strong> CSV<?php echo $format ?> <a href="<?php echo $url_set_format ?>">(Change)</a>
89 <p><a href="<?php echo $url_export ?>"><?php echo _('Download CSV file'); ?></a></p>
93 $ath->footer(array());