Find this useful? Enter your email to receive occasional updates for securing PHP code.
Signing you up...
Thank you for signing up!
PHP Decode
<?php namespace App\Http\Controllers; use Illuminate\Http\Request; use Auth; use..
Decoded Output download
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use Auth;
use App\Alumno;
use App\AlumnoOps;
use App\Setting_globals;
use App\ProgramacionOps;
use App\LibretaOps;
use App\ValoresDetalles;
use App\Asignatura;
use App\Matriculas;
use App\RequisitoAlumno;
use App\Programaciones;
use App\Pensum;
use App\Carrera;
use App\Persona;
use App\Libreta_Regular;
use App\MontoInscripcion;
use App\Docentes;
use App\Mesa;
use App\CargaHoraria;
use App\Libreta_Verano;
use App\AsignaturaDocente;
use App\Http\Controllers\AlumnoAntiguoController;
class ProgramaController extends Controller {
public function estado_programa($id, $re_programar = null) {
try {
$dato = Alumno::select("tipo_alumno", "matriculado", "alumnos.id as alumno_id", "curso_numeral", "plan_id", "alumnos.nivel as grado_a", "personas.nombre", "apellidos", "ci_persona", "genero", "activated", "ru_reg", "ra", "alumnos.gestion", "alumnos.fecha as fecha_alumno", "nombre_area", "nombre_carrera", "nombre_extension", "year", "carrera_paralela", "tipo_inscripcion", "alumnos.curso", "cambio", "tipo_alumno", "reprogramado", "reprogramado", "modalidad_titulacion_id", "convenio_id", "modalidad_activa", "alumnos.carrera_id", "carreras.programa", "carreras.nombre_programa", "programacion_activa", "cumplido", "solo_registro")->join("personas", "personas.id", "=", "alumnos.persona_id")->join("areas", "areas.id", "=", "alumnos.area_id")->join("carreras", "carreras.id", "=", "alumnos.carrera_id")->join("extensiones", "extensiones.id", "=", "alumnos.extension_id")->join("users", "users.persona_id", "=", "personas.id")->join("pensums", "pensums.id", "=", "alumnos.plan_id")->where("alumnos.bloqueado_cambio", "NO")->where("ru_reg", Alumno::find($id)->ru_reg)->where(function ($query) use($re_programar, $id) {
if ($re_programar != null) {
$query->where("alumnos.id", "!=", $id);
}
}
)->orderBy("alumnos.id", "asc")->get();
$dato_re = null;
if ($re_programar == "SI") {
$datos = $dato->where("alumnos.id", "!=", $id)->last();
$dato_re = Alumno::find($id);
}
else {
$datos = $dato->where("cumplido", 0)->last();
}
if ($datos->tipo_alumno == "nuevo" && $datos->matriculado == "NO") {
return redirect()->to("estado_alumno/" . $datos->alumno_id);
}
$cu = array();
$alumno_id = array();
foreach ($dato as $key => $value) {
$cu[] = $value->curso_numeral;
$alumno_id[] = $value->alumno_id;
}
$ultimo_curso = max($cu);
$car_programa = Carrera::find($datos->carrera_id);
if ($car_programa->gestion_programa == null || $car_programa->modulo_programa == null) {
return redirect()->back()->with("infoerror", "FALTA DATOS DE PROGRAMA GESTION O MODULO !! ");
}
$alumno_programa = Alumno::where("gestion", $car_programa->gestion_programa)->where("ru_reg", $datos->ru_reg)->where(function ($query) use($re_programar, $id) {
if ($re_programar != null) {
$query->where("alumnos.id", "!=", $id);
}
}
)->where("modulo_programa", $car_programa->modulo_programa)->first();
$valor_matricula_programa = null;
$valor_matricula = null;
if ($alumno_programa != null) {
if ($car_programa->programa != null && $car_programa->programa == "SI") {
$pensum_pro = Pensum::find($datos->plan_id);
if ($pensum_pro->matricula_programa != null) {
$valor_matricula_programa = ValoresDetalles::join("valores", "valores.id", "=", "valores_detalles.valor_id")->whereIn("valores.id", json_decode($pensum_pro->matricula_programa))->where("valores.antiguo", 0)->get();
$valor_matricula = $valor_matricula_programa->last();
}
else {
$valor_matricula = null;
}
}
$solo_registro = false;
if ($datos->solo_registro == true) {
$solo_registro = true;
}
$programacion_programas = Programaciones::select("programaciones.alumno_id", "programaciones.gestion", "programaciones.modulo_programa", "alumnos.reprogramado")->join("alumnos", "alumnos.id", "=", "programaciones.alumno_id")->where("alumnos.ru_reg", $datos->ru_reg)->groupBy("programaciones.alumno_id", "programaciones.gestion", "programaciones.modulo_programa", "alumnos.reprogramado")->orderBy("programaciones.gestion", "desc")->orderBy("programaciones.modulo_programa", "desc")->get();
$matricula_programas = Matriculas::select("matriculas.*", "alumnos.etapa")->join("alumnos", "alumnos.id", "=", "matriculas.alumno_id")->whereIn("alumnos.id", $alumno_id)->orderBy("matriculas.gestion", "desc")->orderBy("alumnos.etapa", "desc")->get();
return view("programa.estado", compact("datos", "programacion_programas", "alumno_programa", "matricula_programas", "ultimo_curso", "valor_matricula_programa", "valor_matricula", "dato_re", "solo_registro"));
}
$resultado = (new AlumnoAntiguoController())->control_materias_general($datos, $alumno_id);
$materias_aprobadas = $resultado[0];
$materias_reprobadas = $resultado[1];
$optativas = $resultado[2];
$asignaturas_mension = $resultado[3];
$asignaturas_programar = Asignatura::select("id", "nivel", "nombre", "paralelo", "asignaturas.id as asignatura_id")->whereNotIn("id", array_merge($materias_aprobadas, $optativas, $asignaturas_mension))->where("pensum_id", $datos->plan_id)->where("lista", 0)->where(function ($query) use($datos) {
if ($datos->grado_a == "LICENCIATURA") {
$query->where("asignaturas.grado_licenciatura", "SI");
}
elseif ($datos->grado_a == "TECNICO SUPERIOR") {
$query->where("asignaturas.grado_tecnico_superior", "SI");
}
elseif ($datos->grado_a == "TECNICO MEDIO") {
$query->where("asignaturas.grado_tecnico_medio", "SI");
}
elseif ($datos->grado_a == "AUXILIAR") {
$query->where("asignaturas.grado_auxiliar", "SI");
}
elseif ($datos->grado_a == "MANO DE OBRA CALIFICADA") {
$query->where("asignaturas.grado_modular", "SI");
}
$query->where("asignaturas.grado_titulacion", "NO");
}
)->orderby("nivel_numero", "asc")->orderBy("asignaturas.tipo", "asc")->orderBy("asignaturas.id", "asc")->get();
$cu = array();
foreach ($asignaturas_programar as $value) {
$cu[] = $value->nivel;
}
$cursos_unicos = array_unique($cu);
$re_alumno = array();
if ($re_programar != null) {
foreach (Programaciones::select("asignatura_id", "paralelo", "observacion")->where(array(array("alumno_id", $id), array("estado", 1)))->get() as $value) {
$re_alumno[$value->asignatura_id] = array($value->asignatura_id, $value->paralelo, $value->observacion);
}
}
return view("programa.estado", compact("datos", "asignaturas_programar", "ultimo_curso", "cursos_unicos", "re_programar", "dato_re", "re_alumno"));
}
catch (\Exception $e) {
return view("errors.404");
}
}
public function programar(Request $request) {
\DB::beginTransaction();
try {
$alumno = Alumno::find($request->alumno_id);
$carrera_pro = Carrera::find($alumno->carrera_id);
if ($alumno->cambio == "NO") {
$alumno_a = new Alumno();
$alumno_a->ra = $alumno->ra;
$alumno_a->ru_reg = $alumno->ru_reg;
$alumno_a->gestion = $carrera_pro->gestion_programa;
$alumno_a->fecha = date("Y-m-d");
$alumno_a->modalidad_ingreso_id = $alumno->modalidad_ingreso_id;
$alumno_a->usuario_registro = Auth::user()->id;
$alumno_a->postulante_id = $alumno->postulante_id;
$alumno_a->persona_id = $alumno->persona_id;
$alumno_a->curso = $request->curso_nuevo;
$alumno_a->curso_numeral = $this->identificar_curso($request->curso_nuevo);
$alumno_a->nivel = $alumno->nivel;
$alumno_a->plan_id = $alumno->plan_id;
$alumno_a->tipo_inscripcion = $alumno->tipo_inscripcion;
$alumno_a->carrera_paralela = $alumno->carrera_paralela;
$alumno_a->migrado = $alumno->migrado;
$alumno_a->mension_id = $alumno->mension_id;
$alumno_a->convenio_id = $alumno->convenio_id;
$alumno_a->area_id = $alumno->area_id;
$alumno_a->carrera_id = $alumno->carrera_id;
$alumno_a->extension_id = $alumno->extension_id;
$alumno_a->programacion_activa = "SI";
if (isset($request->nivelacion)) {
$alumno_a->observacion = "nivelante";
}
if (isset($request->arrastre)) {
$alumno_a->observacion = "arrastrante";
}
$alumno_a->programado = "SI";
$alumno_a->user_id = $alumno->user_id;
$alumno_a->tipo_alumno = "antiguo";
$alumno_a->modulo_programa = $carrera_pro->modulo_programa;
}
$asignaturas = $request->asignatura;
$contado_paralelos = count($request->paralelo);
if ($asignaturas == null) {
return redirect()->back()->with("infoerror", "SLECCIONE ASIGNATURAS!!");
}
if ($alumno->cambio == "NO") {
$alumno_a->save();
$alumno->cumplido = 1;
$requisito = RequisitoAlumno::where("alumno_id", $alumno->id)->first();
$requisito->alumno_id = $alumno_a->id;
$requisito->save();
$alumno->update();
}
elseif ($alumno->cambio == "SI") {
$alumno->programado = "SI";
$alumno->curso = $request->curso_nuevo;
$alumno->curso_numeral = $this->identificar_curso($request->curso_nuevo);
$alumno->update();
$alumno_a = $alumno;
}
$alumno_a = Alumno::find($alumno_a->id);
if ($alumno_a->carrera_id == 22) {
$alumno_a->matriculado = "SI";
$alumno_a->update();
}
else {
}
$asignaturas_programar = $asignaturas;
foreach ($asignaturas_programar as $key => $value) {
$asignatura = Asignatura::where("id", $value)->first();
$programacion = new Programaciones();
if ($asignatura->optativa !== null) {
for ($i = 0;
$i < $contado_paralelos;
$i++) {
$array_paralelo = explode("-", $request->paralelo[$i]);
if (in_array($asignatura->id, $array_paralelo)) {
$programacion->paralelo = $array_paralelo[1];
}
}
}
$programacion->curso = $asignatura->nivel;
$programacion->nombre_materia = $asignatura->nombre;
$programacion->optativa = "NO";
$programacion->fecha = date("Y-m-d");
$programacion->gestion = $alumno_a->gestion;
$programacion->alumno_id = $alumno_a->id;
$programacion->asignatura_id = $asignatura->id;
$programacion->user_id = Auth::user()->id;
$programacion->etapa = $alumno_a->etapa;
$programacion->modulo_programa = $alumno_a->modulo_programa;
if (isset($request->nivelacion)) {
if (in_array($asignatura->id, $request->nivelacion)) {
$programacion->observacion = "NIVELACION";
}
}
if (isset($request->arrastre)) {
if (in_array($asignatura->id, $request->arrastre)) {
$programacion->observacion = "ARRASTRE";
}
}
$programacion->save();
$libreta = new Libreta_Regular();
$libreta->programacion_id = $programacion->id;
$libreta->save();
}
if (isset($request->optativas)) {
$contado_paralelos_optativa = count($request->paralelo_optativo);
$optativas = $request->optativas;
foreach ($optativas as $key => $value) {
if ($value != "null") {
$asignatura = Asignatura::where("id", $value)->first();
$programacion = new Programaciones();
if ($asignatura->optativa !== null) {
for ($i = 0;
$i < $contado_paralelos_optativa;
$i++) {
$array_paralelo_optativo = explode("-", $request->paralelo_optativo[$i]);
if (in_array($asignatura->id, $array_paralelo_optativo)) {
$programacion->paralelo = $array_paralelo_optativo[1];
}
}
}
$programacion->curso = $asignatura->nivel;
$programacion->nombre_materia = $asignatura->nombre;
$programacion->optativa = $asignatura->optativa;
$programacion->fecha = date("Y-m-d");
$programacion->gestion = $alumno_a->gestion;
$programacion->alumno_id = $alumno_a->id;
$programacion->asignatura_id = $asignatura->id;
$programacion->user_id = Auth::user()->id;
$programacion->etapa = $alumno_a->etapa;
$programacion->modulo_programa = $alumno_a->modulo_programa;
if (isset($request->observacion_optativa)) {
foreach ($request->observacion_optativa as $values) {
$ni_arr = explode("-", $values);
if ($asignatura->identificador == $ni_arr[0] && $ni_arr[1] != "NINGUNO") {
$programacion->observacion = $ni_arr[1];
}
}
}
$programacion->save();
$libreta = new Libreta_Regular();
$libreta->programacion_id = $programacion->id;
$libreta->save();
}
}
}
\DB::commit();
return redirect()->to("imprimir_programacion/" . $alumno_a->id . "/R");
}
catch (\Exception $e) {
\DB::rollback();
return view("errors.404");
}
}
public function reprogramar(Request $request) {
\DB::beginTransaction();
try {
$al = Alumno::find($request->alumno_id);
$asignaturas = $request->asignatura;
if (isset($request->optativas)) {
$optativa = $request->optativas;
}
else {
$optativa = null;
}
$asig_m = Programaciones::select("programaciones.id as prog_id", "asignaturas.id as id_asignatura")->join("alumnos", "alumnos.id", "=", "programaciones.alumno_id")->join("asignaturas", "asignaturas.id", "=", "programaciones.asignatura_id")->where("programaciones.gestion", $al->gestion)->where("programaciones.alumno_id", $al->id)->where("programaciones.modulo_programa", $al->modulo_programa)->get();
if ($asignaturas === null && $optativa === null) {
return redirect()->back()->with("infoerror", "UPS!! SELECCIONE UNA ASIGNATURA.");
}
$id_destroy = array();
$id_no_destroy = array();
foreach ($asig_m as $value) {
$po = Programaciones::find($value->prog_id);
if (isset($request->nivelacion) && in_array($value->id_asignatura, $request->nivelacion)) {
$po->observacion = "NIVELACION";
$po->update();
}
elseif (isset($request->arrastre) && in_array($value->id_asignatura, $request->arrastre)) {
$po->observacion = "ARRASTRE";
$po->update();
}
else {
$po->observacion = null;
$po->update();
}
if ($asignaturas !== null && $optativa !== null) {
if (in_array($value->id_asignatura, $asignaturas)) {
if (($clave = array_search($value->id_asignatura, $asignaturas)) !== false) {
unset($asignaturas[$clave]);
}
}
elseif (in_array($value->id_asignatura, $optativa)) {
if (($clave = array_search($value->id_asignatura, $optativa)) !== false) {
unset($optativa[$clave]);
}
}
else {
$id_destroy[] = $value->prog_id;
}
}
elseif ($asignaturas !== null) {
if (in_array($value->id_asignatura, $asignaturas)) {
if (($clave = array_search($value->id_asignatura, $asignaturas)) !== false) {
unset($asignaturas[$clave]);
}
}
else {
$id_destroy[] = $value->prog_id;
}
}
elseif ($optativa !== null) {
if (($clave = array_search($value->id_asignatura, $optativa)) !== false) {
unset($optativa[$clave]);
}
else {
$id_destroy[] = $value->prog_id;
}
}
else {
$id_destroy[] = $value->prog_id;
}
}
$asig_m_libreta = Libreta_Regular::select("libreta_regular.*", "programaciones.*", "libreta_regular.id as id_lib")->join("programaciones", "programaciones.id", "=", "libreta_regular.programacion_id")->whereIn("programacion_id", $id_destroy)->get();
$id_destroy_libreta = array();
$id_destroy_programacion = array();
foreach ($asig_m_libreta as $value_libreta) {
$id_destroy_libreta[] = $value_libreta->id_lib;
$id_destroy_programacion[] = $value_libreta->programacion_id;
}
Libreta_Regular::destroy($id_destroy_libreta);
Programaciones::destroy($id_destroy_programacion);
$alumno = Alumno::find($request->alumno_id);
$alumno->programacion_activa = "SI";
$alumno->reprogramado = "SI";
if (isset($request->nivelacion)) {
$niv = array_unique($request->nivelacion);
if ($niv[0] == '') {
$alumno->observacion = null;
}
else {
$alumno->observacion = "nivelante";
}
}
$alumno->curso = $request->curso_nuevo;
$alumno->curso_numeral = $this->identificar_curso($request->curso_nuevo);
if (isset($request->nivelacion)) {
$alumno->observacion = "nivelante";
}
if (isset($request->arrastre)) {
$alumno->observacion = "arrastrante";
}
$contado_paralelos = count($request->paralelo);
if ($asignaturas !== null) {
$alumno->reprogramado = "SI";
$alumno->update();
foreach ($asignaturas as $key => $value) {
$asignatura = Asignatura::where("id", $value)->first();
$programacion = new Programaciones();
for ($i = 0;
$i < $contado_paralelos;
$i++) {
$array_paralelo = explode("-", $request->paralelo[$i]);
if (in_array($asignatura->id, $array_paralelo)) {
$programacion->paralelo = $array_paralelo[1];
}
}
$programacion->curso = $asignatura->nivel;
$programacion->nombre_materia = $asignatura->nombre;
$programacion->optativa = $asignatura->optativa;
$programacion->fecha = date("Y-m-d");
$programacion->gestion = $alumno->gestion;
$programacion->alumno_id = $alumno->id;
$programacion->asignatura_id = $asignatura->id;
$programacion->user_id = Auth::user()->id;
$programacion->modulo_programa = $alumno->modulo_programa;
if (isset($request->nivelacion)) {
if (in_array($asignatura->id, $request->nivelacion)) {
$programacion->observacion = "NIVELACION";
}
}
if (isset($request->arrastre)) {
if (in_array($asignatura->id, $request->arrastre)) {
$programacion->observacion = "ARRASTRE";
}
}
$programacion->save();
$libreta = new Libreta_Regular();
$libreta->programacion_id = $programacion->id;
$libreta->save();
}
if ($optativa !== null && array_count($optativa) != 0) {
foreach ($optativas as $key => $value) {
$asignatura = Asignatura::where("id", $value)->first();
$programacion = new Programaciones();
$programacion->curso = $asignatura->nivel;
$programacion->nombre_materia = $asignatura->nombre;
$programacion->optativa = $asignatura->optativa;
$programacion->fecha = date("Y-m-d");
$programacion->gestion = $alumno->gestion;
$programacion->alumno_id = $alumno->id;
$programacion->asignatura_id = $asignatura->id;
if ($alumno->gestion != Setting_globals::where("id", 1)->first()->gestion_admision) {
$programacion->migrado = "SI";
}
$programacion->user_id = Auth::user()->id;
$programacion->modulo_programa = $alumno->modulo_programa;
if (isset($request->nivelacion)) {
if (in_array($asignatura->id, $request->nivelacion)) {
$programacion->observacion = "NIVELACION";
$alumno->observacion = "nivelante";
$alumno->update();
}
}
if (isset($request->arrastre)) {
if (in_array($asignatura->id, $request->arrastre)) {
$programacion->observacion = "ARRASTRE";
}
}
$programacion->save();
$libreta = new Libreta_Regular();
$libreta->programacion_id = $programacion->id;
$libreta->save();
}
}
\DB::commit();
return redirect()->to("estado_curso_programa/" . $alumno->id)->with("info", "MATERIAS RE-PROGRAMADAS CON EXITO!!");
}
else {
\DB::commit();
return redirect()->back()->with("errorinfo", "NINGUNA ASIGNATURA FUE SELECCIONADA!!");
}
}
catch (\Exception $e) {
\DB::rollback();
return view("errors.404");
}
}
public function identificar_curso($curso) {
$curso_siguiente = 1;
switch ($curso) {
case "PRIMERO": $curso_siguiente = 1;
break;
case "SEGUNDO": $curso_siguiente = 2;
break;
case "TERCERO": $curso_siguiente = 3;
break;
case "CUARTO": $curso_siguiente = 4;
break;
case "QUINTO": $curso_siguiente = 5;
break;
case "SEXTO": $curso_siguiente = 6;
break;
case "SEPTIMO": $curso_siguiente = 7;
break;
case "OCTAVO": $curso_siguiente = 8;
break;
case "NOVENO": $curso_siguiente = 9;
break;
case "DECIMO": $curso_siguiente = 10;
break;
default: $curso_siguiente = 1;
break;
}
return $curso_siguiente;
}
}
?>
Did this file decode correctly?
Original Code
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use Auth;
use App\Alumno;
use App\AlumnoOps;
use App\Setting_globals;
use App\ProgramacionOps;
use App\LibretaOps;
use App\ValoresDetalles;
use App\Asignatura;
use App\Matriculas;
use App\RequisitoAlumno;
use App\Programaciones;
use App\Pensum;
use App\Carrera;
use App\Persona;
use App\Libreta_Regular;
use App\MontoInscripcion;
use App\Docentes;
use App\Mesa;
use App\CargaHoraria;
use App\Libreta_Verano;
use App\AsignaturaDocente;
use App\Http\Controllers\AlumnoAntiguoController;
class ProgramaController extends Controller {
public function estado_programa($id, $re_programar = null) {
try {
$dato = Alumno::select("\x74\151\160\157\x5f\x61\154\x75\x6d\x6e\x6f", "\x6d\x61\164\x72\151\143\x75\154\x61\144\157", "\141\x6c\165\155\x6e\157\163\x2e\x69\x64\x20\141\163\40\x61\154\x75\155\156\x6f\137\x69\144", "\x63\165\162\x73\x6f\x5f\156\x75\x6d\x65\162\x61\154", "\x70\x6c\141\156\137\151\144", "\x61\x6c\165\155\x6e\157\163\56\x6e\x69\x76\x65\x6c\40\141\163\x20\147\x72\x61\x64\x6f\x5f\141", "\160\x65\162\x73\x6f\156\141\x73\56\x6e\x6f\155\142\x72\145", "\141\x70\145\154\x6c\151\144\x6f\x73", "\143\x69\x5f\x70\145\x72\163\157\156\141", "\x67\x65\x6e\145\162\x6f", "\x61\x63\164\x69\x76\141\x74\145\x64", "\x72\x75\137\162\145\147", "\162\x61", "\141\x6c\x75\x6d\x6e\x6f\x73\56\x67\x65\163\164\151\157\156", "\141\154\165\155\156\x6f\x73\56\x66\x65\x63\150\x61\x20\x61\x73\40\x66\145\143\x68\x61\137\x61\x6c\x75\x6d\x6e\157", "\x6e\157\x6d\142\x72\x65\137\x61\x72\x65\x61", "\156\x6f\155\x62\162\145\137\x63\x61\x72\x72\145\x72\141", "\156\157\x6d\x62\162\x65\137\x65\170\x74\145\x6e\x73\151\157\x6e", "\x79\145\x61\162", "\x63\x61\162\162\145\162\141\137\160\141\x72\x61\x6c\x65\154\141", "\x74\151\160\157\137\x69\x6e\163\143\x72\151\x70\143\151\157\x6e", "\x61\154\x75\x6d\x6e\x6f\163\56\143\x75\162\x73\157", "\143\x61\x6d\x62\151\157", "\164\x69\160\x6f\137\x61\x6c\x75\x6d\x6e\x6f", "\162\x65\160\162\x6f\x67\x72\141\155\141\x64\x6f", "\162\145\x70\x72\x6f\x67\162\141\155\141\x64\157", "\155\x6f\x64\x61\x6c\x69\144\x61\x64\x5f\164\151\x74\x75\154\141\x63\151\x6f\156\x5f\x69\x64", "\x63\x6f\156\x76\145\x6e\151\x6f\x5f\151\x64", "\155\x6f\144\141\154\x69\144\x61\144\137\x61\143\x74\x69\x76\x61", "\x61\154\x75\x6d\x6e\x6f\163\x2e\x63\141\x72\x72\145\162\141\137\151\144", "\x63\x61\162\x72\x65\x72\141\x73\x2e\160\x72\157\147\x72\x61\x6d\141", "\x63\141\x72\x72\145\x72\141\x73\x2e\156\x6f\x6d\142\162\145\137\x70\162\157\147\162\141\155\x61", "\x70\x72\157\147\x72\x61\155\x61\x63\151\157\x6e\137\x61\143\164\151\166\x61", "\143\x75\155\x70\154\151\144\157", "\163\x6f\154\157\137\162\x65\147\151\x73\164\162\x6f")->join("\x70\145\162\x73\x6f\156\141\163", "\160\x65\162\x73\x6f\x6e\141\163\x2e\151\144", "\75", "\x61\154\x75\x6d\x6e\x6f\163\x2e\x70\x65\162\x73\x6f\x6e\141\x5f\x69\144")->join("\141\x72\145\x61\163", "\x61\x72\145\141\x73\x2e\151\x64", "\x3d", "\141\154\x75\155\156\x6f\163\x2e\x61\x72\145\141\137\151\144")->join("\143\x61\x72\162\x65\162\141\163", "\143\x61\162\x72\x65\162\141\x73\56\151\144", "\75", "\141\x6c\x75\155\x6e\x6f\163\x2e\x63\141\162\162\145\x72\x61\x5f\151\144")->join("\x65\170\164\x65\x6e\163\151\x6f\156\x65\x73", "\145\170\164\145\x6e\163\x69\x6f\156\x65\x73\x2e\151\144", "\75", "\141\154\x75\155\x6e\x6f\163\56\145\170\x74\145\156\163\151\157\156\137\151\x64")->join("\165\163\145\x72\x73", "\165\x73\145\x72\x73\56\160\x65\x72\163\157\x6e\141\137\x69\x64", "\75", "\x70\x65\162\x73\157\x6e\x61\x73\56\151\x64")->join("\160\145\x6e\163\x75\x6d\163", "\x70\x65\156\163\x75\x6d\x73\x2e\x69\144", "\x3d", "\x61\154\x75\x6d\x6e\157\163\56\x70\x6c\141\156\x5f\151\x64")->where("\x61\x6c\165\155\156\157\x73\x2e\142\154\157\161\x75\145\x61\144\157\137\143\141\155\x62\x69\157", "\x4e\117")->where("\162\165\137\162\145\147", Alumno::find($id)->ru_reg)->where(function ($query) use($re_programar, $id) {
if ($re_programar != null) {
$query->where("\141\154\x75\x6d\x6e\x6f\x73\x2e\x69\144", "\x21\75", $id);
}
}
)->orderBy("\x61\154\x75\x6d\x6e\x6f\x73\56\151\x64", "\141\163\x63")->get();
$dato_re = null;
if ($re_programar == "\x53\x49") {
$datos = $dato->where("\x61\154\165\x6d\x6e\x6f\163\56\151\144", "\x21\x3d", $id)->last();
$dato_re = Alumno::find($id);
}
else {
$datos = $dato->where("\143\165\x6d\x70\x6c\151\x64\x6f", 0)->last();
}
if ($datos->tipo_alumno == "\x6e\x75\x65\x76\157" && $datos->matriculado == "\x4e\117") {
return redirect()->to("\x65\163\x74\x61\x64\x6f\137\141\x6c\x75\155\x6e\157\x2f" . $datos->alumno_id);
}
$cu = array();
$alumno_id = array();
foreach ($dato as $key => $value) {
$cu[] = $value->curso_numeral;
$alumno_id[] = $value->alumno_id;
}
$ultimo_curso = max($cu);
$car_programa = Carrera::find($datos->carrera_id);
if ($car_programa->gestion_programa == null || $car_programa->modulo_programa == null) {
return redirect()->back()->with("\151\156\x66\x6f\x65\x72\x72\157\x72", "\106\x41\114\x54\x41\40\104\101\x54\117\x53\x20\104\105\40\120\x52\117\107\122\101\x4d\x41\40\107\105\123\x54\x49\117\116\x20\117\x20\x4d\117\x44\125\114\x4f\40\x21\41\x20");
}
$alumno_programa = Alumno::where("\147\145\163\x74\x69\x6f\156", $car_programa->gestion_programa)->where("\x72\x75\137\x72\145\x67", $datos->ru_reg)->where(function ($query) use($re_programar, $id) {
if ($re_programar != null) {
$query->where("\x61\x6c\x75\155\156\x6f\163\x2e\x69\x64", "\x21\75", $id);
}
}
)->where("\155\x6f\x64\165\x6c\x6f\x5f\160\162\x6f\147\x72\x61\x6d\x61", $car_programa->modulo_programa)->first();
$valor_matricula_programa = null;
$valor_matricula = null;
if ($alumno_programa != null) {
if ($car_programa->programa != null && $car_programa->programa == "\x53\111") {
$pensum_pro = Pensum::find($datos->plan_id);
if ($pensum_pro->matricula_programa != null) {
$valor_matricula_programa = ValoresDetalles::join("\166\x61\x6c\157\162\x65\x73", "\166\x61\x6c\157\x72\145\x73\56\x69\x64", "\75", "\166\141\154\x6f\162\145\163\137\144\x65\164\x61\x6c\154\x65\x73\x2e\x76\141\x6c\157\x72\x5f\x69\x64")->whereIn("\166\x61\154\157\x72\x65\x73\56\151\144", json_decode($pensum_pro->matricula_programa))->where("\x76\141\154\157\162\x65\x73\x2e\141\x6e\x74\151\x67\x75\x6f", 0)->get();
$valor_matricula = $valor_matricula_programa->last();
}
else {
$valor_matricula = null;
}
}
$solo_registro = false;
if ($datos->solo_registro == true) {
$solo_registro = true;
}
$programacion_programas = Programaciones::select("\160\x72\157\147\162\x61\x6d\141\143\x69\157\x6e\145\x73\56\141\154\165\x6d\x6e\157\x5f\151\144", "\160\162\x6f\x67\x72\x61\x6d\141\143\x69\157\x6e\145\x73\56\147\x65\x73\x74\x69\x6f\x6e", "\160\162\157\x67\x72\x61\155\x61\x63\151\x6f\156\x65\x73\56\x6d\x6f\144\165\x6c\157\137\160\x72\157\147\162\141\x6d\141", "\x61\x6c\x75\x6d\x6e\157\x73\56\162\145\160\x72\157\147\162\141\x6d\141\144\x6f")->join("\141\x6c\165\155\x6e\157\x73", "\141\x6c\165\x6d\x6e\x6f\x73\x2e\x69\x64", "\75", "\x70\162\157\x67\162\141\x6d\x61\x63\x69\x6f\156\x65\163\56\x61\154\165\x6d\x6e\157\x5f\151\144")->where("\141\x6c\x75\x6d\x6e\157\163\x2e\x72\165\x5f\162\x65\x67", $datos->ru_reg)->groupBy("\x70\x72\x6f\x67\162\141\155\x61\x63\x69\x6f\x6e\x65\x73\x2e\141\154\165\x6d\156\157\137\x69\144", "\160\162\x6f\147\x72\x61\155\x61\x63\x69\x6f\156\x65\x73\x2e\147\x65\163\x74\151\x6f\x6e", "\x70\162\157\x67\x72\141\155\141\x63\151\x6f\156\145\163\x2e\155\157\144\x75\154\157\137\x70\x72\x6f\x67\162\141\155\x61", "\x61\154\165\x6d\156\x6f\x73\56\162\145\x70\162\157\x67\x72\141\x6d\141\144\x6f")->orderBy("\x70\x72\157\x67\162\141\x6d\x61\x63\x69\x6f\156\145\163\56\x67\x65\x73\x74\151\157\156", "\144\145\163\143")->orderBy("\x70\162\157\147\162\x61\155\141\143\x69\157\156\x65\x73\x2e\x6d\x6f\x64\165\154\157\x5f\160\x72\x6f\x67\x72\141\x6d\141", "\144\x65\163\x63")->get();
$matricula_programas = Matriculas::select("\155\141\164\x72\151\143\165\154\x61\x73\56\x2a", "\x61\154\x75\x6d\x6e\x6f\163\x2e\x65\164\141\x70\141")->join("\x61\x6c\165\155\x6e\x6f\x73", "\x61\154\165\155\156\157\x73\x2e\x69\x64", "\75", "\x6d\x61\164\x72\151\143\165\154\141\163\56\141\x6c\165\155\156\x6f\x5f\151\144")->whereIn("\x61\x6c\165\155\156\x6f\x73\56\151\x64", $alumno_id)->orderBy("\x6d\141\x74\x72\x69\143\165\x6c\x61\163\56\147\145\163\x74\151\x6f\156", "\144\145\163\143")->orderBy("\141\154\165\155\x6e\x6f\163\x2e\x65\164\x61\160\141", "\x64\x65\163\143")->get();
return view("\160\x72\157\147\x72\141\x6d\141\x2e\145\x73\164\141\x64\157", compact("\144\141\164\157\163", "\x70\162\x6f\x67\x72\x61\155\x61\x63\x69\157\156\137\160\162\157\x67\162\x61\155\x61\x73", "\x61\154\165\x6d\156\x6f\x5f\160\x72\157\x67\x72\141\155\x61", "\x6d\x61\164\162\x69\x63\165\154\141\x5f\160\x72\157\147\x72\x61\x6d\141\163", "\x75\154\164\151\x6d\157\x5f\143\x75\162\x73\157", "\x76\141\154\157\x72\137\155\x61\x74\x72\x69\x63\165\154\141\x5f\x70\x72\157\147\x72\x61\155\141", "\x76\141\x6c\157\162\x5f\155\x61\x74\162\151\x63\x75\x6c\x61", "\144\x61\x74\157\x5f\x72\x65", "\x73\157\154\157\x5f\162\x65\147\x69\163\x74\162\x6f"));
}
$resultado = (new AlumnoAntiguoController())->control_materias_general($datos, $alumno_id);
$materias_aprobadas = $resultado[0];
$materias_reprobadas = $resultado[1];
$optativas = $resultado[2];
$asignaturas_mension = $resultado[3];
$asignaturas_programar = Asignatura::select("\151\144", "\x6e\151\166\x65\x6c", "\x6e\x6f\155\142\x72\x65", "\160\x61\162\x61\x6c\x65\x6c\157", "\x61\x73\151\x67\x6e\141\x74\x75\162\141\163\x2e\x69\x64\x20\x61\x73\x20\x61\163\x69\x67\x6e\141\x74\165\162\141\137\x69\144")->whereNotIn("\151\144", array_merge($materias_aprobadas, $optativas, $asignaturas_mension))->where("\160\x65\x6e\163\x75\155\137\x69\x64", $datos->plan_id)->where("\154\151\x73\x74\x61", 0)->where(function ($query) use($datos) {
if ($datos->grado_a == "\114\x49\103\105\x4e\x43\x49\x41\124\125\122\x41") {
$query->where("\x61\x73\x69\x67\x6e\x61\164\x75\162\141\x73\x2e\147\162\x61\144\x6f\137\x6c\x69\x63\x65\156\x63\x69\x61\x74\165\x72\141", "\123\x49");
}
elseif ($datos->grado_a == "\124\x45\x43\116\x49\103\117\40\123\125\x50\x45\122\x49\117\x52") {
$query->where("\141\x73\151\147\x6e\141\x74\x75\162\141\163\56\147\x72\141\x64\157\x5f\164\x65\143\156\x69\143\157\137\x73\x75\x70\x65\x72\x69\x6f\x72", "\123\x49");
}
elseif ($datos->grado_a == "\124\x45\x43\116\x49\x43\x4f\x20\x4d\105\x44\111\117") {
$query->where("\141\163\151\147\x6e\141\x74\165\x72\141\x73\x2e\147\162\x61\x64\x6f\137\164\x65\143\x6e\151\143\x6f\137\155\x65\x64\x69\157", "\123\x49");
}
elseif ($datos->grado_a == "\101\125\x58\x49\114\111\101\x52") {
$query->where("\x61\x73\x69\x67\x6e\141\x74\x75\162\141\x73\x2e\x67\x72\141\x64\157\x5f\x61\165\x78\151\154\151\141\162", "\123\x49");
}
elseif ($datos->grado_a == "\115\101\116\117\x20\x44\105\40\117\x42\122\x41\x20\103\101\x4c\x49\106\x49\x43\x41\x44\101") {
$query->where("\141\163\151\147\x6e\141\x74\165\x72\141\x73\56\147\x72\141\x64\x6f\x5f\155\x6f\144\165\154\141\x72", "\x53\111");
}
$query->where("\x61\163\151\x67\x6e\141\x74\165\x72\141\163\56\x67\x72\141\144\157\x5f\x74\151\x74\165\x6c\x61\x63\151\157\x6e", "\116\x4f");
}
)->orderby("\156\x69\x76\145\x6c\x5f\x6e\x75\155\145\x72\x6f", "\x61\163\x63")->orderBy("\x61\x73\151\147\156\x61\164\x75\162\141\x73\56\164\x69\x70\x6f", "\141\x73\143")->orderBy("\141\x73\x69\x67\x6e\141\x74\165\162\141\163\56\151\144", "\141\x73\x63")->get();
$cu = array();
foreach ($asignaturas_programar as $value) {
$cu[] = $value->nivel;
}
$cursos_unicos = array_unique($cu);
$re_alumno = array();
if ($re_programar != null) {
foreach (Programaciones::select("\141\x73\151\x67\156\x61\164\x75\162\x61\137\x69\x64", "\160\141\x72\x61\154\145\x6c\x6f", "\x6f\x62\x73\x65\x72\166\x61\143\151\157\x6e")->where(array(array("\141\x6c\165\x6d\x6e\x6f\x5f\x69\x64", $id), array("\x65\x73\x74\141\144\157", 1)))->get() as $value) {
$re_alumno[$value->asignatura_id] = array($value->asignatura_id, $value->paralelo, $value->observacion);
}
}
return view("\160\x72\x6f\x67\162\141\x6d\141\x2e\x65\x73\164\141\x64\x6f", compact("\144\141\164\157\163", "\141\163\x69\x67\156\x61\164\x75\162\141\163\x5f\160\162\157\147\x72\141\x6d\x61\162", "\x75\x6c\164\x69\x6d\157\x5f\143\x75\162\163\x6f", "\x63\x75\162\x73\157\x73\x5f\x75\156\151\x63\157\163", "\162\145\x5f\160\162\157\147\x72\x61\155\x61\162", "\x64\x61\164\157\x5f\x72\x65", "\x72\x65\137\x61\154\165\155\156\157"));
}
catch (\Exception $e) {
return view("\145\x72\162\157\x72\x73\x2e\64\60\64");
}
}
public function programar(Request $request) {
\DB::beginTransaction();
try {
$alumno = Alumno::find($request->alumno_id);
$carrera_pro = Carrera::find($alumno->carrera_id);
if ($alumno->cambio == "\116\117") {
$alumno_a = new Alumno();
$alumno_a->ra = $alumno->ra;
$alumno_a->ru_reg = $alumno->ru_reg;
$alumno_a->gestion = $carrera_pro->gestion_programa;
$alumno_a->fecha = date("\131\55\x6d\55\144");
$alumno_a->modalidad_ingreso_id = $alumno->modalidad_ingreso_id;
$alumno_a->usuario_registro = Auth::user()->id;
$alumno_a->postulante_id = $alumno->postulante_id;
$alumno_a->persona_id = $alumno->persona_id;
$alumno_a->curso = $request->curso_nuevo;
$alumno_a->curso_numeral = $this->identificar_curso($request->curso_nuevo);
$alumno_a->nivel = $alumno->nivel;
$alumno_a->plan_id = $alumno->plan_id;
$alumno_a->tipo_inscripcion = $alumno->tipo_inscripcion;
$alumno_a->carrera_paralela = $alumno->carrera_paralela;
$alumno_a->migrado = $alumno->migrado;
$alumno_a->mension_id = $alumno->mension_id;
$alumno_a->convenio_id = $alumno->convenio_id;
$alumno_a->area_id = $alumno->area_id;
$alumno_a->carrera_id = $alumno->carrera_id;
$alumno_a->extension_id = $alumno->extension_id;
$alumno_a->programacion_activa = "\123\111";
if (isset($request->nivelacion)) {
$alumno_a->observacion = "\x6e\x69\166\x65\154\x61\x6e\x74\x65";
}
if (isset($request->arrastre)) {
$alumno_a->observacion = "\x61\x72\162\x61\x73\164\x72\x61\156\x74\x65";
}
$alumno_a->programado = "\123\x49";
$alumno_a->user_id = $alumno->user_id;
$alumno_a->tipo_alumno = "\x61\x6e\x74\151\x67\x75\157";
$alumno_a->modulo_programa = $carrera_pro->modulo_programa;
}
$asignaturas = $request->asignatura;
$contado_paralelos = count($request->paralelo);
if ($asignaturas == null) {
return redirect()->back()->with("\x69\x6e\146\157\145\x72\x72\x6f\x72", "\x53\114\x45\x43\x43\x49\117\116\105\40\101\123\111\x47\116\x41\x54\125\x52\101\123\x21\41");
}
if ($alumno->cambio == "\116\x4f") {
$alumno_a->save();
$alumno->cumplido = 1;
$requisito = RequisitoAlumno::where("\141\x6c\165\155\156\x6f\137\x69\x64", $alumno->id)->first();
$requisito->alumno_id = $alumno_a->id;
$requisito->save();
$alumno->update();
}
elseif ($alumno->cambio == "\x53\x49") {
$alumno->programado = "\x53\111";
$alumno->curso = $request->curso_nuevo;
$alumno->curso_numeral = $this->identificar_curso($request->curso_nuevo);
$alumno->update();
$alumno_a = $alumno;
}
$alumno_a = Alumno::find($alumno_a->id);
if ($alumno_a->carrera_id == 22) {
$alumno_a->matriculado = "\x53\111";
$alumno_a->update();
}
else {
}
$asignaturas_programar = $asignaturas;
foreach ($asignaturas_programar as $key => $value) {
$asignatura = Asignatura::where("\151\144", $value)->first();
$programacion = new Programaciones();
if ($asignatura->optativa !== null) {
for ($i = 0;
$i < $contado_paralelos;
$i++) {
$array_paralelo = explode("\x2d", $request->paralelo[$i]);
if (in_array($asignatura->id, $array_paralelo)) {
$programacion->paralelo = $array_paralelo[1];
}
}
}
$programacion->curso = $asignatura->nivel;
$programacion->nombre_materia = $asignatura->nombre;
$programacion->optativa = "\116\117";
$programacion->fecha = date("\x59\x2d\155\x2d\x64");
$programacion->gestion = $alumno_a->gestion;
$programacion->alumno_id = $alumno_a->id;
$programacion->asignatura_id = $asignatura->id;
$programacion->user_id = Auth::user()->id;
$programacion->etapa = $alumno_a->etapa;
$programacion->modulo_programa = $alumno_a->modulo_programa;
if (isset($request->nivelacion)) {
if (in_array($asignatura->id, $request->nivelacion)) {
$programacion->observacion = "\x4e\x49\126\105\x4c\101\x43\111\117\x4e";
}
}
if (isset($request->arrastre)) {
if (in_array($asignatura->id, $request->arrastre)) {
$programacion->observacion = "\101\122\x52\x41\x53\124\122\x45";
}
}
$programacion->save();
$libreta = new Libreta_Regular();
$libreta->programacion_id = $programacion->id;
$libreta->save();
}
if (isset($request->optativas)) {
$contado_paralelos_optativa = count($request->paralelo_optativo);
$optativas = $request->optativas;
foreach ($optativas as $key => $value) {
if ($value != "\x6e\165\x6c\x6c") {
$asignatura = Asignatura::where("\x69\x64", $value)->first();
$programacion = new Programaciones();
if ($asignatura->optativa !== null) {
for ($i = 0;
$i < $contado_paralelos_optativa;
$i++) {
$array_paralelo_optativo = explode("\55", $request->paralelo_optativo[$i]);
if (in_array($asignatura->id, $array_paralelo_optativo)) {
$programacion->paralelo = $array_paralelo_optativo[1];
}
}
}
$programacion->curso = $asignatura->nivel;
$programacion->nombre_materia = $asignatura->nombre;
$programacion->optativa = $asignatura->optativa;
$programacion->fecha = date("\131\x2d\x6d\55\x64");
$programacion->gestion = $alumno_a->gestion;
$programacion->alumno_id = $alumno_a->id;
$programacion->asignatura_id = $asignatura->id;
$programacion->user_id = Auth::user()->id;
$programacion->etapa = $alumno_a->etapa;
$programacion->modulo_programa = $alumno_a->modulo_programa;
if (isset($request->observacion_optativa)) {
foreach ($request->observacion_optativa as $values) {
$ni_arr = explode("\x2d", $values);
if ($asignatura->identificador == $ni_arr[0] && $ni_arr[1] != "\116\111\116\x47\125\x4e\117") {
$programacion->observacion = $ni_arr[1];
}
}
}
$programacion->save();
$libreta = new Libreta_Regular();
$libreta->programacion_id = $programacion->id;
$libreta->save();
}
}
}
\DB::commit();
return redirect()->to("\151\155\160\x72\151\155\x69\x72\137\x70\x72\157\147\162\x61\x6d\x61\143\151\x6f\x6e\x2f" . $alumno_a->id . "\57\122");
}
catch (\Exception $e) {
\DB::rollback();
return view("\145\x72\162\157\x72\x73\x2e\x34\60\64");
}
}
public function reprogramar(Request $request) {
\DB::beginTransaction();
try {
$al = Alumno::find($request->alumno_id);
$asignaturas = $request->asignatura;
if (isset($request->optativas)) {
$optativa = $request->optativas;
}
else {
$optativa = null;
}
$asig_m = Programaciones::select("\160\x72\157\x67\162\x61\155\141\x63\151\157\x6e\x65\x73\56\151\x64\x20\141\163\40\x70\x72\157\147\x5f\151\x64", "\141\x73\x69\x67\x6e\141\x74\165\x72\141\x73\x2e\x69\144\40\x61\163\x20\151\144\x5f\141\163\x69\x67\x6e\x61\x74\165\162\141")->join("\141\154\165\155\156\x6f\x73", "\141\154\165\x6d\x6e\157\x73\56\151\x64", "\75", "\160\162\157\147\162\x61\x6d\141\x63\151\157\x6e\x65\163\56\x61\x6c\x75\x6d\156\x6f\137\151\144")->join("\x61\163\x69\x67\x6e\141\x74\165\x72\x61\163", "\141\163\x69\x67\x6e\x61\164\165\162\x61\163\56\x69\x64", "\75", "\160\162\x6f\x67\x72\x61\155\141\143\x69\157\156\145\163\x2e\x61\163\151\147\x6e\x61\x74\x75\x72\x61\x5f\151\144")->where("\160\162\157\x67\x72\x61\x6d\x61\x63\151\157\156\x65\163\56\x67\145\163\164\151\x6f\156", $al->gestion)->where("\160\162\x6f\x67\162\141\x6d\141\143\x69\x6f\156\145\x73\56\141\154\x75\155\x6e\x6f\137\x69\144", $al->id)->where("\x70\x72\x6f\x67\162\141\155\141\x63\151\157\156\145\x73\56\x6d\157\144\x75\x6c\x6f\x5f\160\162\x6f\147\162\x61\x6d\141", $al->modulo_programa)->get();
if ($asignaturas === null && $optativa === null) {
return redirect()->back()->with("\x69\x6e\146\157\145\162\162\157\162", "\125\x50\123\41\41\x20\x53\x45\114\105\103\103\111\117\116\x45\40\x55\x4e\101\x20\x41\123\x49\107\x4e\101\x54\125\x52\x41\56");
}
$id_destroy = array();
$id_no_destroy = array();
foreach ($asig_m as $value) {
$po = Programaciones::find($value->prog_id);
if (isset($request->nivelacion) && in_array($value->id_asignatura, $request->nivelacion)) {
$po->observacion = "\116\x49\x56\x45\114\x41\103\111\117\x4e";
$po->update();
}
elseif (isset($request->arrastre) && in_array($value->id_asignatura, $request->arrastre)) {
$po->observacion = "\x41\122\x52\x41\123\x54\122\x45";
$po->update();
}
else {
$po->observacion = null;
$po->update();
}
if ($asignaturas !== null && $optativa !== null) {
if (in_array($value->id_asignatura, $asignaturas)) {
if (($clave = array_search($value->id_asignatura, $asignaturas)) !== false) {
unset($asignaturas[$clave]);
}
}
elseif (in_array($value->id_asignatura, $optativa)) {
if (($clave = array_search($value->id_asignatura, $optativa)) !== false) {
unset($optativa[$clave]);
}
}
else {
$id_destroy[] = $value->prog_id;
}
}
elseif ($asignaturas !== null) {
if (in_array($value->id_asignatura, $asignaturas)) {
if (($clave = array_search($value->id_asignatura, $asignaturas)) !== false) {
unset($asignaturas[$clave]);
}
}
else {
$id_destroy[] = $value->prog_id;
}
}
elseif ($optativa !== null) {
if (($clave = array_search($value->id_asignatura, $optativa)) !== false) {
unset($optativa[$clave]);
}
else {
$id_destroy[] = $value->prog_id;
}
}
else {
$id_destroy[] = $value->prog_id;
}
}
$asig_m_libreta = Libreta_Regular::select("\154\151\142\162\145\x74\141\137\x72\x65\x67\x75\x6c\x61\x72\x2e\52", "\160\162\157\147\x72\141\155\x61\x63\x69\x6f\x6e\145\x73\56\52", "\154\151\142\162\x65\x74\141\137\162\145\x67\165\x6c\141\x72\x2e\151\144\x20\141\163\x20\151\144\137\154\x69\x62")->join("\160\x72\157\147\x72\x61\x6d\141\x63\x69\x6f\156\x65\163", "\x70\x72\x6f\147\162\141\155\x61\143\x69\x6f\156\145\163\56\151\x64", "\75", "\154\x69\x62\x72\x65\x74\141\x5f\x72\145\147\165\x6c\x61\x72\x2e\160\162\x6f\147\162\x61\155\x61\x63\151\x6f\156\137\x69\144")->whereIn("\160\162\157\147\x72\141\x6d\141\x63\151\157\156\x5f\151\144", $id_destroy)->get();
$id_destroy_libreta = array();
$id_destroy_programacion = array();
foreach ($asig_m_libreta as $value_libreta) {
$id_destroy_libreta[] = $value_libreta->id_lib;
$id_destroy_programacion[] = $value_libreta->programacion_id;
}
Libreta_Regular::destroy($id_destroy_libreta);
Programaciones::destroy($id_destroy_programacion);
$alumno = Alumno::find($request->alumno_id);
$alumno->programacion_activa = "\x53\111";
$alumno->reprogramado = "\123\x49";
if (isset($request->nivelacion)) {
$niv = array_unique($request->nivelacion);
if ($niv[0] == '') {
$alumno->observacion = null;
}
else {
$alumno->observacion = "\156\x69\166\145\154\141\156\x74\145";
}
}
$alumno->curso = $request->curso_nuevo;
$alumno->curso_numeral = $this->identificar_curso($request->curso_nuevo);
if (isset($request->nivelacion)) {
$alumno->observacion = "\156\151\166\145\x6c\141\x6e\x74\145";
}
if (isset($request->arrastre)) {
$alumno->observacion = "\x61\162\162\141\x73\x74\162\141\x6e\x74\145";
}
$contado_paralelos = count($request->paralelo);
if ($asignaturas !== null) {
$alumno->reprogramado = "\x53\x49";
$alumno->update();
foreach ($asignaturas as $key => $value) {
$asignatura = Asignatura::where("\x69\x64", $value)->first();
$programacion = new Programaciones();
for ($i = 0;
$i < $contado_paralelos;
$i++) {
$array_paralelo = explode("\55", $request->paralelo[$i]);
if (in_array($asignatura->id, $array_paralelo)) {
$programacion->paralelo = $array_paralelo[1];
}
}
$programacion->curso = $asignatura->nivel;
$programacion->nombre_materia = $asignatura->nombre;
$programacion->optativa = $asignatura->optativa;
$programacion->fecha = date("\x59\x2d\155\x2d\x64");
$programacion->gestion = $alumno->gestion;
$programacion->alumno_id = $alumno->id;
$programacion->asignatura_id = $asignatura->id;
$programacion->user_id = Auth::user()->id;
$programacion->modulo_programa = $alumno->modulo_programa;
if (isset($request->nivelacion)) {
if (in_array($asignatura->id, $request->nivelacion)) {
$programacion->observacion = "\x4e\111\x56\105\114\x41\103\x49\x4f\x4e";
}
}
if (isset($request->arrastre)) {
if (in_array($asignatura->id, $request->arrastre)) {
$programacion->observacion = "\x41\x52\122\101\x53\124\x52\x45";
}
}
$programacion->save();
$libreta = new Libreta_Regular();
$libreta->programacion_id = $programacion->id;
$libreta->save();
}
if ($optativa !== null && array_count($optativa) != 0) {
foreach ($optativas as $key => $value) {
$asignatura = Asignatura::where("\151\x64", $value)->first();
$programacion = new Programaciones();
$programacion->curso = $asignatura->nivel;
$programacion->nombre_materia = $asignatura->nombre;
$programacion->optativa = $asignatura->optativa;
$programacion->fecha = date("\131\x2d\x6d\55\144");
$programacion->gestion = $alumno->gestion;
$programacion->alumno_id = $alumno->id;
$programacion->asignatura_id = $asignatura->id;
if ($alumno->gestion != Setting_globals::where("\151\144", 1)->first()->gestion_admision) {
$programacion->migrado = "\x53\111";
}
$programacion->user_id = Auth::user()->id;
$programacion->modulo_programa = $alumno->modulo_programa;
if (isset($request->nivelacion)) {
if (in_array($asignatura->id, $request->nivelacion)) {
$programacion->observacion = "\116\x49\x56\105\x4c\101\103\x49\117\x4e";
$alumno->observacion = "\156\151\166\145\x6c\141\x6e\x74\145";
$alumno->update();
}
}
if (isset($request->arrastre)) {
if (in_array($asignatura->id, $request->arrastre)) {
$programacion->observacion = "\101\x52\122\x41\123\x54\122\x45";
}
}
$programacion->save();
$libreta = new Libreta_Regular();
$libreta->programacion_id = $programacion->id;
$libreta->save();
}
}
\DB::commit();
return redirect()->to("\145\x73\x74\x61\144\x6f\137\143\165\x72\163\x6f\x5f\160\x72\x6f\147\x72\141\x6d\141\x2f" . $alumno->id)->with("\151\x6e\146\x6f", "\115\101\124\x45\122\x49\x41\x53\40\x52\x45\x2d\120\x52\x4f\107\122\101\115\101\x44\x41\x53\40\x43\117\116\40\105\130\x49\x54\x4f\x21\41");
}
else {
\DB::commit();
return redirect()->back()->with("\x65\162\x72\x6f\162\x69\156\x66\x6f", "\116\x49\116\x47\125\116\x41\x20\101\123\111\x47\116\x41\x54\x55\x52\x41\x20\106\125\105\x20\123\105\x4c\105\x43\103\111\x4f\x4e\x41\104\x41\41\41");
}
}
catch (\Exception $e) {
\DB::rollback();
return view("\145\x72\x72\x6f\162\163\x2e\64\60\64");
}
}
public function identificar_curso($curso) {
$curso_siguiente = 1;
switch ($curso) {
case "\120\122\111\115\105\x52\117": $curso_siguiente = 1;
break;
case "\x53\x45\107\x55\x4e\x44\117": $curso_siguiente = 2;
break;
case "\124\x45\x52\x43\105\122\117": $curso_siguiente = 3;
break;
case "\x43\x55\x41\x52\x54\117": $curso_siguiente = 4;
break;
case "\121\x55\x49\x4e\124\x4f": $curso_siguiente = 5;
break;
case "\123\105\130\124\x4f": $curso_siguiente = 6;
break;
case "\123\x45\x50\x54\111\x4d\117": $curso_siguiente = 7;
break;
case "\x4f\x43\124\x41\126\x4f": $curso_siguiente = 8;
break;
case "\x4e\x4f\126\105\x4e\x4f": $curso_siguiente = 9;
break;
case "\x44\105\x43\111\115\x4f": $curso_siguiente = 10;
break;
default: $curso_siguiente = 1;
break;
}
return $curso_siguiente;
}
}
Function Calls
None |
Stats
MD5 | 9d08424bd7a9227157ea1db31ce7cf8d |
Eval Count | 0 |
Decode Time | 124 ms |