Ver Mensaje Individual
  #5 (permalink)  
Antiguo 01/02/2010, 05:28
leolamela
 
Fecha de Ingreso: febrero-2010
Mensajes: 13
Antigüedad: 14 años, 3 meses
Puntos: 0
Respuesta: Problema Correcion de un examen en php

<?php
$in_files=get_included_files();

if(!in_array("db_handling.php",$in_files))
{

include "db_handling.php";
}
$db=new DB();
$examenes=$db->execute("SELECT `modelo_examen`.`id`,`nivel`.`titulo_nivel`,`model o_examen`.`comentario` FROM `modelo_examen`,`nivel`, `resultado`where `nivel`.id=`modelo_examen`.`nivel` and `resultado`.`id_examen`=`modelo_examen`.`id`");
$estudiantes=$db->execute("SELECT * FROM `usuario` where rol =3");
$fecha_hoy=date('Y-m-d');
$fecha_semana=date('Y-m-d');
$examenes_no_corregidos=$db->execute("SELECT DISTINCT `resultado`.`id_examen`,`resultado`.`fecha_examen` ,`modelo_examen`.`nivel`,`modelo_examen`.`comentar io`,`usuario`.`email`,`resultado`.`puntuacion`,`re sultado`.`identificador_unico` FROM `resultado`,`modelo_examen`,`nivel`,`usuario`, `agenda_examenes` where `resultado`.`id_examen`=`agenda_examenes` and `modelo_examen`.`id`=`resultado`.`id_examen` and `modelo_examen`.`nivel`=`nivel`.`id` and `agenda`.`corregido`=1 and`fecha_examen`<'".$fecha_hoy."' ORDER BY `identificador_unico` ASC limit 5 ");
$examenes_corregidos=$db->execute("SELECT DISTINCT `resultado`.`id_examen`,`resultado`.`fecha_examen` ,`modelo_examen`.`nivel`,`modelo_examen`.`comentar io`,`usuario`.`email`,`puntuacion`,`identificador_ unico` FROM `resultado`,`modelo_examen`,`nivel`,`usuario`,`age nda_examenes` where `resultado`.`id_examen`=`agenda_examenes` and `modelo_examen`.`id`=`resultado`.`id_examen` and `modelo_examen`.`nivel`=`nivel`.`id` and `fecha_examen`<'".$fecha_hoy."' and `agenda`.`corregido`=0 ORDER BY `fecha_examen` ASC limit 5");
?>
<html>
<head>
<script type="text/javascript" src="js/examen.correccion.interaccion.js"></script>

