Blame Identity/Models/Html/Mantis/1.1.2-1.fc9/bug_sponsorship_list_view_inc.php

d6e8d8
d6e8d8
# Mantis - a php based bugtracking system
d6e8d8
d6e8d8
# Copyright (C) 2000 - 2002  Kenzaburo Ito - kenito@300baud.org
d6e8d8
# Copyright (C) 2002 - 2007  Mantis Team   - mantisbt-dev@lists.sourceforge.net
d6e8d8
d6e8d8
# Mantis is free software: you can redistribute it and/or modify
d6e8d8
# it under the terms of the GNU General Public License as published by
d6e8d8
# the Free Software Foundation, either version 2 of the License, or
d6e8d8
# (at your option) any later version.
d6e8d8
#
d6e8d8
# Mantis is distributed in the hope that it will be useful,
d6e8d8
# but WITHOUT ANY WARRANTY; without even the implied warranty of
d6e8d8
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
d6e8d8
# GNU General Public License for more details.
d6e8d8
#
d6e8d8
# You should have received a copy of the GNU General Public License
d6e8d8
# along with Mantis.  If not, see <http://www.gnu.org/licenses/>.
d6e8d8
d6e8d8
	# --------------------------------------------------------
d6e8d8
	# $Id: bug_sponsorship_list_view_inc.php,v 1.16.2.1 2007-10-13 22:32:55 giallu Exp $
d6e8d8
	# --------------------------------------------------------
d6e8d8
?>
d6e8d8
d6e8d8
	# This include file prints out the list of users sponsoring the current
d6e8d8
	# bug.	$f_bug_id must be set to the bug id
d6e8d8
d6e8d8
	$t_core_path = config_get( 'core_path' );
d6e8d8
d6e8d8
	require_once( $t_core_path . 'sponsorship_api.php' );
d6e8d8
	require_once( $t_core_path . 'collapse_api.php' );
d6e8d8
d6e8d8
	#
d6e8d8
	# Determine whether the sponsorship section should be shown.
d6e8d8
	#
d6e8d8
d6e8d8
	if ( ( config_get( 'enable_sponsorship' ) == ON ) && ( access_has_bug_level( config_get( 'view_sponsorship_total_threshold' ), $f_bug_id ) ) ) {
d6e8d8
		$t_sponsorship_ids = sponsorship_get_all_ids( $f_bug_id );
d6e8d8
d6e8d8
		$t_sponsorships_exist = count( $t_sponsorship_ids ) > 0;
d6e8d8
		$t_can_sponsor = !bug_is_readonly( $f_bug_id ) && !current_user_is_anonymous();
d6e8d8
d6e8d8
		$t_show_sponsorships = $t_sponsorships_exist || $t_can_sponsor;
d6e8d8
	} else {
d6e8d8
		$t_show_sponsorships = false;
d6e8d8
	}
d6e8d8
d6e8d8
	#
d6e8d8
	# Sponsorship Box
d6e8d8
	#
