[ Index ]

PHP Cross Reference of MantisBT

title

Body

[close]

/ -> bug_monitor_list_view_inc.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   * This include file prints out the list of users monitoring the current
  19   * bug.    $f_bug_id must be set and be set to the bug id
  20   *
  21   * @package MantisBT
  22   * @copyright Copyright (C) 2000 - 2002  Kenzaburo Ito - kenito@300baud.org
  23   * @copyright Copyright (C) 2002 - 2010  MantisBT Team - mantisbt-dev@lists.sourceforge.net
  24   * @link http://www.mantisbt.org
  25   *
  26   * @uses access_api.php
  27   * @uses collapse_api.php
  28   * @uses config_api.php
  29   * @uses database_api.php
  30   * @uses form_api.php
  31   * @uses helper_api.php
  32   * @uses lang_api.php
  33   * @uses print_api.php
  34   * @uses user_api.php
  35   */
  36  
  37  if ( !defined( 'BUG_MONITOR_LIST_VIEW_INC_ALLOW' ) ) {
  38      return;
  39  }
  40  
  41  require_api( 'access_api.php' );
  42  require_api( 'collapse_api.php' );
  43  require_api( 'config_api.php' );
  44  require_api( 'database_api.php' );
  45  require_api( 'form_api.php' );
  46  require_api( 'helper_api.php' );
  47  require_api( 'lang_api.php' );
  48  require_api( 'print_api.php' );
  49  require_api( 'user_api.php' );
  50  
  51  if ( access_has_bug_level( config_get( 'show_monitor_list_threshold' ), $f_bug_id ) ) {
  52      $c_bug_id = db_prepare_int( $f_bug_id );
  53      $t_bug_monitor_table = db_get_table( 'bug_monitor' );
  54      $t_user_table = db_get_table( 'user' );
  55  
  56      # get the bugnote data
  57      $query = "SELECT user_id, enabled
  58              FROM $t_bug_monitor_table m, $t_user_table u
  59              WHERE m.bug_id=" . db_param() . " AND m.user_id = u.id
  60              ORDER BY u.realname, u.username";
  61      $result = db_query_bound($query, Array( $c_bug_id ) );
  62      $num_users = db_num_rows($result);
  63  
  64      $t_users = array();
  65      for ( $i = 0; $i < $num_users; $i++ ) {
  66          $row = db_fetch_array( $result );
  67          $t_users[$i] = $row['user_id'];
  68      }
  69      user_cache_array_rows( $t_users );
  70  
  71      echo '<a name="monitors" id="monitors" /><br />';
  72  
  73      collapse_open( 'monitoring' );
  74  ?>
  75  <table class="width100" cellspacing="1">
  76  <tr>
  77      <td class="form-title" colspan="2">
  78  <?php
  79      collapse_icon( 'monitoring' );
  80   ?>
  81          <?php echo lang_get( 'users_monitoring_bug' ); ?>
  82      </td>
  83  </tr>
  84  <tr class="row-1">
  85      <td class="category" width="15%">
  86          <?php echo lang_get( 'monitoring_user_list' ); ?>
  87      </td>
  88      <td>
  89  <?php
  90          if ( 0 == $num_users ) {
  91              echo lang_get( 'no_users_monitoring_bug' );
  92          } else {
  93              $t_can_delete_others = access_has_bug_level( config_get( 'monitor_delete_others_bug_threshold' ), $f_bug_id ); 
  94               for ( $i = 0; $i < $num_users; $i++ ) {
  95                  echo ($i > 0) ? ', ' : '';
  96                  echo print_user( $t_users[$i] );
  97                  if ( $t_can_delete_others ) {
  98                      echo ' [<a class="small" href="' . helper_mantis_url( 'bug_monitor_delete.php' ) . '?bug_id=' . $f_bug_id . '&user_id=' . $t_users[$i] . form_security_param( 'bug_monitor_delete' ) . '">' . lang_get( 'delete_link' ) . '</a>]';
  99                  }
 100               }
 101           }
 102  
 103          if ( access_has_bug_level( config_get( 'monitor_add_others_bug_threshold' ), $f_bug_id ) ) {
 104              echo '<br /><br />', lang_get( 'username' );
 105  ?>
 106          <form method="get" action="bug_monitor_add.php">
 107          <?php echo form_security_field( 'bug_monitor_add' ) ?>
 108              <input type="hidden" name="bug_id" value="<?php echo (integer)$f_bug_id; ?>" />
 109              <input type="text" name="username" />
 110              <input type="submit" class="button" value="<?php echo lang_get( 'add_user_to_monitor' ) ?>" />
 111          </form>
 112          <?php } ?>
 113      </td>
 114  </tr>
 115  </table>
 116  <?php
 117      collapse_closed( 'monitoring' );
 118  ?>
 119  <table class="width100" cellspacing="1">
 120  <tr>
 121      <td class="form-title" colspan="2"><?php collapse_icon( 'monitoring' ); ?>
 122          <?php echo lang_get( 'users_monitoring_bug' ); ?>
 123      </td>
 124  </tr>
 125  </table>
 126  <?php
 127      collapse_end( 'monitoring' );
 128  ?>
 129  
 130  <?php 
 131  } # show monitor list
 132  


Generated: Sat Mar 6 17:17:35 2010 Cross-referenced by PHPXref 0.7