Changeset 291 for trunk/app/views/pollrows/results.ctp
- Timestamp:
- 02/29/08 13:57:50 (10 months ago)
- Files:
-
- 1 modified
-
trunk/app/views/pollrows/results.ctp (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/app/views/pollrows/results.ctp
r256 r291 1 1 <?php 2 //exit(print_r( $poll )); 2 /** GPLV3 Chipotle Software 2002-2008 **/ 3 //exit(print_r( $poll )); 3 4 $total_votes = 0; 4 5 5 foreach ( $poll as $val)6 foreach ( $poll['Pollrow'] as $val ) 6 7 { 7 $total_votes += $val[" Pollrow"]["vote"]; // the total votes8 $total_votes += $val["vote"]; // the total votes 8 9 } 9 10 10 echo "<p><b>" . $poll[ 0]['Poll']['question'] ."</b></p>";11 echo "<p><b>" . $poll['Poll']['question'] ."</b></p>"; 11 12 12 foreach ($poll as $val)13 foreach ($poll['Pollrow'] as $val) 13 14 { 14 if ($val[" Pollrow"]["vote"] > 0 )15 if ($val["vote"] > 0 ) 15 16 { 16 $percent = ($val[" Pollrow"]["vote"] * 100) / $total_votes; // % = votes * 100 / total17 $percent = ($val["vote"] * 100) / $total_votes; // % = votes * 100 / total 17 18 } 18 19 else … … 23 24 $width = number_format($percent, 0); 24 25 25 echo '<p><b>' . $val[" Pollrow"]["answer"] . '</b> '.number_format($percent, 2).'% <br />' . "\n";26 echo $html->image('static/poll/'.$val[" Pollrow"]["color"].'.png',27 array("height"=>"10", "width"=>$width,"alt"=>$val[" Pollrow"]["answer"], "title"=>$val["Pollrow"]["answer"])) . "\n";28 echo " ". $val[ "Pollrow"]['vote'] . "\n";26 echo '<p><b>' . $val["answer"] . '</b> '.number_format($percent, 2).'% <br />' . "\n"; 27 echo $html->image('static/poll/'.$val["color"].'.png', 28 array("height"=>"10", "width"=>$width,"alt"=>$val["answer"], "title"=>$val["answer"])) . "\n"; 29 echo " ". $val['vote'] . "\n"; 29 30 } 30 31
