Fix #11417: Allow EVENT_MENU_MAIN plugin events to return null
[mantis/radio.git] / bug_sponsorship_list_view_inc.php
blob1196d33abc0e081746f834d7128ad04a456f5505
1 <?php
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/>.
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
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
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
40 require_api( 'access_api.php' );
41 require_api( 'bug_api.php' );
42 require_api( 'collapse_api.php' );
43 require_api( 'config_api.php' );
44 require_api( 'constant_inc.php' );
45 require_api( 'current_user_api.php' );
46 require_api( 'form_api.php' );
47 require_api( 'helper_api.php' );
48 require_api( 'lang_api.php' );
49 require_api( 'print_api.php' );
50 require_api( 'sponsorship_api.php' );
51 require_api( 'utility_api.php' );
54 # Determine whether the sponsorship section should be shown.
57 if ( ( config_get( 'enable_sponsorship' ) == ON ) && ( access_has_bug_level( config_get( 'view_sponsorship_total_threshold' ), $f_bug_id ) ) ) {
58 $t_sponsorship_ids = sponsorship_get_all_ids( $f_bug_id );
60 $t_sponsorships_exist = count( $t_sponsorship_ids ) > 0;
61 $t_can_sponsor = !bug_is_readonly( $f_bug_id ) && !current_user_is_anonymous();
63 $t_show_sponsorships = $t_sponsorships_exist || $t_can_sponsor;
64 } else {
65 $t_show_sponsorships = false;
69 # Sponsorship Box
72 if ( $t_show_sponsorships ) {
75 <a name="sponsorships" id="sponsorships"></a> <br />
77 <?php
78 collapse_open( 'sponsorship' );
81 <table class="width100" cellspacing="1">
82 <tr>
83 <td width="50" rowspan="3">
84 <img src="images/dollars.gif" alt="<?php echo lang_get( 'sponsor_verb' ) ?>" border="0" />
85 </td>
86 <td class="form-title" colspan="2">
87 <?php
88 collapse_icon( 'sponsorship' );
90 echo lang_get( 'users_sponsoring_bug' );
92 $t_details_url = lang_get( 'sponsorship_process_url' );
93 if ( !is_blank( $t_details_url ) ) {
94 echo '&nbsp;[<a href="' . $t_details_url . '" target="_blank">'
95 . lang_get( 'sponsorship_more_info' ) . '</a>]';
98 </td>
99 </tr>
101 <?php
102 if ( $t_can_sponsor ) {
104 <tr class="row-1">
105 <td class="category" width="15%"><?php echo lang_get( 'sponsor_issue' ) ?></td>
106 <td>
107 <form method="post" action="bug_set_sponsorship.php">
108 <?php echo form_security_field( 'bug_set_sponsorship' ) ?>
109 <?php echo sponsorship_get_currency() ?>
110 <input type="hidden" name="bug_id" value="<?php echo $f_bug_id ?>" size="4" />
111 <input type="text" name="amount" value="<?php echo config_get( 'minimum_sponsorship_amount' ) ?>" size="4" />
112 <input type="submit" class="button" name="sponsor" value="<?php echo lang_get( 'sponsor_verb' ) ?>" />
113 </form>
114 </td>
115 </tr>
116 <?php
119 $t_total_sponsorship = bug_get_field( $f_bug_id, 'sponsorship_total' );
120 if ( $t_total_sponsorship > 0 ) {
122 <tr class="row-2">
123 <td class="category" width="15%"><?php echo lang_get( 'sponsors_list' ) ?></td>
124 <td>
125 <?php
126 echo sprintf( lang_get( 'total_sponsorship_amount' ),
127 sponsorship_format_amount( $t_total_sponsorship ) );
129 if ( access_has_bug_level( config_get( 'view_sponsorship_details_threshold' )
130 , $f_bug_id ) ) {
131 echo '<br /><br />';
132 $i = 0;
133 foreach ( $t_sponsorship_ids as $id ) {
134 $t_sponsorship = sponsorship_get( $id );
135 $t_date_added = date( config_get( 'normal_date_format' )
136 , $t_sponsorship->date_submitted );
138 echo ($i > 0) ? '<br />' : '';
139 $i++;
141 echo sprintf( lang_get( 'label' ), $t_date_added ) . lang_get( 'word_separator' );
142 print_user( $t_sponsorship->user_id );
143 echo ' (' . sponsorship_format_amount( $t_sponsorship->amount ) . ')';
144 if ( access_has_bug_level( config_get( 'handle_sponsored_bugs_threshold' ), $f_bug_id ) ) {
145 echo ' ' . get_enum_element( 'sponsorship', $t_sponsorship->paid );
150 </td>
151 </tr>
152 <?php
155 </table>
157 <?php
158 collapse_closed( 'sponsorship' );
161 <table class="width100" cellspacing="1">
162 <tr>
163 <td class="form-title">
164 <?php
165 collapse_icon( 'sponsorship' );
166 echo lang_get( 'users_sponsoring_bug' );
168 $t_details_url = lang_get( 'sponsorship_process_url' );
169 if ( !is_blank( $t_details_url ) ) {
170 echo '&nbsp;[<a href="' . $t_details_url . '" target="_blank">'
171 . lang_get( 'sponsorship_more_info' ) . '</a>]';
174 $t_total_sponsorship = bug_get_field( $f_bug_id, 'sponsorship_total' );
175 if ( $t_total_sponsorship > 0 ) {
176 echo ' <span style="font-weight: normal;">(';
177 echo sprintf( lang_get( 'total_sponsorship_amount' ),
178 sponsorship_format_amount( $t_total_sponsorship ) );
179 echo ')</span>';
182 </td>
183 </tr>
184 </table>
186 <?php
187 collapse_end( 'sponsorship' );
188 } # If sponsorship enabled