3 * Copyright (C) 2009-2012 Alain Peyrat, Alcatel-Lucent
4 * http://fusionforge.org
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 program ("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
44 require_once ('../../env.inc.php');
45 require_once $gfcommon.'include/pre.php';
46 require_once $gfcommon.'frs/include/frs_utils.php';
47 require_once $gfcommon.'reporting/report_utils.php';
48 require_once $gfcommon.'reporting/ReportDownloads.class.php';
50 $group_id = getIntFromRequest('group_id');
51 $package_id = getIntFromRequest('package_id');
52 $start = getIntFromRequest('start');
53 $end = getIntFromRequest('end');
59 $group=group_get_object($group_id);
60 if (!$group || !is_object($group)) {
62 } elseif ($group->isError()) {
63 exit_error($group->getErrorMessage(),'frs');
66 session_require_perm ('frs', $group_id, 'write') ;
69 if ($report->isError()) {
70 exit_error($report->getErrorMessage(),'frs');
73 if (!$start || !$end) $z =& $report->getMonthStartArr();
80 $end = $z[ count($z)-1];
82 if ($end < $start) list($start, $end) = array($end, $start);
84 frs_header(array('title'=>_('File Release Reporting'),
86 'pagename'=>'project_showfiles',
87 'sectionvals'=>group_getname($group_id)));
89 $report=new ReportDownloads($group_id,$package_id,$start,$end);
90 if ($report->isError()) {
91 echo '<p class="information">'.$report->getErrorMessage().'</p>';
98 <form action="<?php echo util_make_url('/frs/reporting/downloads.php') ?>" method="get">
99 <input type="hidden" name="group_id" value="<?php echo $group_id; ?>" />
101 <td><strong><?php echo _('Package'); ?>:</strong><br />
102 <?php echo report_package_box($group_id,'package_id',$package_id); ?></td>
103 <td><strong><?php echo _('Start'); ?>:</strong><br />
104 <?php echo report_months_box($report, 'start', $start); ?></td>
105 <td><strong><?php echo _('End'); ?>:</strong><br />
106 <?php echo report_months_box($report, 'end', $end); ?></td>
107 <td><input type="submit" name="submit" value="<?php echo _('Refresh'); ?>" /></td>
113 $data = $report->getData();
115 if (count($data) == 0) {
116 echo '<p class="information">';
117 echo _('There have been no downloads for this package.');
121 echo $HTML->listTableTop (array(_('Package'), _('Release'), _('File'), _('User'), _('Date')),
122 false, true, 'Download');
124 for ($i=0; $i<count($data); $i++) {
125 $date = preg_replace('/^(....)(..)(..)$/', '\1-\2-\3', $data[$i][4]);
127 echo '<tr '. $HTML->boxGetAltRowStyle($i) .'>'.
128 '<td>'. $data[$i][0] .'</td>'.
129 '<td>'. $data[$i][1] .'</td>'.
130 '<td>'. basename($data[$i][2]) .'</td>'.
131 '<td><a href="/users/'.urlencode($data[$i][5]).'/">'. $data[$i][3] .'</a></td>'.
132 '<td class="align-center">'. $date .'</td></tr>';
136 echo $HTML->listTableBottom ();