3 * FusionForge reporting system
5 * Copyright (C) 2009 Alain Peyrat, Alcatel-Lucent
6 * Copyright 2009, Roland Mas
7 * Copyright 2012, Franck Villaume
8 * Copyright 2014, Franck Villaume - TrivialDev
9 * http://fusionforge.org
11 * This file is part of FusionForge. FusionForge is free software;
12 * you can redistribute it and/or modify it under the terms of the
13 * GNU General Public License as published by the Free Software
14 * Foundation; either version 2 of the Licence, or (at your option)
17 * FusionForge is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 * GNU General Public License for more details.
22 * You should have received a copy of the GNU General Public License along
23 * with FusionForge; if not, write to the Free Software Foundation, Inc.,
24 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
28 * Standard Alcatel-Lucent disclaimer for contributing to open source
30 * "The class ("Contribution") has not been tested and/or
31 * validated for release as or in products, combinations with products or
32 * other commercial use. Any use of the Contribution is entirely made at
33 * the user's own responsibility and the user can not rely on any features,
34 * functionalities or performances Alcatel-Lucent has attributed to the
37 * THE CONTRIBUTION BY ALCATEL-LUCENT IS PROVIDED AS IS, WITHOUT WARRANTY
38 * OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
39 * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, COMPLIANCE,
40 * NON-INTERFERENCE AND/OR INTERWORKING WITH THE SOFTWARE TO WHICH THE
41 * CONTRIBUTION HAS BEEN MADE, TITLE AND NON-INFRINGEMENT. IN NO EVENT SHALL
42 * ALCATEL-LUCENT BE LIABLE FOR ANY DAMAGES OR OTHER LIABLITY, WHETHER IN
43 * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
44 * CONTRIBUTION OR THE USE OR OTHER DEALINGS IN THE CONTRIBUTION, WHETHER
45 * TOGETHER WITH THE SOFTWARE TO WHICH THE CONTRIBUTION RELATES OR ON A STAND
49 require_once $gfcommon.'reporting/Report.class.php';
51 class ReportPerGroupDocmanDownloads extends Report {
53 function __construct($group_id, $start = 0, $end = 0) {
57 $start = mktime(0, 0, 0, date('m'), 1, date('Y'));
65 // Convert start & end date to month .
66 $start_m = date('Ym', $start);
67 $end_m = date('Ym', $end);
70 $this->setError(_('No Valid Group Object'));
74 $res = db_query_params ('SELECT docdata_vw.filename, docman_dlstats_doc.user_id,
75 docman_dlstats_doc.month || lpad(docman_dlstats_doc.day::text,2,0::text),
77 FROM docman_dlstats_doc, docdata_vw
78 WHERE docdata_vw.group_id = $1
79 AND docman_dlstats_doc.month >= $2
80 AND docman_dlstats_doc.month <= $3
81 AND docdata_vw.docid = docman_dlstats_doc.docid
82 ORDER BY docman_dlstats_doc.month DESC,
83 docman_dlstats_doc.day DESC',
89 $this->start_date = $start;
90 $this->end_date = $end;
92 if (!$res || db_error()) {
93 $this->setError('ReportUserAct: '.db_error());
97 $rows = db_numrows($res);
101 while ($row = db_fetch_array($res)) {