<?
/*
  www.oscGold.com (C) Kamelia-Net Jacek Krysiak
  modul oscGold wer 4.0
*/

if (isset($HTTP_GET_VARS['pollid'])) {
$pollid=$HTTP_GET_VARS['pollid'];
} else {
$pollid=1;
}

$poll_query=tep_db_query("select voters from phesis_poll_desc where pollid=$pollid and poll_open='0'");
$poll_details=tep_db_fetch_array($poll_query);
$title_query = tep_db_query("select optionText from phesis_poll_data where pollid=$pollid and voteid='0' and language_id = '" . $languages_id . "'");
$title = tep_db_fetch_array($title_query);
//
$url = tep_href_link('pollbooth.php', 'op=results&pollid='.$pollid);
$content = '<form name="poll" method="post" action="'. tep_href_link('pollcollect.php') .'">';
$content .= "<table align=\"center\" border=\"0\" width=\"100%\" cellspacing=\"0\" cellpadding=\"2\"><tr><td colspan=\"2\" class=\"main\"><b>" . $title['optionText'] . "</b></td></tr>";
$content .=  "<input type=\"hidden\" name=\"pollid\" value=\"".$pollid."\">\n";
$content .=  "<input type=\"hidden\" name=\"forwarder\" value=\"".$url."\"></td></tr>\n";
$content .= '<tr><td align="center" valign="top" colspan="2" style="padding-top:5px;padding-bottom:5px"><table border="0" cellspacing="0" cellpadding="1">';
for ($i=1;$i<=8;$i++) {
  $query=tep_db_query("select pollid, optiontext, optioncount, voteid from phesis_poll_data where (pollid=$pollid) and (voteid=$i) and (language_id=$languages_id)");
  if ($result=tep_db_fetch_array($query)) {
		if ($result['optiontext']) {
		   $content.= "<tr><td class=\"main\"><input type=\"radio\" name=\"voteid\" value=\"".$i."\" class=\"radio\"></td><td class=\"main\">".$result['optiontext']."</td></tr>";
		}
  }
}
$content .= '</table></td></tr>';
$content .= "<tr><td colspan=\"2\" style=\"padding-top:10px;\"><center>".tep_image_submit('button_poll.gif', _VOTE)."</td></tr>";
$content .= "<tr><td style=\"padding-top:10px;\" colspan=\"2\" class=\"main\"><center><a href=\"" . tep_href_link('pollbooth.php', 'op=results&pollid=' .$pollid, 'NONSSL')."\">"._RESULTS."</a> | <a href=\"" .tep_href_link('pollbooth.php', 'op=list')."\">"._INNE_ANKIETY."</a></td></tr></table></form>";
echo $content;
?>
