[ Index ]

PHP Cross Reference of MantisBT

title

Body

[close]

/plugins/MantisGraph/pages/ -> bug_graph_page.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   * @copyright Copyright (C) 2000 - 2002  Kenzaburo Ito - kenito@300baud.org
  20   * @copyright Copyright (C) 2002 - 2011  MantisBT Team - mantisbt-dev@lists.sourceforge.net
  21   * @link http://www.mantisbt.org
  22   * @uses core.php
  23   * @uses Period.php
  24   * @uses access_api.php
  25   * @uses config_api.php
  26   * @uses gpc_api.php
  27   * @uses html_api.php
  28   * @uses plugin_api.php
  29   */
  30  
  31  /**
  32   * MantisBT Core API's
  33   */
  34  require_once ( 'core.php' );
  35  require_once( 'Period.php' );
  36  require_api( 'access_api.php' );
  37  require_api( 'config_api.php' );
  38  require_api( 'gpc_api.php' );
  39  require_api( 'html_api.php' );
  40  require_api( 'plugin_api.php' );
  41  
  42  require_js( 'jscalendar/calendar.js' );
  43  require_js( 'jscalendar/lang/calendar-en.js' );
  44  require_js( 'jscalendar/calendar-setup.js' );
  45  require_css( 'calendar-blue.css' );
  46  
  47  access_ensure_project_level( config_get( 'view_summary_threshold' ) );
  48  
  49  $f_interval = gpc_get_int( 'interval', 0 );
  50  $t_today = date( 'Y-m-d' );
  51  $f_type = gpc_get_int( 'graph_type', 0 );
  52  $f_show_as_table = gpc_get_bool( 'show_table', FALSE );
  53  
  54  html_page_top1( plugin_lang_get( 'graph_page' ) );
  55  $t_path = config_get( 'path' );
  56  html_page_top2();
  57  
  58  $t_period = new Period();
  59  $t_period->set_period_from_selector( 'interval' );
  60  $t_types = array( 0 => plugin_lang_get( 'select' ),
  61                    2 => plugin_lang_get( 'select_bystatus'),
  62                    3 => plugin_lang_get( 'select_summbystatus'),
  63                    4 => plugin_lang_get( 'select_bycat'),
  64                    6 => plugin_lang_get( 'select_both') );
  65  
  66  $t_show = array( 0 => plugin_lang_get( 'show_as_graph' ),
  67                   1 => plugin_lang_get( 'show_as_table' ) );
  68  ?>
  69          <form name="graph_form" method="post" action="<?php echo plugin_page( 'bug_graph_page.php' ); ?>">
  70              <table class="width100" cellspacing="1">
  71  
  72                  <tr>
  73                      <td>
  74                          <?php echo get_dropdown( $t_types, 'graph_type', $f_type ); ?>
  75                      </td>
  76                      <td>
  77                          <?php echo $t_period->period_selector( 'interval' ); ?>
  78                      </td>
  79                      <td>
  80                          <?php echo get_dropdown( $t_show, 'show_table', $f_show_as_table ? 1 : 0 ); ?>
  81                      </td>
  82                      <td>
  83                          <input type="submit" name="show" value="<?php echo plugin_lang_get( 'show_graph' ); ?>" />
  84                      </td>
  85                  </tr>
  86              </table>
  87          </form>
  88  <?php
  89  // build the graphs if both an interval and graph type are selected
  90  if ( ( 0 != $f_type ) && ( $f_interval > 0 ) && ( gpc_get( 'show', '' ) != '') ) {
  91      $t_width = plugin_config_get( 'window_width' );
  92      $t_summary = ( $f_type % 2 ) != 0;
  93      $t_body = (int)( $f_type / 2 );
  94      $f_start = $t_period->get_start_formatted();
  95      $f_end = $t_period->get_end_formatted();
  96      if ( ($t_body == 1 ) || ($t_body == 3) ) {
  97          if ( $f_show_as_table ) {
  98              echo '<br /><iframe src="' . plugin_page( 'bug_graph_bystatus.php' ) . '&amp;width='.$t_width.'&amp;interval=' . $f_interval .
  99                   '&amp;start_date=' . $f_start . '&amp;end_date=' . $f_end .
 100                   '&amp;summary=' . $t_summary . '&amp;show_table=1" width="100%" height="80%" frameborder="0"' .
 101                   ' marginwidth="0" marginheight="0"></iframe>';
 102          } else {
 103              echo '<br /><img src="' . plugin_page( 'bug_graph_bystatus.php' ) . '&amp;width=600&amp;interval=' . $f_interval .
 104                   '&amp;start_date=' . $f_start . '&amp;end_date=' . $f_end .
 105                   '&amp;summary=' . $t_summary . '&amp;show_table=0" alt="Bug Graph" />';
 106          }
 107      }
 108      if ( ($t_body == 2 ) || ($t_body == 3) ) {
 109          if ( $f_show_as_table ) {
 110              echo '<br /><iframe src="' . plugin_page( 'bug_graph_bycategory.php' ) . '&amp;width='.$t_width.'&amp;interval=' . $f_interval .
 111                   '&amp;start_date=' . $f_start . '&amp;end_date=' . $f_end .
 112                   '&amp;summary=' . $t_summary . '&amp;show_table=1" width="100%" height="80%" frameborder="0"' .
 113                   ' marginwidth="0" marginheight="0"></iframe>';
 114          } else {
 115              echo '<br /><img src="' . plugin_page( 'bug_graph_bycategory.php' ) . '&amp;width=600&amp;interval=' . $f_interval .
 116                   '&amp;start_date=' . $f_start . '&amp;end_date=' . $f_end .
 117                   '&amp;summary=' . $t_summary . '&amp;show_table=0" alt="Bug Graph" />';
 118          }
 119      }
 120  }
 121  
 122  html_page_bottom();


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