Blame Extras/Mantis/1.1.2-1.fc9/bug_sponsorship_list_view_inc.php

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

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