public function update() { $id = Input::get('id'); $tabla = Input::get('tabla'); switch ($tabla) { case '0': $clave = Input::get('clave'); $appat = Input::get('ap_pat'); $apmat = Input::get('ap_mat'); $nombre = Input::get('nombre'); $segnombre = Input::get('seg_nombre'); $tipo = Input::get('tipo'); $grado = Input::get('grado'); $tutorias = Input::get('tutorias'); $gestion = Input::get('gestion'); $investigacion = Input::get('investigacion'); $dependencias = Input::get('dependencias'); $edit = Professor::find($id); $edit->clave = $clave; $edit->ap_pat = $appat; $edit->ap_mat = $apmat; $edit->nombre = $nombre; $edit->seg_nombre = $segnombre; $edit->tipo = $tipo; $edit->id_grado = $grado; $edit->tutorias = $tutorias; $edit->gestion = $gestion; $edit->investigacion = $investigacion; $edit->dependencias = $dependencias; $edit->save(); return View::make('crud.crudMaestros')->with('professors', Professor::all()); break; case '1': $nombre = Input::get('nombre'); $semestre = Input::get('semestre'); $plan = Input::get('idPlan'); $edit = Subject::find($id); $edit->nombre = $nombre; $edit->semestre = $semestre; $edit->id_plan = $plan; $edit->save(); return View::make('crud.crudMaterias')->with('subjects', Subject::all()); break; case '2': $nombre = Input::get('nombre'); $edit = Aula::find($id); $edit->nombre = $nombre; $edit->save(); return View::make('crud.crudAulas')->with('aulas', Aula::all()); break; case '3': $nombre = Input::get('nombre'); $edit = Plan::find($id); $edit->nombre = $nombre; $edit->save(); return View::make('crud.crudPlanes')->with('plans', Plan::all()); break; default: //aqui me redirecciona a una pagina vacia solo con un mensaje 404 return View::make('landing'); break; } }
/** * Remove the specified resource from storage. * * @param int id * @return Response */ public function destroy($id) { $this->professor->find($id)->delete(); return Redirect::route('admin.professor.index'); }
public function get_comparar_profesor() { $id = Input::get('idProf'); $idProyecto = Input::get('idProyecto'); $idRegistro = Input::get('idRegistro'); $json = []; $grupos = ['N/A']; $horas = 0; $data = Professor::find($id); $nombre = $data['ap_pat'] . " " . $data['ap_mat'] . " " . $data['nombre'] . " " . $data['seg_nombre']; array_push($json, $nombre); $data = Plantilla::select('grupo')->where('id_profesor', '=', $id)->where('id_proyecto', $idProyecto)->groupBy('grupo')->get(); if (sizeof($data) > 0) { $grupos = []; foreach ($data as $grupo) { array_push($grupos, $grupo['grupo']); } $data = Plantilla::select('m.horas')->join('subjects as m', 'm.id', '=', 'plantillas.id_subject')->where('plantillas.id_profesor', '=', $id)->where('id_proyecto', $idProyecto)->get(); foreach ($data as $cantidad) { $horas += $cantidad['horas']; } } array_push($json, $grupos); array_push($json, $horas); echo json_encode($json); }