[ Index ]

PHP Cross Reference of MantisBT

title

Body

[close]

/ -> print_all_bug_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   * Bugs to display / print / export can be selected with the checkboxes
  19   * A printing Options link allows to choose the fields to export
  20   * Export :
  21   *  - the bugs displayed in print_all_bug_page.php are saved in a .doc or .xls file
  22   *  - the IE icons allows to see or directly print the same result
  23   *
  24   * @package MantisBT
  25   * @copyright Copyright (C) 2000 - 2002  Kenzaburo Ito - kenito@300baud.org
  26   * @copyright Copyright (C) 2002 - 2011  MantisBT Team - mantisbt-dev@lists.sourceforge.net
  27   * @link http://www.mantisbt.org
  28   *
  29   * @uses core.php
  30   * @uses authentication_api.php
  31   * @uses config_api.php
  32   * @uses constant_inc.php
  33   * @uses filter_api.php
  34   * @uses filter_constants_inc.php
  35   * @uses gpc_api.php
  36   * @uses helper_api.php
  37   * @uses html_api.php
  38   * @uses lang_api.php
  39   * @uses print_api.php
  40   * @uses project_api.php
  41   * @uses string_api.php
  42   * @uses utility_api.php
  43   */
  44  
  45  /**
  46   * MantisBT Core API's
  47   */
  48  require_once ( 'core.php' );
  49  require_api( 'authentication_api.php' );
  50  require_api( 'config_api.php' );
  51  require_api( 'constant_inc.php' );
  52  require_api( 'filter_api.php' );
  53  require_api( 'filter_constants_inc.php' );
  54  require_api( 'gpc_api.php' );
  55  require_api( 'helper_api.php' );
  56  require_api( 'html_api.php' );
  57  require_api( 'lang_api.php' );
  58  require_api( 'print_api.php' );
  59  require_api( 'project_api.php' );
  60  require_api( 'string_api.php' );
  61  require_api( 'utility_api.php' );
  62  
  63  auth_ensure_user_authenticated();
  64  
  65  $f_search        = gpc_get_string( FILTER_PROPERTY_SEARCH, false ); /** @todo need a better default */
  66  $f_offset        = gpc_get_int( 'offset', 0 );
  67  
  68  $t_cookie_value_id = gpc_get_cookie( config_get( 'view_all_cookie' ), '' );
  69  $t_cookie_value = filter_db_get_filter( $t_cookie_value_id );
  70  
  71  $f_highlight_changed     = 0;
  72  $f_sort                 = null;
  73  $f_dir                     = null;
  74  $t_project_id             = 0;
  75  
  76  $t_columns = helper_get_columns_to_view( COLUMNS_TARGET_PRINT_PAGE );
  77  $t_num_of_columns = count( $t_columns );
  78  
  79  # check to see if the cookie exists
  80  if ( !is_blank( $t_cookie_value ) ) {
  81  
  82      # check to see if new cookie is needed
  83      if ( !filter_is_cookie_valid() ) {
  84          print_header_redirect( 'view_all_set.php?type=0&print=1' );
  85      }
  86  
  87      $t_setting_arr = explode( '#', $t_cookie_value, 2 );
  88      $t_filter_cookie_arr = unserialize( $t_setting_arr[1] );
  89  
  90      $f_highlight_changed     = $t_filter_cookie_arr[ FILTER_PROPERTY_HIGHLIGHT_CHANGED ];
  91      $f_sort                 = $t_filter_cookie_arr[ FILTER_PROPERTY_SORT_FIELD_NAME ];
  92      $f_dir                     = $t_filter_cookie_arr[ FILTER_PROPERTY_SORT_DIRECTION ];
  93      $t_project_id             = helper_get_current_project();
  94  }
  95  
  96  # This replaces the actual search that used to be here
  97  $f_page_number = gpc_get_int( 'page_number', 1 );
  98  $t_per_page = -1;
  99  $t_bug_count = null;
 100  $t_page_count = null;
 101  
 102  $result = filter_get_bug_rows( $f_page_number, $t_per_page, $t_page_count, $t_bug_count );
 103  $row_count = count( $result );
 104  
 105  # for export
 106  $t_show_flag = gpc_get_int( 'show_flag', 0 );
 107  
 108  html_page_top1();
 109  html_head_end();
 110  html_body_begin();
 111  ?>
 112  
 113  <table class="width100"><tr><td class="form-title">
 114      <div class="center">
 115          <?php echo string_display( config_get( 'window_title' ) ) . ' - ' . string_display( project_get_name( $t_project_id ) ); ?>
 116      </div>
 117  </td></tr></table>
 118  
 119  <br />
 120  
 121  <form method="post" action="view_all_set.php">
 122  <?php # CSRF protection not required here - form does not result in modifications ?>
 123  <input type="hidden" name="type" value="1" />
 124  <input type="hidden" name="print" value="1" />
 125  <input type="hidden" name="offset" value="0" />
 126  <input type="hidden" name="<?php echo FILTER_PROPERTY_SORT_FIELD_NAME; ?>" value="<?php echo $f_sort ?>" />
 127  <input type="hidden" name="<?php echo FILTER_PROPERTY_SORT_DIRECTION; ?>" value="<?php echo $f_dir ?>" />
 128  
 129  <table class="width100" cellpadding="2px">
 130  <?php
 131  #<SQLI> Excel & Print export
 132  #$f_bug_array stores the number of the selected rows
 133  #$t_bug_arr_sort is used for displaying
 134  #$f_export is a string for the word and excel pages
 135  
 136  $f_bug_arr = gpc_get_int_array( 'bug_arr', array() );
 137  $f_bug_arr[$row_count]=-1;
 138  
 139  for( $i=0; $i < $row_count; $i++ ) {
 140      if ( isset( $f_bug_arr[$i] ) ) {
 141          $index = $f_bug_arr[$i];
 142          $t_bug_arr_sort[$index]=1;
 143      }
 144  }
 145  $f_export = implode( ',', $f_bug_arr );
 146  
 147  $t_icon_path = config_get( 'icon_path' );
 148  ?>
 149  
 150  <tr>
 151      <td colspan="<?php echo $t_num_of_columns ?>">
 152  <?php
 153      if ( 'DESC' == $f_dir ) {
 154          $t_new_dir = 'ASC';
 155      } else {
 156          $t_new_dir = 'DESC';
 157      }
 158  
 159      $t_search = urlencode( $f_search );
 160  
 161      $t_icons = array(
 162          array( 'print_all_bug_page_word', 'word', '', 'fileicons/doc.gif', 'Word 2000' ),
 163          array( 'print_all_bug_page_word', 'html', 'target="_blank"', 'ie.gif', 'Word View' ) );
 164  
 165      foreach ( $t_icons as $t_icon ) {
 166          echo '<a href="' . $t_icon[0] . '.php' .
 167              '?' . FILTER_PROPERTY_SEARCH. "=$t_search" .
 168              '&amp;' . FILTER_PROPERTY_SORT_FIELD_NAME . "=$f_sort" .
 169              '&amp;' . FILTER_PROPERTY_SORT_DIRECTION . "=$t_new_dir" .
 170              '&amp;type_page=' . $t_icon[1] .
 171              "&amp;export=$f_export" .
 172              "&amp;show_flag=$t_show_flag" .
 173              '" ' . $t_icon[2] . '>' .
 174              '<img src="' . $t_icon_path . $t_icon[3] . '" alt="' . $t_icon[4] . '" /></a> ';
 175      }
 176  ?>
 177      </td>
 178  </tr>
 179  <?php #<SQLI> ?>
 180  </table>
 181  
 182  </form>
 183  
 184  <br />
 185  
 186  <form method="post" action="print_all_bug_page.php">
 187  <?php # CSRF protection not required here - form does not result in modifications ?>
 188  <table class="width100" cellspacing="1" cellpadding="2px">
 189  <tr>
 190      <td class="form-title" colspan="<?php echo $t_num_of_columns / 2 + $t_num_of_columns % 2; ?>">
 191          <?php
 192              echo lang_get( 'viewing_bugs_title' );
 193  
 194              if ( $row_count > 0 ) {
 195                  $v_start = $f_offset+1;
 196                  $v_end   = $f_offset+$row_count;
 197              } else {
 198                  $v_start = 0;
 199                  $v_end   = 0;
 200              }
 201              echo "( $v_start - $v_end )";
 202          ?>
 203      </td>
 204      <td class="right" colspan="<?php echo $t_num_of_columns / 2 ?>">
 205          <?php
 206              # print_bracket_link( 'print_all_bug_options_page.php', lang_get( 'printing_options_link' ) );
 207              # print_bracket_link( 'view_all_bug_page.php', lang_get( 'view_bugs_link' ) );
 208              # print_bracket_link( 'summary_page.php', lang_get( 'summary' ) );
 209          ?>
 210      </td>
 211  </tr>
 212  <tr class="row-category">
 213      <?php
 214          $t_sort = $f_sort;    // used within the custom function called in the loop (@todo cleanup)
 215          $t_dir = $f_dir;    // used within the custom function called in the loop (@todo cleanup)
 216  
 217          foreach( $t_columns as $t_column ) {
 218              $t_title_function = 'print_column_title';
 219              helper_call_custom_function( $t_title_function, array( $t_column, COLUMNS_TARGET_PRINT_PAGE ) );
 220          }
 221      ?>
 222  </tr>
 223  <tr class="spacer">
 224      <td colspan="9"></td>
 225  </tr>
 226  <?php
 227      for( $i=0; $i < $row_count; $i++ ) {
 228          $t_row = $result[$i];
 229  
 230          # alternate row colors
 231          $status_color = helper_alternate_colors( $i, '#ffffff', '#dddddd' );
 232          if ( isset( $t_bug_arr_sort[ $t_row->id ] ) || ( $t_show_flag==0 ) ) {
 233  ?>
 234  <tr bgcolor="<?php echo $status_color ?>">
 235  <?php
 236          foreach( $t_columns as $t_column ) {
 237              $t_column_value_function = 'print_column_value';
 238              helper_call_custom_function( $t_column_value_function, array( $t_column, $t_row, COLUMNS_TARGET_PRINT_PAGE ) );
 239          }
 240  ?>
 241  </tr>
 242  <?php
 243      } # isset_loop
 244  } # for_loop
 245  ?>
 246  <input type="hidden" name="show_flag" value="1" />
 247  </table>
 248  
 249  <br />
 250  
 251  <input type="submit" class="button" value="<?php echo lang_get( 'hide_button' ) ?>" />
 252  </form>
 253  
 254  <?php
 255  html_body_end();
 256  html_end();


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