<?php
include('DWPollManager.php');
class CDWImagePoll extends CDWPollManager
{
var $iImages;
function ImageVote($aMarks)
{
if (sizeof($aMarks) != $this->iImages) return false;
$strMarks = implode(':', $aMarks);
return $this->Vote($strMarks);
}
function GetImageVoteResults()
{
$results = array();
for ($i = 0; $i < $this->iImages; $i++)
$results[$i] = 0;
$votes = $this->GetAllVotes();
foreach($votes as $choice)
{
$aChoices = explode(':', $choice);
assert(sizeof($results) == sizeof($aChoices));
for ($i = 0; $i < sizeof($results); $i++)
$results[$i] += $aChoices[$i];
}
return $results;
}
}
?>