[ Index ]

PHP Cross Reference of MantisBT

title

Body

[close]

/ -> bug_sponsorship_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 sponsoring the current
  19   * bug.    $f_bug_id must 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 - 2011  MantisBT Team - mantisbt-dev@lists.sourceforge.net
  24   * @link http://www.mantisbt.org
  25   *
  26   * @uses access_api.php
  27   * @uses bug_api.php
  28   * @uses collapse_api.php
  29   * @uses config_api.php
  30   * @uses constant_inc.php
  31   * @uses current_user_api.php
  32   * @uses form_api.php
  33   * @uses helper_api.php
  34   * @uses lang_api.php
  35   * @uses print_api.php
  36   * @uses sponsorship_api.php
  37   * @uses utility_api.php
  38   */
  39  
  40  if ( !defined( 'BUG_SPONSORSHIP_LIST_VIEW_INC_ALLOW' ) ) {
  41      return;
  42  }
  43  
  44  require_api( 'access_api.php' );
  45  require_api( 'bug_api.php' );
  46  require_api( 'collapse_api.php' );
  47  require_api( 'config_api.php' );
  48  require_api( 'constant_inc.php' );
  49  require_api( 'current_user_api.php' );
  50  require_api( 'form_api.php' );
  51  require_api( 'helper_api.php' );
  52  require_api( 'lang_api.php' );
  53  require_api( 'print_api.php' );
  54  require_api( 'sponsorship_api.php' );
  55  require_api( 'utility_api.php' );
  56  
  57  #
  58  # Determine whether the sponsorship section should be shown.
  59  #
  60  
  61  if ( ( config_get( 'enable_sponsorship' ) == ON ) && ( access_has_bug_level( config_get( 'view_sponsorship_total_threshold' ), $f_bug_id ) ) ) {
  62      $t_sponsorship_ids = sponsorship_get_all_ids( $f_bug_id );
  63  
  64      $t_sponsorships_exist = count( $t_sponsorship_ids ) > 0;
  65      $t_can_sponsor = !bug_is_readonly( $f_bug_id ) && !current_user_is_anonymous();
  66  
  67      $t_show_sponsorships = $t_sponsorships_exist || $t_can_sponsor;
  68  } else {
  69      $t_show_sponsorships = false;
  70  }
  71  
  72  #
  73  # Sponsorship Box
  74  #
  75  
  76  if ( $t_show_sponsorships ) {
  77  ?>
  78  
  79  <a id="sponsorships"></a> <br />
  80  
  81  <?php
  82      collapse_open( 'sponsorship' );
  83  ?>
  84  
  85  <table class="width100" cellspacing="1">
  86      <tr>
  87          <td width="50" rowspan="3">
  88              <img src="images/dollars.gif" alt="<?php echo lang_get( 'sponsor_verb' ) ?>" />
  89          </td>
  90          <td class="form-title" colspan="2">
  91          <?php
  92              collapse_icon( 'sponsorship' );
  93  
  94              echo lang_get( 'users_sponsoring_bug' );
  95  
  96              $t_details_url = lang_get( 'sponsorship_process_url' );
  97              if ( !is_blank( $t_details_url ) ) {
  98                  echo '&#160;[<a href="' . $t_details_url . '" target="_blank">'
  99                      . lang_get( 'sponsorship_more_info' ) . '</a>]';
 100              }
 101          ?>
 102          </td>
 103      </tr>
 104  
 105  <?php
 106      if ( $t_can_sponsor ) {
 107  ?>
 108      <tr class="row-1">
 109          <th class="category" width="15%"><?php echo lang_get( 'sponsor_issue' ) ?></th>
 110          <td>
 111              <form method="post" action="bug_set_sponsorship.php">
 112                  <?php echo form_security_field( 'bug_set_sponsorship' ) ?>
 113                  <?php echo sponsorship_get_currency() ?>
 114                  <input type="hidden" name="bug_id" value="<?php echo $f_bug_id ?>" size="4" />
 115                  <input type="text" name="amount" value="<?php echo config_get( 'minimum_sponsorship_amount' )  ?>" size="4" />
 116                  <input type="submit" class="button" name="sponsor" value="<?php echo lang_get( 'sponsor_verb' ) ?>" />
 117              </form>
 118          </td>
 119      </tr>
 120  <?php
 121      }
 122  
 123      $t_total_sponsorship = bug_get_field( $f_bug_id, 'sponsorship_total' );
 124      if ( $t_total_sponsorship > 0 ) {
 125  ?>
 126      <tr class="row-2">
 127          <th class="category" width="15%"><?php echo lang_get( 'sponsors_list' ) ?></th>
 128          <td>
 129          <?php
 130              echo sprintf( lang_get( 'total_sponsorship_amount' ),
 131                  sponsorship_format_amount( $t_total_sponsorship ) );
 132  
 133              if ( access_has_bug_level( config_get( 'view_sponsorship_details_threshold' )
 134                  , $f_bug_id ) ) {
 135                  echo '<br /><br />';
 136                  $i = 0;
 137                  foreach ( $t_sponsorship_ids as $id ) {
 138                      $t_sponsorship = sponsorship_get( $id );
 139                      $t_date_added = date( config_get( 'normal_date_format' )
 140                          , $t_sponsorship->date_submitted );
 141  
 142                      echo ($i > 0) ? '<br />' : '';
 143                      $i++;
 144  
 145                      echo sprintf( lang_get( 'label' ), $t_date_added ) . lang_get( 'word_separator' );
 146                      print_user( $t_sponsorship->user_id );
 147                      echo ' (' . sponsorship_format_amount( $t_sponsorship->amount ) . ')';
 148                      if ( access_has_bug_level( config_get( 'handle_sponsored_bugs_threshold' ), $f_bug_id ) ) {
 149                          echo ' ' . get_enum_element( 'sponsorship', $t_sponsorship->paid );
 150                      }
 151                  }
 152              }
 153          ?>
 154          </td>
 155          </tr>
 156  <?php
 157          }
 158  ?>
 159  </table>
 160  
 161  <?php
 162      collapse_closed( 'sponsorship' );
 163  ?>
 164  
 165  <table class="width100" cellspacing="1">
 166      <tr>
 167          <td class="form-title">
 168  <?php
 169              collapse_icon( 'sponsorship' );
 170              echo lang_get( 'users_sponsoring_bug' );
 171  
 172              $t_details_url = lang_get( 'sponsorship_process_url' );
 173              if ( !is_blank( $t_details_url ) ) {
 174                  echo '&#160;[<a href="' . $t_details_url . '" target="_blank">'
 175                      . lang_get( 'sponsorship_more_info' ) . '</a>]';
 176              }
 177  
 178      $t_total_sponsorship = bug_get_field( $f_bug_id, 'sponsorship_total' );
 179      if ( $t_total_sponsorship > 0 ) {
 180          echo ' <span style="font-weight: normal;">(';
 181          echo sprintf( lang_get( 'total_sponsorship_amount' ),
 182              sponsorship_format_amount( $t_total_sponsorship ) );
 183          echo ')</span>';
 184      }
 185  ?>
 186          </td>
 187      </tr>
 188  </table>
 189  
 190  <?php
 191      collapse_end( 'sponsorship' );
 192  } # If sponsorship enabled


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