-
Notifications
You must be signed in to change notification settings - Fork 1
/
usuarios.php
218 lines (178 loc) · 7.55 KB
/
usuarios.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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags -->
<title>Guías Resueltas</title>
<!-- Bootstrap -->
<link href="css/bootstrap.min.css" rel="stylesheet">
<link href="css/guia.css" rel="stylesheet">
<?php
/*LUIS
require_once(__DIR__. '/scripts/cargar.php');
$tipo = "";
if(isset($_SESSION['user'])){
$usr = usuarioActual();
$tipo = $usr->tipoUsuario;
$rutProfesor = $usr->rut;
}
*/
/*GONZALO*/
/*Datos de conexion*/
require('scripts/conexion.php');
$rutProfesor = $_GET['rut'];
$idAsignatura = $_GET['id'];
//$rutProfesor = '15302958-k';
//$idAsignatura = 1;
//print "<h3>Rut_Profesor: ".$rutProfesor."</h3>";
//print "<h3>ID_Asignatura: ".$idAsignatura."</h3>";
function cargar_alumno($rut,$nombre){
print "<div class=\"row\" id = \"".$rut."\">";
print "<div class=\"col-md-9\">";
print "<h4 id=\"alumno\"> ".$nombre."</h4>";
print "</div>";
print "<div class=\"col-md-3\">";
print "<div class=\"col-xs-5\">";
print "<a href=\"#\"><span class=\"glyphicon glyphicon-eye-open\"></span></a>";
print "</div>";
print "</div>";
print "</div>";
print "<hr>";
}
function menuAsignatura($idAsignatura, $asignatura){
print "<li><a href=\"usuarios.php?id=".$idAsignatura."\">".$asignatura."</a></li>";
}
?>
</head>
<body>
<?php
/*Recuperar listado de asignaturas*/
$stmt = $conn->prepare("SELECT Id, NombreAsignatura FROM Asignatura WHERE RutProfesorACargo=:rut");
$stmt->bindParam(':rut', $rutProfesor);
$stmt->execute();
$idAsignatura = array();
$asignaturas = array();
while($row = $stmt->fetch()){
array_push($idAsignatura, $row['Id']);
array_push($asignaturas, $row['NombreAsignatura']);
}
/*Recuperar datos del profesor*/
$stmt = $conn->prepare ("SELECT Nombre, ApellidoP FROM Usuario WHERE Rut=:rut");
$stmt->bindParam(':rut',$rutProfesor);
$stmt->execute();
$row = $stmt->fetch();
$profesor = $row['Nombre']." ".$row['ApellidoP'];
?>
<!-- nav -->
<nav class="navbar navbar-default">
<div class="container">
<!-- LEFT SECTION -->
<div class="navbar-header">
<div class="col-lg-4">
<img src="imagenes/logo-ULS.png" id="logo-uls" class="center-block img-circle">
</div>
<div class="col-md-8">
<h6 class="navbar-brand">Departamento de Biología</h6>
</div>
</div>
<!-- RIGHT SECTION -->
<div class="navbar-right">
<ul class="nav navbar-nav">
<li>
<a href="asignaturas.php">Asignaturas</a>
</li>
<li class="active dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" data-hover="dropdown">Guías Resueltas<span class="caret"></span></a>
<ul class="dropdown-menu" id = "listado-secundario">
<!-- Listar asignaturas -->
<?php
for($i=0; $i<count($asignaturas);$i++){
menuAsignatura($idAsignatura[$i], $asignaturas[$i]);
}
?>
</ul>
</li>
<li>
<a href="#">Galería</a>
</li>
<li class="dropdown sign-out">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" data-hover="dropdown"><?php print $profesor;?><span class=" caret"></span></a>
<ul class="dropdown-menu">
<!-- Listar asignaturas -->
<!--<li class="divider"></li>-->
<li><a href="#">Cerrar Sesión</a></li>
</ul>
</li>
</ul>
</div>
</div>
</nav>
<!-- CONTENIDO DE LA GUIA -->
<div class="container" id="contenido-guia">
<div id="numero-laboratorio">
<h3 class="text text-center">Guías Resueltas</h3>
</div>
</div>
<!-- LISTADO DE ALUMNOS -->
<div class="container">
<?php
/*Seleccionar personas que pertenezcan a la asignatura*/
$stmt = $conn->prepare ("SELECT RutUsuario FROM UsuarioAsignatura WHERE IdAsignatura = :id");
$stmt->bindParam(':id',$idAsignatura);
$stmt->execute();
while ($row = $stmt->fetch()){
$stmt2 = $conn->prepare ("SELECT Rut, Nombre, ApellidoP, ApellidoM FROM Usuario WHERE TipoUsuario = 'ALUMNO' AND Rut =:rut");
$stmt2->bindParam(':rut',$row['RutUsuario']);
$stmt2->execute();
while($row = $stmt2->fetch()){
$rut = $row['Rut'];
$nombre = $row['Nombre']." ".$row['ApellidoP']." ".$row['ApellidoM'];
/*print "<br><br><br>";
print "Alumno<br><br>";
print $rut."<br>";
print $alumno."<br>";*/
/*Cargando alumno*/
cargar_alumno($rut,$nombre);
}
}
?>
</div>
<!-- BARRA DE PAGINACION -->
<div class="container">
<div class="row">
<div class="col-md-8 text-center">
<nav>
<ul class="pagination pagination-sm">
<li class="disabled">
<a href="#" aria-label="Previous">
<span aria-hidden="true">«</span>
</a>
</li>
<li class="active">
<a href="#">1
<span class="sr-only">(current)</span>
</a>
</li>
...
</ul>
</nav> <!-- end NAV -->
</div>
</div>
</div>
<!-- PIE DE PAGINA -->
<footer>
<div class="jumbotron">
<center>
<h4 id="pie-pagina">Copyright © 2016 Departamento de Biología - Facultad de Ciencias - Universidad de La Serena</h4>
<h5>Desarrollado por la carrera de Ingeniería en Computación</h5>
</center>
</div>
</footer>
<!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
<!-- Include all compiled plugins (below), or include individual files as needed -->
<script src="js/bootstrap.min.js"></script>
</body>
</html>