Show
Ignore:
Timestamp:
02/29/08 13:57:50 (10 months ago)
Author:
aarkerio
Message:

Fixed poll and admin routes

Files:
1 modified

Legend:

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

    r256 r291  
    11<?php 
    2   //exit(print_r( $poll )); 
     2/**  GPLV3 Chipotle Software  2002-2008 **/ 
     3//exit(print_r( $poll ));   
    34  $total_votes = 0; 
    45   
    5   foreach ($poll as $val)  
     6  foreach ( $poll['Pollrow'] as $val )  
    67  { 
    7        $total_votes += $val["Pollrow"]["vote"];  // the total votes 
     8       $total_votes += $val["vote"];  // the total votes 
    89  } 
    910   
    10   echo "<p><b>" . $poll[0]['Poll']['question'] ."</b></p>"; 
     11  echo "<p><b>" . $poll['Poll']['question'] ."</b></p>"; 
    1112   
    12   foreach ($poll as $val)  
     13  foreach ($poll['Pollrow'] as $val)  
    1314  {           
    14              if ($val["Pollrow"]["vote"] > 0 ) 
     15             if ($val["vote"] > 0 ) 
    1516             { 
    16                    $percent = ($val["Pollrow"]["vote"] * 100) / $total_votes;  // % = votes * 100 / total 
     17                   $percent = ($val["vote"] * 100) / $total_votes;  // % = votes * 100 / total 
    1718             } 
    1819             else 
     
    2324             $width   = number_format($percent, 0); 
    2425              
    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"; 
    2930  } 
    3031