Exemple #1
0
 private function mapearMatricula(Matricula $matricula, array $props)
 {
     if (array_key_exists('idPersona', $props)) {
         $matricula->setIdPersona($props['idPersona']);
     }
     if (array_key_exists('idSalon', $props)) {
         $matricula->setIdSalon($props['idSalon']);
     }
     if (array_key_exists('jornada', $props)) {
         $matricula->setJornada($props['jornada']);
     }
     if (array_key_exists('fecha_matricula', $props)) {
         $matricula->setFecha($props['fecha_matricula']);
     }
     if (array_key_exists('año_lectivo', $props)) {
         $matricula->setAnoLectivo($props['año_lectivo']);
     }
     if (array_key_exists('nMatricula', $props)) {
         $matricula->setNMatricula($props['nMatricula']);
     }
 }
 /**
  * Matricula De estudiantes
  */
 public function matricular()
 {
     try {
         $idPersona = isset($_POST['idPersona']) ? $_POST['idPersona'] : NULL;
         $idSalon = isset($_POST['idSalon']) ? $_POST['idSalon'] : NULL;
         $jornada = isset($_POST['jornada']) ? $_POST['jornada'] : NULL;
         $foto = isset($_POST['foto']) ? $_POST['foto'] : NULL;
         if ($foto != "") {
             $foto = $this->limpia_espacios($foto);
             $contents = file_get_contents($foto);
             $savefile = fopen('utiles/imagenes/fotos/' . $idPersona . '.png', 'w');
             fwrite($savefile, $contents);
             fclose($savefile);
         }
         $fecha = getdate();
         $FechaTxt = $fecha["year"] . "-" . $fecha["mon"] . "-" . $fecha["mday"];
         if ($fecha["month"] == 'December' or $fecha["month"] == 'November' or $fecha["month"] == 'October') {
             $año = $fecha["year"];
             $añoLectivo = $año + 1;
         } else {
             $añoLectivo = $fecha["year"];
         }
         $mat = new Matricula();
         $mat->setIdPersona($idPersona);
         $mat->setIdSalon($idSalon);
         $mat->setJornada($jornada);
         $mat->setFecha($FechaTxt);
         $mat->setAnoLectivo(strval($añoLectivo));
         $mat->matricularEstudiante($mat);
         echo json_encode("1");
     } catch (Exception $exc) {
         echo json_encode('Error de aplicacion: ' . $exc->getMessage());
     }
 }