Changeset 32 for trunk/app/views/pollrows
- Timestamp:
- 07/14/07 14:26:07 (17 months ago)
- Files:
-
- 1 modified
-
trunk/app/views/pollrows/results.thtml (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/app/views/pollrows/results.thtml
r1 r32 1 1 <?php 2 //die(print_r( $ poll));2 //die(print_r( $data )); 3 3 $total_votes = 0; 4 4 5 foreach ($ pollas $key => $val)5 foreach ($data as $key => $val) 6 6 { 7 $total_votes += $ poll[$key]["Pollrow"]["vote"]; // the total votes7 $total_votes += $data[$key]["Pollrow"]["vote"]; // the total votes 8 8 } 9 9 10 echo "<p><b>" . $ poll[0]['Poll']['question'] ."</b></p>";10 echo "<p><b>" . $data[0]['Poll']['question'] ."</b></p>"; 11 11 12 foreach ($ pollas $key => $val)12 foreach ($data as $key => $val) 13 13 { 14 $percent = ($ poll[$key]["Pollrow"]["vote"] * 100) / $total_votes; // % = votes * 100 / total14 $percent = ($data[$key]["Pollrow"]["vote"] * 100) / $total_votes; // % = votes * 100 / total 15 15 $width = number_format($percent, 0); 16 echo '<p><b>' . $ poll[$key]["Pollrow"]["answer"] . '</b> '.number_format($percent, 2).'% <br />';17 echo $html->image('static/poll/'.$ poll[$key]["Pollrow"]["color"].'.png',18 array("height"=>"10", "width"=>$width,"alt"=>$ poll[$key]["Pollrow"]["answer"], "title"=>$poll[$key]["Pollrow"]["answer"]) );19 echo " ". $ poll[$key]["Pollrow"]['vote'];16 echo '<p><b>' . $data[$key]["Pollrow"]["answer"] . '</b> '.number_format($percent, 2).'% <br />'; 17 echo $html->image('static/poll/'.$data[$key]["Pollrow"]["color"].'.png', 18 array("height"=>"10", "width"=>$width,"alt"=>$data[$key]["Pollrow"]["answer"], "title"=>$data[$key]["Pollrow"]["answer"]) ); 19 echo " ". $data[$key]["Pollrow"]['vote']; 20 20 } 21 21
