3 * Copyright (C) 2009 Alain Peyrat, Alcatel-Lucent
5 * This file is part of FusionForge.
7 * FusionForge is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published
9 * by the Free Software Foundation; either version 2 of the License,
10 * or (at your option) any later version.
12 * FusionForge is distributed in the hope that it will be useful, but
13 * WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with FusionForge; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
24 * Standard Alcatel-Lucent disclaimer for contributing to open source
26 * "The program ("Contribution") has not been tested and/or
27 * validated for release as or in products, combinations with products or
28 * other commercial use. Any use of the Contribution is entirely made at
29 * the user's own responsibility and the user can not rely on any features,
30 * functionalities or performances Alcatel-Lucent has attributed to the
33 * THE CONTRIBUTION BY ALCATEL-LUCENT IS PROVIDED AS IS, WITHOUT WARRANTY
34 * OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
35 * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, COMPLIANCE,
36 * NON-INTERFERENCE AND/OR INTERWORKING WITH THE SOFTWARE TO WHICH THE
37 * CONTRIBUTION HAS BEEN MADE, TITLE AND NON-INFRINGEMENT. IN NO EVENT SHALL
38 * ALCATEL-LUCENT BE LIABLE FOR ANY DAMAGES OR OTHER LIABLITY, WHETHER IN
39 * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
40 * CONTRIBUTION OR THE USE OR OTHER DEALINGS IN THE CONTRIBUTION, WHETHER
41 * TOGETHER WITH THE SOFTWARE TO WHICH THE CONTRIBUTION RELATES OR ON A STAND
45 require_once ('../../env.inc.php');
46 require_once $gfwww.'include/pre.php';
47 require_once $gfwww.'frs/include/frs_utils.php';
48 require_once $gfcommon.'reporting/report_utils.php';
49 require_once $gfcommon.'reporting/ReportDownloads.class.php';
51 $group_id = getIntFromRequest('group_id');
52 $package_id = getIntFromRequest('package_id');
53 $start = getIntFromRequest('start');
54 $end = getIntFromRequest('end');
60 $g =& group_get_object($group_id);
61 if (!$g || $g->isError()) {
62 exit_error('Error',$g->getErrorMessage());
64 $perm =& $g->getPermission(session_get_user());
65 if (!$perm->isReleaseTechnician()) {
66 exit_permission_denied();
70 if ($report->isError()) {
71 exit_error($report->getErrorMessage());
74 // Fix: Add current month to the reports.
75 $z =& $report->getMonthStartArr();
76 $z[] = mktime(0,0,0,date('m')+1,1,date('Y'));
79 $z =& $report->getMonthStartArr();
84 $z =& $report->getMonthStartArr();
85 $end = $z[ count($z)-1];
88 frs_header(array('title'=>_('File Release Reporting'),
90 'pagename'=>'project_showfiles',
91 'sectionvals'=>group_getname($group_id)));
95 <form action="<?php echo util_make_url('/frs/reporting/downloads.php') ?>" method="get">
96 <input type="hidden" name="group_id" value="<?php echo $group_id; ?>" />
98 <td><strong><?php echo _('Package'); ?>:</strong><br />
99 <?php echo report_package_box($group_id,'package_id',$package_id); ?></td>
100 <td><strong><?php echo _('Start'); ?>:</strong><br />
101 <?php echo report_months_box($report, 'start', $start); ?></td>
102 <td><strong><?php echo _('End'); ?>:</strong><br />
103 <?php echo report_months_box($report, 'end', $end); ?></td>
104 <td><input type="submit" name="submit" value="<?php echo _('Refresh'); ?>" /></td>
110 $report=new ReportDownloads($group_id,$package_id,$start,$end);
111 $data = $report->getData();
113 if (count($data) == 0) {
115 echo _('There have been no downloads for this package.');
119 echo $HTML->listTableTop (array('Package', 'Release', 'File','User', 'Date'),
120 false, true, 'Download');
122 for ($i=0; $i<count($data); $i++) {
123 $date = preg_replace('/^(....)(..)(..)$/', '\1-\2-\3', $data[$i][4]);
125 echo '<tr '. $HTML->boxGetAltRowStyle($i) .'>'.
126 '<td>'. $data[$i][0] .'</td>'.
127 '<td>'. $data[$i][1] .'</td>'.
128 '<td>'. basename($data[$i][2]) .'</td>'.
129 '<td><a href="/users/'.urlencode($data[$i][5]).'/">'. $data[$i][3] .'</a></td>'.
130 '<td align="center">'. $date .'</td></tr>';
134 echo $HTML->listTableBottom ();