public function asignatura($profesor_id)
 {
     $profesor = new Profesor();
     $profesorasignatura = new Profesorasignatura();
     $this->profesor = $profesor->find($profesor_id);
     $this->asignaturas = $profesorasignatura->getAsignaturasByProfesorId($profesor_id);
     $this->select = $profesorasignatura->getParaAsignaturaParaAsignar($profesor_id);
 }
예제 #2
0
 public function editarDatos()
 {
     if (Request::ajax()) {
         $new_profesor = Profesor::find(Auth::user()->id);
         $new_profesor->email = Input::get("email");
         $new_datos_profesor = DatosProfesor::where('profesor_id', '=', Auth::user()->id)->first();
         $new_datos_profesor->nombre = Input::get("nombre");
         $new_datos_profesor->apellido_paterno = Input::get("apellido_paterno");
         $new_datos_profesor->apellido_materno = Input::get("apellido_materno");
         $new_datos_profesor->celular = Input::get("celular");
         if ($new_datos_profesor->validate(array('nombre' => 'required', 'apellido_paterno' => 'required', 'apellido_materno' => 'required', 'celular' => 'required|digits:10'))) {
             if ($new_profesor->updateUniques()) {
                 $new_datos_profesor->forceSave();
                 return Response::json(array('success' => true));
             } else {
                 return Response::json(array('success' => false, 'errores' => $new_profesor->errors()->toArray()));
             }
         } else {
             return Response::json(array('success' => false, 'errores' => $new_datos_profesor->errors()->toArray()));
         }
     }
 }
 public function getProfesor($id)
 {
     $prof = new Profesor();
     return $prof->find($id);
 }
 public function cambiarpass($id_profesor)
 {
     $this->titulo = "Cambiar contraseña";
     $this->profesor = new Profesor();
     $this->profesor->id = $id_profesor;
     if (Input::post("profesor") and Input::post("pass1")) {
         $inputs = Input::post("profesor");
         if ($inputs['password'] != $inputs['password2']) {
             Input::delete();
             Flash::info("Las nuevas contraseñas no coinciden");
             Router::redirect("perfil/cambiarpass/{$id_profesor}");
             die;
         }
         $prof = new Profesor();
         $prof_pass = $prof->find($id_profesor);
         if ($prof->encriptar(Input::post("pass1")) != $prof_pass->password) {
             Input::delete();
             Flash::info("La contraseña anterior no coincide");
             Router::redirect("perfil/cambiarpass/{$id_profesor}");
             die;
         }
         $prof_pass->password = $prof->encriptar($inputs['password']);
         if ($prof_pass->update()) {
             Flash::valid("La contraseña ha sido cambiada con éxito");
         } else {
             Flash::error("No se pudo cambiar la contraseña");
         }
         Input::delete();
     }
 }
예제 #5
0
 public function eliminarODesactivarProfesor()
 {
     if (Request::ajax()) {
         $profesor = Profesor::find(Input::get('id'));
         if (Input::get('borrado') === "temporal") {
             $profesor->status = 0;
             if ($profesor->forceSave()) {
                 return Response::json(array('success' => 'true'));
             } else {
                 return Response::json(array('success' => 'false'));
             }
         } else {
             if (Input::get('borrado') === "permanente") {
                 if ($profesor->rol == 'profesor') {
                     if (unlink('../public/CVs/' . $profesor->datos->ruta)) {
                         $profesor->delete();
                         return Response::json(array('success' => 'true'));
                     } else {
                         return Response::json(array('success' => 'false'));
                     }
                 } else {
                     return Response::json(array('success' => 'denegado'));
                 }
             } else {
                 return Response::json(array('success' => 'false'));
             }
         }
     }
 }
예제 #6
0
 public function eliminarJDD()
 {
     if (Request::ajax()) {
         $depto = Departamento::find(Input::get('id'));
         $profesor = Profesor::find($depto->profesores_id);
         $depto->profesores_id = null;
         $profesor->rol = "profesor";
         if ($profesor->forceSave() && $depto->save()) {
             return Response::json(array('success' => true));
         } else {
             return Response::json(array('success' => false));
         }
     }
 }
예제 #7
0
 public function eliminarPDA()
 {
     if (Request::ajax()) {
         $academia = Academia::find(Input::get('id'));
         $profesor = Profesor::find($academia->profesores_id);
         $academia->profesores_id = null;
         $profesor->rol = $profesor->rol === "PDAJDA" ? "JDA" : "profesor";
         if ($profesor->forceSave() && $academia->save()) {
             return Response::json(array('success' => true));
         } else {
             return Response::json(array('success' => false));
         }
     }
 }