[ Index ]

PHP Cross Reference of MantisBT

title

Body

[close]

/ -> workflow_graph_img.php (source)

   1  <?php
   2  # MantisBT - A PHP based bugtracking system
   3  
   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.
   8  #
   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.
  13  #
  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/>.
  16  
  17  /**
  18   * @package MantisBT
  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
  23   *
  24   * @uses core.php
  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
  30   */
  31  
  32  /**
  33   * MantisBT Core API's
  34   */
  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' );
  41  
  42  auth_ensure_user_authenticated();
  43  
  44  if ( !config_get( 'relationship_graph_enable' ) ) {
  45      access_denied();
  46  }
  47  
  48  compress_enable();
  49  
  50  $t_status_arr  = MantisEnum::getAssocArrayIndexedByValues( config_get( 'status_enum_string' ) );
  51  
  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' );
  56  
  57  $t_graph_attributes = array();
  58  
  59  if( !empty( $t_graph_fontpath ) ) {
  60      $t_graph_attributes['fontpath'] = $t_graph_fontpath;
  61  }
  62  
  63  $t_graph = new Graph( 'workflow', $t_graph_attributes, $t_dot_tool );
  64  
  65  $t_graph->set_default_node_attr( array ( 'fontname' => $t_graph_fontname,
  66                                           'fontsize' => $t_graph_fontsize,
  67                                           'shape'    => 'record',
  68                                           'style'    => 'filled',
  69                                           'height'   => '0.2',
  70                                           'width'    => '0.4' ) );
  71  
  72  $t_graph->set_default_edge_attr( array ( 'style' => 'solid',
  73                                           'color' => '#0000C0',
  74                                           'dir'   => 'forward' ) );
  75  
  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 ) ),
  82                                  array() );
  83          }
  84      }
  85  }
  86  
  87  $t_graph->output( 'png', true );


Generated: Thu Jul 28 15:48:31 2011 Cross-referenced by PHPXref 0.7