2 # MantisBT - A PHP based bugtracking system
4 # MantisBT is free software: you can redistribute it and/or modify
5 # it under the terms of the GNU General Public License as published by
6 # the Free Software Foundation, either version 2 of the License, or
7 # (at your option) any later version.
9 # MantisBT is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 # GNU General Public License for more details.
14 # You should have received a copy of the GNU General Public License
15 # along with MantisBT. If not, see <http://www.gnu.org/licenses/>.
19 * @author Author Bernard de Rubinat - bernard@derubinat.net
20 * @copyright Copyright (C) 2000 - 2002 Kenzaburo Ito - kenito@300baud.org
21 * @copyright Copyright (C) 2002 - 2011 MantisBT Team - mantisbt-dev@lists.sourceforge.net
22 * @link http://www.mantisbt.org
25 * @uses authentication_api.php
26 * @uses compress_api.php
27 * @uses config_api.php
28 * @uses relationship_graph_api.php
29 * @uses workflow_api.php
35 require_once( 'core.php' );
36 require_api( 'authentication_api.php' );
37 require_api( 'compress_api.php' );
38 require_api( 'config_api.php' );
39 require_api( 'graphviz_api.php' );
40 require_api( 'workflow_api.php' );
42 auth_ensure_user_authenticated();
44 if ( !config_get( 'relationship_graph_enable' ) ) {
50 $t_status_arr = MantisEnum
::getAssocArrayIndexedByValues( config_get( 'status_enum_string' ) );
52 $t_graph_fontname = config_get( 'relationship_graph_fontname' );
53 $t_graph_fontsize = config_get( 'relationship_graph_fontsize' );
54 $t_graph_fontpath = get_font_path();
55 $t_dot_tool = config_get( 'dot_tool' );
57 $t_graph_attributes = array();
59 if( !empty( $t_graph_fontpath ) ) {
60 $t_graph_attributes['fontpath'] = $t_graph_fontpath;
63 $t_graph = new Graph( 'workflow', $t_graph_attributes, $t_dot_tool );
65 $t_graph->set_default_node_attr( array ( 'fontname' => $t_graph_fontname,
66 'fontsize' => $t_graph_fontsize,
72 $t_graph->set_default_edge_attr( array ( 'style' => 'solid',
74 'dir' => 'forward' ) );
76 foreach ( $t_status_arr as $t_from_status => $t_from_label) {
77 $t_enum_status = MantisEnum
::getAssocArrayIndexedByValues( config_get( 'status_enum_string' ) );
78 foreach ( $t_enum_status as $t_to_status_id => $t_to_status_label ) {
79 if ( workflow_transition_edge_exists( $t_from_status, $t_to_status_id ) ) {
80 $t_graph->add_edge( string_no_break( MantisEnum
::getLabel( lang_get( 'status_enum_string' ), $t_from_status ) ),
81 string_no_break( MantisEnum
::getLabel( lang_get( 'status_enum_string' ), $t_to_status_id ) ),
87 $t_graph->output( 'png', true );