Пример #1
0
function ResultEnquete($numero)
{
    require_once $_SESSION['DOCROOT'] . "/classes/class.enquete.php";
    $Enq = new Enquete($numero);
    $tv = $Enq->getVotos("TOTAL");
    $perc = 0.0;
    $vt = 0;
    $wd = "";
    $aux = "";
    for ($x = 1; $x < 11; $x++) {
        if ($Enq->getOpcao($x) != NULL) {
            $vt = $Enq->getVotos($x);
            if ($vt == 0) {
                $perc = 0;
            } else {
                $perc = $vt / $tv * 100;
            }
            $wd = sprintf("%02.1d", 120 * $perc / 100);
            echo '<tr>' . "\n";
            echo '<td width=10%> </td>' . "\n";
            echo '<td width=40%>' . "\n";
            echo $Enq->getOpcao($x) . "\n";
            echo '</td>' . "\n";
            echo '<td width=50%>' . "\n";
            echo "<IMG SRC='imagens/bluebar.gif' WIDTH='" . $wd . "' HEIGHT='9' ALT='" . sprintf("%2.1f", $perc) . "%'>" . "\n";
            $aux = sprintf("%d  (%2.1f%s)", $vt, $perc, '%');
            echo $aux . "\n";
            echo '</td>' . "\n";
            echo '</tr>' . "\n";
        }
    }
    echo "<tr><td colspan=3 align=center><br><br><b>Total de votos: " . $tv . "</td></tr>" . "\n";
}
Пример #2
0
    <tr> <td> 
	  <fieldset  width="430px" style="width:430px;" align="center">
    	<legend><span style="color:green;"><b>Pergunta</b></legend>
		<input size="65" maxlength="50" tabindex="1" name="pergunta" value="<?php 
echo $enq->getPergunta();
?>
">
   	</fieldset> 

	</td> </tr> 
    <tr><td align=right>
  <fieldset  width="430px" style="width:430px;" align="center">
    <legend><span style="color:green;"><b>Opções</b></legend>
	1)<input size="60" maxlength="40" tabindex="2" name="op01" value="<?php 
echo $enq->getOpcao(1);
?>
"><br>
	2)<input size="60" maxlength="40" tabindex="3" name="op02" value="<?php 
echo $enq->getOpcao(2);
?>
"><br>
	3)<input size="60" maxlength="40" tabindex="4" name="op03" value="<?php 
echo $enq->getOpcao(3);
?>
"><br>
	4)<input size="60" maxlength="40" tabindex="5" name="op04" value="<?php 
echo $enq->getOpcao(4);
?>
"><br>
	5)<input size="60" maxlength="40" tabindex="6" name="op05" value="<?php 
Пример #3
0
<table cellpadding="0" cellspacing="0" frame="box" rules="none">
<?php 
$vez = 0;
foreach ($lst as $e) {
    $enq = new Enquete($e['numero']);
    if ($vez != 0) {
        echo '<tr> <td colspan=2>' . "\n";
        echo '<hr style="height: 1px; width: 100%;" align="left">' . "\n";
        echo '</td></tr>' . "\n";
    }
    $nomeform = sprintf("enq%04d", $enq->getCodigo());
    echo ' <form method="post" action="prc_votaenq.php" name="' . $nomeform . '">' . "\n";
    echo '<input type=hidden name="enquete"  value="' . $enq->getCodigo() . '">' . "\n";
    echo "<tr><td colspan=2>" . $enq->getPergunta() . "</td></tr>\n";
    for ($x = 1; $x < 11; $x++) {
        if ($enq->getOpcao($x) != NULL) {
            if ($enq->getTipoResposta() == "U") {
                echo '<tr><td colspan=2> <input type="radio" tabindex="' . $x . '" name="opcoes" value="' . $x . '">' . $enq->getOpcao($x) . '</td></tr>';
            } else {
                echo '<tr><td colspan=2> <input type="checkbox" tabindex="' . $x . '" name="' . sprintf("op%02d", $x) . '" value="S">' . $enq->getOpcao($x) . '</td></tr>';
            }
        }
    }
    echo '<tr><td><a href="javascript:document.' . $nomeform . '.submit();"><b>Votar</a></td>';
    echo '<td align="center"><a href="lst_resenquete.php?enq=' . $enq->getCodigo() . '"><b>Resultado</a></td></tr>';
    echo '</form>';
    $vez = 1;
}
?>
  </table>
</div>