public function __construct($expr, $explain) { $this->resId = getNextGlobalId(); $this->expr = $expr; $this->color = nextColor(); $this->explain = '<span style="background-color: #' . sprintf("%'06X", $this->color) . '" class="resource" data-resource-id="$this->resId">' . $explain . "</span>"; }
// Show each answer with the number of votes it recived. foreach ($answers as $ans) { $class = 'alternate' == $class ? '' : 'alternate'; print "<tr class='{$class}'><td>"; if (isset($user_answer) and $ans->ID == $user_answer) { print "<strong>" . stripslashes($ans->answer) . "</strong>"; } else { print stripslashes($ans->answer); } print "</td>"; if ($ans->votes == 0) { $percent = 0; } else { $percent = intval($ans->votes / $total * 100); } $color = nextColor(); print "<td class='pollin-result-bar-holder' style='width:200px;'><div class='pollin-result-bar' style='background-color:{$color}; width:{$percent}%;'> </div></td>"; print "<td>{$ans->votes} " . t('Votes') . "({$percent}%)</td>"; print "</tr>"; } ?> </tbody> </table> <strong><?php e('Total Votes'); ?> : <?php echo $total; ?> </strong><br /><hr />