<?php

require_once("../config/conexion.php");
require_once("../models/Procesos.php");
require_once("../models/Permisos.php");
$procesos = new Procesos();

switch ($_GET["op"]) {
    case "replicar":
        $datos = $procesos->ReplicarMalla($_GET["carrera"], $_GET["periodo"],$_GET["periodoN"]);        
        $data = Array();
        $accesos = "";
        foreach ($datos as $row) {
            $sub_array = array();
            $sub_array[] = $row["asignatura"];
            $sub_array[] = $row["nivel"];
            $sub_array[] = $row["periodo"];
            $sub_array[] = $row["estado"];
            $sub_array[] = $row["carrera"];
            $sub_array[] = $row["creditos"];
            $sub_array[] = $row["tipo"];
            $sub_array[] = $row["codigo"];
            $sub_array[] = $row["docente"];
            $sub_array[] = $row["paralelo"];
            $sub_array[] = $row["itinerario"];
            $sub_array[] = $row["calificar"];
            $sub_array[] = $row["cd"];
            $sub_array[] = $row["cp"];
            $sub_array[] = $row["ca"];
            $sub_array[] = $accesos;
            $data[] = $sub_array;
            $accesos = "";            
        }
        $results = array(
            "sEcho" => 1,
            "iTotalRecords" => count($data),
            "iTotalDisplayRecords" => count($data),
            "aaData" => $data
        );
        echo json_encode($results);
        break;
}
?>
