Ver Mensaje Individual
  #7 (permalink)  
Antiguo 21/10/2003, 13:41
KillerBKS
 
Fecha de Ingreso: julio-2002
Ubicación: Rancagua - Chile
Mensajes: 494
Antigüedad: 21 años, 9 meses
Puntos: 0
Aca estoy buscando todos los alumnos del curso y luego les agrego un campo texto para poner la nota.

ver.php
Código PHP:
<?
require "../include/global_login.php";
?>
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link href="../estilos.css" rel="stylesheet" type="text/css">
</head>
<body onLoad="MM_preloadImages('../images/forotopizout.gif')">
<?
     $id_curso
=$curso;

?>
<table width="100%" border=0 cellpadding=0 cellspacing=0>
  <tr bgcolor="#5c60a5"> 
    
    
    <td height="18" class="mainwhite"> <table width="100%" border="0" cellspacing="0" 
background="../images/fonditoforotop.gif">

        <tr> 
          <td width="91%" class="titulo"><img 
src="../images/recursosgr.gif" width="50" height="50">Ingresar 
            Evaluaciones</td>
          <td width="9%" valign="top"><div align="right"><a href="javascript:history.go(-1)" 
onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage

('Image3','','../images/forotopizout.gif',1)"><img 
src="../images/forotopiz.gif" alt="Volver..." name="Image3" 
width="99" height="50" border="0"></a></div></td>

        </tr>
      </table>
      <p>&nbsp; <img src="../images/fl.gif" width="5" height="10" 
alt="" border="0"> 
        <b class="foroplat">Administracion de 
Evaluaciones</b></p></td>
    <td class="mainwhite">&nbsp;</td>
    <td class="mainwhite">&nbsp;</td>
    
    <td width="1%" valign="top" class="mainwhite"> <div align="right"><img src="../images/esqizsup.gif" width="18" 
height="18"></div></td>
  </tr>
  <tr bgcolor="#A8EAFF"> 
    <td height="18" colspan="4" class="mainwhite">&nbsp;</td>
  </tr>
</table>
<form name="form1" method="post" action="grabar.php">
  <table width="75%" border="1">
    <tr> 
      <td width="47%" class="titulo">Nombre de la Evaluacion : <? 
echo $nombre ?></td>
      <td width="53%" class="titulo">Nota del Alumno</td>
    </tr>
    <? $numero=1;
  
$consulta_usuarios=mysql_query("select 
id,courses,modules,users FROM wp where courses='"
.$id_curso."' 
AND modules=0 AND folders=0 AND groups=0 AND cases=0"
);
  
$maximo=mysql_num_rows($consulta_usuarios);
  
  while (
$row2=mysql_fetch_array($consulta_usuarios))
  {
      
$ver_user=mysql_query("select id,surname,firstname 
FROM users where id='"
.$row2["users"]."'");
    
$valor=mysql_result($ver_user,0,"id");
    
$arr_user[$numero]=$valor;
    
    
  
?>
    <tr> 
      <td class="contenido"><?  echo mysql_result
($ver_user,0,"surname")." "; echo mysql_result
($ver_user,0,"firstname"); ?></td>
      <td class="contenido"><input name="nota<? echo 
$numero?>" type="text" id="nota<? echo $numero?>
size="4" maxlength="3"></td>
    </tr>
    <? 
    $numero
=$numero+1;
   } echo 
$maximo;
     
$usuarios=implode(",",$arr_user);
     echo 
"usuarios ..."; echo $usuarios;
   
?>

  </table>
  <p> 
    <input name="id_curso" type="hidden" value="<? echo 
$id_curso ?>">
    <input name="id_eval" type="hidden" value="<? echo 
$id_eval ?>">
    <input name="id_user" type="hidden" value="<? echo $usuarios ?>">
    <input name="Grabar" type="submit" id="Grabar" 
value="Grabar">
    <input name="limpiar" type="reset" id="limpiar" 
value="Limpiar">
    <input name="valormax" type="hidden" value="<? 
echo $maximo?>">
  </p>
</form>
<p>&nbsp;</p>
</body>
</html>
y en este archivo tomo los datos anteriores para grabar

grabar.php
Código PHP:
<?
require "../include/global_login.php";
?>
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>

<body>
<?
echo $id_eval;
$id_usuario=$person["id"];
$array_id_user=explode(",",$id_user);
for (
$i=0;$i<$valormax;$i++)
{
    
$n=$i+1;
    
$nueva="nota".$n;
    
$insertar=mysql_query("INSERT INTO notas(id_alum,nota,id_eval,id_profe,fecha_ing,id_curso)
    VALUES('"
.$array_id_user[$i]."','".$$nueva."','".$id_eval."','".$id_usuario."',NOW(),'".$id_curso."')");
}
?>
<p><font size="3" face="Verdana, Arial, Helvetica, sans-
serif">Las Notas han Sido ingresadas </font></p>
<p><font size="3" face="Verdana, Arial, Helvetica, sans-
serif"><a href="index.php?curso=<? echo $id_curso ?>">Volver</a></font> 

</p>
</body>
</html>
Igual esta funcionando bien, pero lo encuentro medio carretero, tal vez este consumiendo muchos recursos del servidor.
Echenle una miradita, espero sus comentarios

Salu2
__________________
AK.T.I.V.E.tm Live, Never DIE

Última edición por KillerBKS; 21/10/2003 a las 21:26