<?php

include_once '../../login/check.php';
$folder = "../../";
$titulo = "Modificar Tema";
$id = $_GET['id'];
include_once '../../class/temas.php';
$temas = new temas();
$tem = array_shift($temas->mostrar($id));
$bimestre = array("1" => "1", "2" => "2", "3" => "3", "4" => "4");
include_once '../../funciones/funciones.php';
include_once '../../cabecerahtml.php';
include_once '../../cabecera.php';
?>
<div class="grid_12">
	<div class="contenido imagenfondo">
    	<div class="prefix_4 grid_4 alpha">
			<fieldset>
				<div class="titulo"><?php 
echo $titulo;
?>
</div>
                <form action="actualizar.php" method="post" enctype="multipart/form-data">
                <?php 
campos("", "id", "hidden", $id);
?>
				<table class="tablareg">
                    <tr>
						<td><?php 
campos("Bimestre", "bimestre", "select", $bimestre, 1, array("required" => "required"), $tem['bimestre']);
?>
<?php

include_once '../../login/check.php';
if (!empty($_POST)) {
    $folder = "../../";
    include_once '../../class/practica.php';
    $practica = new practica();
    include_once '../../class/temas.php';
    $temas = new temas();
    extract($_POST);
    $codtemas = $codtemas != "" ? $codtemas : "%";
    $bimestre = $bimestre != "" ? $bimestre : "%";
    $prac = $practica->mostrarTodo("codtemas LIKE '{$codtemas}' ", "enunciado");
    foreach ($prac as $p) {
        $i++;
        $tem = array_shift($temas->mostrar($p['codtemas']));
        $datos[$i]['codpractica'] = $p['codpractica'];
        $datos[$i]['tema'] = $tem['nombre'];
        switch ($p['tipo']) {
            case '1':
                $tipo = "Enunciado, Video/Audio y Respuesta";
                break;
            case '2':
                $tipo = "Traducir o Completar";
                break;
            case '3':
                $tipo = "Seleccionar la Respuesta Correcta";
                break;
        }
        $datos[$i]['tipo'] = $tipo;
        $datos[$i]['enunciado'] = $p['enunciado'];