[ Index ] |
|
Code source de Mantis 1.1.0rc3 |
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: account_sponsor_page.php,v 1.5.2.1 2007-10-13 22:32:20 giallu Exp $ 22 # -------------------------------------------------------- 23 24 # CALLERS 25 # This page is called from: 26 # - print_menu() 27 # - print_account_menu() 28 29 # EXPECTED BEHAVIOUR 30 # - Display the user's current sponsorships 31 # - Allow the user to edit the payment flag 32 33 # CALLS 34 # This page calls the following pages: 35 # - account_sponsor_update.php (to save changes) 36 37 # RESTRICTIONS & PERMISSIONS 38 # - User must be authenticated, and not anonymous 39 # - sponsorship must be enabled 40 41 require_once ( 'core.php' ); 42 43 $t_core_path = config_get( 'core_path' ); 44 45 require_once( $t_core_path.'current_user_api.php' ); 46 47 if ( config_get( 'enable_sponsorship' ) == OFF ) { 48 trigger_error( ERROR_SPONSORSHIP_NOT_ENABLED, ERROR ); 49 } 50 51 # anonymous users are not allowed to sponsor issues 52 if ( current_user_is_anonymous() ) { 53 access_denied(); 54 } 55 56 $t_show_all = gpc_get_bool( 'show_all', false ); 57 58 # start the page 59 html_page_top1( lang_get( 'my_sponsorship' ) ); 60 html_page_top2(); 61 62 $t_project = helper_get_current_project(); 63 ?> 64 <br /> 65 <table class="width100" cellspacing="1"> 66 <tr> 67 <td class="form-title"> 68 <?php echo lang_get( 'my_sponsorship' ) ?> 69 </td> 70 <td class="right"> 71 <?php print_account_menu( 'account_sponsor_page.php' ) ?> 72 </td> 73 </tr> 74 </table> 75 <?php 76 # get issues user has sponsored 77 $t_user = auth_get_current_user_id(); 78 $t_resolved = config_get( 'bug_resolved_status_threshold' ); 79 $t_bug_table = config_get( 'mantis_bug_table' ); 80 $t_sponsor_table = config_get( 'mantis_sponsorship_table' ); 81 $t_payment = config_get( 'payment_enable', 0 ); 82 83 $t_show_clause = $t_show_all ? '' : 'AND ( b.status < ' . $t_resolved . ' OR s.paid < ' . SPONSORSHIP_PAID . ')'; 84 $t_project_clause = helper_project_specific_where( $t_project ); 85 86 $query = "SELECT b.id as bug, s.id as sponsor, s.paid, b.project_id, b.fixed_in_version, b.status 87 FROM $t_bug_table b, $t_sponsor_table s 88 WHERE s.user_id=$t_user AND s.bug_id = b.id $t_show_clause AND $t_project_clause 89 ORDER BY s.paid ASC, b.project_id ASC, b.fixed_in_version ASC, b.status ASC, b.id DESC"; 90 91 $result = db_query( $query ); 92 93 $t_sponsors = db_num_rows( $result ); 94 if ( 0 == $t_sponsors ) { 95 echo '<p>' . lang_get( 'no_own_sponsored' ) . '</p>'; 96 } else { 97 ?> 98 99 <!-- # Edit own sponsorship Form BEGIN --> 100 <br /> 101 <div align="center"> 102 <table class="width100" cellspacing="1"> 103 104 <!-- Headings --> 105 <tr> 106 <td class="form-title" colspan="9"> 107 <?php echo lang_get( 'own_sponsored' ) ?> 108 </td> 109 </tr> 110 <tr> 111 <td class="form-title" width="10%"><?php echo lang_get( 'email_bug' ) ?></td> 112 <td class="form-title" width="8%"><?php echo lang_get( 'email_project' ) ?></td> 113 <td class="form-title" width="7%"><?php echo lang_get( 'fixed_in_version' ) ?></td> 114 <td class="form-title" width="10%"><?php echo lang_get( 'email_status' ) ?></td> 115 <td class="form-title" width="10%"><?php echo lang_get( 'email_handler' ) ?></td> 116 <td class="form-title" width="30%"><?php echo lang_get( 'email_summary' ) ?></td> 117 <td class="form-title" width="8%"><?php echo lang_get( 'amount' ) ?></td> 118 <td class="form-title" width="7%"><?php echo lang_get( 'status' ) ?></td> 119 <td class="form-title" width="10%"> </td> 120 </tr> 121 <?php 122 $t_total_owing = 0; 123 $t_total_paid = 0; 124 for ( $i=0; $i < $t_sponsors; ++$i ) { 125 $row = db_fetch_array( $result ); 126 $t_bug = bug_get( $row['bug'] ); 127 $t_sponsor = sponsorship_get( $row['sponsor'] ); 128 129 # describe bug 130 $t_status = string_attribute( get_enum_element( 'status', $t_bug->status ) ); 131 $t_resolution = string_attribute( get_enum_element( 'resolution', $t_bug->resolution ) ); 132 $t_version_id = version_get_id( $t_bug->fixed_in_version, $t_project ); 133 if ( ( false !== $t_version_id ) && ( VERSION_RELEASED == version_get_field( $t_version_id, 'released' ) ) ) { 134 $t_released_label = '<a title="' . lang_get( 'released' ) . '">' . $t_bug->fixed_in_version . '</a>'; 135 } else { 136 $t_released_label = $t_bug->fixed_in_version; 137 } 138 139 echo '<tr bgcolor="' . get_status_color( $t_bug->status ) . '">'; 140 echo '<td><a href="' . string_get_bug_view_url( $row['bug'] ) . '">' . bug_format_id( $row['bug'] ) . '</a></td>'; 141 echo '<td>' . project_get_field( $t_bug->project_id, 'name' ) . ' </td>'; 142 echo '<td class="right">' . $t_released_label . ' </td>'; 143 echo '<td><span class="issue-status" title="' . $t_resolution . '">' . $t_status . '</span></td>'; 144 echo '<td>'; 145 print_user( $t_bug->handler_id ); 146 echo '</td>'; 147 148 # summary 149 echo '<td>' . $t_bug->summary; 150 if ( VS_PRIVATE == $t_bug->view_state ) { 151 printf( ' <img src="%s" alt="(%s)" title="%s" />', $t_icon_path . 'protected.gif', lang_get( 'private' ), lang_get( 'private' ) ); 152 } 153 154 # describe sponsorship amount 155 echo '<td class="right">' . sponsorship_format_amount( $t_sponsor->amount ) . '</td>'; 156 echo '<td>' . get_enum_element( 'sponsorship', $t_sponsor->paid ) . '</td>'; 157 158 if ( SPONSORSHIP_PAID == $t_sponsor->paid ) { 159 $t_total_paid += $t_sponsor->amount; 160 } else { 161 $t_total_owing += $t_sponsor->amount; 162 } 163 164 echo '<td>'; 165 if ( $t_payment ) { 166 echo '(paypal button)'; 167 } else { 168 echo ' '; 169 } 170 echo '</td>'; 171 echo '</tr>'; 172 } 173 ?> 174 <!-- Totals --> 175 <tr border="top"> 176 <td colspan="5"></td> 177 <td><?php echo lang_get( 'total_owing' ) ?></td> 178 <td class="right"><?php echo sponsorship_format_amount( $t_total_owing ) ?></td> 179 <td colspan="2"></td> 180 </tr> 181 <tr> 182 <td colspan="5"></td> 183 <td><?php echo lang_get( 'total_paid' ) ?></td> 184 <td class="right"><?php echo sponsorship_format_amount( $t_total_paid ) ?></td> 185 <td colspan="2"></td> 186 </tr> 187 </table> 188 </div> 189 <?php } # end sponsored issues 190 191 $query = "SELECT b.id as bug, s.id as sponsor, s.paid, b.project_id, b.fixed_in_version, b.status 192 FROM $t_bug_table b, $t_sponsor_table s 193 WHERE b.handler_id=$t_user AND s.bug_id = b.id $t_show_clause AND $t_project_clause 194 ORDER BY s.paid ASC, b.project_id ASC, b.fixed_in_version ASC, b.status ASC, b.id DESC"; 195 196 $result = db_query( $query ); 197 $t_sponsors = db_num_rows( $result ); 198 if ( 0 == $t_sponsors ) { 199 echo '<p>' . lang_get( 'no_sponsored' ) . '</p>'; 200 } else { 201 ?> 202 203 <!-- # Edit sponsorship Form BEGIN --> 204 <br /> 205 <div align="center"> 206 <form method="post" action="account_sponsor_update.php"> 207 <table class="width100" cellspacing="1"> 208 209 <!-- Headings --> 210 <tr> 211 <td class="form-title" colspan="8"> 212 <?php echo lang_get( 'issues_handled' ) ?> 213 </td> 214 </tr> 215 <tr> 216 <td class="form-title" width="10%"><?php echo lang_get( 'email_bug' ) ?></td> 217 <td class="form-title" width="8%"><?php echo lang_get( 'email_project' ) ?></td> 218 <td class="form-title" width="7%"><?php echo lang_get( 'fixed_in_version' ) ?></td> 219 <td class="form-title" width="10%"><?php echo lang_get( 'email_status' ) ?></td> 220 <td class="form-title" width="35%"><?php echo lang_get( 'email_summary' ) ?></td> 221 <td class="form-title" width="10%"><?php echo lang_get( 'sponsor' ) ?></td> 222 <td class="form-title" width="10%"><?php echo lang_get( 'amount' ) ?></td> 223 <td class="form-title" width="10%"><?php echo lang_get( 'status' ) ?></td> 224 </tr> 225 <?php 226 $t_bug_list = array(); 227 $t_total_owing = 0; 228 $t_total_paid = 0; 229 for ( $i=0; $i < $t_sponsors; ++$i ) { 230 $row = db_fetch_array( $result ); 231 $t_bug = bug_get( $row['bug'] ); 232 $t_sponsor = sponsorship_get( $row['sponsor'] ); 233 $t_buglist[] = $row['bug'] . ':' . $row['sponsor']; 234 235 # describe bug 236 $t_status = string_attribute( get_enum_element( 'status', $t_bug->status ) ); 237 $t_resolution = string_attribute( get_enum_element( 'resolution', $t_bug->resolution ) ); 238 $t_version_id = version_get_id( $t_bug->fixed_in_version, $t_project ); 239 if ( ( false !== $t_version_id ) && ( VERSION_RELEASED == version_get_field( $t_version_id, 'released' ) ) ) { 240 $t_released_label = '<a title="' . lang_get( 'released' ) . '">' . $t_bug->fixed_in_version . '</a>'; 241 } else { 242 $t_released_label = $t_bug->fixed_in_version; 243 } 244 245 echo '<tr bgcolor="' . get_status_color( $t_bug->status ) . '">'; 246 echo '<td><a href="' . string_get_bug_view_url( $row['bug'] ) . '">' . bug_format_id( $row['bug'] ) . '</a></td>'; 247 echo '<td>' . project_get_field( $t_bug->project_id, 'name' ) . ' </td>'; 248 echo '<td class="right">' . $t_released_label . ' </td>'; 249 echo '<td><a title="' . $t_resolution . '"><u>' . $t_status . '</u> </a></td>'; 250 251 # summary 252 echo '<td>' . $t_bug->summary; 253 if ( VS_PRIVATE == $t_bug->view_state ) { 254 printf( ' <img src="%s" alt="(%s)" title="%s" />', $t_icon_path . 'protected.gif', lang_get( 'private' ), lang_get( 'private' ) ); 255 } 256 257 # describe sponsorship amount 258 echo '<td>'; 259 print_user( $t_sponsor->user_id ); 260 echo '</td>'; 261 echo '<td class="right">' . sponsorship_format_amount( $t_sponsor->amount ) . '</td>'; 262 echo '<td><select name="sponsor_' . $row['bug'] . '_' . $t_sponsor->id . '">'; 263 print_enum_string_option_list( 'sponsorship', $t_sponsor->paid ); 264 echo '</select></td>'; 265 266 echo '</tr>'; 267 if ( SPONSORSHIP_PAID == $t_sponsor->paid ) { 268 $t_total_paid += $t_sponsor->amount; 269 } else { 270 $t_total_owing += $t_sponsor->amount; 271 } 272 273 } 274 $t_hidden_bug_list = implode( ',', $t_buglist ); 275 ?> 276 <!-- Totals --> 277 <tr border="top"> 278 <td colspan="5"></td> 279 <td><?php echo lang_get( 'total_owing' ) ?></td> 280 <td class="right"><?php echo sponsorship_format_amount( $t_total_owing ) ?></td> 281 <td></td> 282 </tr> 283 <tr> 284 <td colspan="5"></td> 285 <td><?php echo lang_get( 'total_paid' ) ?></td> 286 <td class="right"><?php echo sponsorship_format_amount( $t_total_paid ) ?></td> 287 <td></td> 288 </tr> 289 <input type="hidden" name="buglist" value="<?php echo $t_hidden_bug_list ?>" /> 290 <!-- BUTTONS --> 291 <tr> 292 <td colspan="5"> </td> 293 <!-- Update Button --> 294 <td colspan="2"> 295 <input type="submit" class="button" value="<?php echo lang_get( 'update_sponsorship_button' ) ?>" /> 296 </td> 297 </tr> 298 </table> 299 </form> 300 </div> 301 <?php } # end sponsored issues ?> 302 303 <br /> 304 <div align="center"> 305 <?php 306 html_button ( 'account_sponsor_page.php', 307 lang_get( ( $t_show_all ? 'sponsor_hide' : 'sponsor_show' ) ), 308 array( 'show_all' => ( $t_show_all ? 0 : 1 ) ) ); 309 ?> 310 </div> 311 312 <?php html_page_bottom1( __FILE__ ) ?>
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
Généré le : Thu Nov 29 09:42:17 2007 | par Balluche grâce à PHPXref 0.7 |
![]() |