[ Index ]
 

Code source de Mantis 1.1.0rc3

Accédez au Source d'autres logiciels libres

Classes | Fonctions | Variables | Constantes | Tables

title

Body

[fermer]

/graphs/ -> graph_by_release_delta.php (source)

   1  <?php
   2  # Mantis - a php based bugtracking system
   3  
   4  # Copyright (C) 2000 - 2002  Kenzaburo Ito - kenito@300baud.org
   5  # Copyright (C) 2002 - 2007  Mantis Team   - mantisbt-dev@lists.sourceforge.net
   6  
   7  # Mantis is free software: you can redistribute it and/or modify
   8  # it under the terms of the GNU General Public License as published by
   9  # the Free Software Foundation, either version 2 of the License, or
  10  # (at your option) any later version.
  11  #
  12  # Mantis 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.
  16  #
  17  # You should have received a copy of the GNU General Public License
  18  # along with Mantis.  If not, see <http://www.gnu.org/licenses/>.
  19  
  20      # --------------------------------------------------------
  21      # $Id: graph_by_release_delta.php,v 1.9.22.1 2007-10-13 22:35:53 giallu Exp $
  22      # --------------------------------------------------------
  23  ?>
  24  <?php
  25      require_once ( '../core.php' );
  26  
  27      $t_core_path = config_get( 'core_path' );
  28  
  29      require_once( $t_core_path.'graph_api.php' );
  30  ?>
  31  <?php
  32      $data_category_arr = array();
  33      $data_count_arr = array();
  34  
  35      $t_project_id = helper_get_current_project();
  36  
  37      # Grab the Projections/Releases
  38      $query = "SELECT DISTINCT projection
  39              FROM mantis_bug_table
  40              WHERE project_id='$t_project_id'
  41              ORDER BY projection";
  42      $result = db_query( $query );
  43      $projection_count = db_num_rows( $result );
  44      $projection_arr = array();
  45      for ($i=0;$i<$projection_count;$i++) {
  46          $row = db_fetch_array( $result );
  47          extract( $row );
  48  
  49          $projection_arr[] = $projection;
  50      }
  51  
  52      $open_count_arr = array();
  53      $resolved_count_arr = array();
  54      $closed_count_arr = array();
  55      foreach ( $projection_arr as $t_projection ) {
  56          # OPEN
  57          $query = "SELECT COUNT(*) as count
  58                  FROM mantis_bug_table
  59                  WHERE project_id='$t_project_id' AND
  60                      projection='$t_projection' AND
  61                      status<80";
  62          $result = db_query ( $query );
  63          $open_count_arr[] = db_result( $result, 0, 0 );
  64  
  65          # RESOLVED
  66          $query = "SELECT COUNT(*) as count
  67                  FROM mantis_bug_table
  68                  WHERE project_id='$t_project_id' AND
  69                      projection='$t_projection' AND
  70                      status=80";
  71          $result = db_query ( $query );
  72          $resolved_count_arr[] = db_result( $result, 0, 0 );
  73  
  74          # CLOSED
  75          $query = "SELECT COUNT(*) as count
  76                  FROM mantis_bug_table
  77                  WHERE project_id='$t_project_id' AND
  78                      projection='$t_projection' AND
  79                      status=90";
  80          $result = db_query ( $query );
  81          $closed_count_arr[] = db_result( $result, 0, 0 );
  82      }
  83  
  84      $proj_name = get_project_field( $t_project_id, 'name' );
  85  
  86      $graph = new Graph(800,600,'auto');
  87      $graph->SetScale("textlin");
  88      $graph->SetShadow();
  89      $graph->img->SetMargin(40,30,40,80);
  90  
  91      $graph->xaxis->SetFont(FF_ARIAL,FS_NORMAL,10);
  92      $graph->xaxis->SetTickLabels($projection_arr);
  93      $graph->xaxis->SetLabelAngle(45);
  94  
  95      #$graph->xaxis->title->Set("Release Increments");
  96      #$graph->xaxis->title->SetFont(FF_FONT1,FS_BOLD);
  97  
  98      $graph->title->Set("$proj_name Release Delta Chart");
  99      $graph->title->SetFont(FF_FONT1,FS_BOLD);
 100  
 101      # Create graph
 102      $bplot1 = new BarPlot($open_count_arr);
 103      $bplot2 = new BarPlot($resolved_count_arr);
 104      $bplot3 = new BarPlot($closed_count_arr);
 105  
 106      $bplot1->SetFillColor("slateblue");
 107      $bplot2->SetFillColor("maroon");
 108      $bplot3->SetFillColor("lightgoldenrodyellow");
 109  
 110      $bplot1->SetShadow();
 111      $bplot2->SetShadow();
 112      $bplot3->SetShadow();
 113  
 114      $bplot1->SetLegend('Open');
 115      $bplot2->SetLegend('Resolved');
 116      $bplot3->SetLegend('Closed');
 117  
 118      $bplot1->value->Show();
 119      $bplot2->value->Show();
 120      $bplot3->value->Show();
 121  
 122      $bplot1->value->SetFont(FF_FONT1,FS_NORMAL,8);
 123      $bplot2->value->SetFont(FF_FONT1,FS_NORMAL,8);
 124      $bplot3->value->SetFont(FF_FONT1,FS_NORMAL,8);
 125  
 126      $bplot1->value->SetColor("black","darkred");
 127      $bplot2->value->SetColor("black","darkred");
 128      $bplot3->value->SetColor("black","darkred");
 129  
 130      $bplot1->value->SetFormat('%d');
 131      $bplot2->value->SetFormat('%d');
 132      $bplot3->value->SetFormat('%d');
 133  
 134      $gbarplot = new GroupBarPlot(array($bplot1,$bplot2,$bplot3));
 135  
 136      $gbarplot->SetWidth(0.6);
 137      $graph->Add($gbarplot);
 138  
 139      $graph->Stroke();
 140  ?>


Généré le : Thu Nov 29 09:42:17 2007 par Balluche grâce à PHPXref 0.7
  Clicky Web Analytics