<?
include_once("../fnc.php");
enlinea_c();
//$frm_action="frm_replicar_evaluacion.php";

if($id_evaluacion){
  $frm_action="mnt_replicar_evaluacion.php";
}

$tipo_trn="Add";
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>e-Ducativo - Bienvenido</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link href="../estilo1.css" rel="stylesheet" type="text/css">
<?
//$onload=foco("txtcursoo");
?>
<?=mascara();?>
<script language="javascript">
<!--
function validar(){
  var objeto;
  var formulario = document.form1;

  objeto = document.form1.txtcursoo;
  if(objeto.value=="SV"){
    alert("Seleccione un curso origen");
    objeto.focus();
    return(false);
  }
  return (true);
}

function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}
//-->
</script>
</head>

<body>
<table width="100%"  border="0" cellspacing="0" cellpadding="1">
  <tr>
    <td align="left" valign="top"><form action="<?=$frm_action;?>" method="post" enctype="multipart/form-data" name="form1" onsubmit="return validar();">
      <table width="100%" border="0" cellspacing="0" cellpadding="0">
        <tr>
          <td colspan="2"><table width="100%" border="0" cellspacing="0" cellpadding="0">
            <tr>
              <td width="2%"><img src="../images/tema/ic_formularios.png" width="35" height="32"></td>
              <td width="98%" background="../images/tema/bg_titulo_frm.png" class="titulo_formulario">Replicar evaluaciones en l&iacute;nea para otros cursos</td>
            </tr>
          </table></td>
        </tr>
        <tr>
          <td width="42%" background="../images/tema/bg_frm_campos.png" class="lbl_campo"><strong>Curso origen para importar la evaluaci&oacute;n:</strong></td>
          <td width="58%" background="../images/tema/bg_frm_campos.png">&nbsp;</td>
        </tr>
        <tr>
          <td colspan="2" bgcolor="#CFDFEF"><select name="txtcursoo" class="textbox" id="txtcursoo" onChange="MM_jumpMenu('self',this,0)">
            <option value="#" selected>Seleccione uno...</option>
            <?
                                           $qgrados=runsql("select distinct grados.grado, grados.id as idg, cursos.curso, cursos.codigo as idc,
                                                            jornadas.jornada, jornadas.id as idj, niveles.nivel, niveles.id as idn, cursos_catedraticos.seccion
                                                            from cursos_catedraticos inner join grados on cursos_catedraticos.grado = grados.id
                                                            inner join cursos on cursos_catedraticos.curso = cursos.codigo
                                                            inner join niveles on grados.nivel = niveles.id
                                                            inner join jornadas on jornadas.id = grados.jornada
                                                            where cursos_catedraticos.catedratico = '$uuser'
                                                            order by jornadas.jornada, niveles.nivel, grados.grado, cursos.curso");
                            while($ico=registro($qgrados)){
                              $sel="";
                              if($ico[idc]==dec($idc)){
                                $sel="selected class='selected_option'";
                                $filtro=$ico[curso];
                              }
                              echo "<option value='index2.php?op=frm_replicar_evaluacion&idc=".enc($ico[idc])."' $sel>{$ico[jornada]} | {$ico[nivel]} | {$ico[grado]} | {$ico[curso]} {$ico[seccion]}</option>\n";
                            }
                            ?>
          </select></td>
        </tr>
        <?
                        if($idc){
                        $id_c=dec($idc);
                        ?>
        <tr>
          <td colspan="2" bgcolor="#FFFFCC" class="lbl_campo"><strong>Seleccione la evaluaci&oacute;n que desea importar: </strong></td>
        </tr>
        <tr>
          <td colspan="2" bgcolor="#FFFFCC"><table width="100%" border="0" cellspacing="0" cellpadding="0">
            <tr>
              <td width="7%" class="lbl_campo"><div align="center"><strong>Marque</strong></div></td>
              <td width="47%" class="lbl_campo"><div align="center"><strong>Nombre</strong></div></td>
              <td width="11%" class="lbl_campo"><div align="center"><strong>Fecha Inicio </strong></div></td>
              <td width="12%" class="lbl_campo"><div align="center"><strong>Fecha Caducidad </strong></div></td>
              <td width="9%" class="lbl_campo"><div align="center"><strong>Estado</strong></div></td>
              <td width="14%" class="lbl_campo"><div align="center"><strong>Opciones</strong></div></td>
            </tr>
            <?
                             $filtro_ev="";
                            if($id_evaluacion){
                              $filtro_ev=" and id = '$id_evaluacion'"; 
                            }
                            $qev=runsql("select * from evaluaciones where curso = '$id_c' $filtro_ev");
                            while($iev=registro($qev)){
                            $chk="";
                            if($id_evaluacion == $iev[id]){
                             $chk="checked";
                            }
                            ?>
            <tr bgcolor="<?=color_fila(++$cont);?>">
              <td class="parrafo"><div align="center">
                <input name="id_evaluacion" type="radio" value="<?=$iev[id];?>" <?=$chk;?>>
              </div></td>
              <td class="parrafo"><?=$iev[nombre];?></td>
              <td class="parrafo"><div align="center"><?=fecha($iev[fecha_inicio]);?><br><?=$iev[hora_inicio];?></div></td>
              <td class="parrafo"><div align="center"><?=fecha($iev[fecha_fin]);?><br><?=$iev[hora_fin];?></div></td>
              <td class="parrafo"><div align="center"><?if($iev[activa]=="S"){echo "Activa";}else{echo "Inactiva";}?></div></td>
              <td class="parrafo"><div align="center">Ver Preguntas </div></td>
            </tr>
            <?
                            }
                            ?>
          </table></td>
        </tr>
        <tr>
          <td background="../images/tema/bg_frm_campos.png" class="lbl_campo">&nbsp;</td>
          <td background="../images/tema/bg_frm_campos.png"><input name="max" type="hidden" id="max" value="<?=$cont;?>"></td>
        </tr>
        <tr>
          <td background="../images/tema/bg_frm_campos.png">&nbsp;</td>
          <td background="../images/tema/bg_frm_campos.png"><input name="button" type="submit" class="boton_guardar" id="button" value="Ir al paso2">
                <br></td>
        </tr>
        <?
                        if($id_evaluacion){
                        ?>
        <tr>
          <td colspan="2" bgcolor="#FFFFFF"></td>
        </tr>
        <tr>
          <td colspan="2" bgcolor="#FFFFFF"></td>
        </tr>
        <tr>
          <td colspan="2" bgcolor="#FFFFFF"></td>
        </tr>
        <tr>
          <td colspan="2" bgcolor="#FFF7D7"><div align="left" class="lbl_campo"><strong>Seleccione los cursos a los que desea replicar la evaluaci&oacute;n: </strong></div></td>
        </tr>
        <tr>
          <td colspan="2" bgcolor="#FFF7D7"><table width="100%" border="1" cellspacing="0" cellpadding="2">
            <tr>
              <td width="7%"><div align="center" class="lbl_campo">
                <div align="center">Marque</div>
              </div></td>
              <td width="10%" class="lbl_campo"><div align="center">Jornada </div></td>
              <td width="19%" class="lbl_campo"><div align="center">Nivel</div></td>
              <td width="28%" class="lbl_campo"><div align="center">Grado</div></td>
              <td width="25%" class="lbl_campo"><div align="center">Curso</div></td>
            </tr>
            <?
                            $qoc=runsql("select distinct c.curso, c.codigo, cg.grado, n.nivel, j.jornada, grados.grado as ngrado, cc.seccion
                                         from cursos c inner join cursos_grados cg ON c.codigo = cg.curso
                                         inner join grados ON grados.id = cg.grado
                                         inner join niveles n ON n.id = grados.nivel
                                         inner join jornadas j ON j.id = grados.jornada
                                         inner join cursos_catedraticos cc ON cc.curso = c.codigo
                                         where cc.catedratico = '$uuser'
                                         order by j.jornada, n.nivel, grados.en_numeros, c.curso, seccion");
                                         //where c.curso like '%$txtfiltro%'
                            while($ioc=registro($qoc)){
                            ?>
            <tr bgcolor="<?=color_fila(++$cont2);?>">
              <td class="parrafo"><div align="center">
                <input type="checkbox" name="curso<?=$cont2;?>" value="<?=$ioc[codigo];?>">
                <input type="hidden" name="seccion<?=$cont2;?>" value="<?=$ioc[seccion];?>">
              </div></td>
              <td class="parrafo"><?=$ioc[jornada];?></td>
              <td class="parrafo"><?=$ioc[nivel];?></td>
              <td class="parrafo"><?=$ioc[ngrado];?></td>
              <td class="parrafo"><?=$ioc[curso]."<br>Secci&oacute;n: ".$ioc[seccion];?></td>
            </tr>
            <?
                           }
                           ?>
          </table></td>
        </tr>
        <tr>
          <td background="../images/tema/bg_frm_campos.png"><input name="maxc" type="hidden" id="maxc" value="<?=$cont2;?>"></td>
          <td background="../images/tema/bg_frm_campos.png"><input name="button2" type="submit" class="boton_guardar" id="button2" value="Replicar Evaluaci&oacute;n"></td>
        </tr>
        <?
        } //fin del segundo if
        } // fin del primer if
        ?>
      </table>
    </form></td>
  </tr>
</table>
</body>
</html>
