2 # MantisBT - A PHP based bugtracking system
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.
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.
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/>.
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
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
26 * @uses access_api.php
28 * @uses collapse_api.php
29 * @uses config_api.php
30 * @uses constant_inc.php
31 * @uses current_user_api.php
33 * @uses helper_api.php
36 * @uses sponsorship_api.php
37 * @uses utility_api.php
40 if ( !defined( 'BUG_SPONSORSHIP_LIST_VIEW_INC_ALLOW' ) ) {
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' );
58 # Determine whether the sponsorship section should be shown.
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 );
64 $t_sponsorships_exist = count( $t_sponsorship_ids ) > 0;
65 $t_can_sponsor = !bug_is_readonly( $f_bug_id ) && !current_user_is_anonymous();
67 $t_show_sponsorships = $t_sponsorships_exist ||
$t_can_sponsor;
69 $t_show_sponsorships = false;
76 if ( $t_show_sponsorships ) {
79 <a id
="sponsorships"></a
> <br
/>
82 collapse_open( 'sponsorship' );
85 <table
class="width100" cellspacing
="1">
87 <td width
="50" rowspan
="3">
88 <img src
="images/dollars.gif" alt
="<?php echo lang_get( 'sponsor_verb' ) ?>" />
90 <td
class="form-title" colspan
="2">
92 collapse_icon( 'sponsorship' );
94 echo lang_get( 'users_sponsoring_bug' );
96 $t_details_url = lang_get( 'sponsorship_process_url' );
97 if ( !is_blank( $t_details_url ) ) {
98 echo ' [<a href="' . $t_details_url . '" target="_blank">'
99 . lang_get( 'sponsorship_more_info' ) . '</a>]';
106 if ( $t_can_sponsor ) {
109 <th
class="category" width
="15%"><?php
echo lang_get( 'sponsor_issue' ) ?
></th
>
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' ) ?>" />
123 $t_total_sponsorship = bug_get_field( $f_bug_id, 'sponsorship_total' );
124 if ( $t_total_sponsorship > 0 ) {
127 <th
class="category" width
="15%"><?php
echo lang_get( 'sponsors_list' ) ?
></th
>
130 echo sprintf( lang_get( 'total_sponsorship_amount' ),
131 sponsorship_format_amount( $t_total_sponsorship ) );
133 if ( access_has_bug_level( config_get( 'view_sponsorship_details_threshold' )
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
);
142 echo ($i > 0) ?
'<br />' : '';
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
);
162 collapse_closed( 'sponsorship' );
165 <table
class="width100" cellspacing
="1">
167 <td
class="form-title">
169 collapse_icon( 'sponsorship' );
170 echo lang_get( 'users_sponsoring_bug' );
172 $t_details_url = lang_get( 'sponsorship_process_url' );
173 if ( !is_blank( $t_details_url ) ) {
174 echo ' [<a href="' . $t_details_url . '" target="_blank">'
175 . lang_get( 'sponsorship_more_info' ) . '</a>]';
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 ) );
191 collapse_end( 'sponsorship' );
192 } # If sponsorship enabled