d6e8d8
d6e8d8
	if ( $t_show_sponsorships ) {
d6e8d8
?>
d6e8d8
d6e8d8
 
d6e8d8
d6e8d8
d6e8d8
	collapse_open( 'sponsorship' );
d6e8d8
?>
d6e8d8
d6e8d8
d6e8d8
	
d6e8d8
		
d6e8d8
			<?php echo lang_get( 'sponsor_verb' ) ?>
d6e8d8
		
d6e8d8
		
d6e8d8
			
d6e8d8
		
d6e8d8
			echo lang_get( 'users_sponsoring_bug' );
d6e8d8
d6e8d8
			$t_details_url = lang_get( 'sponsorship_process_url' );
d6e8d8
			if ( !is_blank( $t_details_url ) ) {
d6e8d8
				echo ' ['
d6e8d8
					. lang_get( 'sponsorship_more_info' ) . ']';
d6e8d8
			}
d6e8d8
		?>
d6e8d8
		
d6e8d8
	
d6e8d8
d6e8d8
d6e8d8
	if ( $t_can_sponsor ) {
d6e8d8
?>
d6e8d8
	
d6e8d8
		
d6e8d8
		
d6e8d8
			<form method="post" action="bug_set_sponsorship.php">
d6e8d8
				
d6e8d8
				<input type="hidden" name="bug_id" value="<?php echo $f_bug_id ?>" size="4" />
d6e8d8
				<input type="text" name="amount" value="<?php echo config_get( 'minimum_sponsorship_amount' )  ?>" size="4" />
d6e8d8
				<input type="submit" class="button" name="sponsor" value="<?php echo lang_get( 'sponsor_verb' ) ?>" />
d6e8d8
			</form>
d6e8d8
		
d6e8d8
	
d6e8d8
d6e8d8
	}
d6e8d8
d6e8d8
	$t_total_sponsorship = bug_get_field( $f_bug_id, 'sponsorship_total' );
d6e8d8
	if ( $t_total_sponsorship > 0 ) {
d6e8d8
?>
d6e8d8
	
d6e8d8
		
d6e8d8
		
d6e8d8
		
d6e8d8
			echo sprintf( lang_get( 'total_sponsorship_amount' ),
d6e8d8
				sponsorship_format_amount( $t_total_sponsorship ) );
d6e8d8
d6e8d8
			if ( access_has_bug_level( config_get( 'view_sponsorship_details_threshold' )
d6e8d8
				, $f_bug_id ) ) {
d6e8d8
				echo '

';
d6e8d8
				$i = 0;
d6e8d8
				foreach ( $t_sponsorship_ids as $id ) {
d6e8d8
					$t_sponsorship = sponsorship_get( $id );
d6e8d8
					$t_date_added = date( config_get( 'normal_date_format' )
d6e8d8
						, $t_sponsorship->date_submitted );
d6e8d8
d6e8d8
					echo ($i > 0) ? '
' : '';
d6e8d8
					$i++;
d6e8d8
d6e8d8
					echo $t_date_added . ': ';
d6e8d8
					print_user( $t_sponsorship->user_id );
d6e8d8
					echo ' (' . sponsorship_format_amount( $t_sponsorship->amount ) . ')';
d6e8d8
					if ( access_has_bug_level( config_get( 'handle_sponsored_bugs_threshold' ), $f_bug_id ) ) {
d6e8d8
						echo ' ' . get_enum_element( 'sponsorship', $t_sponsorship->paid );
d6e8d8
					}
d6e8d8
				}
d6e8d8
			}
d6e8d8
		?>
d6e8d8
		
d6e8d8
		
d6e8d8
d6e8d8
		}
d6e8d8
?>
d6e8d8
d6e8d8
d6e8d8
d6e8d8
	collapse_closed( 'sponsorship' );
d6e8d8
?>
d6e8d8
d6e8d8
d6e8d8
	
d6e8d8
		
d6e8d8
d6e8d8
			collapse_icon( 'sponsorship' );
d6e8d8
			echo lang_get( 'users_sponsoring_bug' );
d6e8d8
d6e8d8
			$t_details_url = lang_get( 'sponsorship_process_url' );
d6e8d8
			if ( !is_blank( $t_details_url ) ) {
d6e8d8
				echo ' ['
d6e8d8
					. lang_get( 'sponsorship_more_info' ) . ']';
d6e8d8
			}
d6e8d8
?>
d6e8d8
d6e8d8
d6e8d8
	$t_total_sponsorship = bug_get_field( $f_bug_id, 'sponsorship_total' );
d6e8d8
	if ( $t_total_sponsorship > 0 ) {
d6e8d8
		echo ' (';
d6e8d8
		echo sprintf( lang_get( 'total_sponsorship_amount' ),
d6e8d8
			sponsorship_format_amount( $t_total_sponsorship ) );
d6e8d8
		echo ')';
d6e8d8
	}
d6e8d8
?>
d6e8d8
		
d6e8d8
	
d6e8d8
d6e8d8
d6e8d8
d6e8d8
	collapse_end( 'sponsorship' );
d6e8d8
} # If sponsorship enabled
d6e8d8
?>