* @copyright Copyright 2009-2011
* @license http://www.gnu.org/licenses/gpl.txt GNU General Public License V2.0
*/
?>
0) {
// Determine which poll to display
// $last_id is set to the highest id from the DB
// But is one is in the URL, that has preference
$inp_poll = (isset($_GET['poll_id']) ? $_GET['poll_id'] : $last_id);
// But only if it really can be displayed
$inp_poll = (array_key_exists($inp_poll, $ppoll) ? $inp_poll : $last_id);
// Only show the dropdown on 2 or more polls
if (count($ppoll) > 1) {
?>
$poll) {
$drops[] = array('id' => $poll_id, 'text' => $poll['question']);
}
print zen_draw_form('poll_overview_page', zen_href_link(PM_FILENAME_POLL_OVERVIEW), 'get');
print zen_draw_hidden_field('main_page', PM_FILENAME_POLL_OVERVIEW);
print PM_SELECT_POLL . ' ';
print zen_draw_pull_down_menu('poll_id_select', $drops, $inp_poll, 'onchange="PMactivatePoll(this.value);"');
print '
' . "\n\n";
}
// Print the poll results, but only open the div for the one selected
foreach($ppoll as $poll_id => $poll) {
print '
' . "\n\t";
print '
' . $poll['question'] . '
' . "\n\t";
foreach($poll['option'] as $index => $option) {
print '
' . html_entity_decode($option['text']) . '
' . "\n\t\t";
$perc = round($option['count'] / $poll['vtotal'] * 100, 0);
print '
';
print '
';
print "
" . ($poll['type'] == '0' ? $perc . "%" : $option['count']) . "
" . "\n\t\t";
print "
" . "\n\t";
}
print '
' . "\n\t";
print '' . PM_FIRST_VOTE . ' | ' . $poll['first'] . ' |
' . "\n\t";
print '' . PM_LAST_VOTE . ' | ' . $poll['last'] . ' |
' . "\n\t";
print '' . PM_NBR_VOTERS . ' | ' . $poll['voters'] . ' |
' . "\n\t";
print '
' . "\n";
print '
' . "\n\n";
}
}
else {
print PM_NO_POLLS;
}
require($define_page);
?>