campo-sirio/corsi/admin/tutticorsi.php

126 lines
5.7 KiB
PHP
Raw Normal View History

<html>
<head>
<title>Test</title>
<LINK rel="stylesheet" type="text/css" href="stile.css">
<META HTTP-EQUIV="Expires" CONTENT="3">
</head>
<body>
<?php
include("required.php");
include("funzioni.php");
$db = mysql_connect($ip, $user, $password);
mysql_select_db($dataname,$db);
if (isset($test))
{
$criteri = "SELECT $tbl_test.nome, $tbl_domande.idtest, $tbl_domande.domanda, $tbl_domande.id ";
$criteri .= "FROM $tbl_test LEFT JOIN $tbl_domande ON $tbl_test.id = $tbl_domande.idtest WHERE ($tbl_domande.idtest = $test)";
//echo $criteri;
$result = mysql_query($criteri, $db);
if ($myrow = mysql_fetch_array($result))
{
echo "<p>".$myrow[nome]."</p>";
echo "<form name=form1 action=verifica.php target=destra method=post>";
echo "<table align=center border=1 width=80% cellpadding=2 cellspacing=0>";
$n = 1;
do
{
echo "<tr bgcolor=#BF210B><td height=25><font color=white>$n) $myrow[domanda]</font></td></tr>";
$criteri1 = "SELECT * FROM $tbl_risposte WHERE (iddomanda = $myrow[id]) ";
//echo $criteri01;
$result1 = mysql_query($criteri1, $db);
if ($myrow1 = mysql_fetch_array($result1))
{
do
{
if ($riga == true)
{
echo "<tr class=chiaro><td><input type=checkbox name='scelte[]' value=$myrow1[id]>$myrow1[risposta]<br></td></tr>";
$riga = false;
}
else
{
echo "<tr class=scuro><td><input type=checkbox name='scelte[]' value=$myrow1[id]>$myrow1[risposta]<br></td></tr>";
$riga = true;
}
}while ($myrow1 = mysql_fetch_array($result1));
}
$n++;
}while ($myrow = mysql_fetch_array($result));
echo "<tr><td><input type=hidden name=test value=$test><input type=hidden name=verifica></td></tr>";
echo "<tr><td align=center><input type=Reset value=Azzera class=bottoni>&nbsp;<input type=submit value=Correggi class=bottoni></td></tr></table></form>";
}
else
{
echo "<br><br><p class=error>Nessun record trovato!</p><br><br>";
}
}
else
{
// LISTA DEI CORSI
for($x = 1; $x < 2; $x++)
$spazi1 = $spazi1."&nbsp;";
$spazi2 = $spazi1.$spazi1;
$criteri2 = "SELECT * FROM $tbl_corsi ORDER BY nome";
$result2 = mysql_query($criteri2, $db);
if ($myrow2 = mysql_fetch_array($result2))
{
//echo "<table align=center CELLSPACING=0 CELLPADDING=0 BORDER=0>";
do
{
//$criterix = "SELECT * FROM $tbl_lezioni LEFT JOIN $tbl_corsi ON $tbl_lezioni.idcorso = $tbl_corsi.id WHERE ($tbl_corsi.id = ".$myrow2["id"].")";
//$criterix = "SELECT * FROM $tbl_lezioni LEFT JOIN $tbl_moduli ON $tbl_lezioni.idmodulo = $tbl_moduli.id WHERE ($tbl_moduli.id = ".$myrow2["id"].")";
$criterix = "SELECT * FROM $tbl_corsi_righe LEFT JOIN $tbl_corsi ON $tbl_corsi_righe.idcorso = $tbl_corsi.id WHERE ($tbl_corsi.id = ".$myrow2["id"].")";
$resultx = mysql_query($criterix, $db);
$numx = mysql_num_rows($resultx);
if ($numx == 0)
echo "<TABLE CELLSPACING=0 CELLPADDING=0 BORDER=0><TR><TD class=corso><IMG SRC=images/trans.gif WIDTH=5 HEIGHT=21 BORDER=0><IMG SRC=images/n.gif WIDTH=9 HEIGHT=21 BORDER=0></TD><TD class=corso>$spazi1".$myrow2["nome"]."</TD></TR></TABLE>";
//echo "<form action=n_lezione.php><tr><td class=corso>".$myrow2["nome"]."<input type=text size=2 name=idcorso value=".$myrow2["id"]."><input type=submit name=n_lezione value='Aggiungi lezione'></form></td></tr>";
//echo "<TABLE CELLSPACING=0 CELLPADDING=0 BORDER=0><TR><TD class=corso><IMG SRC=images/trans.gif WIDTH=5 HEIGHT=21 BORDER=0><IMG SRC=images/n.gif WIDTH=9 HEIGHT=21 BORDER=0></td><form action=n_lezione.php><td class=corso>".$myrow2["nome"]."<input type=text size=2 name=idcorso value=".$myrow2["id"]."><input type=submit name=n_lezione value='Aggiungi lezione'></form></td></tr></TABLE>";
else
echo "<TABLE CELLSPACING=0 CELLPADDING=0 BORDER=0><TR><TD class=corso><IMG SRC=images/trans.gif WIDTH=5 HEIGHT=21 BORDER=0><IMG SRC=images/m.gif WIDTH=9 HEIGHT=21 BORDER=0></TD><TD class=corso>$spazi1".$myrow2["nome"]."</TD></TR></TABLE>";
//echo "<TABLE CELLSPACING=0 CELLPADDING=0 BORDER=0><TR><TD class=corso><IMG SRC=images/trans.gif WIDTH=5 HEIGHT=21 BORDER=0><IMG SRC=images/m.gif WIDTH=9 HEIGHT=21 BORDER=0></td><form action=n_lezione.php><td class=corso>".$myrow2["nome"]."<input type=text size=2 name=idcorso value=".$myrow2["id"]."><input type=submit name=n_lezione value='Aggiungi lezione'></form></td></tr></TABLE>";
//$criteri3 = "SELECT * FROM $tbl_lezioni WHERE (idmodulo = ".$myrow2["id"].")";
//$criteri3 = "SELECT * FROM $tbl_moduli WHERE (id = ".$myrow2["id"].")";
$criteri3 = "SELECT * FROM $tbl_corsi_righe LEFT JOIN $tbl_moduli ON $tbl_corsi_righe.idmodulo = $tbl_moduli.id WHERE ($tbl_corsi_righe.idcorso = ".$myrow2["id"].")";
$result3 = mysql_query($criteri3, $db);
$num_lez = mysql_num_rows($result3);
if ($myrow3 = mysql_fetch_array($result3))
{
$c = 1;
//echo $num_lez;
do
{
if ($c == $num_lez)
echo "<TABLE CELLSPACING=0 CELLPADDING=0 BORDER=0><TR><TD class=lezione><IMG SRC=images/trans.gif WIDTH=5 HEIGHT=21 BORDER=0><img src='images/l.gif' border=0 WIDTH=12 HEIGHT=21><IMG SRC=images/c.gif WIDTH=5 HEIGHT=21 BORDER=0></TD><TD class=lezione>$spazi1".$myrow3["nome"]."</TD></TR></TABLE>";
else
echo "<TABLE CELLSPACING=0 CELLPADDING=0 BORDER=0><TR><TD class=lezione><IMG SRC=images/trans.gif WIDTH=5 HEIGHT=21 BORDER=0><img src='images/t.gif' border=0 WIDTH=12 HEIGHT=21><IMG SRC=images/c.gif WIDTH=5 HEIGHT=21 BORDER=0></TD><TD class=lezione>$spazi1".$myrow3["nome"]."</TD></TR></TABLE>";
$c++;
}while ($myrow3 = mysql_fetch_array($result3));
}
}while ($myrow2 = mysql_fetch_array($result2));
//echo "</table>";
}
else
{
echo "<br><br><p class=error>Nessun test trovato!</p><br><br>";
}
}
//echo "<p><a href=# onclick=history.back()>Torna</a></p>";
//echo "<p><a href=$PHP_SELF target=destra>Torna</a></p>";
?>
</body>
</html>