[ Index ] |
PHP Cross Reference of Eventum |
[Summary view] [Print] [Text view]
1 <?php 2 /* vim: set expandtab tabstop=4 shiftwidth=4 encoding=utf-8: */ 3 // +----------------------------------------------------------------------+ 4 // | Eventum - Issue Tracking System | 5 // +----------------------------------------------------------------------+ 6 // | Copyright (c) 2003, 2004, 2005, 2006, 2007 MySQL AB | 7 // | | 8 // | This program is free software; you can redistribute it and/or modify | 9 // | it under the terms of the GNU General Public License as published by | 10 // | the Free Software Foundation; either version 2 of the License, or | 11 // | (at your option) any later version. | 12 // | | 13 // | This program is distributed in the hope that it will be useful, | 14 // | but WITHOUT ANY WARRANTY; without even the implied warranty of | 15 // | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 16 // | GNU General Public License for more details. | 17 // | | 18 // | You should have received a copy of the GNU General Public License | 19 // | along with this program; if not, write to: | 20 // | | 21 // | Free Software Foundation, Inc. | 22 // | 59 Temple Place - Suite 330 | 23 // | Boston, MA 02111-1307, USA. | 24 // +----------------------------------------------------------------------+ 25 // | Authors: João Prado Maia <jpm@mysql.com> | 26 // +----------------------------------------------------------------------+ 27 // 28 // @(#) $Id: stats_chart.php 3380 2007-09-26 04:30:54Z balsdorf $ 29 30 require_once(dirname(__FILE__) . "/init.php"); 31 require_once (APP_INC_PATH . "db_access.php"); 32 require_once (APP_INC_PATH . "class.auth.php"); 33 require_once (APP_INC_PATH . "class.stats.php"); 34 35 ini_set('memory_limit', '64M'); 36 error_reporting(0); 37 38 @require_once(APP_JPGRAPH_PATH . "jpgraph.php"); 39 @require_once(APP_JPGRAPH_PATH . "jpgraph_pie.php"); 40 41 Auth::checkAuthentication(APP_COOKIE); 42 43 // check to see if the TTF file is available or not 44 $ttf_font = TTF_DIR . "verdana.ttf"; 45 if (!@file_exists($ttf_font)) { 46 $font = FF_FONT1; 47 } else { 48 $font = FF_VERDANA; 49 } 50 51 if (isset($_REQUEST['hide_closed'])) { 52 $hide_closed = $_REQUEST['hide_closed']; 53 } else { 54 $hide_closed = false; 55 } 56 57 // Some data 58 $colors = array(); 59 if ($_GET["plot"] == "status") { 60 $rgb = new RGB(); 61 $data = Stats::getAssocStatus($hide_closed); 62 $graph_title = ev_gettext("Issues by Status"); 63 foreach ($data as $sta_title => $trash) { 64 $sta_id = Status::getStatusID($sta_title); 65 $status_details = Status::getDetails($sta_id); 66 if (!isset($rgb->rgb_table[$status_details['sta_color']])) { 67 $colors = array(); 68 break; 69 } 70 $colors[] = $status_details['sta_color']; 71 } 72 } elseif ($_GET["plot"] == "release") { 73 $data = Stats::getAssocRelease($hide_closed); 74 $graph_title = ev_gettext("Issues by Release"); 75 } elseif ($_GET["plot"] == "priority") { 76 $data = Stats::getAssocPriority($hide_closed); 77 $graph_title = ev_gettext("Issues by Priority"); 78 } elseif ($_GET["plot"] == "user") { 79 $data = Stats::getAssocUser($hide_closed); 80 $graph_title = ev_gettext("Issues by Assignment"); 81 } elseif ($_GET["plot"] == "category") { 82 $data = Stats::getAssocCategory($hide_closed); 83 $graph_title = ev_gettext("Issues by Category"); 84 } 85 $labels = array(); 86 foreach ($data as $label => $count) { 87 $labels[] = $label . ' (' . $count . ')'; 88 } 89 $data = array_values($data); 90 91 // check the values coming from the database and if they are all empty, then 92 // output a pre-generated 'No Data Available' picture 93 if ((!Stats::hasData($data)) || ((Auth::getCurrentRole() <= User::getRoleID("Reporter")) && (Project::getSegregateReporters(Auth::getCurrentProject())))) { 94 readfile(APP_PATH . "images/no_data.gif"); 95 exit; 96 } 97 98 // A new graph 99 $graph = new PieGraph(360,200,"auto"); 100 101 // Setup title 102 $graph->title->Set($graph_title); 103 $graph->title->SetFont($font, FS_BOLD, 12); 104 105 // The pie plot 106 $p1 = new PiePlot($data); 107 if (count($colors) > 0) { 108 $p1->SetSliceColors($colors); 109 } else { 110 $p1->SetTheme('pastel'); 111 } 112 113 // Move center of pie to the left to make better room 114 // for the legend 115 $p1->SetCenter(0.26,0.55); 116 117 // Label font and color setup 118 $p1->SetFont($font, FS_BOLD); 119 $p1->SetFontColor("black"); 120 121 // Use absolute values (type==1) 122 $p1->SetLabelType(1); 123 124 // Label format 125 $p1->SetLabelFormat("%d"); 126 127 // Size of pie in fraction of the width of the graph 128 $p1->SetSize(0.3); 129 130 // Legends 131 $p1->SetLegends($labels); 132 $graph->legend->SetFont($font); 133 $graph->legend->Pos(0.06,0.27); 134 135 $graph->Add($p1); 136 $graph->Stroke();
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Wed Dec 19 21:21:33 2007 | Cross-referenced by PHPXref 0.7 |