Patch level :
Files correlati : Ricompilazione Demo : [ ] Commento : Versione FAD del 11/10/2001 git-svn-id: svn://10.65.10.50/trunk@9917 c028cbd2-c16b-5b4b-a496-9718f37d4682
117
corsi/admin/Copia di costruisci.php
Executable file
@ -0,0 +1,117 @@
|
||||
<html>
|
||||
<head>
|
||||
<title></title>
|
||||
<LINK rel="stylesheet" type="text/css" href="stile.css">
|
||||
</head>
|
||||
|
||||
<script language="JavaScript">
|
||||
|
||||
function apri()
|
||||
{
|
||||
document.form1.submit();
|
||||
return false;
|
||||
}
|
||||
|
||||
</script>
|
||||
<body>
|
||||
<?php
|
||||
include("required.php");
|
||||
$db = mysql_connect($ip, $user, $password);
|
||||
mysql_select_db($dataname,$db);
|
||||
|
||||
echo "<form name=form1 action=$PHP_SELF method=get>";
|
||||
|
||||
// BOTTONI
|
||||
echo "<table align=center width=60%><tr>";
|
||||
//echo "<td><a href='$PHP_SELF' target=destra onclick='return apri();'><img src=images/apri_n.gif alt=Visualizza border=0 align=absmiddle>Visualizza...</a></td>";
|
||||
echo "<td><a href='modifica.php' target=destra><img src=images/scrivi.gif alt=Modifica border=0 align=absmiddle>Modifica</a></td>";
|
||||
echo "<td><a href='modifica.php' target=destra><img src=images/categoria.gif alt=Nuovo border=0 align=absmiddle>Nuovo</a></td>";
|
||||
echo "<td><a href='$PHP_SELF' target=destra onclick='return apri();'><img src=images/apri_n.gif alt=Visualizza border=0 align=absmiddle>Visualizza</a></td>";
|
||||
echo "<td><a href='modifica.php' target=destra><img src=images/apri_n.gif alt=Visualizza border=0 align=absmiddle>Elimina</a></td>";
|
||||
echo "</tr></table>";
|
||||
|
||||
echo "<table border=0 align=center>";
|
||||
|
||||
if (isset ($modulo) && ($modulo != 0))
|
||||
{
|
||||
// LISTA LEZIONI
|
||||
$filtro = "idmodulo = $modulo";
|
||||
Apri_Select("Lezioni", $tbl_lezioni, $filtro, "lezione", "nome");
|
||||
}
|
||||
elseif (isset ($lezione) && ($lezione != 0))
|
||||
{
|
||||
// LISTA TEST
|
||||
$filtro = "idlezione = $lezione";
|
||||
Apri_Select("Test", $tbl_test, $filtro, "test", "nome");
|
||||
}
|
||||
elseif (isset ($test) && ($test != 0))
|
||||
{
|
||||
// LISTA TEST
|
||||
$filtro = "idtest = $test";
|
||||
Apri_Select("Domande", $tbl_domande, $filtro, "domanda", "domanda");
|
||||
}
|
||||
elseif (isset ($domanda) && ($domanda != 0))
|
||||
{
|
||||
// LISTA TEST
|
||||
$filtro = "iddomanda = $domanda";
|
||||
Apri_Select("Risposte", $tbl_risposte, $filtro, "risposta", "risposta");
|
||||
}
|
||||
else
|
||||
{
|
||||
// LISTA MODULI
|
||||
Apri_Select("Moduli", $tbl_moduli, $filtro, "modulo", "nome");
|
||||
}
|
||||
|
||||
|
||||
function Apri_Select($titolo, $tabella, $filtro, $nome, $campo)
|
||||
{
|
||||
include("required.php");
|
||||
$db = mysql_connect($ip, $user, $password);
|
||||
mysql_select_db($dataname,$db);
|
||||
|
||||
echo "<tr><td><br></td></tr>";
|
||||
echo "<tr><th>$titolo</th></tr>";
|
||||
if (isset($filtro))
|
||||
$criteri = "SELECT * FROM $tabella WHERE $filtro ORDER BY $campo";
|
||||
else
|
||||
$criteri = "SELECT * FROM $tabella ORDER BY $campo";
|
||||
//echo $criteri;
|
||||
$result = mysql_query($criteri, $db);
|
||||
if ($myrow = mysql_fetch_array($result))
|
||||
{
|
||||
////echo "<tr><td align=center><select name=$nome onchange='apri();'>";
|
||||
//echo "<tr><td align=center><select name=$nome>";
|
||||
//echo "<option value=0></option>";
|
||||
do
|
||||
{
|
||||
//if (isset ($nome) && $myrow[id] == $nome)
|
||||
// echo "<option value=$myrow[id] selected>".$myrow[$campo]."</option>";
|
||||
//else
|
||||
// echo "<option value=$myrow[id]>".$myrow[$campo]."</option>";
|
||||
echo "<tr><td>".$myrow[$campo]."</td>";
|
||||
//echo "<td><a href='$PHP_SELF'>Visualizza</a></td>";
|
||||
//echo "<td><a href='$PHP_SELF'>Modifica</a></td>";
|
||||
//echo "<td><a href='$PHP_SELF'>Elimina</a></td></tr>";
|
||||
// IMMAGINI
|
||||
echo "<td><a href=''><img src='images/apri_n.gif' alt=Visualizza border=0></a></td>";
|
||||
echo "<td><a href=''><img src='images/modifica.gif' alt=Modifica border=0></a></td>";
|
||||
echo "<td><a href=''><img src='images/elimina.gif' alt=Elimina border=0></a></td></tr>";
|
||||
|
||||
|
||||
}while ($myrow = mysql_fetch_array($result));
|
||||
//echo "</select></td></tr>";
|
||||
//echo $nome;
|
||||
}
|
||||
else
|
||||
echo "<tr><td><p class=error>Nessun record trovato!</p></td></tr>";
|
||||
}
|
||||
|
||||
//echo "<tr><td><br></td></tr><tr><td align=center><input type=submit name=aggiorna value=Aggiorna class=bottoni></td></tr>";
|
||||
|
||||
echo "</table></form>";
|
||||
|
||||
|
||||
?>
|
||||
|
||||
</body>
|
||||
</html>
|
128
corsi/admin/aggiungi.php
Executable file
@ -0,0 +1,128 @@
|
||||
<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($aggiorna))
|
||||
Aggiorna($tbl, $id, $valori);
|
||||
elseif (isset($tbl) && isset($id))
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
echo "<form name=form1 action=$PHP_SELF method=get>";
|
||||
echo "<table border=0 align=center>";
|
||||
|
||||
|
||||
function Aggiungi($tbl, $id)
|
||||
{
|
||||
include("required.php");
|
||||
$db = mysql_connect($ip, $user, $password);
|
||||
mysql_select_db($dataname,$db);
|
||||
|
||||
$liv = Livello($tbl);
|
||||
if ($liv > 1 )
|
||||
{
|
||||
$tabella = Tabella($liv-1);
|
||||
$chiave = Chiave($liv-1);
|
||||
|
||||
$sql = "INSERT INTO $tabella (".$chiave.") VALUES ($id)";
|
||||
//echo $sql;
|
||||
$sal = mysql_query($sql, $db);
|
||||
if (!$sal)
|
||||
echo "<br><br><p class=error>Salvataggio non riuscito!</p><br><br>";
|
||||
}
|
||||
else
|
||||
echo "<br><br><p class=error>Impossibile aggiungere altri elementi!</p><br><br>";
|
||||
}
|
||||
|
||||
|
||||
function Aggiorna($tabella, $id)
|
||||
{
|
||||
include("required.php");
|
||||
$db = mysql_connect($ip, $user, $password);
|
||||
mysql_select_db($dataname,$db);
|
||||
|
||||
$query = "INSERT INTO $tabella (";
|
||||
for($x = 0; $x < $num_fields-1; $x++)
|
||||
$query .= " ".mysql_field_name($result, $x).",";
|
||||
$query .= " ".mysql_field_name($result, $num_fields-1)."";
|
||||
$query .= ") VALUES ( ";
|
||||
for($x = 0; $x < $num_fields-1; $x++)
|
||||
$query .= " '".$valori[mysql_field_name($result, $x)]."',";
|
||||
$query .= " '".$valori[mysql_field_name($result, $x)]."')";
|
||||
//echo $query;
|
||||
$sal = mysql_query($query, $db);
|
||||
if (!$sal)
|
||||
echo "<br><br><p class=error>Salvataggio non riuscito!</p><br><br>";
|
||||
}
|
||||
|
||||
|
||||
|
||||
function Livello($tabella)
|
||||
{
|
||||
include("required.php");
|
||||
$db = mysql_connect($ip, $user, $password);
|
||||
mysql_select_db($dataname,$db);
|
||||
|
||||
$criteri = "SELECT * FROM $tbl_livelli WHERE tabella = '$tabella'";
|
||||
//echo $criteri;
|
||||
$result = mysql_query($criteri, $db);
|
||||
if ($myrow = mysql_fetch_array($result))
|
||||
return $myrow[livello];
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
function Tabella($livello)
|
||||
{
|
||||
include("required.php");
|
||||
$db = mysql_connect($ip, $user, $password);
|
||||
mysql_select_db($dataname,$db);
|
||||
|
||||
$criteri = "SELECT * FROM $tbl_livelli WHERE livello = $livello";
|
||||
//echo $criteri;
|
||||
$result = mysql_query($criteri, $db);
|
||||
if ($myrow = mysql_fetch_array($result))
|
||||
return $myrow[tabella];
|
||||
else
|
||||
return "";
|
||||
}
|
||||
|
||||
function Chiave($livello)
|
||||
{
|
||||
include("required.php");
|
||||
$db = mysql_connect($ip, $user, $password);
|
||||
mysql_select_db($dataname,$db);
|
||||
|
||||
$criteri = "SELECT * FROM $tbl_livelli WHERE livello = $livello";
|
||||
//echo $criteri;
|
||||
$result = mysql_query($criteri, $db);
|
||||
if ($myrow = mysql_fetch_array($result))
|
||||
return $myrow[chiave];
|
||||
else
|
||||
return "";
|
||||
}
|
||||
|
||||
|
||||
|
||||
?>
|
||||
|
||||
</body>
|
||||
</html>
|
143
corsi/admin/assegna_mod.php
Executable file
@ -0,0 +1,143 @@
|
||||
<html>
|
||||
<head>
|
||||
<title></title>
|
||||
<LINK rel="stylesheet" type="text/css" href="stile.css">
|
||||
</head>
|
||||
|
||||
<script language="JavaScript">
|
||||
|
||||
function apri_moduli()
|
||||
{
|
||||
document.corsi.submit();
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
<body>
|
||||
|
||||
<?php
|
||||
|
||||
include("required.php");
|
||||
|
||||
$db = mysql_connect($ip, $user, $password);
|
||||
mysql_select_db($dataname,$db);
|
||||
|
||||
if (isset ($aggiorna))
|
||||
{
|
||||
if ($corso != 0)
|
||||
{
|
||||
$criteri = "SELECT * FROM $tbl_moduli ";
|
||||
$result = mysql_query($criteri, $db);
|
||||
if ($myrow = mysql_fetch_array($result))
|
||||
{
|
||||
if (isset ($scelte))
|
||||
{
|
||||
do
|
||||
{
|
||||
$criteri1 = "SELECT * FROM $tbl_corsi_righe WHERE idcorso = $corso_s AND idmodulo = $myrow[id]";
|
||||
//echo $criteri1;
|
||||
$result1 = mysql_query($criteri1, $db);
|
||||
if ($myrow1 = mysql_fetch_array($result1))
|
||||
{
|
||||
//if (isset ($scelte))
|
||||
if (!(in_array($myrow[id], $scelte)))
|
||||
{
|
||||
$sql = "DELETE FROM $tbl_corsi_righe WHERE idcorso = $corso_s AND idmodulo = $myrow[id]";
|
||||
$ins = mysql_query($sql,$db);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (in_array($myrow[id], $scelte))
|
||||
{
|
||||
$sql = "INSERT INTO $tbl_corsi_righe (idcorso, idmodulo) VALUES ($corso_s, $myrow[id])";
|
||||
$ins = mysql_query($sql,$db);
|
||||
}
|
||||
}
|
||||
//echo $sql;
|
||||
}while ($myrow = mysql_fetch_array($result));
|
||||
}
|
||||
else
|
||||
{
|
||||
$sql = "DELETE FROM $tbl_corsi_righe WHERE idcorso = $corso_s";
|
||||
$ins = mysql_query($sql,$db);
|
||||
}
|
||||
|
||||
if ($ins)
|
||||
echo "<br><br><p class=success>Aggiornamento effettutato con successo!</p><br><br>";
|
||||
else
|
||||
echo "<br><br><p class=error>Nessun aggiornamento effettutato!</p><br><br>";
|
||||
}
|
||||
else
|
||||
echo "<br><br><p class=error>Nessun modulo disponibile!</p><br><br>";
|
||||
}
|
||||
else
|
||||
echo "<br><br><p class=error>Nessun corso selezionato!</p><br><br>";
|
||||
}
|
||||
else
|
||||
{
|
||||
echo "<form name=corsi action=$PHP_SELF method=get>";
|
||||
echo "<table border=0 align=center>";
|
||||
echo "<tr><th>Corsi</th></tr>";
|
||||
|
||||
// SELECT CORSI
|
||||
$criteri = "SELECT * FROM $tbl_corsi ORDER BY nome";
|
||||
$result = mysql_query($criteri, $db);
|
||||
if ($myrow = mysql_fetch_array($result))
|
||||
{
|
||||
echo "<tr><td align=center><select name=corso onchange='apri_moduli();'>";
|
||||
echo "<option value=0>Seleziona un corso</option>";
|
||||
echo "<option value=0>--------------------------------</option>";
|
||||
do
|
||||
{
|
||||
if (isset ($corso) && $myrow[id] == $corso)
|
||||
echo "<option value=$myrow[id] selected>$myrow[nome]</option>";
|
||||
else
|
||||
echo "<option value=$myrow[id]>$myrow[nome]</option>";
|
||||
|
||||
}while ($myrow = mysql_fetch_array($result));
|
||||
echo "</select></td></tr>";
|
||||
}
|
||||
else
|
||||
echo "<tr><td><p class=error>Nessun Corso trovato!</p></td></tr>";
|
||||
|
||||
|
||||
if (isset ($corso) && ($corso != 0))
|
||||
{
|
||||
// LISTA MODULI
|
||||
echo "<tr><td><br></td></tr><tr><th>Moduli disponibili</th></tr>";
|
||||
$criteri = "SELECT * FROM $tbl_moduli ORDER BY nome";
|
||||
$result = mysql_query($criteri, $db);
|
||||
if ($myrow = mysql_fetch_array($result))
|
||||
{
|
||||
echo "<tr><td><table align=center border=0>";
|
||||
do
|
||||
{
|
||||
$criteri1 = "SELECT * FROM $tbl_corsi_righe ";
|
||||
$criteri1 .= "WHERE ($tbl_corsi_righe.idcorso = $corso) AND ($tbl_corsi_righe.idmodulo = $myrow[id])";
|
||||
//echo $criteri1;
|
||||
$result1 = mysql_query($criteri1, $db);
|
||||
$num_rows = mysql_num_rows($result1);
|
||||
if ($num_rows == 0)
|
||||
echo "<tr><td><input type=Checkbox name='scelte[]' value=$myrow[id]></td><td>".$myrow["nome"]."</td></tr>";
|
||||
else
|
||||
echo "<tr><td><input type=Checkbox name='scelte[]' value=$myrow[id] checked></td><td>".$myrow["nome"]."</td></tr>";
|
||||
|
||||
}while ($myrow = mysql_fetch_array($result));
|
||||
echo "<input type=hidden name=corso_s value=$corso>";
|
||||
echo "</table></td></tr>";
|
||||
}
|
||||
else
|
||||
echo "<tr><td><p class=error>Nessun Utente trovato!</p></td></tr>";
|
||||
|
||||
echo "<tr><td><br></td></tr><tr><td align=center><input type=submit name=aggiorna value=Aggiorna class=bottoni></td></tr>";
|
||||
}
|
||||
|
||||
echo "</table></form>";
|
||||
}
|
||||
|
||||
|
||||
?>
|
||||
|
||||
</body>
|
||||
</html>
|
260
corsi/admin/costruisci.php
Executable file
@ -0,0 +1,260 @@
|
||||
<html>
|
||||
<head>
|
||||
<title></title>
|
||||
<LINK rel="stylesheet" type="text/css" href="stile.css">
|
||||
</head>
|
||||
|
||||
<script language="JavaScript">
|
||||
|
||||
function apri()
|
||||
{
|
||||
document.form1.submit();
|
||||
return false;
|
||||
}
|
||||
|
||||
</script>
|
||||
<body>
|
||||
<?php
|
||||
include("required.php");
|
||||
$db = mysql_connect($ip, $user, $password);
|
||||
mysql_select_db($dataname,$db);
|
||||
|
||||
echo "<form name=form1 action=$PHP_SELF method=get>";
|
||||
echo "<table border=0 align=center>";
|
||||
|
||||
if ($azione == "nuovo")
|
||||
{
|
||||
if ((isset($tbl)) && (isset($id)))
|
||||
Aggiungi($tbl,$id);
|
||||
else
|
||||
NuovoModulo();
|
||||
}
|
||||
else
|
||||
{
|
||||
if (isset ($modulo) && ($modulo != 0))
|
||||
{
|
||||
// LISTA LEZIONI
|
||||
$filtro = "idmodulo = $modulo";
|
||||
//Apri_Select("Lezioni", $tbl_lezioni, $filtro, "lezione", "nome");
|
||||
Apri_Select("Lezioni", $tbl_moduli_righe, $filtro, "lezione", "nome");
|
||||
}
|
||||
elseif (isset ($lezione) && ($lezione != 0))
|
||||
{
|
||||
// LISTA TEST
|
||||
$filtro = "idlezione = $lezione";
|
||||
//Apri_Select("Test", $tbl_test, $filtro, "test", "nome");
|
||||
Apri_Select("Test", $tbl_moduli_righe, $filtro, "test", "nome");
|
||||
}
|
||||
elseif (isset ($test) && ($test != 0))
|
||||
{
|
||||
EseguiTest($test);
|
||||
}
|
||||
else
|
||||
{
|
||||
// LISTA MODULI
|
||||
Apri_Select("Moduli", $tbl_moduli, $filtro, "modulo", "nome");
|
||||
echo "<tr><td><br></td></tr>";
|
||||
echo "<tr><td><a href='$PHP_SELF?azione=nuovo'><img src='images/chiusa.gif' alt=Nuovo border=0>Nuovo</a></td></tr>";
|
||||
}
|
||||
}
|
||||
|
||||
function Apri_Select($titolo, $tabella, $filtro, $nome, $campo)
|
||||
{
|
||||
include("required.php");
|
||||
$db = mysql_connect($ip, $user, $password);
|
||||
mysql_select_db($dataname,$db);
|
||||
|
||||
echo "<tr><td><br></td></tr>";
|
||||
echo "<tr><th>$titolo</th></tr>";
|
||||
if (isset($filtro))
|
||||
$criteri = "SELECT * FROM $tabella WHERE $filtro ORDER BY $campo";
|
||||
else
|
||||
$criteri = "SELECT * FROM $tabella ORDER BY $campo";
|
||||
//echo $criteri;
|
||||
$result = mysql_query($criteri, $db);
|
||||
if ($myrow = mysql_fetch_array($result))
|
||||
{
|
||||
do
|
||||
{
|
||||
echo "<tr>";
|
||||
echo "<td>".$myrow[$campo]."</td>";
|
||||
// IMMAGINI
|
||||
echo "<td><a href='$PHP_SELF?$nome=$myrow[id]'><img src='images/apri_n.gif' alt=Visualizza border=0></a></td>";
|
||||
echo "<td><a href='modifica.php?tbl=$tabella&id=$myrow[id]'><img src='images/modifica.gif' alt=Modifica border=0></a></td>";
|
||||
echo "<td><a href='$PHP_SELF?azione=nuovo&tbl=$tabella&id=$myrow[id]'><img src='images/aggiungi.gif' alt=Aggiungi border=0></a></td>";
|
||||
//echo "<td><a href='$PHP_SELF?$nome=$myrow[id]'><img src='images/elimina.gif' alt=Elimina border=0></a></td></tr>";
|
||||
echo "<td><a href='elimina.php?tbl=$tabella&id=$myrow[id]'><img src='images/elimina.gif' alt=Elimina border=0></a></td></tr>";
|
||||
|
||||
}while ($myrow = mysql_fetch_array($result));
|
||||
//echo "</select></td></tr>";
|
||||
//echo $nome;
|
||||
}
|
||||
|
||||
|
||||
|
||||
else
|
||||
echo "<tr><td><p class=error>Nessun record trovato!</p></td></tr>";
|
||||
}
|
||||
|
||||
function EseguiTest($id)
|
||||
{
|
||||
include("required.php");
|
||||
$db = mysql_connect($ip, $user, $password);
|
||||
mysql_select_db($dataname,$db);
|
||||
|
||||
$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 = $id)";
|
||||
//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 class=rosso><td><a href=''><img src='images/modifica.gif' alt=Modifica border=0></a></td><td height=25><font color=white><b>$n) $myrow[domanda]</b></font></td></tr>";
|
||||
echo "<tr class=rosso>";
|
||||
echo "<td height=25><font color=white>$n) $myrow[domanda]</font></td>";
|
||||
echo "<td><a href=modifica.php?tbl=$tbl_risposte&id=$myrow1[id]'><img src='images/modifica.gif' alt=Modifica border=0></a></td>";
|
||||
//echo "<td><a href=aggiungi.php?tbl=$tbl_risposte&id=$myrow1[id]'><img src='images/aggiungi.gif' alt=Aggiungi border=0></a></td>";
|
||||
echo "<td><a href='$PHP_SELF?azione=nuovo&tbl=$tbl_domande&id=$myrow[id]'><img src='images/aggiungi.gif' alt=Aggiungi border=0></a></td>";
|
||||
echo "<td><a href='elimina.php?tbl=$tbl_domande&id=$myrow[id]'><img src='images/elimina.gif' alt=Elimina border=0></a></td>";
|
||||
echo "</tr>";
|
||||
$criteri1 = "SELECT * FROM $tbl_risposte WHERE (iddomanda = $myrow[id]) ";
|
||||
//echo $criteri01;
|
||||
$result1 = mysql_query($criteri1, $db);
|
||||
if ($myrow1 = mysql_fetch_array($result1))
|
||||
{
|
||||
do
|
||||
{
|
||||
//echo "<td><input type=checkbox name='scelte[]' value=$myrow1[id]>$myrow1[risposta]<br></td></tr>";
|
||||
echo "<tr class=chiaro><td>$myrow1[risposta]</td>";
|
||||
echo "<td><a href=modifica.php?tbl=$tbl_risposte&id=$myrow1[id]'><img src='images/modifica.gif' alt=Modifica border=0></a></td>";
|
||||
echo "<td><a href='elimina.php?tbl=$tbl_risposte&id=$myrow1[id]'><img src='images/elimina.gif' alt=Elimina border=0></a></td>";
|
||||
echo "</tr>";
|
||||
|
||||
}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> <input type=submit value=Correggi class=bottoni></td></tr>";
|
||||
echo "</table></form>";
|
||||
}
|
||||
else
|
||||
{
|
||||
echo "<br><br><p class=error>Nessun record trovato!</p><br><br>";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function Aggiungi($tbl, $id)
|
||||
{
|
||||
include("required.php");
|
||||
$db = mysql_connect($ip, $user, $password);
|
||||
mysql_select_db($dataname,$db);
|
||||
|
||||
$liv = Livello($tbl);
|
||||
if ($liv > 1 )
|
||||
{
|
||||
$tabella = Tabella($liv-1);
|
||||
$chiave = Chiave($liv-1);
|
||||
$campo = Campo($liv-1);
|
||||
|
||||
$sql = "INSERT INTO $tabella (".$chiave.", ".$campo.") VALUES ($id, 'Nuovo elemento')";
|
||||
//echo $sql;
|
||||
$sal = mysql_query($sql, $db);
|
||||
if (!$sal)
|
||||
echo "<br><br><p class=error>Salvataggio non riuscito!</p><br><br>";
|
||||
}
|
||||
else
|
||||
echo "<br><br><p class=error>Impossibile aggiungere altri elementi!</p><br><br>";
|
||||
}
|
||||
|
||||
function NuovoModulo()
|
||||
{
|
||||
include("required.php");
|
||||
$db = mysql_connect($ip, $user, $password);
|
||||
mysql_select_db($dataname,$db);
|
||||
|
||||
$sql = "INSERT INTO $tbl_moduli (nome) VALUES ('Nuovo modulo')";
|
||||
//echo $sql;
|
||||
$sal = mysql_query($sql, $db);
|
||||
if (!$sal)
|
||||
echo "<br><br><p class=error>Salvataggio non riuscito!</p><br><br>";
|
||||
}
|
||||
|
||||
|
||||
function Livello($tabella)
|
||||
{
|
||||
include("required.php");
|
||||
$db = mysql_connect($ip, $user, $password);
|
||||
mysql_select_db($dataname,$db);
|
||||
|
||||
$criteri = "SELECT * FROM $tbl_livelli WHERE tabella = '$tabella'";
|
||||
//echo $criteri;
|
||||
$result = mysql_query($criteri, $db);
|
||||
if ($myrow = mysql_fetch_array($result))
|
||||
return $myrow[livello];
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
function Tabella($livello)
|
||||
{
|
||||
include("required.php");
|
||||
$db = mysql_connect($ip, $user, $password);
|
||||
mysql_select_db($dataname,$db);
|
||||
|
||||
$criteri = "SELECT * FROM $tbl_livelli WHERE livello = $livello";
|
||||
//echo $criteri;
|
||||
$result = mysql_query($criteri, $db);
|
||||
if ($myrow = mysql_fetch_array($result))
|
||||
return $myrow[tabella];
|
||||
else
|
||||
return "";
|
||||
}
|
||||
|
||||
function Campo($livello)
|
||||
{
|
||||
include("required.php");
|
||||
$db = mysql_connect($ip, $user, $password);
|
||||
mysql_select_db($dataname,$db);
|
||||
|
||||
$criteri = "SELECT * FROM $tbl_livelli WHERE livello = $livello";
|
||||
//echo $criteri;
|
||||
$result = mysql_query($criteri, $db);
|
||||
if ($myrow = mysql_fetch_array($result))
|
||||
return $myrow[campo];
|
||||
else
|
||||
return "";
|
||||
}
|
||||
|
||||
|
||||
function Chiave($livello)
|
||||
{
|
||||
include("required.php");
|
||||
$db = mysql_connect($ip, $user, $password);
|
||||
mysql_select_db($dataname,$db);
|
||||
|
||||
$criteri = "SELECT * FROM $tbl_livelli WHERE livello = $livello";
|
||||
//echo $criteri;
|
||||
$result = mysql_query($criteri, $db);
|
||||
if ($myrow = mysql_fetch_array($result))
|
||||
return $myrow[chiave];
|
||||
else
|
||||
return "";
|
||||
}
|
||||
|
||||
//echo "<tr><td><br></td></tr><tr><td align=center><input type=submit name=aggiorna value=Aggiorna class=bottoni></td></tr>";
|
||||
|
||||
echo "</table></form>";
|
||||
|
||||
|
||||
?>
|
||||
|
||||
</body>
|
||||
</html>
|
@ -199,8 +199,12 @@ else
|
||||
|
||||
}
|
||||
//echo "<td><a href=elenco.php?mostra=mod&tbl=$tbl&id=$y[0]>Modifica</a></td><td><a href=elenco.php?mostra=canc&tbl=$tbl&id=$y[0]>Cancella</a></td></tr>";
|
||||
echo "<td><a href=elenco.php?mostra=mod&tbl=$tbl&id=$y[0]>Modifica</a></td>";
|
||||
echo "<td><a href=elenco.php?mostra=canc&tbl=$tbl&id=$y[0]>Cancella</a></td></tr>";
|
||||
//echo "<td><a href=elenco.php?mostra=mod&tbl=$tbl&id=$y[0]>Modifica</a></td>";
|
||||
//echo "<td><a href=elenco.php?mostra=canc&tbl=$tbl&id=$y[0]>Cancella</a></td></tr>";
|
||||
|
||||
echo "<td><a href=elenco.php?mostra=mod&tbl=$tbl&id=$y[0]><img src='images/modifica.gif' alt=Modifica border=0></a></td>";
|
||||
echo "<td><a href=elenco.php?mostra=canc&tbl=$tbl&id=$y[0]><img src='images/elimina.gif' alt=Elimina border=0></a></td></tr>";
|
||||
|
||||
}
|
||||
echo "<tr><td><br></td></tr><tr><td colspan=$num_fields align=left><a href=elenco.php?mostra=delete&tbl=$tbl>Vuota la tabella</a></td></tr>";
|
||||
}
|
||||
|
137
corsi/admin/elimina.php
Executable file
@ -0,0 +1,137 @@
|
||||
<html>
|
||||
<head>
|
||||
<title></title>
|
||||
<LINK rel="stylesheet" type="text/css" href="stile.css">
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<?php
|
||||
include("required.php");
|
||||
$db = mysql_connect($ip, $user, $password);
|
||||
mysql_select_db($dataname,$db);
|
||||
|
||||
if (isset($tbl) && isset($id))
|
||||
Elimina($tbl,$id);
|
||||
else
|
||||
echo "<br><br><p class=error>Impossibile eliminare!</p><br><br>";
|
||||
|
||||
|
||||
function Elimina($tabella, $id)
|
||||
{
|
||||
include("required.php");
|
||||
$db = mysql_connect($ip, $user, $password);
|
||||
mysql_select_db($dataname,$db);
|
||||
|
||||
$vecchi = array();
|
||||
$nuovi = array();
|
||||
|
||||
$sql = "DELETE FROM $tabella WHERE id = $id";
|
||||
//echo $query."<br>";
|
||||
$canc = mysql_query($sql, $db);
|
||||
if (!$canc)
|
||||
echo "<br><br><p class=error>Eliminazione non riuscita!</p><br><br>";
|
||||
|
||||
$vecchi[] = $id;
|
||||
|
||||
$criteri = "SELECT * FROM $tbl_livelli WHERE tabella = '$tabella'";
|
||||
//echo $criteri;
|
||||
$result = mysql_query($criteri, $db);
|
||||
if ($myrow = mysql_fetch_array($result))
|
||||
{
|
||||
$livello = $myrow[livello]-1;
|
||||
//for($x = ($myrow[livello]-1); $x > 0; $x--)
|
||||
while ($livello > 0)
|
||||
{
|
||||
//echo "Livello:".$livello."<br>";
|
||||
//$tbl = Tabella($x);
|
||||
$tbl = Tabella($livello);
|
||||
if ($tbl != "")
|
||||
{
|
||||
Vuota($Vecchi);
|
||||
//for($j = 0; $j < $nuovi[count($nuovi-1)]; $j++)
|
||||
foreach($nuovi as $temp)
|
||||
$vecchi[] = $temp;
|
||||
Vuota($nuovi);
|
||||
|
||||
//foreach($vecchi as $temp)
|
||||
//{
|
||||
// echo "Vecchi:".$temp."<br>";
|
||||
//}
|
||||
|
||||
//for($j = 0; $j < $vecchi[count($vecchi-1)]; $j++)
|
||||
foreach($vecchi as $temp)
|
||||
{
|
||||
//$criterix = "SELECT * FROM $tbl WHERE id = $vecchi[$j]";
|
||||
//$criterix = "SELECT * FROM $tbl WHERE id = $temp";
|
||||
$criterix = "SELECT * FROM $tbl WHERE ".Chiave($livello)." = $temp";
|
||||
//echo $criterix."<br>";
|
||||
$resultx = mysql_query($criterix, $db);
|
||||
if ($myrowx = mysql_fetch_array($resultx))
|
||||
{
|
||||
do
|
||||
{
|
||||
echo $myrowx[id]."<br>";
|
||||
$nuovi[] = $myrowx[id];
|
||||
//$query = "DELETE FROM $tbl WHERE id = $temp";
|
||||
$query = "DELETE FROM $tbl WHERE id = $myrowx[id]";
|
||||
//echo $query."<br>";
|
||||
$el = mysql_query($query, $db);
|
||||
if (!$el)
|
||||
echo "<br><br><p class=error>Eliminazione non completata!</p><br><br>";
|
||||
}while ($myrowx = mysql_fetch_array($resultx));
|
||||
}
|
||||
}
|
||||
}
|
||||
$livello--;
|
||||
}
|
||||
}
|
||||
else
|
||||
echo "<br><br><p class=error>Tabella '$tabella' non trovata!</p><br><br>";
|
||||
}
|
||||
|
||||
|
||||
function Tabella($livello)
|
||||
{
|
||||
include("required.php");
|
||||
$db = mysql_connect($ip, $user, $password);
|
||||
mysql_select_db($dataname,$db);
|
||||
|
||||
$criteri = "SELECT * FROM $tbl_livelli WHERE livello = $livello";
|
||||
//echo $criteri;
|
||||
$result = mysql_query($criteri, $db);
|
||||
if ($myrow = mysql_fetch_array($result))
|
||||
return $myrow[tabella];
|
||||
else
|
||||
return "";
|
||||
}
|
||||
|
||||
function Chiave($livello)
|
||||
{
|
||||
include("required.php");
|
||||
$db = mysql_connect($ip, $user, $password);
|
||||
mysql_select_db($dataname,$db);
|
||||
|
||||
$criteri = "SELECT * FROM $tbl_livelli WHERE livello = $livello";
|
||||
//echo $criteri;
|
||||
$result = mysql_query($criteri, $db);
|
||||
if ($myrow = mysql_fetch_array($result))
|
||||
return $myrow[chiave];
|
||||
else
|
||||
return "";
|
||||
}
|
||||
|
||||
function Vuota($array)
|
||||
{
|
||||
$array = array();
|
||||
|
||||
while (count($array))
|
||||
array_shift($array);
|
||||
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
@ -166,17 +166,20 @@ function abilitato($utente, $corso)
|
||||
return false;
|
||||
}
|
||||
|
||||
// Restituisce il test iniziale del corso
|
||||
function inizio($utente)
|
||||
// Restituisce il test iniziale del modulo
|
||||
function inizio($modulo, $utente)
|
||||
{
|
||||
include("required.php");
|
||||
$db = mysql_connect($ip, $user, $password);
|
||||
mysql_select_db($dataname,$db);
|
||||
|
||||
$criteri = "SELECT $tbl_utenti.id, $tbl_test.posizione, $tbl_test.nome, $tbl_test.id as test ";
|
||||
$criteri .= "FROM (($tbl_corsi LEFT JOIN $tbl_utenti ON $tbl_corsi.id = $tbl_utenti.idcorso) LEFT JOIN $tbl_lezioni ON $tbl_corsi.id = $tbl_lezioni.idcorso) LEFT JOIN $tbl_test ON $tbl_lezioni.id = $tbl_test.idlezione ";
|
||||
$criteri .= "WHERE ($tbl_utenti.id = $utente) AND ($tbl_test.posizione = '$s_inizio')";
|
||||
//echo $criteri;
|
||||
//$criteri = "SELECT $tbl_utenti.id, $tbl_test.posizione, $tbl_test.nome, $tbl_test.id as test ";
|
||||
//$criteri .= "FROM (($tbl_moduli LEFT JOIN $tbl_utenti ON $tbl_corsi.id = $tbl_utenti.idcorso) LEFT JOIN $tbl_lezioni ON $tbl_corsi.id = $tbl_lezioni.idcorso) LEFT JOIN $tbl_test ON $tbl_lezioni.id = $tbl_test.idlezione ";
|
||||
//$criteri .= "WHERE ($tbl_utenti.id = $utente) AND ($tbl_test.posizione = '$s_inizio')";
|
||||
$criteri = "SELECT $tbl_moduli.id, $tbl_test.posizione, $tbl_test.nome, $tbl_test.id as test ";
|
||||
$criteri .= "FROM ($tbl_moduli LEFT JOIN $tbl_lezioni ON $tbl_moduli.id = $tbl_lezioni.idmodulo) LEFT JOIN $tbl_test ON $tbl_lezioni.id = $tbl_test.idlezione ";
|
||||
$criteri .= "WHERE ($tbl_moduli.id = $modulo) AND ($tbl_test.posizione = '$s_inizio')";
|
||||
echo $criteri;
|
||||
$result = mysql_query($criteri,$db);
|
||||
//$num_rows = mysql_num_rows($result);
|
||||
$myrow = mysql_fetch_array($result);
|
||||
@ -195,16 +198,20 @@ function inizio($utente)
|
||||
}
|
||||
|
||||
|
||||
// Restutuisce il test finale del corso se un utente puo' eseguirlo
|
||||
function fine($utente)
|
||||
// Restutuisce il test finale del modulo
|
||||
function fine($utente, $modulo)
|
||||
{
|
||||
include("required.php");
|
||||
$db = mysql_connect($ip, $user, $password);
|
||||
mysql_select_db($dataname,$db);
|
||||
|
||||
$criteri = "SELECT $tbl_utenti.id, $tbl_test.posizione, $tbl_test.nome, $tbl_test.id as test, $tbl_test.idlezione as lezione ";
|
||||
$criteri .= "FROM (($tbl_corsi LEFT JOIN $tbl_utenti ON $tbl_corsi.id = $tbl_utenti.idcorso) LEFT JOIN $tbl_lezioni ON $tbl_corsi.id = $tbl_lezioni.idcorso) LEFT JOIN $tbl_test ON $tbl_lezioni.id = $tbl_test.idlezione ";
|
||||
$criteri .= "WHERE ($tbl_utenti.id = $utente) AND ($tbl_test.posizione = '$s_fine')";
|
||||
//$criteri = "SELECT $tbl_utenti.id, $tbl_test.posizione, $tbl_test.nome, $tbl_test.id as test, $tbl_test.idlezione as lezione ";
|
||||
//$criteri .= "FROM (($tbl_corsi LEFT JOIN $tbl_utenti ON $tbl_corsi.id = $tbl_utenti.idcorso) LEFT JOIN $tbl_lezioni ON $tbl_corsi.id = $tbl_lezioni.idcorso) LEFT JOIN $tbl_test ON $tbl_lezioni.id = $tbl_test.idlezione ";
|
||||
//$criteri .= "WHERE ($tbl_utenti.id = $utente) AND ($tbl_test.posizione = '$s_fine')";
|
||||
|
||||
$criteri = "SELECT $tbl_test.posizione, $tbl_test.id as test, $tbl_test.idlezione as lezione ";
|
||||
$criteri .= "FROM $tbl_lezioni ON $tbl_moduli.id = $tbl_lezioni.idmodulo) LEFT JOIN $tbl_test ON $tbl_lezioni.id = $tbl_test.idlezione ";
|
||||
$criteri .= "WHERE ($tbl_moduli.id = $modulo) AND ($tbl_test.posizione = '$s_fine')";
|
||||
//echo $criteri;
|
||||
$result = mysql_query($criteri,$db);
|
||||
$myrow = mysql_fetch_array($result);
|
||||
@ -329,19 +336,24 @@ function controllo_test($lezione, $utente)
|
||||
}
|
||||
|
||||
|
||||
function fine_abilita($utente)
|
||||
function fine_abilita($utente, $modulo)
|
||||
{
|
||||
include("required.php");
|
||||
$db = mysql_connect($ip, $user, $password);
|
||||
mysql_select_db($dataname,$db);
|
||||
|
||||
$criteri ="SELECT utenti.id, Max(lezioni.progressivo) AS ultimo ";
|
||||
$criteri .= "FROM utenti LEFT JOIN lezioni ON utenti.idcorso = lezioni.idcorso ";
|
||||
$criteri .= "GROUP BY utenti.id HAVING (utenti.id = $utente) ";
|
||||
//echo $criteri;
|
||||
//$criteri ="SELECT utenti.id, Max(lezioni.progressivo) AS ultimo ";
|
||||
//$criteri .= "FROM utenti LEFT JOIN lezioni ON utenti.idcorso = lezioni.idcorso ";
|
||||
//$criteri .= "GROUP BY utenti.id HAVING (utenti.id = $utente) ";
|
||||
|
||||
$criteri ="SELECT Max(lezioni.progressivo) AS ultimo ";
|
||||
//$criteri .= "FROM $tbl_moduli LEFT JOIN $tbl_lezioni ON $tbl_moduli.id = $tbl_lezioni.idmodulo ";
|
||||
//$criteri .= "GROUP BY $tbl_moduli.id HAVING (utenti.id = $utente) ";
|
||||
$criteri .= "FROM $tbl_lezioni WHERE $tbl_lezioni.idmodulo = $modulo ";
|
||||
echo $criteri;
|
||||
$result = mysql_query($criteri,$db);
|
||||
$myrow = mysql_fetch_array($result);
|
||||
//echo $myrow["ultimo"];
|
||||
echo $myrow["ultimo"];
|
||||
$criteri1 = "SELECT $tbl_lezioni.progressivo, $tbl_test.posizione, $tbl_prove.idutente ";
|
||||
$criteri1 .= "FROM ($tbl_lezioni LEFT JOIN $tbl_test ON $tbl_lezioni.id = $tbl_test.idlezione) LEFT JOIN $tbl_prove ON $tbl_test.id = $tbl_prove.idtest ";
|
||||
$criteri1 .= "WHERE ($tbl_lezioni.progressivo = $myrow[ultimo]) AND ($tbl_test.posizione = '$s_dopo') AND ($tbl_prove.idutente = $utente) ";
|
||||
|
BIN
corsi/admin/images/aggiungi.gif
Executable file
After Width: | Height: | Size: 945 B |
BIN
corsi/admin/images/aperta.gif
Executable file
After Width: | Height: | Size: 918 B |
BIN
corsi/admin/images/apri_n.gif
Executable file
After Width: | Height: | Size: 180 B |
BIN
corsi/admin/images/bott_giu.gif
Executable file
After Width: | Height: | Size: 144 B |
BIN
corsi/admin/images/bott_su.gif
Executable file
After Width: | Height: | Size: 137 B |
BIN
corsi/admin/images/categoria.gif
Executable file
After Width: | Height: | Size: 162 B |
BIN
corsi/admin/images/chiusa.gif
Executable file
After Width: | Height: | Size: 921 B |
BIN
corsi/admin/images/elimina.gif
Executable file
After Width: | Height: | Size: 1015 B |
BIN
corsi/admin/images/modifica.gif
Executable file
After Width: | Height: | Size: 891 B |
BIN
corsi/admin/images/nuovo.gif
Executable file
After Width: | Height: | Size: 973 B |
BIN
corsi/admin/images/scrivi.gif
Executable file
After Width: | Height: | Size: 111 B |
@ -1,10 +1,10 @@
|
||||
body{background-color:#707070;}
|
||||
|
||||
p{font-family:Arial; font-size:12pt; text-align:center;}
|
||||
p.titolo{font-family:Arial; font-size:14pt; text-align:center;}
|
||||
/*p.titolo{font-family:Arial; font-size:14pt; text-align:center;}*/
|
||||
th{font-family:Arial; font-size:10pt; background-color:Navy; color:white;}
|
||||
td{font-family:Arial; font-size:9pt; font-weight:bold;}
|
||||
td.titolo{font-family:Arial; font-size:9pt; font-weight:bold;}
|
||||
/*td.titolo{font-family:Arial; font-size:9pt; font-weight:bold;}*/
|
||||
|
||||
A:visited{color:white; text-decoration:none;}
|
||||
/*A:active{color:red; text-decoration:none;}*/
|
||||
|
@ -1,10 +1,10 @@
|
||||
<html>
|
||||
<head>
|
||||
<title>Menu</title>
|
||||
<LINK rel="stylesheet" type="text/css" href="menu.css">
|
||||
<LINK rel="stylesheet" type="text/css" href="stile.css">
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<body class="sinistra">
|
||||
|
||||
<table border=0 cellpadding=0 cellspacing=0>
|
||||
|
||||
@ -18,15 +18,21 @@ mysql_select_db($dataname,$db);
|
||||
$tab_res = mysql_list_tables($dataname, $db);
|
||||
while ($tab_rows = mysql_fetch_row($tab_res))
|
||||
//echo "<tr><td>$tab_rows[0]</td></tr>";
|
||||
echo "<tr><td><a href=elenco.php?tbl=$tab_rows[0] target=destra>$tab_rows[0]</a></td></tr>";
|
||||
echo "<tr><td class=sinistra><a class=sinistra href=elenco.php?tbl=$tab_rows[0] target=destra>$tab_rows[0]</a></td></tr>";
|
||||
|
||||
echo "<tr><td><hr size=3></td></tr>";
|
||||
echo "<tr><td><a href=assegna.php target=destra>Assegna Corsi</a></td></tr>";
|
||||
echo "<tr><td><a href=prove.php target=destra>Prove</a></td></tr>";
|
||||
echo "<tr><td><a href=presenze.php target=destra>Presenze</a></td></tr>";
|
||||
echo "<tr><td class=sinistra><hr size=3></td></tr>";
|
||||
echo "<tr><td class=sinistra><a class=sinistra href=assegna.php target=destra>Assegna Corsi</a></td></tr>";
|
||||
echo "<tr><td class=sinistra><a class=sinistra href=assegna_mod.php target=destra>Assegna Moduli</a></td></tr>";
|
||||
echo "<tr><td class=sinistra><a class=sinistra href=prove.php target=destra>Prove</a></td></tr>";
|
||||
echo "<tr><td class=sinistra><a class=sinistra href=presenze.php target=destra>Presenze</a></td></tr>";
|
||||
//echo "<tr><td><a href=variabili.php target=destra>Variabili</a></td></tr>";
|
||||
echo "<tr><td><hr size=3></td></tr>";
|
||||
echo "<tr><td><a href=tuttitest.php target=destra>Tutti i Test</a></td></tr>";
|
||||
echo "<tr><td class=sinistra><hr size=3></td></tr>";
|
||||
echo "<tr><td class=sinistra><a class=sinistra href=tutticorsi.php target=destra>Corsi attivi</a></td></tr>";
|
||||
echo "<tr><td class=sinistra><a class=sinistra href=tuttitest.php target=destra>Moduli e Test</a></td></tr>";
|
||||
echo "<tr><td class=sinistra><hr size=3></td></tr>";
|
||||
echo "<tr><td class=sinistra><a class=sinistra href=costruisci.php target=destra>Costriusci</a></td></tr>";
|
||||
//echo "<tr><td class=sinistra><a class=sinistra href=tuttitest.php target=destra>Moduli e Test</a></td></tr>";
|
||||
|
||||
|
||||
?>
|
||||
|
||||
|
148
corsi/admin/modifica.php
Executable file
@ -0,0 +1,148 @@
|
||||
<html>
|
||||
<head>
|
||||
<title></title>
|
||||
<LINK rel="stylesheet" type="text/css" href="stile.css">
|
||||
</head>
|
||||
|
||||
<script language="JavaScript">
|
||||
|
||||
function apri()
|
||||
{
|
||||
document.form1.submit();
|
||||
return false;
|
||||
}
|
||||
|
||||
</script>
|
||||
<body>
|
||||
<?php
|
||||
include("required.php");
|
||||
$db = mysql_connect($ip, $user, $password);
|
||||
mysql_select_db($dataname,$db);
|
||||
|
||||
|
||||
if (isset($aggiorna))
|
||||
Aggiorna($tbl, $id, $valori);
|
||||
elseif (isset($tbl) && isset($id))
|
||||
Modifica($tbl,$id);
|
||||
else
|
||||
echo "<br><br><p class=error>Impossibile eliminare!</p><br><br>";
|
||||
|
||||
|
||||
|
||||
echo "<form name=form1 action=$PHP_SELF method=get>";
|
||||
echo "<table border=0 align=center>";
|
||||
|
||||
|
||||
|
||||
function Modifica($tabella, $id)
|
||||
{
|
||||
include("required.php");
|
||||
$db = mysql_connect($ip, $user, $password);
|
||||
mysql_select_db($dataname,$db);
|
||||
|
||||
echo "<p class=titolo>Modifica $tabella<br></p>";
|
||||
$criteri = "SELECT * FROM $tabella WHERE id = $id ";
|
||||
//echo $criteri;
|
||||
$result = mysql_query($criteri, $db);
|
||||
$myrow = mysql_fetch_array($result);
|
||||
$num_fields = mysql_num_fields($result);
|
||||
echo "<form name=form1 action=modifica.php method=post><table border=0 align=center>";
|
||||
//$valori = array();
|
||||
for($x = 0; $x < $num_fields; $x++)
|
||||
{
|
||||
//$tipo = "<td>".mysql_field_type($result, $x)."</td>"; // Visualizza il tipo del campo
|
||||
$t = ereg_replace("'", "", $myrow[mysql_field_name($result, $x)]); // Rimozione delle stringhe del singolo apice
|
||||
$dati = $t;
|
||||
if ($riga == true)
|
||||
{
|
||||
echo "<tr class=chiaro><td>".mysql_field_name($result, $x)."</td>";
|
||||
$riga = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
echo "<tr class=scuro><td>".mysql_field_name($result, $x)."</td>";
|
||||
$riga = true;
|
||||
}
|
||||
if (mysql_field_type($result, $x) == "blob")
|
||||
//if (mysql_field_type($result, $x) == "blob" || mysql_field_len($result, $x) > 30 )
|
||||
echo "$tipo<td><textarea cols=35 rows=3 name='valori[".mysql_field_name($result, $x)."]' wrap=hard>$dati</textarea></td></tr>";
|
||||
else
|
||||
{
|
||||
if (strstr(mysql_field_name($result, $x), "id"))
|
||||
//echo "$tipo</td><td><input type=Text size=50 name='valori[".mysql_field_name($result, $x)."]' value='$dati' ></td></tr>";
|
||||
echo "$tipo</td><td><input type=hidden name='valori[".mysql_field_name($result, $x)."]' value='$dati'>$dati</td></tr>";
|
||||
else
|
||||
echo "$tipo</td><td><input type=text size=50 name='valori[".mysql_field_name($result, $x)."]' value='$dati'></td></tr>";
|
||||
}
|
||||
}
|
||||
echo "<tr><td><br></td></tr>";
|
||||
echo "<tr><td align=center colspan=2><input type=hidden name=tbl value=$tabella><input type=hidden name=id value=$id>";
|
||||
echo "<input type=submit name=aggiorna value=Aggiorna></td></tr>";
|
||||
echo "</table></form>";
|
||||
}
|
||||
|
||||
function Aggiorna($tbl, $id, $valori)
|
||||
{
|
||||
include("required.php");
|
||||
$db = mysql_connect($ip, $user, $password);
|
||||
mysql_select_db($dataname,$db);
|
||||
|
||||
$criteri = "SELECT * FROM $tbl ";
|
||||
//echo $criteri;
|
||||
$result = mysql_query($criteri, $db);
|
||||
$myrow = mysql_fetch_array($result);
|
||||
$num_fields = mysql_num_fields($result);
|
||||
|
||||
$query = "UPDATE $tbl SET ";
|
||||
for($x = 0; $x < $num_fields-1; $x++)
|
||||
$query .= " ".mysql_field_name($result, $x)." = '".$valori[mysql_field_name($result, $x)]."',";
|
||||
$query .= " ".mysql_field_name($result, $num_fields-1)." = '".$valori[mysql_field_name($result, $num_fields-1)]."'";
|
||||
$query .= " WHERE id = $id ";
|
||||
//echo $query;
|
||||
$agg = mysql_query($query, $db);
|
||||
if (!$agg)
|
||||
echo "<br><br><p class=error>Aggiornamento non effettuato!</p><br><br>";
|
||||
}
|
||||
|
||||
function Tabella($livello)
|
||||
{
|
||||
include("required.php");
|
||||
$db = mysql_connect($ip, $user, $password);
|
||||
mysql_select_db($dataname,$db);
|
||||
|
||||
$criteri = "SELECT * FROM $tbl_livelli WHERE livello = $livello";
|
||||
//echo $criteri;
|
||||
$result = mysql_query($criteri, $db);
|
||||
if ($myrow = mysql_fetch_array($result))
|
||||
return $myrow[tabella];
|
||||
else
|
||||
return "";
|
||||
}
|
||||
|
||||
function Chiave($livello)
|
||||
{
|
||||
include("required.php");
|
||||
$db = mysql_connect($ip, $user, $password);
|
||||
mysql_select_db($dataname,$db);
|
||||
|
||||
$criteri = "SELECT * FROM $tbl_livelli WHERE livello = $livello";
|
||||
//echo $criteri;
|
||||
$result = mysql_query($criteri, $db);
|
||||
if ($myrow = mysql_fetch_array($result))
|
||||
return $myrow[chiave];
|
||||
else
|
||||
return "";
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
//echo "<tr><td><br></td></tr><tr><td align=center><input type=submit name=aggiorna value=Aggiorna class=bottoni></td></tr>";
|
||||
|
||||
echo "</table></form>";
|
||||
|
||||
|
||||
?>
|
||||
|
||||
</body>
|
||||
</html>
|
@ -22,9 +22,13 @@ $s_fine = "Fine";
|
||||
// Nomi delle tabelle nel database
|
||||
$tbl_accessi = "accessi";
|
||||
$tbl_corsi = "corsi";
|
||||
$tbl_corsi_righe = "corsi_righe";
|
||||
$tbl_domande = "domande";
|
||||
$tbl_download = "download";
|
||||
$tbl_lezioni = "lezioni";
|
||||
$tbl_livelli = "livelli";
|
||||
$tbl_moduli = "moduli";
|
||||
$tbl_moduli_righe = "moduli_righe";
|
||||
$tbl_prove = "prove";
|
||||
$tbl_risposte = "risposte";
|
||||
$tbl_test = "test";
|
||||
|
@ -1,34 +1,43 @@
|
||||
body{background-color:#fafafa;}
|
||||
body.sinistra{background-color:#707070;}
|
||||
|
||||
p{font-family:Arial; font-size:12pt; text-align:center;}
|
||||
p.titolo{font-family:Arial; font-size:12pt; text-align:center; color:#006699}
|
||||
p.error{font-family:Garamond; font-size:12pt; color:red; font-weight:900; text-align:center;}
|
||||
p.success{font-family:Garamond; font-size:12pt; color:#0099ff; font-weight:900; text-align:center;}
|
||||
p.success{font-family:Garamond; font-size:12pt; color:#0066cc; font-weight:900; text-align:center;}
|
||||
|
||||
tr.chiaro{background-color:#d7d7d7;}
|
||||
tr.scuro{background-color:#bcbcbc;}
|
||||
tr.rosso{background-color:#BF210B;}
|
||||
tr.blu{background-color:#1058BA;}
|
||||
|
||||
th{font-family:Arial; font-size:10pt; background-color:#5a5a5a; color:white;}
|
||||
th{font-family:Tahoma; font-size:8pt; background-color:#5a5a5a; color:white;}
|
||||
|
||||
td{font-family:Arial; font-size:9pt;}
|
||||
|
||||
td.corso{font-size:11pt; font-weight:bold}
|
||||
td.lezione{font-size:11pt;}
|
||||
td{font-family:Tahoma; font-size:8pt;}
|
||||
td.corso{font-size:10pt; font-weight:bold}
|
||||
td.lezione{font-size:10pt;}
|
||||
td.test{font-size:9pt;}
|
||||
|
||||
td.grande{font-family:Arial; font-size:48pt; color:#707070;}
|
||||
td.titolo{font-family:Arial; font-size:12pt;}
|
||||
td.menu{font-family:Arial; font-size:9pt; font-weight:bold; text-align:center; color:white;}
|
||||
td.menug{font-family:Arial; font-size:12pt; font-weight:bold; text-align:center; color:Navy;}
|
||||
|
||||
input{font-family:Arial; font-size:9pt; font-weight:bold;}
|
||||
input.bottoni{font-family:Tahoma; font-size:9pt; font-weight:bold;}
|
||||
td.sinistra{font-family:Arial; font-size:9pt; font-weight:bold;}
|
||||
|
||||
input{font-family:Verdana; font-size:8pt; font-weight:bold;}
|
||||
input.bottoni{font-family:Verdana; font-size:9pt; font-weight:bold;}
|
||||
|
||||
A:visited{color:blue; text-decoration:none;}
|
||||
/*A:active{color:blue; text-decoration:none;}*/
|
||||
A:link{color:blue; text-decoration:none;}
|
||||
A:hover{color:red; text-decoration:underline;}
|
||||
|
||||
A:visited.sinistra{color:#ffffcc; text-decoration:none;}
|
||||
/*A:active{color:blue; text-decoration:none;}*/
|
||||
A:link.sinistra{color:White; text-decoration:none;}
|
||||
A:hover.sinistra{text-decoration:underline;}
|
||||
|
||||
|
||||
option.rosso{color:red}
|
||||
|
||||
|
||||
|
41
corsi/admin/stile_1.css
Executable file
@ -0,0 +1,41 @@
|
||||
body{background-color:#fafafa;}
|
||||
body.sinistra{background-color:#707070;}
|
||||
|
||||
p{font-family:Arial; font-size:12pt; text-align:center;}
|
||||
p.titolo{font-family:Arial; font-size:12pt; text-align:center; color:#006699}
|
||||
p.error{font-family:Garamond; font-size:12pt; color:red; font-weight:900; text-align:center;}
|
||||
p.success{font-family:Garamond; font-size:12pt; color:#0066cc; font-weight:900; text-align:center;}
|
||||
|
||||
tr.chiaro{background-color:#d7d7d7;}
|
||||
tr.scuro{background-color:#bcbcbc;}
|
||||
|
||||
th{font-family:Arial; font-size:10pt; background-color:#5a5a5a; color:white;}
|
||||
|
||||
td{font-family:Arial; font-size:9pt;}
|
||||
td.corso{font-size:11pt; font-weight:bold}
|
||||
td.lezione{font-size:11pt;}
|
||||
td.test{font-size:9pt;}
|
||||
td.grande{font-family:Arial; font-size:48pt; color:#707070;}
|
||||
td.titolo{font-family:Arial; font-size:12pt;}
|
||||
td.menu{font-family:Arial; font-size:9pt; font-weight:bold; text-align:center; color:white;}
|
||||
td.menug{font-family:Arial; font-size:12pt; font-weight:bold; text-align:center; color:Navy;}
|
||||
|
||||
td.sinistra{font-family:Arial; font-size:9pt; font-weight:bold;}
|
||||
|
||||
input{font-family:Verdana; font-size:8pt; font-weight:bold;}
|
||||
input.bottoni{font-family:Verdana; font-size:9pt; font-weight:bold;}
|
||||
|
||||
A:visited{color:blue; text-decoration:none;}
|
||||
/*A:active{color:blue; text-decoration:none;}*/
|
||||
A:link{color:blue; text-decoration:none;}
|
||||
A:hover{color:red; text-decoration:underline;}
|
||||
|
||||
A:visited.sinistra{color:#ffffcc; text-decoration:none;}
|
||||
/*A:active{color:blue; text-decoration:none;}*/
|
||||
A:link.sinistra{color:White; text-decoration:none;}
|
||||
A:hover.sinistra{text-decoration:underline;}
|
||||
|
||||
|
||||
option.rosso{color:red}
|
||||
|
||||
|
125
corsi/admin/tutticorsi.php
Executable file
@ -0,0 +1,125 @@
|
||||
<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> <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." ";
|
||||
$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>
|
@ -65,24 +65,33 @@ else
|
||||
$spazi1 = $spazi1." ";
|
||||
$spazi2 = $spazi1.$spazi1;
|
||||
|
||||
$criteri2 = "SELECT * FROM $tbl_corsi ORDER BY nome";
|
||||
$criteri2 = "SELECT * FROM $tbl_moduli 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_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_lezioni LEFT JOIN $tbl_moduli_righe ON $tbl_lezioni.id = $tbl_moduli_righe.idlezione WHERE ($tbl_moduli_righe.idmodulo = ".$myrow2["id"].")";
|
||||
//$criterix = "SELECT * FROM $tbl_moduli_righe LEFT JOIN $tbl_moduli_righe ON $tbl_lezioni.id = $tbl_moduli_righe.idlezione WHERE ($tbl_moduli_righe.idmodulo = ".$myrow2["id"].")";
|
||||
//echo $criterix;
|
||||
$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 "<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=hidden size=2 name=idcorso value=".$myrow2["id"]."><input type=image src=images/n.gif name=n_lezione value='Aggiungi lezione'></form></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/n.gif WIDTH=9 HEIGHT=21 BORDER=0></td><form action=n_lezione.php><td class=corso>".$myrow2["nome"]."<input type=hidden size=2 name=idcorso value=".$myrow2["id"]."><img src=images/scrivi.gif alt='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=hidden 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 (idcorso = ".$myrow2["id"].")";
|
||||
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>";
|
||||
//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=hidden size=2 name=idcorso value=".$myrow2["id"]."><img src=images/scrivi.gif alt='Aggiungi lezione'></form></td></tr></TABLE>";
|
||||
|
||||
//$criteri3 = "SELECT * FROM $tbl_lezioni WHERE (idmodulo = ".$myrow2["id"].")";
|
||||
$criteri3 = "SELECT * FROM $tbl_lezioni LEFT JOIN $tbl_moduli_righe ON $tbl_lezioni.id = $tbl_moduli_righe.idlezione WHERE ($tbl_moduli_righe.idmodulo = ".$myrow2["id"].")";
|
||||
//echo $criteri3;
|
||||
$result3 = mysql_query($criteri3, $db);
|
||||
$num_lez = mysql_num_rows($result3);
|
||||
if ($myrow3 = mysql_fetch_array($result3))
|
||||
@ -91,33 +100,27 @@ else
|
||||
//echo $num_lez;
|
||||
do
|
||||
{
|
||||
$criteriy = "SELECT * FROM $tbl_test LEFT JOIN $tbl_lezioni ON $tbl_test.idlezione = $tbl_lezioni.id WHERE ($tbl_lezioni.id = ".$myrow3["id"].")";
|
||||
//$criteriy = "SELECT * FROM $tbl_test LEFT JOIN $tbl_lezioni ON $tbl_test.idlezione = $tbl_lezioni.id WHERE ($tbl_lezioni.id = ".$myrow3["id"].")";
|
||||
$criteriy = "SELECT * FROM $tbl_test LEFT JOIN $tbl_moduli_righe ON $tbl_test.id = $tbl_moduli_righe.idtest WHERE ($tbl_moduli_righe.idlezione = ".$myrow3["id"].")";
|
||||
$resulty = mysql_query($criteriy, $db);
|
||||
$numy = mysql_num_rows($resulty);
|
||||
if ($myrow3["percorso"] == "" )
|
||||
$percorso = "tuttitest.php";
|
||||
else
|
||||
$percorso = $myrow3["percorso"];
|
||||
|
||||
if ($numy == 0)
|
||||
{
|
||||
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/n.gif WIDTH=9 HEIGHT=21 BORDER=0></TD><TD class=lezione>$spazi1".$myrow3["nome"]."</TD></TR></TABLE>";
|
||||
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/n.gif WIDTH=9 HEIGHT=21 BORDER=0></TD><TD class=lezione>$spazi1<a href='$percorso' target=destra>".$myrow3["nome"]."</a></TD></TR></TABLE>";
|
||||
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/n.gif WIDTH=9 HEIGHT=21 BORDER=0></TD><TD class=lezione>$spazi1<a href='".$myrow3["percorso"]."' target=new>".$myrow3["nome"]."</a></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/n.gif WIDTH=9 HEIGHT=21 BORDER=0></TD><TD class=lezione>$spazi1".$myrow3["nome"]."</TD></TR></TABLE>";
|
||||
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/n.gif WIDTH=9 HEIGHT=21 BORDER=0></TD><TD class=lezione>$spazi1<a href='$percorso' target=destra>".$myrow3["nome"]."</a></TD></TR></TABLE>";
|
||||
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/n.gif WIDTH=9 HEIGHT=21 BORDER=0></TD><TD class=lezione>$spazi1<a href='".$myrow3["percorso"]."' target=new>".$myrow3["nome"]."</a></TD></TR></TABLE>";
|
||||
}
|
||||
else
|
||||
{
|
||||
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/m.gif WIDTH=9 HEIGHT=21 BORDER=0></TD><TD class=lezione>$spazi1".$myrow3["nome"]."</TD></TR></TABLE>";
|
||||
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/m.gif WIDTH=9 HEIGHT=21 BORDER=0></TD><TD class=lezione>$spazi1<a href='$percorso' target=destra>".$myrow3["nome"]."</a></TD></TR></TABLE>";
|
||||
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/m.gif WIDTH=9 HEIGHT=21 BORDER=0></TD><TD class=lezione>$spazi1<a href='".$myrow3["percorso"]."' target=new>".$myrow3["nome"]."</a></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/m.gif WIDTH=9 HEIGHT=21 BORDER=0></TD><TD class=lezione>$spazi1".$myrow3["nome"]."</TD></TR></TABLE>";
|
||||
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/m.gif WIDTH=9 HEIGHT=21 BORDER=0></TD><TD class=lezione>$spazi1<a href='$percorso' target=destra>".$myrow3["nome"]."</a></TD></TR></TABLE>";
|
||||
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/m.gif WIDTH=9 HEIGHT=21 BORDER=0></TD><TD class=lezione>$spazi1<a href='".$myrow3["percorso"]."' target=new>".$myrow3["nome"]."</a></TD></TR></TABLE>";
|
||||
}
|
||||
$criteri4 = "SELECT * FROM $tbl_test WHERE (idlezione = ".$myrow3["id"].")";
|
||||
//$criteri4 = "SELECT * FROM $tbl_test WHERE (idlezione = ".$myrow3["id"].")";
|
||||
$criteri4 = "SELECT * FROM $tbl_test LEFT JOIN $tbl_moduli_righe ON $tbl_test.id = $tbl_moduli_righe.idtest WHERE ($tbl_moduli_righe.idlezione = ".$myrow3["id"].")";
|
||||
$result4 = mysql_query($criteri4, $db);
|
||||
$num_test = mysql_num_rows($result4);
|
||||
if ($myrow4 = mysql_fetch_array($result4))
|
||||
@ -157,7 +160,7 @@ else
|
||||
|
||||
//echo "<p><a href=# onclick=history.back()>Torna</a></p>";
|
||||
|
||||
echo "<p><a href=$PHP_SELF target=destra>Torna</a></p>";
|
||||
//echo "<p><a href=$PHP_SELF target=destra>Torna</a></p>";
|
||||
|
||||
?>
|
||||
|
||||
|
125
corsi/admin/tuttitest_o.php
Executable file
@ -0,0 +1,125 @@
|
||||
<html>
|
||||
<head>
|
||||
<title>Test</title>
|
||||
<LINK rel="stylesheet" type="text/css" href="stile.css">
|
||||
<META HTTP-EQUIV="Expires" CONTENT="3">
|
||||
</head>
|
||||
|
||||
<script language="javascript">
|
||||
function nuovo()
|
||||
{
|
||||
document.form1.submit();
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
<body>
|
||||
|
||||
<?php
|
||||
|
||||
include("required.php");
|
||||
include("funzioni.php");
|
||||
|
||||
$db = mysql_connect($ip, $user, $password);
|
||||
mysql_select_db($dataname,$db);
|
||||
|
||||
if (isset($test)) // Visualizza il test da provare
|
||||
{
|
||||
$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> <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 // Visualizza lo schema dei corsi
|
||||
{
|
||||
//$criteri2 = "SELECT $tbl_corsi.nome as corso, $tbl_lezioni.nome as lezione, $tbl_test.nome as test ";
|
||||
//$criteri2 .= "FROM ($tbl_corsi LEFT JOIN $tbl_lezioni ON $tbl_corsi.id = $tbl_lezioni.idcorso) LEFT JOIN $tbl_test ON $tbl_lezioni.id = $tbl_test.idlezione ";
|
||||
for($x = 0; $x < 10; $x++)
|
||||
$spazi1 = $spazi1." ";
|
||||
|
||||
$spazi2 = $spazi1.$spazi1;
|
||||
|
||||
$criteri2 = "SELECT * FROM $tbl_corsi ORDER BY nome";
|
||||
$result2 = mysql_query($criteri2, $db);
|
||||
if ($myrow2 = mysql_fetch_array($result2))
|
||||
{
|
||||
echo "<table border=0 align=center>";
|
||||
do
|
||||
{
|
||||
//echo "<tr><td class=corso>".$myrow2["nome"]."</td></tr>";
|
||||
//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 "<form action=n_lezione.php><tr><td class=corso>".$myrow2["nome"]."<input type=text size=2 name=idcorso value=".$myrow2["id"]."><img src='images/scrivi.gif' alt='Aggiungi Lezioni'></form></td></tr>";
|
||||
$criteri3 = "SELECT * FROM $tbl_lezioni WHERE (idcorso = ".$myrow2["id"].")";
|
||||
$result3 = mysql_query($criteri3, $db);
|
||||
if ($myrow3 = mysql_fetch_array($result3))
|
||||
{
|
||||
do
|
||||
{
|
||||
echo "<tr><td class=lezione>$spazi1".$myrow3["nome"]."</td></tr>";
|
||||
$criteri4 = "SELECT * FROM $tbl_test WHERE (idlezione = ".$myrow3["id"].")";
|
||||
$result4 = mysql_query($criteri4, $db);
|
||||
if ($myrow4 = mysql_fetch_array($result4))
|
||||
{
|
||||
do
|
||||
{
|
||||
//echo "<tr class=chiaro><td><a href=tuttitest.php?test=$myrow4[id] target=destra>".$myrow4["nome"]."</a></td></tr>";
|
||||
echo "<tr class=test><td><a href=tuttitest.php?test=$myrow4[id] target=destra>$spazi2".$myrow4["nome"]."</a></td></tr>";
|
||||
}while ($myrow4 = mysql_fetch_array($result4));
|
||||
}
|
||||
}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>
|
@ -31,7 +31,7 @@ if ($myrow = mysql_fetch_array($result))
|
||||
$false = 0;
|
||||
$indovinate = 0;
|
||||
$sbagliate = 0;
|
||||
echo "<tr bgcolor=#1058BA><td width=5% bgcolor=#D3DCED><br></td><td height=25><font color=white>$n) $myrow[domanda]</font></td></tr>";
|
||||
echo "<tr class=blu><td width=5% bgcolor=#D3DCED><br></td><td height=25><font color=white>$n) $myrow[domanda]</font></td></tr>";
|
||||
//$criteri1 = "SELECT * FROM $tbl_risposte WHERE (iddomanda = $myrow[id]) AND (visibile = 'true') ";
|
||||
$criteri1 = "SELECT * FROM $tbl_risposte WHERE (iddomanda = $myrow[id]) ";
|
||||
//echo $criteri1;
|
||||
|
@ -29,7 +29,8 @@ if ($logout)
|
||||
include("funzioni.php");
|
||||
|
||||
echo "<table width=100% align='center' border=0 cellpadding=0 cellspacing=0>";
|
||||
echo "<tr bgcolor=Navy><td class=menu>Nome utente</td><td class=menu>Data e ora</td><td><br></td><td><br></td></tr>";
|
||||
//echo "<tr bgcolor=Navy><td class=menu>Nome utente</td><td class=menu>Data e ora</td><td><br></td><td><br></td></tr>";
|
||||
echo "<tr class=menu><td class=menu>Nome utente</td><td class=menu>Data e ora</td><td><br></td><td><br></td></tr>";
|
||||
|
||||
$myrow = generale($validato);
|
||||
//$oggi = date("d m Y, H:i");
|
||||
@ -63,9 +64,11 @@ switch ($mese)
|
||||
break;
|
||||
}
|
||||
|
||||
//$oggi = date("d")." ".$mese." ".date("Y")." - ".date("H:i");
|
||||
$oggi = date("d")." ".$mese." ".date("Y")." - ".date("H:i");
|
||||
|
||||
echo "<tr bgcolor=#EEEEEE><td class=menug>".$myrow["nome"]." ".$myrow["cognome"]."</td><td class=menug>$oggi</td>";
|
||||
//echo "<tr bgcolor=#EEEEEE><td class=menug>".$myrow["nome"]." ".$myrow["cognome"]."</td><td class=menug>$oggi</td>";
|
||||
echo "<tr class=menug><td class=menug>".$myrow["nome"]." ".$myrow["cognome"]."</td><td class=menug>$oggi</td>";
|
||||
echo "<td class=menug><a href=logout.php?login=$login>Logout</a></td><td class=menug><a href=presenze.php>Presenze</a></td></tr>";
|
||||
echo "</table>";
|
||||
|
||||
@ -73,37 +76,70 @@ include("required.php");
|
||||
$db = mysql_connect($ip, $user, $password);
|
||||
mysql_select_db($dataname,$db);
|
||||
|
||||
$criteri = "SELECT * FROM $tbl_corsi ORDER BY nome";
|
||||
//echo $criteri;
|
||||
$result = mysql_query($criteri, $db);
|
||||
if ($myrow = mysql_fetch_array($result))
|
||||
{
|
||||
echo "<br><br><table align=center border=1 cellpadding=2 cellspacing=0>";
|
||||
echo "<tr><th colspan=3>Corsi disponibili</th></tr>";
|
||||
do
|
||||
{
|
||||
$immagine = "<td><br></td>";
|
||||
if (file_exists($myrow["immagine"])) $immagine = "<td align=center><a href=lezioni.php?corso=".$myrow["id"]."><img src=".$myrow["immagine"]." border=0></a></td>";
|
||||
|
||||
$descr = "<td><br></td>";
|
||||
if ($myrow["descrizione"] != "") $descr = "<td>".$myrow["descrizione"]."</td>";
|
||||
if ($riga == true)
|
||||
{
|
||||
echo "<tr bgcolor=#BBBBBB align=center>$immagine<td><a href=lezioni.php?corso=".$myrow["id"].">".$myrow["nome"]."</a></td>$descr</tr>";
|
||||
$riga = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
echo "<tr bgcolor=#DDDDDD align=center>$immagine<td><a href=lezioni.php?corso=".$myrow["id"].">".$myrow["nome"]."</a></td>$descr</tr>";
|
||||
$riga = true;
|
||||
}
|
||||
}
|
||||
while ($myrow = mysql_fetch_array($result));
|
||||
echo "</table>";
|
||||
}
|
||||
else
|
||||
echo "<br><br><p class=error>Nessun record trovato!</p><br><br>";
|
||||
$corso = corso($validato);
|
||||
//echo $corso;
|
||||
|
||||
if ($corso != "")
|
||||
{
|
||||
if ($corso == 0)
|
||||
$criteri = "SELECT * FROM $tbl_corsi";
|
||||
else
|
||||
$criteri = "SELECT * FROM $tbl_corsi WHERE id = $corso ";
|
||||
|
||||
$result = mysql_query($criteri, $db);
|
||||
if ($myrow = mysql_fetch_array($result))
|
||||
{
|
||||
do
|
||||
{
|
||||
echo "<br><br><table align=center border=1 cellpadding=2 cellspacing=0>";
|
||||
echo "<tr><th colspan=3>".$myrow["nome"]."</th></tr>";
|
||||
|
||||
$criteri1 = "SELECT $tbl_moduli.id, $tbl_moduli.nome, $tbl_moduli.descrizione, $tbl_moduli.immagine ";
|
||||
$criteri1 .= "FROM $tbl_corsi_righe LEFT JOIN $tbl_moduli ON $tbl_corsi_righe.idmodulo = $tbl_moduli.id ";
|
||||
if ($corso == 0)
|
||||
$criteri1 .= "WHERE $tbl_corsi_righe.idcorso = $myrow[id]";
|
||||
else
|
||||
$criteri1 .= "WHERE $tbl_corsi_righe.idcorso = $corso";
|
||||
|
||||
//echo $criteri;
|
||||
$result1 = mysql_query($criteri1, $db);
|
||||
if ($myrow1 = mysql_fetch_array($result1))
|
||||
{
|
||||
echo "<tr><td colspan=3 class=titolo>Moduli</th></tr>";
|
||||
do
|
||||
{
|
||||
$immagine = "<td><br></td>";
|
||||
if (file_exists($myrow1["immagine"])) $immagine = "<td align=center><a href=lezioni.php?modulo=".$myrow1["id"]."><img src=".$myrow1["immagine"]." border=0></a></td>";
|
||||
|
||||
$descr = "<td><br></td>";
|
||||
if ($myrow1["descrizione"] != "") $descr = "<td>".$myrow1["descrizione"]."</td>";
|
||||
if ($riga == true)
|
||||
{
|
||||
//echo "<tr bgcolor=#BBBBBB align=center>$immagine<td><a href=lezioni.php?corso=".$myrow["id"].">".$myrow["nome"]."</a></td>$descr</tr>";
|
||||
echo "<tr class=scuro align=center>$immagine<td><a href=lezioni.php?modulo=".$myrow1["id"].">".$myrow1["nome"]."</a></td>$descr</tr>";
|
||||
$riga = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
//echo "<tr bgcolor=#DDDDDD align=center>$immagine<td><a href=lezioni.php?corso=".$myrow["id"].">".$myrow["nome"]."</a></td>$descr</tr>";
|
||||
echo "<tr class=chiaro align=center>$immagine<td><a href=lezioni.php?modulo=".$myrow1["id"].">".$myrow1["nome"]."</a></td>$descr</tr>";
|
||||
$riga = true;
|
||||
}
|
||||
}
|
||||
while ($myrow1 = mysql_fetch_array($result1));
|
||||
}
|
||||
else
|
||||
//echo "<br><br><p class=error>Nessun modulo trovato!</p><br><br>";
|
||||
echo "<tr><td colspan=3><p class=error>Nessun modulo trovato!</p><td><tr>";
|
||||
echo "</table>";
|
||||
}
|
||||
while ($myrow = mysql_fetch_array($result));
|
||||
}
|
||||
}
|
||||
else
|
||||
//echo "<br><br><p class=error>L'utente non è abilitato a nessun corso!</p><br><br>";
|
||||
echo "<tr><td colspan=3><p class=error>L'utente non è abilitato a nessun corso!</p><td><tr>";
|
||||
|
||||
|
||||
?>
|
||||
|
||||
|
@ -25,27 +25,19 @@ if (isset ($lezione) && ($lezione != 0))
|
||||
//echo $criteri;
|
||||
$result = mysql_query($criteri, $db);
|
||||
if ($myrow = mysql_fetch_array($result))
|
||||
{
|
||||
//echo $myrow["percorso"];
|
||||
header ("location: $myrow[percorso]");
|
||||
}
|
||||
else
|
||||
{
|
||||
//echo "<br><br><p class=error>Nessun record trovato!</p><br><br>";
|
||||
$mess = "Nessun record trovato!";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
//echo "<br><br><p class=error>Errore durante il download. Riprovare!</p><br><br>";
|
||||
$mess = "Errore durante il download. Riprovare!";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
//echo "<br><br><p class=error>Prima di scaricare questa lezione occorre effettuare il test della lezione precedente!</p><br><br>";
|
||||
$mess = "Prima di scaricare la lezione occorre effettuare il test iniziale oppure il test finale della lezione precedente!";
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
|
@ -1,6 +1,5 @@
|
||||
<?php
|
||||
|
||||
|
||||
// Controlla il login di un utente
|
||||
function validazione($username, $psw)
|
||||
{
|
||||
@ -28,7 +27,7 @@ function corso($utente)
|
||||
if ($myrow)
|
||||
return $myrow["idcorso"];
|
||||
else
|
||||
return 0;
|
||||
return "";
|
||||
}
|
||||
|
||||
// Restituisce tutte le informazioni su un utente
|
||||
@ -87,14 +86,14 @@ function differenza($periodo1, $periodo2)
|
||||
$diff = $diff + (($giorno2-$giorno1)*3600*24);
|
||||
$ore = $diff;
|
||||
$O = 0;
|
||||
while ($ore > 3600):
|
||||
while ($ore >= 3600):
|
||||
$ore = ($ore-3600);
|
||||
$O = $O + 1;
|
||||
endwhile;
|
||||
$resto = ($diff-($O*3600));
|
||||
$min = $resto;
|
||||
$M = 0;
|
||||
while ($min > 60):
|
||||
while ($min >= 60):
|
||||
$min = ($min-60);
|
||||
$M = $M + 1;
|
||||
endwhile;
|
||||
@ -148,7 +147,7 @@ function somma_tempo($tempo1, $tempo2)
|
||||
return $somma;
|
||||
}
|
||||
|
||||
// Stabilisce se l'utente e' abilitato a eseguire le lezioni di un corso
|
||||
// Stabilisce se l'utente e' abilitato a eseguire i moduli di un corso
|
||||
function abilitato($utente, $corso)
|
||||
{
|
||||
include("required.php");
|
||||
@ -168,32 +167,32 @@ function abilitato($utente, $corso)
|
||||
return false;
|
||||
}
|
||||
|
||||
// Restituisce il test iniziale del corso
|
||||
function inizio($utente, $corso)
|
||||
// Restituisce 0 se non si deve effettuare il test iniziale del modulo altrimenti restituticse l'ID
|
||||
function inizio($modulo, $utente)
|
||||
{
|
||||
include("required.php");
|
||||
|
||||
$db = mysql_connect($ip, $user, $password);
|
||||
mysql_select_db($dataname,$db);
|
||||
|
||||
$criteri = "SELECT $tbl_utenti.id, $tbl_test.posizione, $tbl_test.nome, $tbl_test.id as test ";
|
||||
$criteri .= "FROM (($tbl_corsi LEFT JOIN $tbl_utenti ON $tbl_corsi.id = $tbl_utenti.idcorso) LEFT JOIN $tbl_lezioni ON $tbl_corsi.id = $tbl_lezioni.idcorso) LEFT JOIN $tbl_test ON $tbl_lezioni.id = $tbl_test.idlezione ";
|
||||
$criteri .= "WHERE ($tbl_utenti.id = $utente) AND ($tbl_test.posizione = '$s_inizio')";
|
||||
//$criteri = "SELECT moduli_righe.idmodulo, moduli_righe.iniziale, moduli_righe.idtest, prove.idutente ";
|
||||
//$criteri .= "FROM moduli_righe INNER JOIN prove ON moduli_righe.idtest = prove.idtest ";
|
||||
//$criteri .= "WHERE ($tbl_moduli.id = $modulo) AND (prove.idutente = $utente) AND (moduli_righe.iniziale = $s_vero)";
|
||||
|
||||
$criteri = "SELECT * FROM moduli_righe WHERE (idmodulo = $modulo) AND (iniziale = $s_vero)";
|
||||
//echo $criteri;
|
||||
$result = mysql_query($criteri,$db);
|
||||
//$num_rows = mysql_num_rows($result);
|
||||
$myrow = mysql_fetch_array($result);
|
||||
if ($myrow)
|
||||
//if ($num_rows != 0)
|
||||
if ($myrow = mysql_fetch_array($result))
|
||||
{
|
||||
$criteri1 = "SELECT * FROM $tbl_prove WHERE (idutente = $utente) AND (idtest = $myrow[test])";
|
||||
//echo $criteri1;
|
||||
$criteri1 = "SELECT prove.idutente, prove.idtest FROM prove WHERE (prove.idutente = $utente) AND (prove.idtest = $myrow[idtest])";
|
||||
$result1 = mysql_query($criteri1,$db);
|
||||
$myrow1 = mysql_fetch_array($result1);
|
||||
if ($myrow1)
|
||||
if ($myrow1 = mysql_fetch_array($result1))
|
||||
return 0;
|
||||
else
|
||||
return $myrow[test];
|
||||
return $myrow[idtest];
|
||||
}
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@ -224,129 +223,148 @@ function fine($utente)
|
||||
}
|
||||
|
||||
|
||||
// Da il permesso di scaricare una lezione
|
||||
// Verificando, qualora fosse abilitato $test_prima, che sia stato effettuato il test iniziale della lezione,
|
||||
// Altrimenti che sia stato effettuato il test finale della lezione precedente.
|
||||
// da il permesso di scaricare una lezione
|
||||
// se test_prima controllando che sia stato effettuato il test iniziale
|
||||
// altrimenti che sia stato effettuato il test finale della lezione precedente.
|
||||
function controllo_download($lezione, $utente)
|
||||
{
|
||||
include("required.php");
|
||||
$db = mysql_connect($ip, $user, $password);
|
||||
mysql_select_db($dataname,$db);
|
||||
if ($test_prima == 'Vero')
|
||||
|
||||
$modulo = getvar($tbl_moduli_righe, "idmodulo", "idlezione =".$lezione);
|
||||
$t_prima = getvar($tbl_moduli, "test_prima", "id=".$modulo);
|
||||
|
||||
if ($t_prima == $s_vero)
|
||||
{
|
||||
$criteri = "SELECT * FROM $tbl_lezioni WHERE (id = $lezione) ";
|
||||
//echo $criteri;
|
||||
$result = mysql_query($criteri,$db);
|
||||
$myrow = mysql_fetch_array($result);
|
||||
if ($myrow[progressivo] != 0)
|
||||
$test = getvar($tbl_moduli_righe, "idtest", "idlezione = ".$lezione." AND posizione = ".$s_prima);
|
||||
echo "qui";
|
||||
if ($test > 0)
|
||||
{
|
||||
if ($myrow[progressivo] >= 1)
|
||||
{
|
||||
//$cur = $myrow[progressivo] - 1;
|
||||
$cur = $myrow[progressivo];
|
||||
$criteri1 = "SELECT $tbl_lezioni.progressivo, $tbl_lezioni.nome, $tbl_test.nome, $tbl_test.posizione, $tbl_prove.id ";
|
||||
$criteri1 .= "FROM ($tbl_lezioni LEFT JOIN $tbl_test ON $tbl_lezioni.id = $tbl_test.idlezione) LEFT JOIN $tbl_prove ON $tbl_test.id = $tbl_prove.idtest ";
|
||||
$criteri1 .= "WHERE ($tbl_lezioni.progressivo = $cur) AND ($tbl_test.posizione = '$s_prima') AND ($tbl_prove.idutente = $utente)";
|
||||
//echo $criteri1;
|
||||
$result1 = mysql_query($criteri1,$db);
|
||||
if ($myrow1 = mysql_fetch_array($result1))
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
}
|
||||
else
|
||||
if (test_effettuato($test, $utente))
|
||||
return true;
|
||||
}
|
||||
else
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
$criteri = "SELECT * FROM $tbl_lezioni WHERE (id = $lezione) ";
|
||||
//echo $criteri;
|
||||
$result = mysql_query($criteri,$db);
|
||||
$myrow = mysql_fetch_array($result);
|
||||
//echo $myrow[progressivo];
|
||||
if ($myrow[progressivo] != 0)
|
||||
{
|
||||
if ($myrow[progressivo] > 1)
|
||||
{
|
||||
$cur = $myrow[progressivo] - 1;
|
||||
$criteri1 = "SELECT $tbl_lezioni.progressivo, $tbl_lezioni.nome, $tbl_test.nome, $tbl_test.posizione, $tbl_prove.id ";
|
||||
$criteri1 .= "FROM ($tbl_lezioni LEFT JOIN $tbl_test ON $tbl_lezioni.id = $tbl_test.idlezione) LEFT JOIN $tbl_prove ON $tbl_test.id = $tbl_prove.idtest ";
|
||||
$criteri1 .= "WHERE ($tbl_lezioni.progressivo = $cur) AND ($tbl_test.posizione = '$s_dopo') AND ($tbl_prove.idutente = $utente)";
|
||||
//echo $criteri1;
|
||||
$result1 = mysql_query($criteri1,$db);
|
||||
if ($myrow1 = mysql_fetch_array($result1))
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
}
|
||||
else
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
else
|
||||
return false;
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
$progressivo = getvar($tbl_moduli_righe, "progressivo", "idlezione =".$lezione." AND idmodulo = ".$modulo);
|
||||
//echo $progressivo;
|
||||
if ($progressivo != 0)
|
||||
{
|
||||
//$modulo = getvar($tbl_lezioni, "idmodulo", "id =".$lezione);
|
||||
//echo $modulo;
|
||||
if ($progressivo == $l_end)
|
||||
$p_lez_prec = max_lezione($modulo);
|
||||
else
|
||||
$p_lez_prec = $progressivo - 1;
|
||||
//echo $p_lez_prec;
|
||||
//$lez_prec = getvar($tbl_lezioni, "id", "idmodulo =".$modulo." AND progressivo = ".$p_lez_prec);
|
||||
//$lez_prec = getvar($tbl_moduli_righe, "idlezione", "idmodulo =".$modulo." AND progressivo = ".$p_lez_prec);
|
||||
$test_prec = getvar($tbl_moduli_righe, "idtest", "idmodulo =".$modulo." AND progressivo = ".$p_lez_prec);
|
||||
if ($test_prec > 0)
|
||||
{
|
||||
//echo $lez_prec;
|
||||
//$test = max_test($lez_prec);
|
||||
//if ($test > 0)
|
||||
//{
|
||||
if (test_effettuato($test_prec, $utente))
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
//}
|
||||
//else
|
||||
return false;
|
||||
}
|
||||
else
|
||||
return false;
|
||||
}
|
||||
else
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
// Da il permesso di effettuare un test
|
||||
// Verificando che sia stato effettuato il test finale della lezione precedente
|
||||
function controllo_test($lezione, $utente)
|
||||
// Restituisce Vero se il test e' stato effettuato
|
||||
function test_effettuato($test, $utente)
|
||||
{
|
||||
include("required.php");
|
||||
$db = mysql_connect($ip, $user, $password);
|
||||
mysql_select_db($dataname,$db);
|
||||
|
||||
$criteri = "SELECT * FROM $tbl_lezioni WHERE (id = $lezione) ";
|
||||
$criteri = "SELECT * FROM $tbl_prove WHERE (idtest = $test) AND (idutente = $utente) ";
|
||||
//echo $criteri;
|
||||
$result = mysql_query($criteri,$db);
|
||||
$myrow = mysql_fetch_array($result);
|
||||
//echo $myrow[progressivo];
|
||||
if ($myrow[progressivo] != 0)
|
||||
{
|
||||
if ($myrow[progressivo] > 1)
|
||||
{
|
||||
$cur = $myrow[progressivo] - 1;
|
||||
$criteri1 = "SELECT $tbl_lezioni.progressivo, $tbl_lezioni.nome, $tbl_test.nome, $tbl_test.posizione, $tbl_prove.id ";
|
||||
$criteri1 .= "FROM ($tbl_lezioni LEFT JOIN $tbl_test ON $tbl_lezioni.id = $tbl_test.idlezione) LEFT JOIN $tbl_prove ON $tbl_test.id = $tbl_prove.idtest ";
|
||||
$criteri1 .= "WHERE ($tbl_lezioni.progressivo = $cur) AND ($tbl_test.posizione = '$s_dopo') AND ($tbl_prove.idutente = $utente)";
|
||||
//echo $criteri1;
|
||||
$result1 = mysql_query($criteri1,$db);
|
||||
if ($myrow1 = mysql_fetch_array($result1))
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
}
|
||||
else
|
||||
return true;
|
||||
}
|
||||
$myrow = mysql_num_rows($result);
|
||||
//echo $myrow;
|
||||
if ($myrow > 0)
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
|
||||
}
|
||||
|
||||
|
||||
function fine_abilita($utente)
|
||||
// Da il permesso di effettuare un test se e' stato eseguito il test finale della lezione precedente
|
||||
function test_prima($test, $utente)
|
||||
{
|
||||
include("required.php");
|
||||
$db = mysql_connect($ip, $user, $password);
|
||||
mysql_select_db($dataname,$db);
|
||||
|
||||
$criteri ="SELECT utenti.id, Max(lezioni.progressivo) AS ultimo ";
|
||||
$criteri .= "FROM utenti LEFT JOIN lezioni ON utenti.idcorso = lezioni.idcorso ";
|
||||
$criteri .= "GROUP BY utenti.id HAVING (utenti.id = $utente) ";
|
||||
$lezione = getvar($tbl_test, "idlezione", "id =".$test);
|
||||
$progressivo = getvar($tbl_lezioni, "progressivo", "id =".$lezione);
|
||||
if ($progressivo != 0)
|
||||
{
|
||||
$modulo = getvar($tbl_lezioni, "idmodulo", "id =".$lezione);
|
||||
$lezione_prec = getvar($tbl_lezioni, "id", "idmodulo =".$modulo." AND progressivo =".($progressivo-1));
|
||||
}
|
||||
$criteri = "SELECT $tbl_moduli.test_prima ";
|
||||
$criteri .= "FROM $tbl_moduli LEFT JOIN $tbl_lezioni ON $tbl_moduli.id = $tbl_lezioni.idmodulo ";
|
||||
$criteri .= "WHERE $tbl_lezioni.id = $lezione ";
|
||||
//echo $criteri;
|
||||
$result = mysql_query($criteri,$db);
|
||||
$myrow = mysql_fetch_array($result);
|
||||
//echo $myrow["ultimo"];
|
||||
if ($myrow[test_prima] == $s_falso)
|
||||
return false;
|
||||
else
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
// Da il permesso di effettuare un test se e' stata scaricata la lezione
|
||||
function test_dopo($test, $utente)
|
||||
{
|
||||
include("required.php");
|
||||
$db = mysql_connect($ip, $user, $password);
|
||||
mysql_select_db($dataname,$db);
|
||||
|
||||
$lezione = getvar($tbl_moduli_righe, "idlezione", "idtest =".$test);
|
||||
//echo $lezione;
|
||||
$criteri = "SELECT * FROM $tbl_download WHERE (idlezione = $lezione) AND (idutente = $utente) ";
|
||||
//echo $criteri;
|
||||
$result = mysql_query($criteri,$db);
|
||||
$myrow = mysql_num_rows($result);
|
||||
if ($myrow > 0)
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
|
||||
}
|
||||
|
||||
// Restituisce true se l'utente puo' effettuare l'ultimo test di un modulo
|
||||
function fine_abilita($utente)
|
||||
{
|
||||
include("required.php");
|
||||
|
||||
$db = mysql_connect($ip, $user, $password);
|
||||
mysql_select_db($dataname,$db);
|
||||
|
||||
$criteri1 = "SELECT $tbl_lezioni.progressivo, $tbl_test.posizione, $tbl_prove.idutente ";
|
||||
$criteri1 .= "FROM ($tbl_lezioni LEFT JOIN $tbl_test ON $tbl_lezioni.id = $tbl_test.idlezione) LEFT JOIN $tbl_prove ON $tbl_test.id = $tbl_prove.idtest ";
|
||||
$criteri1 .= "WHERE ($tbl_lezioni.progressivo = $myrow[ultimo]) AND ($tbl_test.posizione = '$s_dopo') AND ($tbl_prove.idutente = $utente) ";
|
||||
$criteri1 .= "WHERE ($tbl_lezioni.progressivo = $l_end) AND ($tbl_test.posizione = $s_dopo) AND ($tbl_prove.idutente = $utente) ";
|
||||
//echo $criteri1;
|
||||
$result1 = mysql_query($criteri1,$db);
|
||||
if ($myrow1 = mysql_fetch_array($result1))
|
||||
@ -355,25 +373,88 @@ function fine_abilita($utente)
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
function test_prima($lezione)
|
||||
// Restituisce il numero massimo di test di una lezione
|
||||
function max_test($lezione)
|
||||
{
|
||||
include("required.php");
|
||||
$db = mysql_connect($ip, $user, $password);
|
||||
mysql_select_db($dataname,$db);
|
||||
|
||||
$criteri ="SELECT $tbl_corsi.test_prima FROM $tbl_corsi LEFT JOIN $tbl_lezioni ON $tbl_corsi.id = $tbl_lezioni.idcorso WHERE $tbl_lezioni.id = $lezione ";
|
||||
//echo $criteri;
|
||||
$result = mysql_query($criteri,$db);
|
||||
$myrow = mysql_fetch_array($result);
|
||||
if ($myrow[test_prima] == $s_falso)
|
||||
return false;
|
||||
else
|
||||
return true;
|
||||
//$criteri1 = "SELECT COUNT($tbl_test.id) AS conto FROM $tbl_test WHERE $tbl_test.idlezione = $myrow[id]";
|
||||
$criteri1 = "SELECT COUNT(*) AS conto FROM $tbl_moduli_righe WHERE $tbl_moduli_righe.idlezione = $lezione";
|
||||
//echo $criteri1;
|
||||
$result1 = mysql_query($criteri1,$db);
|
||||
$myrow1 = mysql_fetch_array($result1);
|
||||
return $myrow[conto];
|
||||
}
|
||||
|
||||
// Restituisce il numero massimo di lezioni di un modulo
|
||||
function max_lezione($modulo)
|
||||
{
|
||||
include("required.php");
|
||||
$db = mysql_connect($ip, $user, $password);
|
||||
mysql_select_db($dataname,$db);
|
||||
|
||||
$max = 0;
|
||||
//$criteri1 = "SELECT COUNT($tbl_test.id) AS conto FROM $tbl_test WHERE $tbl_test.idlezione = $myrow[id]";
|
||||
//$criteri1 = "SELECT MAX(progressivo) AS alto FROM $tbl_lezioni WHERE $tbl_lezioni.idmodulo = $modulo HAVING progressivo <> $l_end";
|
||||
//$criteri1 = "SELECT * FROM $tbl_lezioni WHERE $tbl_lezioni.idmodulo = $modulo";
|
||||
$criteri1 = "SELECT * FROM $tbl_moduli_righe WHERE $tbl_moduli_righe.idmodulo = $modulo";
|
||||
//echo $criteri1;
|
||||
$result1 = mysql_query($criteri1,$db);
|
||||
if ($myrow1 = mysql_fetch_array($result1))
|
||||
{
|
||||
do
|
||||
{
|
||||
if ($myrow1[progressivo] != $l_end)
|
||||
if ($max < $myrow1[progressivo]) $max = $myrow1[progressivo];
|
||||
|
||||
}while ($myrow1 = mysql_fetch_array($result1));
|
||||
}
|
||||
return $max;
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Restituisce il massimo numero di test che ha una lezione di un modulo
|
||||
function max_num_test($modulo)
|
||||
{
|
||||
include("required.php");
|
||||
$db = mysql_connect($ip, $user, $password);
|
||||
mysql_select_db($dataname,$db);
|
||||
|
||||
$max = 0;
|
||||
$criteri = "SELECT $tbl_lezioni.id FROM $tbl_lezioni WHERE $tbl_lezioni.idmodulo = $modulo";
|
||||
//echo $criteri;
|
||||
$result = mysql_query($criteri,$db);
|
||||
if ($myrow = mysql_fetch_array($result))
|
||||
{
|
||||
do
|
||||
{
|
||||
$num = max_test($myrow[id]);
|
||||
if ($max < $num) $max = $num;
|
||||
|
||||
}while ($myrow = mysql_fetch_array($result));
|
||||
}
|
||||
return $max;
|
||||
}
|
||||
|
||||
|
||||
// DLOOKUP rudimentale
|
||||
function getvar($tabella, $campo, $criteri)
|
||||
{
|
||||
include("required.php");
|
||||
$db = mysql_connect($ip, $user, $password);
|
||||
mysql_select_db($dataname,$db);
|
||||
|
||||
$criteri = "SELECT $campo FROM $tabella WHERE $criteri";
|
||||
//echo $criteri;
|
||||
$result = mysql_query($criteri,$db);
|
||||
if ($myrow = mysql_fetch_array($result))
|
||||
return $myrow[$campo];
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
?>
|
@ -1,26 +1,23 @@
|
||||
<?php
|
||||
|
||||
//$mostra = "";
|
||||
|
||||
if ($validato == 0) header ("location: login.php");
|
||||
|
||||
if ($presenze) header("location: presenze.php");
|
||||
include("funzioni.php");
|
||||
|
||||
//echo $modulo;
|
||||
//echo $validato;
|
||||
//$inizio = inizio($validato);
|
||||
$inizio = inizio($modulo, $validato);
|
||||
//echo $inizio;
|
||||
// Se inizio e' diverso da 0 occorre fare il test iniziale del modulo
|
||||
if ($inizio != 0) header ("location: test.php?test=$inizio&iniziale=1");
|
||||
|
||||
if ($logout)
|
||||
{
|
||||
include("funzioni.php");
|
||||
$ora = date("Y-m-d H:i:s");
|
||||
logout($login, $ora);
|
||||
setcookie("login", "");
|
||||
setcookie("validato", "0");
|
||||
header("location: login.php");
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
<html>
|
||||
<head>
|
||||
<title>Corsi</title>
|
||||
<title>Lezioni</title>
|
||||
<LINK rel="stylesheet" type="text/css" href="stile.css">
|
||||
</head>
|
||||
|
||||
@ -28,126 +25,256 @@ if ($logout)
|
||||
|
||||
<?php
|
||||
|
||||
|
||||
include("funzioni.php");
|
||||
|
||||
include("required.php");
|
||||
|
||||
$db = mysql_connect($ip, $user, $password);
|
||||
mysql_select_db($dataname,$db);
|
||||
|
||||
if (abilitato($validato, $corso))
|
||||
if (isset($modulo))
|
||||
{
|
||||
$inizio = inizio($validato);
|
||||
//echo $inizio;
|
||||
if ($inizio == 0)
|
||||
switch (modo($modulo))
|
||||
{
|
||||
$criteri = "SELECT $tbl_lezioni.nome, $tbl_lezioni.percorso, $tbl_lezioni.id ";
|
||||
$criteri .= "FROM ($tbl_corsi LEFT JOIN $tbl_lezioni ON $tbl_corsi.id = $tbl_lezioni.idcorso) LEFT JOIN $tbl_utenti ON $tbl_corsi.id = $tbl_utenti.idcorso ";
|
||||
$criteri .= "WHERE ($tbl_utenti.id = $validato) AND ($tbl_corsi.id = $corso) AND ($tbl_lezioni.progressivo > 0) ORDER BY $tbl_lezioni.progressivo";
|
||||
case 0: modalita_0($modulo);
|
||||
break;
|
||||
case 1: modalita_1($modulo);
|
||||
break;
|
||||
case 2: modalita_2($modulo);
|
||||
break;
|
||||
case 3: modalita_3($modulo);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// Lezione -> Test
|
||||
function modalita_0($modulo)
|
||||
{
|
||||
//include("funzioni.php");
|
||||
include("required.php");
|
||||
|
||||
$db = mysql_connect($ip, $user, $password);
|
||||
mysql_select_db($dataname,$db);
|
||||
|
||||
$criteri = "SELECT moduli_righe.idmodulo, moduli_righe.idlezione, moduli_righe.idtest, lezioni.nome, lezioni.percorso, moduli_righe.progressivo ";
|
||||
$criteri .= "FROM moduli_righe LEFT JOIN lezioni ON moduli_righe.idlezione = lezioni.id ";
|
||||
$criteri .= "WHERE (moduli_righe.idmodulo = $modulo) ORDER BY moduli_righe.progressivo";
|
||||
|
||||
//$criteri = "SELECT * FROM moduli_righe WHERE idmodulo = $modulo ORDER BY progressivo ";
|
||||
|
||||
//echo $criteri;
|
||||
$result = mysql_query($criteri, $db);
|
||||
if ($myrow = mysql_fetch_array($result))
|
||||
{
|
||||
echo "<br><br><table align=center border=1 cellpadding=2 cellspacing=0>";
|
||||
echo "<tr><th>Lezione</th><th>Descrizione</th><th>Test</th></tr>";
|
||||
do
|
||||
{
|
||||
//echo $myrow[progressivo];
|
||||
//if (($myrow[progressivo] == $l_end) || ($myrow[progressivo] == $l_start))
|
||||
if ($myrow[percorso] == "")
|
||||
{
|
||||
$lezione = "<br>";
|
||||
//$test = "<form action=test.php><input type=hidden name=fine value=".$myrow["id"]."><input type=submit value='Test Finale' class=bottoni></form>";
|
||||
$test = "<form action=test.php method=post><input type=hidden name=test value=".$myrow["idtest"]."><input type=submit value='Test $myrow[idtest]' class=bottoni></form>";
|
||||
}
|
||||
else
|
||||
{
|
||||
$lezione = "<form action=download.php method=post><input type=hidden name=lezione value=".$myrow["idlezione"]."><input type=submit value='Lezione $myrow[idlezione]' class=bottoni></form>";
|
||||
$test = "<form action=test.php method=post><input type=hidden name=test value=".$myrow["idtest"]."><input type=submit value='Test $myrow[idtest]' class=bottoni></form>";
|
||||
}
|
||||
if ($riga == true)
|
||||
{
|
||||
echo "<tr bgcolor=#BBBBBB align=center><td>$lezione</td><td>".$myrow["nome"]."</td><td>$test</td></tr>";
|
||||
$riga = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
echo "<tr bgcolor=#DDDDDD align=center><td>$lezione</td><td>".$myrow["nome"]."</td><td>$test</td></tr>";
|
||||
$riga = true;
|
||||
}
|
||||
}while ($myrow = mysql_fetch_array($result));
|
||||
echo "</form>";
|
||||
//if (fine_abilita($validato))
|
||||
//{
|
||||
// $test_fine = fine($validato);
|
||||
// if ($test_fine != 0)
|
||||
// {
|
||||
// echo "<tr><td colspan=3><br></td></tr>";
|
||||
// echo "<tr><td colspan=3 align=center><form action=test.php><input type=hidden name=fine value=$test_fine><input type=submit value='Esegui Test Finale' class=bottoni></form></td></tr>";
|
||||
// }
|
||||
// else
|
||||
// echo "<tr><td colspan=3><br></td></tr>";
|
||||
// echo "<tr><td colspan=3>Modulo Concluso</td></tr>";
|
||||
//}
|
||||
echo "</table>";
|
||||
echo "<p><a href=corsi.php>Torna</a></p>";
|
||||
}
|
||||
else
|
||||
{
|
||||
echo "<br><br><p class=error>Non é abilitato a questo corso!</p><br><br>";
|
||||
echo "<p><a href=corsi.php>Torna</a></p>";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Test prima -> Lezione -> Test dopo
|
||||
function modalita_1($modulo)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
function modalita_2($modulo)
|
||||
{
|
||||
//include("funzioni.php");
|
||||
include("required.php");
|
||||
|
||||
$db = mysql_connect($ip, $user, $password);
|
||||
mysql_select_db($dataname,$db);
|
||||
|
||||
$giro = 1;
|
||||
$max_test = max_num_test($modulo);
|
||||
echo "<br><br><table align=center border=1 cellpadding=2 cellspacing=0>";
|
||||
|
||||
//$lezione .= "<tr class=scuro><td bgcolor=#D3DCED><br></td>";
|
||||
$lezione .= "<tr class=scuro>";
|
||||
for($x = 1; $x <= $max_test; $x++)
|
||||
{
|
||||
//$test .= "<tr class=chiaro><th>Test</th>";
|
||||
$test .= "<tr class=chiaro>";
|
||||
$criteri = "SELECT $tbl_lezioni.nome, $tbl_lezioni.percorso, $tbl_lezioni.id, $tbl_lezioni.progressivo ";
|
||||
$criteri .= "FROM $tbl_moduli LEFT JOIN $tbl_lezioni ON $tbl_moduli.id = $tbl_lezioni.idmodulo ";
|
||||
$criteri .= "WHERE ($tbl_moduli.id = $modulo) ORDER BY $tbl_lezioni.progressivo";
|
||||
//echo $criteri;
|
||||
$result = mysql_query($criteri, $db);
|
||||
$num_rows = mysql_num_rows($result);
|
||||
if ($myrow = mysql_fetch_array($result))
|
||||
{
|
||||
echo "<br><br><table align=center border=1 cellpadding=2 cellspacing=0>";
|
||||
echo "<tr><th><br></th><th>Lezione</th><th><br></th></tr>";
|
||||
do
|
||||
do
|
||||
{
|
||||
// echo "<form>";
|
||||
// $lezione = "<td><a href='".$myrow["percorso"]."' target=new>Scarica Lezione</a></td>";
|
||||
$lezione = "<td><form action=download.php><input type=hidden name=lezione value=".$myrow["id"]."><input type=submit value='Scarica Lezione' class=bottoni></form></td>";
|
||||
// echo $myrow["id"];
|
||||
// $test = "<td><a href=test.php?lez=".$myrow["id"].">Esegui Test</a></td>";
|
||||
$test = "<td><form action=test.php><input type=hidden name=lez value=".$myrow["id"]."><input type=submit value='Esegui Test' class=bottoni></form></td>";
|
||||
if ($riga == true)
|
||||
If ($giro == 1)
|
||||
{
|
||||
echo "<tr bgcolor=#BBBBBB align=center>$lezione<td>".$myrow["nome"]."</td>$test</tr>";
|
||||
$riga = false;
|
||||
$lezione .= "<td>$myrow[nome]";
|
||||
//if ($myrow[progressivo] == $l_end)
|
||||
if (($myrow[progressivo] == $l_end) || ($myrow[progressivo] == $l_start))
|
||||
$lezione .= "</td>";
|
||||
else
|
||||
$lezione .= "<br><form action=download.php><input type=hidden name=lezione value=".$myrow["id"]."><input type=submit value='Lezione $myrow[id]' class=bottoni></form></td>";
|
||||
}
|
||||
$criteri1 = "SELECT * FROM $tbl_test WHERE $tbl_test.idlezione = $myrow[id] AND $tbl_test.ordine = $x";
|
||||
//echo $criteri1."<br>";
|
||||
$result1 = mysql_query($criteri1, $db);
|
||||
//$num_rows1 = mysql_num_rows($result1);
|
||||
if ($myrow1 = mysql_fetch_array($result1))
|
||||
{
|
||||
//$riga .= "<td>".$myrow1["nome"]."<br>";
|
||||
//$riga .= "<form action=test.php><input type=hidden name=lezione value=".$myrow1["id"]."><input type=submit value='Esegui Test' class=bottoni></form></td>";
|
||||
$test .= "<td><form action=test.php><input type=hidden name=test value=".$myrow1["id"]."><input type=submit value='Test $myrow1[id]' class=bottoni></form></td>";
|
||||
}
|
||||
else
|
||||
{
|
||||
echo "<tr bgcolor=#DDDDDD align=center>$lezione<td>".$myrow["nome"]."</td>$test</tr>";
|
||||
$riga = true;
|
||||
}
|
||||
}
|
||||
while ($myrow = mysql_fetch_array($result));
|
||||
// echo "</form>";
|
||||
if (fine_abilita($validato))
|
||||
{
|
||||
$test_fine = fine($validato);
|
||||
if ($test_fine != 0)
|
||||
{
|
||||
echo "<tr><td colspan=3><br></td></tr>";
|
||||
echo "<tr><td colspan=3 align=center><form action=test.php><input type=hidden name=fine value=$test_fine><input type=submit value='Esegui Test Finale' class=bottoni></form></td></tr>";
|
||||
}
|
||||
else
|
||||
echo "<tr><td colspan=3><br></td></tr>";
|
||||
echo "<tr><td colspan=3>Modulo Concluso</td></tr>";
|
||||
}
|
||||
echo "</table>";
|
||||
echo "<p><a href=corsi.php>Torna</a></p>";
|
||||
}
|
||||
else
|
||||
$test .= "<td><br></td>";
|
||||
}while ($myrow = mysql_fetch_array($result));
|
||||
}
|
||||
$lezione .= "</tr>";
|
||||
$test .= "</tr>";
|
||||
$giro++;
|
||||
}
|
||||
//echo "<tr class=scuro align=center>$lezione</tr>";
|
||||
//echo "<tr class=chiaro align=center>$test</tr>";
|
||||
echo "<tr><th colspan=$num_rows align=center>Lezioni</th></tr>";
|
||||
echo $lezione;
|
||||
echo $test;
|
||||
//echo "</form>";
|
||||
echo "</table>";
|
||||
echo "<p><a href=corsi.php>Torna</a></p>";
|
||||
}
|
||||
|
||||
|
||||
function modalita_3($modulo)
|
||||
{
|
||||
//include("funzioni.php");
|
||||
include("required.php");
|
||||
|
||||
$db = mysql_connect($ip, $user, $password);
|
||||
mysql_select_db($dataname,$db);
|
||||
|
||||
$criteri = "SELECT $tbl_lezioni.nome, $tbl_lezioni.percorso, $tbl_lezioni.id, $tbl_lezioni.progressivo ";
|
||||
$criteri .= "FROM $tbl_moduli LEFT JOIN $tbl_lezioni ON $tbl_moduli.id = $tbl_lezioni.idmodulo ";
|
||||
$criteri .= "WHERE ($tbl_moduli.id = $modulo) ORDER BY $tbl_lezioni.progressivo";
|
||||
//echo $criteri;
|
||||
$result = mysql_query($criteri, $db);
|
||||
$num_rows = mysql_num_rows($result);
|
||||
if ($myrow = mysql_fetch_array($result))
|
||||
{
|
||||
echo "<br><br><table align=center border=1 cellpadding=2 cellspacing=0>";
|
||||
//echo "<tr><th><br></th><th>Lezione</th><th><br></th></tr>";
|
||||
//echo "<tr><td><br></td><th colspan=$num_rows align=center>Lezione</th></tr>";
|
||||
//echo "<tr><th colspan=$num_rows align=center>Lezione</th></tr>";
|
||||
$max_test = max_num_test($modulo);
|
||||
//$max_test = 1;
|
||||
//echo $max_test;
|
||||
//$lezione = "<td><br></td>";
|
||||
//$test = "<td><br></td>";
|
||||
echo "<tr>";
|
||||
for($j = 0; $j <= $max_test; $j++)
|
||||
{
|
||||
echo "<br><br><p class=error>Non é abilitato a questo corso!</p><br><br>";
|
||||
echo "<p><a href=corsi.php>Torna</a></p>";
|
||||
if ($j != 0)
|
||||
echo "<th>Test $j</th>";
|
||||
else
|
||||
echo "<th>Lezioni \ Test</th>";
|
||||
}
|
||||
echo "</tr>";
|
||||
$n = 1;
|
||||
do
|
||||
{
|
||||
$riga .= "<tr><td>";
|
||||
//if ($myrow[progressivo] == $l_end)
|
||||
if (($myrow[progressivo] == $l_end) || ($myrow[progressivo] == $l_start))
|
||||
$riga .= "Lezione $n</td>";
|
||||
else
|
||||
//$riga .= "<form action=download.php><input type=hidden name=lezione value=".$myrow["id"]."><input type=submit value='Scarica Lezione' class=bottoni></form></td>";
|
||||
$riga .= "<form action=download.php><input type=hidden name=lezione value=".$myrow["id"]."><input type=submit value='Lezione $n' class=bottoni></form></td>";
|
||||
|
||||
for($x = 1; $x <= $max_test; $x++)
|
||||
{
|
||||
$criteri1 = "SELECT * FROM $tbl_test WHERE $tbl_test.idlezione = $myrow[id] AND $tbl_test.ordine = $x";
|
||||
//echo $criteri1."<br>";
|
||||
$result1 = mysql_query($criteri1, $db);
|
||||
//$num_rows1 = mysql_num_rows($result1);
|
||||
if ($myrow1 = mysql_fetch_array($result1))
|
||||
{
|
||||
$riga .= "<td><form action=test.php><input type=hidden name=test value=".$myrow1["id"]."><input type=submit value='Test $myrow1[id]' class=bottoni></form></td>";
|
||||
}
|
||||
else
|
||||
$riga .= "<td><br></td>";
|
||||
}
|
||||
$riga .= "</tr>";
|
||||
$n++;
|
||||
}while ($myrow = mysql_fetch_array($result));
|
||||
echo $riga;
|
||||
//echo "</form>";
|
||||
echo "</table>";
|
||||
echo "<p><a href=corsi.php>Torna</a></p>";
|
||||
}
|
||||
else
|
||||
{
|
||||
echo "<br><p class=titolo>Test preliminare</p><br>";
|
||||
|
||||
$criteri2 = "SELECT $tbl_domande.idtest, $tbl_domande.domanda, $tbl_domande.id ";
|
||||
$criteri2 .= "FROM $tbl_domande WHERE ($tbl_domande.idtest = $inizio)";
|
||||
//echo $criteri2;
|
||||
$result2 = mysql_query($criteri2, $db);
|
||||
if ($myrow2 = mysql_fetch_array($result2))
|
||||
{
|
||||
echo "<form action=verifica.php 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) $myrow2[domanda]</font></td></tr>";
|
||||
$criteri3 = "SELECT * FROM $tbl_risposte WHERE (iddomanda = $myrow2[id]) AND (visibile = '$s_vero') ";
|
||||
//echo $criteri3;
|
||||
$result3 = mysql_query($criteri3, $db);
|
||||
if ($myrow3 = mysql_fetch_array($result3))
|
||||
{
|
||||
do
|
||||
{
|
||||
if ($riga == true)
|
||||
{
|
||||
echo "<tr bgcolor=#BBBBBB><td><input type=checkbox name='scelte[]' value=$myrow3[id]>$myrow3[risposta]<br></td></tr>";
|
||||
$riga = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
echo "<tr bgcolor=#DDDDDD><td><input type=checkbox name='scelte[]' value=$myrow3[id]>$myrow3[risposta]<br></td></tr>";
|
||||
$riga = true;
|
||||
}
|
||||
}while ($myrow3= mysql_fetch_array($result3));
|
||||
}
|
||||
$n++;
|
||||
}while ($myrow2 = mysql_fetch_array($result2));
|
||||
echo "<tr><td><input type=hidden name=test value=$inizio><input type=hidden name=verifica></td></tr>";
|
||||
//echo "<tr><td align=center><input type=Reset value=Azzera class=bottoni><input type=submit value=Correggi class=bottoni></td></tr></table></form>";
|
||||
echo "<tr><td align=center><input type=checkbox value=bianco name=bianco>Consegna in bianco</td></tr>";
|
||||
echo "<tr><td align=center><input type=Reset value=Azzera class=bottoni> <input type=submit value=Correggi class=bottoni></td></tr></table></form>";
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
echo "<br><br><p class=error>Nessun record trovato!</p><br><br>";
|
||||
echo "<p><a href=corsi.php>Torna</a></p>";
|
||||
}
|
||||
}
|
||||
echo "<br><br><p class=error>Non é abilitato a questo corso!</p><br><br>";
|
||||
echo "<p><a href=corsi.php>Torna</a></p>";
|
||||
}
|
||||
}
|
||||
else
|
||||
|
||||
function modo($modulo)
|
||||
{
|
||||
echo "<br><br><p class=error>Non é abilitato a questo corso!</p><br><br>";
|
||||
//echo "<p><a href=corsi.php>Torna ai corsi</a></p>";
|
||||
echo "<p><a href=# onclick=history.back()>Torna</a></p>";
|
||||
include("required.php");
|
||||
|
||||
$db = mysql_connect($ip, $user, $password);
|
||||
mysql_select_db($dataname,$db);
|
||||
|
||||
$criteri = "SELECT modo FROM $tbl_moduli WHERE id = $modulo ";
|
||||
//echo $criteri;
|
||||
$result = mysql_query($criteri, $db);
|
||||
if ($myrow = mysql_fetch_array($result))
|
||||
return $myrow[modo];
|
||||
}
|
||||
|
||||
|
||||
|
@ -5,25 +5,34 @@ $user = "root";
|
||||
$password = "";
|
||||
$dataname = "corsi";
|
||||
|
||||
|
||||
//$test_prima = "Falso"; // Impostato su Vero indica che e' presente anche il test prima del download di una lezione.
|
||||
|
||||
//$modo = 0; // Modalita' default = 0
|
||||
|
||||
// Costanti di controllo
|
||||
$s_vero = "Vero";
|
||||
$s_falso = "Falso";
|
||||
$s_prima = "Prima";
|
||||
$s_dopo = "Dopo";
|
||||
$s_inizio = "Inizio";
|
||||
$s_fine = "Fine";
|
||||
|
||||
$l_start = 0; // Valore della prima lezione di un modulo.
|
||||
$l_end = 20; // Valore dell'ultima lezione di un modulo: max 21 lezioni.
|
||||
// Le lezioni 0 e 20 non hanno materiale da scaricare ma sono i test iniziali e finali di un modulo.
|
||||
|
||||
$s_vero = 1;
|
||||
$s_falso = 0;
|
||||
//$s_prima = "Prima";
|
||||
//$s_dopo = "Dopo";
|
||||
$s_prima = 1; // Indica che il test va effettuato prima di scaricare la lezione.
|
||||
$s_dopo = 2; // Indica che il test va effettuato dopo aver scaricato la lezione.
|
||||
//$s_inizio = "Inizio";
|
||||
//$s_fine = "Fine";
|
||||
|
||||
// Nomi delle tabelle nel database
|
||||
$tbl_accessi = "accessi";
|
||||
$tbl_corsi = "corsi";
|
||||
$tbl_corsi_righe = "corsi_righe";
|
||||
$tbl_domande = "domande";
|
||||
$tbl_download = "download";
|
||||
$tbl_lezioni = "lezioni";
|
||||
$tbl_livelli = "livelli";
|
||||
$tbl_moduli = "moduli";
|
||||
$tbl_moduli_righe = "moduli_righe";
|
||||
$tbl_prove = "prove";
|
||||
$tbl_risposte = "risposte";
|
||||
$tbl_test = "test";
|
||||
|
@ -1,17 +1,24 @@
|
||||
body{background-color:#D3DCED;}
|
||||
|
||||
p{font-family:Arial; font-size:12pt; text-align:center;}
|
||||
p.titolo{font-family:Arial; font-size:14pt; text-align:center;}
|
||||
p.error{font-family:Garamond; font-size:12pt; color:red; font-weight:900; text-align:center;}
|
||||
p.titolo{font-family:Arial; font-size:13pt; text-align:center;}
|
||||
p.error{font-family:Garamond; font-size:13pt; color:Red; font-weight:900; text-align:center;}
|
||||
|
||||
th{font-family:Tahoma; font-size:10pt; background-color:Navy; color:white;}
|
||||
|
||||
tr.chiaro{background-color:#DDDDDD;}
|
||||
tr.scuro{background-color:#BBBBBB;}
|
||||
tr.rosso{background-color:#BF210B;}
|
||||
tr.blu{background-color:#1058BA;}
|
||||
tr.menu{background-color:Navy;}
|
||||
tr.menug{background-color:White;}
|
||||
|
||||
td{font-family:Tahoma; font-size:8pt; font-weight:bold;}
|
||||
td.titolo{font-family:Arial; font-size:12pt; font-weight:bold;}
|
||||
td.titolo{font-family:Arial; font-size:10pt; font-weight:bold; text-align:center;}
|
||||
td.menu{font-family:Arial; font-size:8pt; font-weight:bold; text-align:center; color:white;}
|
||||
td.menug{font-family:Arial; font-size:12pt; font-weight:bold; text-align:center; color:Navy;}
|
||||
|
||||
input{font-family:Tahoma; font-size:8pt; font-weight:bold;}
|
||||
input{font-family:Verdana; font-size:8pt; font-weight:bold;}
|
||||
input.bottoni{font-family:Verdana; font-size:9pt; font-weight:bold;}
|
||||
|
||||
A:visited{color:Teal; text-decoration:none;}
|
||||
@ -20,10 +27,4 @@ A:link{color:blue; text-decoration:none;}
|
||||
A:hover{color:red; text-decoration:underline;}
|
||||
|
||||
|
||||
/*
|
||||
TAVOLA DEI COLORI
|
||||
|
||||
#BF210B = rosso
|
||||
#D3DCED = celeste
|
||||
|
||||
*/
|
35
corsi/pages/stile2.css
Executable file
@ -0,0 +1,35 @@
|
||||
body{background-color:Gray;}
|
||||
|
||||
p{font-family:Times New Roman; font-size:12pt; text-align:center;}
|
||||
p.titolo{font-family:Times New Roman; font-size:12pt; text-align:center;}
|
||||
p.error{font-family:Garamond; font-size:14pt; color:White; font-weight:900; text-align:center;}
|
||||
|
||||
th{font-family:Times New Roman; font-size:10pt; background-color:#ffcc33; color:Black;}
|
||||
|
||||
tr.chiaro{background-color:#DDDDDD;}
|
||||
tr.scuro{background-color:#BBBBBB;}
|
||||
tr.menu{background-color:Black;}
|
||||
tr.menug{background-color:#ffcc33;}
|
||||
|
||||
td{font-family:Times New Roman; font-size:9pt; font-weight:bold;}
|
||||
td.titolo{font-family:Times New Roman; font-size:10pt; font-weight:bold;}
|
||||
td.menu{font-family:Times New Roman; font-size:8pt; font-weight:bold; text-align:center; color:#ffcc33;}
|
||||
td.menug{font-family:Times New Roman; font-size:10pt; font-weight:bold; text-align:center; color:Black;}
|
||||
|
||||
input{font-family:Verdana; font-size:8pt; font-weight:bold;}
|
||||
input.bottoni{font-family:Verdana; font-size:9pt; font-weight:bold;}
|
||||
|
||||
A:visited{color:Purple; text-decoration:none;}
|
||||
/*A:active{color:blue; text-decoration:none;}*/
|
||||
A:link{color:blue; text-decoration:none;}
|
||||
/*A:hover{color:Red; text-decoration:underline;}*/
|
||||
A:hover{text-decoration:underline;}
|
||||
|
||||
|
||||
/*
|
||||
TAVOLA DEI COLORI
|
||||
|
||||
#BF210B = rosso
|
||||
#D3DCED = celeste
|
||||
|
||||
*/
|
@ -21,44 +21,82 @@ include("funzioni.php");
|
||||
$db = mysql_connect($ip, $user, $password);
|
||||
mysql_select_db($dataname,$db);
|
||||
|
||||
if (isset ($fine) && ($fine !=0))
|
||||
//if (isset($test)) echo getvar($tbl_test, "posizione", "id = ".$test);
|
||||
if (isset($test))
|
||||
{
|
||||
echo "<br><p class=titolo>Test finale</p><br>";
|
||||
|
||||
$criteri0 = "SELECT $tbl_domande.idtest, $tbl_domande.domanda, $tbl_domande.id ";
|
||||
$criteri0 .= "FROM $tbl_domande WHERE ($tbl_domande.idtest = $fine)";
|
||||
//echo $criteri5;
|
||||
$result0 = mysql_query($criteri0, $db);
|
||||
if ($myrow0 = mysql_fetch_array($result0))
|
||||
//echo $iniziale;
|
||||
if ((isset ($iniziale)) && ($iniziale == 1))
|
||||
EseguiTest($test);
|
||||
//echo "esegui";
|
||||
else
|
||||
{
|
||||
if (test_effettuato($test, $validato))
|
||||
echo "<br><br><p class=error>Il test è già stato svolto!</p><br><br>";
|
||||
else
|
||||
{
|
||||
if (getvar($tbl_moduli_righe, "posizione", "idtest = ".$test) == $s_prima)
|
||||
{
|
||||
echo "<br><br><p class=error>Test Prima della lezione non abilitato!</p><br><br>";
|
||||
}
|
||||
if (getvar($tbl_moduli_righe, "posizione", "idtest = ".$test) == $s_dopo)
|
||||
{
|
||||
if (test_dopo($test, $validato))
|
||||
EseguiTest($test);
|
||||
//echo "Puoi eseguire il test adesso!";
|
||||
else
|
||||
echo "<br><br><p class=error>Prima di effettuare il test occorre scaricare la lezione!</p><br><br>";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//EseguiTest($test);
|
||||
|
||||
function EseguiTest($test)
|
||||
{
|
||||
include("required.php");
|
||||
//include("funzioni.php");
|
||||
$db = mysql_connect($ip, $user, $password);
|
||||
mysql_select_db($dataname,$db);
|
||||
|
||||
$criteri = "SELECT $tbl_test.id as test, $tbl_test.nome, $tbl_domande.id, $tbl_domande.domanda ";
|
||||
$criteri .= "FROM $tbl_test LEFT JOIN $tbl_domande ON $tbl_test.id = $tbl_domande.idtest ";
|
||||
$criteri .= "WHERE $tbl_test.id = $test";
|
||||
//echo $criteri;
|
||||
$result = mysql_query($criteri, $db);
|
||||
if ($myrow = mysql_fetch_array($result))
|
||||
{
|
||||
//$num_test = $myrow[id];
|
||||
echo "<form name=form1 action=verifica.php method=post>";
|
||||
echo "<table align=center border=1 width=80% cellpadding=2 cellspacing=0>";
|
||||
echo "<table align=center border=1 width=90% cellpadding=2 cellspacing=0>";
|
||||
echo "<tr><td class=titolo align=center>".$myrow["nome"]."</td></tr><tr><td><br></td></tr>";
|
||||
$n = 1;
|
||||
do
|
||||
{
|
||||
echo "<tr bgcolor=#BF210B><td height=25><font color=white>$n) $myrow0[domanda]</font></td></tr>";
|
||||
$criteri01 = "SELECT * FROM $tbl_risposte WHERE (iddomanda = $myrow0[id]) ";
|
||||
//echo $criteri01;
|
||||
$result01 = mysql_query($criteri01, $db);
|
||||
if ($myrow01 = mysql_fetch_array($result01))
|
||||
echo "<tr class=rosso><td height=25><font color=white>$n) $myrow[domanda]</font></td></tr>";
|
||||
$criteri1 = "SELECT * FROM $tbl_risposte WHERE (iddomanda = $myrow[id]) AND (visibile = $s_vero) ";
|
||||
//echo $criteri1;
|
||||
$result1 = mysql_query($criteri1, $db);
|
||||
if ($myrow1 = mysql_fetch_array($result1))
|
||||
{
|
||||
do
|
||||
{
|
||||
if ($riga == true)
|
||||
{
|
||||
echo "<tr bgcolor=#BBBBBB><td><input type=checkbox name='scelte[]' value=$myrow01[id]>$myrow01[risposta]<br></td></tr>";
|
||||
echo "<tr class=scuro><td><input type=checkbox name='scelte[]' value=$myrow1[id]> $myrow1[risposta]<br></td></tr>";
|
||||
$riga = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
echo "<tr bgcolor=#DDDDDD><td><input type=checkbox name='scelte[]' value=$myrow01[id]>$myrow01[risposta]<br></td></tr>";
|
||||
echo "<tr class=chiaro><td><input type=checkbox name='scelte[]' value=$myrow1[id]> $myrow1[risposta]<br></td></tr>";
|
||||
$riga = true;
|
||||
}
|
||||
}while ($myrow01 = mysql_fetch_array($result01));
|
||||
}while ($myrow1= mysql_fetch_array($result1));
|
||||
}
|
||||
$n++;
|
||||
}while ($myrow0 = mysql_fetch_array($result0));
|
||||
echo "<tr><td><input type=hidden name=test value=$fine><input type=hidden name=verifica></td></tr>";
|
||||
}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=Checkbox name=bianco>Consegna in bianco</td></tr>";
|
||||
echo "<tr><td align=center><input type=Reset value=Azzera class=bottoni> <input type=submit value=Correggi class=bottoni></td></tr></table></form>";
|
||||
}
|
||||
else
|
||||
@ -66,157 +104,11 @@ if (isset ($fine) && ($fine !=0))
|
||||
echo "<br><br><p class=error>Nessun record trovato!</p><br><br>";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$criteri = "SELECT count(*) as download ";
|
||||
$criteri .= "FROM $tbl_lezioni LEFT JOIN $tbl_download ON $tbl_lezioni.id = $tbl_download.idlezione ";
|
||||
$criteri .= "WHERE ($tbl_download.idlezione = $lez)";
|
||||
//echo $criteri;
|
||||
$result = mysql_query($criteri, $db);
|
||||
$myrow = mysql_fetch_array($result);
|
||||
//echo $myrow[download];
|
||||
if ($myrow[download] != 0)
|
||||
{
|
||||
$criteri1 = "SELECT $tbl_test.id as test, $tbl_prove.id as prove ";
|
||||
$criteri1 .= "FROM $tbl_test LEFT JOIN $tbl_prove ON $tbl_test.id = $tbl_prove.idtest ";
|
||||
$criteri1 .= "WHERE ($tbl_test.idlezione = $lez) AND ($tbl_test.posizione = '$s_dopo') AND ($tbl_prove.idutente = $validato)";
|
||||
//echo $criteri1;
|
||||
$result1 = mysql_query($criteri1, $db);
|
||||
if ($myrow1 = mysql_fetch_array($result1))
|
||||
{
|
||||
|
||||
echo "<br><br><p class=error>Impossibile accedere al corso oppure il test è stato svolto!</p><br><br>";
|
||||
}
|
||||
else
|
||||
{
|
||||
$criteri2 = "SELECT $tbl_lezioni.id, $tbl_test.posizione, $tbl_domande.domanda, $tbl_domande.id, $tbl_test.id as test, $tbl_test.nome ";
|
||||
$criteri2 .= "FROM ($tbl_lezioni LEFT JOIN $tbl_test ON $tbl_lezioni.id = $tbl_test.idlezione) LEFT JOIN $tbl_domande ON $tbl_test.id = $tbl_domande.idtest ";
|
||||
$criteri2 .= "WHERE ($tbl_lezioni.id = $lez) AND ($tbl_test.posizione = '$s_dopo') ";
|
||||
|
||||
$result2 = mysql_query($criteri2, $db);
|
||||
if ($myrow2 = mysql_fetch_array($result2))
|
||||
{
|
||||
$num_test = $myrow2[test];
|
||||
echo "<form name=form1 action=verifica.php method=post>";
|
||||
echo "<table align=center border=1 width=80% cellpadding=2 cellspacing=0>";
|
||||
echo "<tr><td class=titolo align=center><font color=#BF210B>".$myrow2["nome"]."</font></td></tr><tr><td><br></td></tr>";
|
||||
$n = 1;
|
||||
do
|
||||
{
|
||||
echo "<tr bgcolor=#BF210B><td height=25><font color=white>$n) $myrow2[domanda]</font></td></tr>";
|
||||
$criteri3 = "SELECT * FROM $tbl_risposte WHERE (iddomanda = $myrow2[id]) AND (visibile = '$s_vero') ";
|
||||
//echo $criteri3;
|
||||
$result3 = mysql_query($criteri3, $db);
|
||||
if ($myrow3 = mysql_fetch_array($result3))
|
||||
{
|
||||
do
|
||||
{
|
||||
if ($riga == true)
|
||||
{
|
||||
echo "<tr bgcolor=#BBBBBB><td><input type=checkbox name='scelte[]' value=$myrow3[id]>$myrow3[risposta]<br></td></tr>";
|
||||
$riga = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
echo "<tr bgcolor=#DDDDDD><td><input type=checkbox name='scelte[]' value=$myrow3[id]>$myrow3[risposta]<br></td></tr>";
|
||||
$riga = true;
|
||||
}
|
||||
}while ($myrow3= mysql_fetch_array($result3));
|
||||
}
|
||||
$n++;
|
||||
}while ($myrow2 = mysql_fetch_array($result2));
|
||||
echo "<tr><td><input type=hidden name=test value=$num_test><input type=hidden name=verifica></td></tr>";
|
||||
echo "<tr><td align=center><input type=Reset value=Azzera class=bottoni> <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
|
||||
{
|
||||
if (test_prima($lez) == true)
|
||||
{
|
||||
$criteri4 = "SELECT $tbl_test.id as test, $tbl_prove.id as prove ";
|
||||
$criteri4 .= "FROM $tbl_test LEFT JOIN $tbl_prove ON $tbl_test.id = $tbl_prove.idtest ";
|
||||
$criteri4 .= "WHERE ($tbl_test.idlezione = $lez) AND ($tbl_test.posizione = '$s_prima')";
|
||||
//echo $criteri4;
|
||||
$result4 = mysql_query($criteri4, $db);
|
||||
$myrow4 = mysql_fetch_array($result4);
|
||||
//$num_rows = mysql_num_rows($result4);
|
||||
if ($myrow4[prove] != 0)
|
||||
//if ($num_rows != 0)
|
||||
{
|
||||
echo "<br><br><p class=error>Impossibile accedere al corso oppure il test è stato svolto!</p><br><br>";
|
||||
}
|
||||
else
|
||||
{
|
||||
if (controllo_test($lez, $validato))
|
||||
{
|
||||
$num_test = $myrow4[test];
|
||||
|
||||
if ($num_test != "")
|
||||
{
|
||||
$criteri5 = "SELECT $tbl_domande.idtest, $tbl_domande.domanda, $tbl_domande.id ";
|
||||
$criteri5 .= "FROM $tbl_domande WHERE ($tbl_domande.idtest = $num_test)";
|
||||
//echo $criteri5;
|
||||
$result5 = mysql_query($criteri5, $db);
|
||||
$myrow5 = mysql_fetch_array($result5);
|
||||
//if ($myrow5 = mysql_fetch_array($result5))
|
||||
|
||||
echo "<form name=form1 action=verifica.php 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) $myrow5[domanda]</font></td></tr>";
|
||||
//$criteri6 = "SELECT * FROM risposte WHERE (iddomanda = $myrow5[id]) AND (visibile = 'true') ";
|
||||
$criteri6 = "SELECT * FROM $tbl_risposte WHERE (iddomanda = $myrow5[id]) ";
|
||||
//echo $criteri6;
|
||||
$result6 = mysql_query($criteri6, $db);
|
||||
if ($myrow6 = mysql_fetch_array($result6))
|
||||
{
|
||||
do
|
||||
{
|
||||
if ($riga == true)
|
||||
{
|
||||
echo "<tr bgcolor=#BBBBBB><td><input type=checkbox name='scelte[]' value=$myrow6[id]>$myrow6[risposta]<br></td></tr>";
|
||||
$riga = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
echo "<tr bgcolor=#DDDDDD><td><input type=checkbox name='scelte[]' value=$myrow6[id]>$myrow6[risposta]<br></td></tr>";
|
||||
$riga = true;
|
||||
}
|
||||
}while ($myrow6 = mysql_fetch_array($result6));
|
||||
}
|
||||
$n++;
|
||||
}while ($myrow5 = mysql_fetch_array($result5));
|
||||
echo "<tr><td><input type=hidden name=test value=$num_test><input type=hidden name=verifica></td></tr>";
|
||||
echo "<tr><td align=center><input type=Reset value=Azzera class=bottoni> <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
|
||||
{
|
||||
echo "<br><br><p class=error>Prima di passare a questa lezione occorre concludere quella precedente!</p><br><br>";
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
echo "<br><br><p class=error>Prima di effettuare il test occorre scaricare la lezione!</p><br><br>";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//echo "<p><a href=corsi.php>Torna ai corsi</a></p>";
|
||||
|
||||
echo "<p><a href=# onclick=history.back()>Torna</a></p>";
|
||||
echo "<p><a href=corsi.php>Torna ai corsi</a></p>";
|
||||
|
||||
//echo "<p><a href=# onclick=history.back()>Torna</a></p>";
|
||||
|
||||
?>
|
||||
|
||||
|
@ -38,7 +38,7 @@ if ($myrow = mysql_fetch_array($result))
|
||||
$false = 0;
|
||||
$indovinate = 0;
|
||||
$sbagliate = 0;
|
||||
echo "<tr bgcolor=#1058BA><td width=5% bgcolor=#D3DCED><br></td><td height=25><font color=white>$n) $myrow[domanda]</font></td></tr>";
|
||||
echo "<tr class=rosso><td width=5% bgcolor=#D3DCED><br></td><td height=25><font color=white>$n) $myrow[domanda]</font></td></tr>";
|
||||
//$criteri1 = "SELECT * FROM $tbl_risposte WHERE (iddomanda = $myrow[id]) AND (visibile = 'true') ";
|
||||
$criteri1 = "SELECT * FROM $tbl_risposte WHERE (iddomanda = $myrow[id]) ";
|
||||
//echo $criteri1;
|
||||
|