Blame Identity/Webenv/App/Mantis/1.1.2-1.fc9/bug_sponsorship_list_view_inc.php

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

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