Show
Ignore:
Timestamp:
07/14/07 14:26:07 (17 months ago)
Author:
aarkerio
Message:

Poll fixed

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/app/views/pollrows/results.thtml

    r1 r32  
    11<?php 
    2   //die(print_r( $poll )); 
     2  //die(print_r( $data )); 
    33  $total_votes = 0; 
    44   
    5   foreach ($poll as $key => $val)  
     5  foreach ($data as $key => $val)  
    66  { 
    7        $total_votes += $poll[$key]["Pollrow"]["vote"];  // the total votes 
     7       $total_votes += $data[$key]["Pollrow"]["vote"];  // the total votes 
    88  } 
    99   
    10   echo "<p><b>" . $poll[0]['Poll']['question'] ."</b></p>"; 
     10  echo "<p><b>" . $data[0]['Poll']['question'] ."</b></p>"; 
    1111   
    12   foreach ($poll as $key => $val)  
     12  foreach ($data as $key => $val)  
    1313  { 
    14              $percent = ($poll[$key]["Pollrow"]["vote"] * 100) / $total_votes;  // % = votes * 100 / total 
     14             $percent = ($data[$key]["Pollrow"]["vote"] * 100) / $total_votes;  // % = votes * 100 / total 
    1515             $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']; 
    2020  } 
    2121