Exemple #1
0
	/**
	 * column "results"
	 *
	 * @param Proposal $proposal
	 * @param array   $proposals
	 * @param boolean $first
	 */
	private function display_results(Proposal $proposal, array $proposals, $first) {
		if ($this->state != 'finished') {
?>
		<td></td>
<?
			return;
		}
?>
		<td class="result" onClick="location.href='vote_result.php?issue=<?=$this->id?>'"><?
		static $options_count, $score_max;
		if ($first) {
			// get number of options and highest score
			$options_count = 0;
			$score_max = 0;
			foreach ( $proposals as $proposal_vote ) {
				if ($proposal_vote->yes === null) continue; // skip cancelled proposals
				$score_max = max($score_max, $proposal_vote->score);
				$options_count++;
			}
		}
		if ( $proposal->yes !== null ) { // skip cancelled proposals
			$title = $proposal->bargraph_acceptance($proposal->yes, $proposal->no, $proposal->abstention, $proposal->accepted);
			if ( $options_count > 1 ) {
				$proposal->bargraph_score($proposal->score, $score_max);
			}
			if (BN=="vote_result.php") {
				?><br><?=$title;
			}
		}
		?></td>
<?
	}