-
Notifications
You must be signed in to change notification settings - Fork 0
/
presentaIndividualNOFunciona.php
86 lines (57 loc) · 1.87 KB
/
presentaIndividualNOFunciona.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
<?php
require ('fpdf.php');
require ("config.php");
require("conectarse.php");
session_start();
$link=Conectarse();
$grupo=$_SESSION["nombregrupo"];
$pdf = new FPDF();
/*
echo "trabajando... ";
echo $grupo;
";
;
*/
$listaAlumnado=array();
$result = mysql_query("SELECT * FROM matriculas WHERE grupo='$grupo'",$link);
while($row = mysql_fetch_array($result)) {
$idalumno=$row["alumno"];
$nombreapellidos=mysql_query("SELECT * FROM alumnos WHERE alumno='$idalumno'",$link);
while($averiguanombre= mysql_fetch_array($nombreapellidos)){
$nombre=$averiguanombre["nombre"];
$apellidos=$averiguanombre["apellidos"];
$nombreCompleto=$apellidos.", ".$nombre;
$listaAlumnado[$nombreCompleto]=$idalumno;
}
}
ksort($listaAlumnado);
/*
$notas=mysql_query("SELECT * FROM notasindividuales WHERE idalumno='$idalumno'",$link);
while($notasindividuales= mysql_fetch_array($notas)){
*/
$pdf->AddPage();
$pdf->Image('logoies.jpg',10,10);
$pdf->SETXY(30,30);
foreach($listaAlumnado as $nombreAlumno=>$matriculaAlumno)
{
$notas=mysql_query("SELECT * FROM notasindividuales WHERE idalumno='$matriculaAlumno'ORDER BY materia,fecha",$link);
while($notasindividuales= mysql_fetch_array($notas)){
$texto='';
$pdf->SetFont('Arial','B',16);
$pdf->Multicell(160,10,'ALUMNO: '.$nombreAlumno."\n",1,'C',0);
$pdf->SetFont('Arial','',12);
$texto=$texto."Materia: ";
$texto=$texto.$notasindividuales["materia"]."\n";
$texto=$texto.utf8_decode("Apreciación: ");
$texto=$texto.$notasindividuales["texto"]."\n";
$pdf->Multicell(160,10, $texto,0,'L',0);
}
}
$file = basename(tempnam('.', 'tmp'));
rename($file, $file.'.pdf');
$file .= '.pdf';
//Guardar el PDF en un fichero
$pdf->Output($file, 'F');
//Redirección
header('Location: '.$file);
?>