[ Index ]
 

Code source de Mantis 1.1.0rc3

Accédez au Source d'autres logiciels libres

Classes | Fonctions | Variables | Constantes | Tables

title

Body

[fermer]

/ -> print_all_bug_options_inc.php (source)

   1  <?php
   2  # Mantis - a php based bugtracking system
   3  
   4  # Copyright (C) 2000 - 2002  Kenzaburo Ito - kenito@300baud.org
   5  # Copyright (C) 2002 - 2007  Mantis Team   - mantisbt-dev@lists.sourceforge.net
   6  
   7  # Mantis is free software: you can redistribute it and/or modify
   8  # it under the terms of the GNU General Public License as published by
   9  # the Free Software Foundation, either version 2 of the License, or
  10  # (at your option) any later version.
  11  #
  12  # Mantis is distributed in the hope that it will be useful,
  13  # but WITHOUT ANY WARRANTY; without even the implied warranty of
  14  # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  15  # GNU General Public License for more details.
  16  #
  17  # You should have received a copy of the GNU General Public License
  18  # along with Mantis.  If not, see <http://www.gnu.org/licenses/>.
  19  
  20      # --------------------------------------------------------
  21      # $Id: print_all_bug_options_inc.php,v 1.25.2.1 2007-10-13 22:34:11 giallu Exp $
  22      # --------------------------------------------------------
  23  ?>
  24  <?php
  25      $t_core_path = config_get( 'core_path' );
  26  
  27      require_once( $t_core_path.'current_user_api.php' );
  28  ?>
  29  <?php
  30  # this function only gets the field names, by appending strings
  31  function get_field_names()
  32  {
  33      #currently 27 fields
  34      return $t_arr = array (
  35                                 'id',
  36                                 'category',
  37                                 'severity',
  38                                 'reproducibility',
  39                                 'date_submitted',
  40                                 'last_update',
  41                                 'reporter',
  42                                 'assigned_to',
  43                                'priority',
  44                                 'status',
  45                                 'build',
  46                                 'projection',
  47                                 'eta',
  48                                 'platform',
  49                                 'os',
  50                                 'os_version',
  51                                 'product_version',
  52                                 'resolution',
  53                                 'duplicate_id',
  54                                 'summary',
  55                                 'description',
  56                                 'steps_to_reproduce',
  57                                 'additional_information',
  58                                 'attached_files',
  59                                 'bugnote_title',
  60                                 'bugnote_date',
  61                                 'bugnote_description',
  62                  'time_tracking' );
  63  }
  64  
  65  
  66  function edit_printing_prefs( $p_user_id = null, $p_error_if_protected = true, $p_redirect_url = '' )
  67  {
  68      if ( null === $p_user_id ) {
  69          $p_user_id = auth_get_current_user_id();
  70      }
  71  
  72      $c_user_id = db_prepare_int( $p_user_id );
  73  
  74      # protected account check
  75      if ( $p_error_if_protected ) {
  76          user_ensure_unprotected( $p_user_id );
  77      }
  78  
  79      $t_user_print_pref_table = config_get( 'mantis_user_print_pref_table' );
  80  
  81      if ( is_blank( $p_redirect_url ) ) {
  82          $p_redirect_url = 'print_all_bug_page.php';
  83      }
  84  
  85      # get the fields list
  86      $t_field_name_arr = get_field_names();
  87      $field_name_count = count( $t_field_name_arr );
  88  
  89      # Grab the data
  90      $query = "SELECT print_pref
  91              FROM $t_user_print_pref_table
  92              WHERE user_id='$c_user_id'";
  93      $result = db_query( $query );
  94  
  95      ## OOPS, No entry in the database yet.  Lets make one
  96      if ( 0 == db_num_rows( $result ) ) {
  97  
  98          # create a default array, same size than $t_field_name
  99          for ($i=0 ; $i<$field_name_count ; $i++) {
 100              $t_default_arr[$i] = 1 ;
 101          }
 102          $t_default = implode( '', $t_default_arr ) ;
 103  
 104          # all fields are added by default
 105          $query = "INSERT
 106                  INTO $t_user_print_pref_table
 107                  (user_id, print_pref)
 108                  VALUES
 109                  ('$c_user_id','$t_default')";
 110  
 111          $result = db_query( $query );
 112  
 113          # Rerun select query
 114          $query = "SELECT print_pref
 115                  FROM $t_user_print_pref_table
 116                  WHERE user_id='$c_user_id'";
 117          $result = db_query( $query );
 118      }
 119  
 120      # putting the query result into an array with the same size as $t_fields_arr
 121      $row = db_fetch_array( $result );
 122      $t_prefs = $row['print_pref'];
 123  
 124  ?>
 125  
 126  <?php # Account Preferences Form BEGIN ?>
 127  <?php $t_index_count=0; ?>
 128  <br />
 129  <div align="center">
 130  <form method="post" action="print_all_bug_options_update.php">
 131  <input type="hidden" name="user_id" value="<?php echo $p_user_id ?>" />
 132  <input type="hidden" name="redirect_url" value="<?php echo string_attribute( $p_redirect_url ) ?>" />
 133  <table class="width75" cellspacing="1">
 134  <tr>
 135      <td class="form-title">
 136          <?php echo lang_get( 'printing_preferences_title' ) ?>
 137      </td>
 138      <td class="right">
 139      </td>
 140  </tr>
 141  
 142  
 143  <?php # display the checkboxes
 144  for ($i=0 ; $i <$field_name_count ; $i++) {
 145  
 146      printf ( '<tr %s>', helper_alternate_class( $i ) );
 147  ?>
 148  
 149      <td class="category">
 150          <?php echo lang_get( $t_field_name_arr[$i] ) ?>
 151      </td>
 152      <td>
 153          <input type="checkbox" name="<?php echo 'print_' . $t_field_name_arr[$i]; ?>"
 154          <?php if ( isset( $t_prefs[$i] ) && ( $t_prefs[$i]==1 ) ) echo 'checked="checked"' ?> />
 155      </td>
 156  </tr>
 157  
 158  <?php
 159  }
 160  ?>
 161  <tr>
 162      <td>&nbsp;</td>
 163      <td>
 164          <input type="submit" class="button" value="<?php echo lang_get( 'update_prefs_button' ) ?>" />
 165      </td>
 166  </tr>
 167  </table>
 168  </form>
 169  </div>
 170  
 171  <br />
 172  
 173  <div class="border-center">
 174      <form method="post" action="print_all_bug_options_reset.php">
 175      <input type="submit" class="button" value="<?php echo lang_get( 'reset_prefs_button' ) ?>" />
 176      </form>
 177  </div>
 178  
 179  <?php } # end of edit_printing_prefs() ?>


Généré le : Thu Nov 29 09:42:17 2007 par Balluche grâce à PHPXref 0.7
  Clicky Web Analytics