3 * Copyright (C) 2015 Vitaliy Pylypiv <vitaliy.pylypiv@gmail.com>
4 * Copyright 2016, Stéphane-Eymeric Bredtthauer - TrivialDev
5 * Copyright 2017, Franck Villaume - TrivialDev
7 * This file is part of FusionForge.
9 * FusionForge is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published
11 * by the Free Software Foundation; either version 2 of the License,
12 * or (at your option) any later version.
14 * FusionForge is distributed in the hope that it will be useful, but
15 * WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 * General Public License for more details.
19 * You should have received a copy of the GNU General Public License along
20 * with this program; if not, write to the Free Software Foundation, Inc.,
21 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
24 global $group_id, $group, $taskboard;
26 $release_id = getIntFromRequest('release_id', NULL);
28 $release = new TaskBoardRelease($taskboard, $release_id);
30 html_use_jqueryjqplotpluginCanvas();
31 html_use_jqueryjqplotplugindateAxisRenderer();
32 html_use_jqueryjqplotpluginhighlighter();
36 'title' => $taskboard->getName()._(': '). _('Releases')._(': ')._('Burndown chart')._(': ').$release->getTitle() ,
37 'pagename' => _('Releases')._(': ')._('Burndown chart')._(': ').$release->getTitle(),
38 'sectionvals' => array($group->getPublicName()),
43 if ($taskboard->isError()) {
44 echo $HTML->error_msg($taskboard->getErrorMessage());
46 echo html_e('div', array('id' => 'messages', 'style' => 'display: none;'), '', false);
50 // $xaxisData is used to have an every date on the X axis
52 $chartDate = $release->getStartDate();
53 while($chartDate <= $release->getEndDate()) {
54 $xaxisData[] = array(date( 'r', $chartDate) , 0);
58 $release_volume = $release->getVolume();
60 if (!$release_volume) {
61 echo $HTML->error_msg($taskboard->getErrorMessage());
66 array( $release->getStartDate() * 1000, $release_volume['tasks']),
67 array( $release->getEndDate() * 1000, 0)
70 $release_snapshots = $release->getSnapshots();
71 $dataRemainingTasks = array();
72 $dataRemainingEfforts = array();
74 foreach ($release_snapshots as $snapshot) {
75 if (empty($dataRemainingTasks) && $snapshot['snapshot_date'] != $release->getStartDate()) {
76 // initialize start point if snapshot is missing for the first day
77 $dataRemainingTasks[] = array($release->getStartDate() * 1000, $release_volume['tasks']);
78 $dataRemainingEfforts[] = array($release->getStartDate() * 1000, $release_volume['man_days']);
81 $dataRemainingTasks[] = array($snapshot['snapshot_date'] * 1000, ($release_volume['tasks'] - $snapshot['completed_tasks']));
82 $dataRemainingEfforts[] = array($snapshot['snapshot_date'] * 1000, ($release_volume['man_days'] - $snapshot['completed_man_days']));
86 <div id="taskboard-burndown-chart-nav">
87 <button id="taskboard-view-btn"><?php echo _('Task Board'); ?></button>
92 <figcaption><?php echo _("Burndown chart")._(': ').$release->getTitle() ?></figcaption>
93 <div id="taskboard-burndown-chart">
99 var xaxisData = <?php echo json_encode($xaxisData); ?>;
100 var dataRemainingTasks = <?php echo json_encode($dataRemainingTasks); ?>;
101 var dataRemainingEfforts = <?php echo json_encode($dataRemainingEfforts); ?>;
102 var dataRemainingIdeal = <?php echo json_encode($dataIdeal); ?>;
104 jQuery( document ).ready(function( $ ) {
105 jQuery('#taskboard-view-btn').click( function ( e ) {
106 window.location = '<?php echo util_make_url('/plugins/'.$pluginTaskboard->name.'/?group_id='.$group_id.'&taskboard_id='.$taskboard->getID().'&_release='.$release_id ); ?>';
110 burndownChart = jQuery.jqplot(
111 'taskboard-burndown-chart',
112 [ xaxisData, dataRemainingIdeal, dataRemainingTasks, dataRemainingEfforts ],
117 seriesColors: [ '#000', '#DDDDDD', '#00FA9A', '#B22222' ],
126 renderer : jQuery.jqplot.DateAxisRenderer,
127 tickRenderer: jQuery.jqplot.CanvasAxisTickRenderer,
131 formatString : '%Y-%m-%d'
133 numberTicks: <?php echo count($xaxisData) - 2; ?>,
134 min: <?php echo $release->getStartDate() * 1000; ?>,
135 max: <?php echo $release->getEndDate() * 1000; ?>
140 label: "<?php echo _('Completed tasks') ?>" ,
141 labelRenderer: jQuery.jqplot.CanvasAxisLabelRenderer,
151 formatString: "%.1f <?php echo _('m/d') ?>"
156 { show : false }, // to indicate all dates
157 { label : "<?php echo _('Ideal burndown') ;?>", lineWidth:1, markerOptions : { style : 'circle', size : 5 } },
158 { label : "<?php echo _('Remaining tasks') ;?>", lineWidth:1, markerOptions : { style : 'circle', size : 5 }, yaxis: 'yaxis' },
159 { label : "<?php echo _('Remaining efforts') ;?>", lineWidth:1, markerOptions : { style : 'circle', size : 5 } , yaxis:'y2axis' }