</head>
</body>
<h1><font color="grey">Correción de Examenes</font></h1>
<div style="height:900px;width:98%;overflow-y:scroll;font-size:130%;table-layout:fixed;font-weight:600">
<form id="form_parametros">
<input type="hidden" name="mostrar_modelo_examen" value=""/>
<input type="hidden" name="fecha_examen" value=""/>
<input type="hidden" name="identificador_unico" value=""/>
<input type="hidden" name="puntuacion" value=""/>
</form>
<fieldset>
<a href="javascript:void(0)" class="ver_corregidos"><font color="purple"> Corregidos </a></font><a href="javascript:void(0)" class="ver_no_corregidos"> <font color="purple">No Corregidos </font></a>
<div class="examenes_corregidos hide" style="height:300px;overflow-y:scroll" >
<table class="fidescu_table" >
<col/><col/><col/><col width="50%"/>
<tr ><td colspan="6">Examenes Corregidos</td></tr>
<tr>
<th>mod. Examen</th><th>Fecha</th><th >Descripción examen</th><th></th><th></th></tr>
<?php
if(count($examenes_corregidos)!=0)
{
foreach($examenes_corregidos as $examen_planificado)
{
$descripcion=html_entity_decode(utf8_decode($exame n_planificado[3]));


$descripcion=wordwrap($descripcion,20,'</br>');

if(strlen($descripcion)>40 and substr_count($descripcion," ")==0 )
{
$descripcion=chunk_split($descripcion,20,"<br/>");
}
$alumnos_participantes=$db->execute('select usuario.email,usuario.contrasena,resultado.puntuac ion from usuario,resultado,modelo_examen where resultado.id_usuario=usuario.id and modelo_examen.id='.$examen_planificado[0].' and resultado.fecha_examen="'.$examen_planificado[1].' ; "');
$tabla_participantes="";
foreach($alumnos_participantes as $alumno)
{
$tabla_participantes.=sprintf("<tr><td>%s </td><td>%s</td><td>%s</td></tr>",$alumno[0],$alumno[1],$alumno[2]);
}
printf('<tr><td>%s</td><td>%s</td><td><a href="javascript:void(0)" class="boton_mas_detalles_examen">+</a><p>%s</p><table class="fidescu_table hide">',$examen_planificado[0],date("d-m-y",strtotime($examen_planificado[1])),$descripcion);
print "<col width='80%'/><col width='20%'/>";
printf('<th>Alumno</th><th>Contraseña</th><th>Puntuacion</th></tr>
%s</table></td><td><input type="hidden" name="fecha_act_agenda" value="%s"/><a href="javascript:void(0)" class="boton_eliminar_examen_planeado">eliminar</a> </td><td><a href="javascript:void(0)" class="boton_modificar_examen_planeado"> clasificar</a></td>
</tr>',$tabla_participantes,date("Y-m-d",strtotime($examen_planificado[1])));
}
}
else
{print '<tr><td colspan="6">No se han tomado examenes.</td></tr>';}
?>
</table>
</div>
<div class="examenes_no_corregidos hide" style="height:300px;overflow-y:scroll" >
<table class="fidescu_table" >
<col/><col/><col/><col width="50%"/>
<tr ><td colspan="6">Examenes No Corregidos</td></tr>
<tr>
<th>mod. Examen</th><th>Fecha</th><th >Descripción examen</th><th></th><th></th></tr>
<?php
if(count($examenes_no_corregidos)!=0)
{
foreach($examenes_no_corregidos as $examen_planificado)
{
$descripcion=html_entity_decode(utf8_decode($exame n_planificado[3]));


$descripcion=wordwrap($descripcion,20,'</br>');

if(strlen($descripcion)>40 and substr_count($descripcion," ")==0 )
{
$descripcion=chunk_split($descripcion,20,"<br/>");
}
$alumnos_participantes=$db->execute('select usuario.email,usuario.contrasena,resultado.puntuac ion from usuario,resultado where resultado.id_usuario=usuario.id and resultado.id_examen='.$examen_planificado[0].' and resultado.fecha_examen="'.$examen_planificado[1].' ; "');
$tabla_participantes="";
foreach($alumnos_participantes as $alumno)
{
$tabla_participantes.=sprintf("<tr><td>%s %s</td><td>%s</td></tr>",$alumno[0],$alumno[1],$alumno[2]);
}
printf('<tr><td>%s</td><td>%s</td><td><a href="javascript:void(0)" class="boton_mas_detalles_examen">+</a><p>%s</p><table class="fidescu_table hide">',$examen_planificado[0],date("d-m-y",strtotime($examen_planificado[1])),$descripcion);
print "<col width='80%'/><col width='20%'/>";
printf('<th>Alumno</th><th>Contraseña</th><th>Puntuacion</th></tr>
%s</table></td><td><input type="hidden" name="fecha_act_agenda" value="%s"/><a href="javascript:void(0)" class="boton_eliminar_examen_planeado">eliminar</a> </td><td><a href="javascript:void(0)" class="boton_modificar_examen_planeado"> clasificar</a></td>
</tr>',$tabla_participantes,date("Y-m-d",strtotime($examen_planificado[1])));
}
}
else
{print '<tr><td colspan="6">No se han tomado examenes.</td></tr>';}
?>
</table>
</div>
</fieldset>
</form>
<table style="background-color:#FFFFFF" class="fidescu_table" style="width:98%; color:black" >
<col/>
<col width="220" style="border-left:1px black solid ;border-right:1px black solid"/>
<col width="100" style="border-right:1px black solid"/>
<col />
<tr>
<th width="50px"></th>
<th></th>
<th>Fecha</br>impartición</th>
<th>Descripción</th>
<th></th>
</tr>
<?php
$examenes_por_fecha=$db->execute('select fecha_examen,nivel.titulo_nivel,id_examen,usuario. email,identificador_unico, resultado.puntuacion from resultado,nivel,modelo_examen,usuario where resultado.id_examen In (select `id_examen` from `resultado` where id_examen between 346 and 365) and modelo_examen.id=resultado.id_examen and modelo_examen.nivel=nivel.id and resultado.id_usuario=usuario.id group by identificador_unico;');
$output="";
$num_examen=1;
$clase="impar";
foreach($examenes_por_fecha as $examen)
{
$id_examen=$examen[2];
$fecha_examen=$examen[0];
$nivel=$examen[1];
$puntuacion=$examen[5];
$identificador_unico=$examen[4];

if($clase=="impar")
{
$clase="par";
}
else
{
$clase="impar";
}

$output.=sprintf('<tr class="%s registro_examen"><td><a href="javascript:void(0);" class="boton_mostrar_tabla tabla_numero" meta="%s" >%s</a></td><td><a href="javascript:void()" meta="%s" class="boton_ver_modelo_examen">Ver Modelo Examen:%s</a></td><td><div id="fecha_examen" meta="%s">%s</div></td><td><input type="hidden" class="identificador_unico_examen" name="identificador_unico_examen" value="%s"/></td><td>%s</td></tr>',$clase,$id_examen,$num_examen,$id_examen,$id_ examen,$fecha_examen,strftime('%Y-%m-%d',strtotime($fecha_examen)),$identificador_unico ,$nivel);

$num_examen++;
}
print $output;




?>

</div>
</table>
<p id="loading" style="position:fixed;top:45%;left:0;px;width:110% ;height:50px;z-index:3;display:none;text-align:center"><b style="border:solid white 3px;background-color:#A6C9E2;-moz-border-radius:6px;font-size:120%;padding:0.6em;color:white">Cargando...</b></p>
</body>

<style type="text/css">
.hidden{display:none}
.tabla_numero{font-weight:bold;font-size:145%}
.par
{
background-color:silver;color:white
}
.impar
{
background-color:silver;color:white
}

div.corregido{font-weight:bold;font-size:1.1em;color:green}
div.no_corregido{font-weight:bold;font-size:1.1em;color:red;}
.marcar_no_corregido{-moz-border-radius:3em;background-color:blue;color:white;}
.marcar_borrado{-moz-border-radius:3em;background-color:blue;color:white;} .marcar_aprobado{-moz-border-radius:3em;background-color:blue;color:white;}


</style>
</html>