admin_Catalog

Posted by .

Numele si prenumele : “.$nume_elev.”
“;

echo “

“;
echo “Total absente :
“;
echo “Motivate :
“;
echo ““;
echo ““;
echo ““;
echo “

“;
}
else
if (isset($_POST[‘Adauga’]))
{
// adaugarea unei noi note
$id_elev=$_POST[‘id_elev’];
$id_disc=$_POST[‘id_disc’];
$nota=$_POST[‘nota’];
$tip=$_POST[‘tip’];
$data=$_POST[‘data’];
$c=$_POST[‘c’];
echo “disc “.$id_disc.” id_elev “.$id_elev.” nota “.$nota;
mysqli_query($con,”INSERT INTO note (id_elev, id_disciplina, data, nota, tip)
VALUES (‘”.$id_elev.”‘, ‘”.$id_disc.”‘,'”.$data.”‘,'”.$nota.”‘,'”.$tip.”‘)”);
// echo “Am adaugat
“;
$cont=1;

}
else
if (isset($_POST[‘Salveaza’]))
{ // salvarea absentelor
$id_elev=$_POST[‘id_elev’];
$total=$_POST[‘total’];
$motivate=$_POST[‘motivate’];
$c=$_POST[‘c’];

mysqli_query($con,”UPDATE elevi SET absente='”.$total.”‘, motivate='”.$motivate.
“‘ WHERE id='”.$id_elev.”‘”);
$cont=1;
}
else
{
// formular pentru citirea noii note

$id_elev = $_POST[‘id_elev’];
$nume_elev = $_POST[‘nume_elev’];
$cont=0;
$nrdisc=$_POST[‘max_id_disc’];
echo “Numele si prenumele : “.$nume_elev.”
“;

for ($i=0;$i<=$nrdisc;$i++) if (isset($_POST[$i])) $id_disc=$i; $rez = mysqli_query($con,"SELECT * FROM discipline WHERE id='".$id_disc."'"); $row = mysqli_fetch_array($rez); $nume_disc = $row['denumire']; echo "Disciplina : “.$nume_disc.”
“;

echo “Note : “;

$rez = mysqli_query($con,”SELECT * FROM note WHERE id_elev='”.$id_elev.”‘ AND id_disciplina='”.$id_disc.”‘ AND tip=1″);
while ($row = mysqli_fetch_array($rez))
{
echo $row[‘nota’];
if ($row[‘data’]!=”) echo “/”.$row[‘data’];
echo “;  “;
}

echo “
Teza : “;
$rez = mysqli_query($con,”SELECT * FROM note WHERE id_elev='”.$id_elev.”‘ AND id_disciplina='”.$id_disc.”‘ AND tip=2″);
$row = mysqli_fetch_array($rez);
echo $row[‘nota’];
if ($row[‘data’]!=”) echo “/”.$row[‘data’];
echo “
“;

echo “

“;
echo “Nota :
“;
echo “Data :
“;
echo “Tip (1=nota, 2=teza)
“;
echo ““;
echo ““;
echo ““;
echo ““;
echo “

“;
}

}
else
$c=0;

if (empty($_POST) || $cont==1)
{

// memoram datele elevilor
$rez = mysqli_query($con, “SELECT * FROM elevi”);
$nrelevi = mysqli_num_rows($rez);

for ($i=0; $i<$nrelevi ;$i++) $elev[$i] = mysqli_fetch_assoc($rez); // disciplinele $rez = mysqli_query($con,"SELECT MAX(id) AS mx FROM discipline"); $row = mysqli_fetch_array($rez); $max_id_disc = $row['mx']; $rez = mysqli_query($con,"SELECT * FROM discipline"); $nrdisc = mysqli_num_rows($rez); for ($i=0; $i<$nrdisc ;$i++) $disc[$i] = mysqli_fetch_assoc($rez); echo "

“;
echo ” “;
echo ” “;
echo ” “;
$id_elev=$elev[$c][‘id’];
$total=$elev[$c][‘absente’];
$motivate=$elev[$c][‘motivate’];
$nemotivate=($total-$motivate);
echo ““;
echo ““;
echo “Numele si prenumele : “.$elev[$c][‘nume’].” “.$elev[$c][‘prenume’].”
“;
echo “Numar total absente : “.$total.”
“;
echo “Absente motivate : “.$motivate.”
“;
echo “Absente nemotivate : “.$nemotivate.”
“;

echo ” “;
echo ” “;
echo ” “;

echo ” “;
echo ” “;
echo ” “;
echo ”     “;
echo ” “;

echo “

“;

for ($j=0; $j<$nrdisc; $j++) { $id_disc=$disc[$j]['id']; echo "

“;
echo “

“;

echo “

“;
}

echo “

Disciplina Note Teza  
“;
echo $disc[$j][‘denumire’].”
“;

// notele
$rnote = mysqli_query($con,”SELECT * FROM note WHERE id_elev='”.$id_elev.”‘ AND id_disciplina='”.$id_disc.”‘ AND tip=1″);

while ($note = mysqli_fetch_array($rnote))
{
echo $note[‘nota’];
if ($note[‘data’] != ”)
echo “/”.$note[‘data’];
echo “;   “;
}
echo “

“;
// teza
$rnote = mysqli_query($con,”SELECT * FROM note WHERE id_elev='”.$id_elev.”‘ AND id_disciplina='”.$id_disc.”‘ AND tip=2″);

if (mysqli_num_rows($rnote)>0)
{
$note = mysqli_fetch_array($rnote);
echo $note[‘nota’];
if ($note[‘data’] != ”)
echo “/”.$note[‘data’];
}
echo “

“;
echo ”

“;

echo ” “;
echo ” “;
echo ” “;
echo ” “;
echo “

“;
}
?>