3 * FusionForge Documentation Manager
5 * Copyright (C) 2009-2012 Alain Peyrat, Alcatel-Lucent
6 * Copyright 2012-2015, Franck Villaume - TrivialDev
7 * http://fusionforge.org
9 * This file is part of FusionForge. FusionForge is free software;
10 * you can redistribute it and/or modify it under the terms of the
11 * GNU General Public License as published by the Free Software
12 * Foundation; either version 2 of the Licence, or (at your option)
15 * FusionForge is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
20 * You should have received a copy of the GNU General Public License along
21 * with FusionForge; if not, write to the Free Software Foundation, Inc.,
22 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
26 * Standard Alcatel-Lucent disclaimer for contributing to open source
28 * "The program ("Contribution") has not been tested and/or
29 * validated for release as or in products, combinations with products or
30 * other commercial use. Any use of the Contribution is entirely made at
31 * the user's own responsibility and the user can not rely on any features,
32 * functionalities or performances Alcatel-Lucent has attributed to the
35 * THE CONTRIBUTION BY ALCATEL-LUCENT IS PROVIDED AS IS, WITHOUT WARRANTY
36 * OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
37 * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, COMPLIANCE,
38 * NON-INTERFERENCE AND/OR INTERWORKING WITH THE SOFTWARE TO WHICH THE
39 * CONTRIBUTION HAS BEEN MADE, TITLE AND NON-INFRINGEMENT. IN NO EVENT SHALL
40 * ALCATEL-LUCENT BE LIABLE FOR ANY DAMAGES OR OTHER LIABLITY, WHETHER IN
41 * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
42 * CONTRIBUTION OR THE USE OR OTHER DEALINGS IN THE CONTRIBUTION, WHETHER
43 * TOGETHER WITH THE SOFTWARE TO WHICH THE CONTRIBUTION RELATES OR ON A STAND
47 /* please do not add require here : use www/docman/index.php to add require */
48 /* global variables used */
49 global $HTML; // Layout object
50 global $group_id; // id of group
51 global $g; // Group object
54 if ( !forge_check_perm('docman', $group_id, 'admin')) {
55 $warning_msg = _('Document Manager Access Denied');
56 session_redirect(DOCMAN_BASEURL.$group_id);
59 $start = getIntFromRequest('start');
60 $end = getIntFromRequest('end');
62 $report = new Report();
63 if ($report->isError()) {
64 exit_error($report->getErrorMessage(), 'docman');
67 if (!$start || !$end) {
68 $z =& $report->getMonthStartArr();
76 $end = $z[ count($z)-1 ];
79 list($start, $end) = array($end, $start);
82 html_use_jqueryjqplotpluginCanvas();
83 html_use_jqueryjqplotpluginhighlighter();
84 echo $HTML->getJavascripts();
85 echo $HTML->getStylesheets();
87 $report = new ReportPerGroupDocmanDownloads($group_id, $start, $end);
88 if ($report->isError()) {
89 echo $HTML->error_msg($report->getErrorMessage());
91 echo html_ao('div', array('id' => 'div_form_reporting'));
92 echo $HTML->openForm(array('action' => DOCMAN_BASEURL.$group_id.'&view=reporting', 'method' => 'post', 'class' => 'align-center'));
93 echo html_e('strong', array(), _('Start Date')._(':'), false);
94 echo report_months_box($report, 'start', $start);
95 echo html_e('strong', array(), _('End Date')._(':'), false);
96 echo report_months_box($report, 'end', $end);
97 echo html_e('input', array('type' => 'submit', 'value' => _('Refresh')));
98 echo $HTML->closeForm();
99 echo html_ac(html_ap() -1);
101 $data = $report->getData();
104 echo $HTML->information(_('There have been no viewed documents for this project yet.'));
106 echo html_ao('script', array('type' => 'text/javascript'));
107 echo '//<![CDATA['."\n";
108 echo 'var ticks = new Array();';
109 echo 'var values = new Array();';
110 $arr =& $report->getMonthStartArr();
112 $valuesArr = array();
113 for ($i=0; $i < count($arr); $i++) {
114 if ($arr[$i] >= $start && $arr[$i] <= $end) {
115 $arr2[$i] = date(_('Y-m'), $arr[$i]);
119 foreach ($arr2 as $key) {
120 echo 'ticks.push("'.$key.'");';
122 for ($i=0; $i < count($data); $i++) {
123 $this_date = substr($data[$i][2], 0, 4).'-'.substr($data[$i][2], 4, 2);
124 $index_key = array_search($this_date, $arr2);
125 $valuesArr[$index_key]++;
127 foreach ($valuesArr as $key) {
128 echo 'values.push('.$key.');';
131 echo 'jQuery(document).ready(function(){
132 plot1 = jQuery.jqplot (\'chart1\', [values], {
143 label: "'._('Month').'",
144 renderer: jQuery.jqplot.CategoryAxisRenderer,
149 label: "'._('Downloads').'",
163 echo 'jQuery(window).resize(function() {
164 plot1.replot( { resetAxes: true } );
167 echo html_ac(html_ap() -1);
168 echo $HTML->html_chartid('chart1');
169 $tabletop = array(_('Folder'), _('Document'), _('User'), _('Date'));
170 $classth = array('', '', '', '');
171 echo $HTML->listTableTop($tabletop, array(), 'sortable_docman_listfile', 'sortable', $classth);
172 for ($i = 0; $i < count($data); $i++) {
173 $ndg = documentgroup_get_object($data[$i][3], $group_id);
175 $cells[][] = $ndg->getPath(true);
176 $cells[][] = $data[$i][0];
177 if ( $data[$i][1] != 100) {
178 $userObject = user_get_object($data[$i][1]);
179 $cells[][] = util_display_user($userObject->getUnixName(), $data[$i][1], $userObject->getRealName());
181 $cells[][] = _('Anonymous user');
183 $cells[] = array(preg_replace('/^(....)(..)(..)$/', '\1-\2-\3', $data[$i][2]), 'class' => 'align-center');
184 echo $HTML->multiTableRow(array(), $cells);
186 echo $HTML->listTableBottom();