public function listaProfesores() { $q = isset($_POST['q']) ? strval($_POST['q']) : ''; $personal = new Personal(); $row = $personal->find('all', array('conditions' => array('Personal.nombres like' => "%{$q}%"), 'fields' => array('Personal.id, Personal.cedula, Personal.nombres, Personal.apellidos, Personal.telefono'))); $this->set('result', $row); $this->render('listaProfesores', 'ajax'); }
/** * Remove the specified personal from storage. * * @param int $id * @return Response */ public function destroy($id) { if (Auth::user()->residencia->id == Personal::find($id)->residencia_id) { Personal::destroy($id); return "TRUE"; } else { return "ERROR"; } }
public function change_password() { $validator = Validator::make($input = Input::all(), Personal::rules('password')); if ($validator->fails()) { $output['status'] = 'error'; $output['msg'] = $validator->getMessageBag()->toArray(); } else { $employee = Personal::find(Auth::personales()->get()->id); $employee->password = Hash::make($input['password']); $employee->save(); $output['status'] = 'success'; $output['msg'] = '<strong>Success ! </strong>Password changed successfully'; } return Response::json($output, 200); }
public function index() { App::import('Model', 'Horario'); App::import('Model', 'Personal'); App::import('Model', 'Materia'); App::import('Model', 'Seccion'); $this->set('horarios', $this->Asistencia->Horario->find('list', array('order' => 'Horario.personal_id ASC'))); $horario = new Horario(); $this->set('lista_horarios', $horario->find('all', array('recursive' => -1))); $personal = new Personal(); $this->set('docentes', $personal->find('all', array('recursive' => -1))); $materia = new Materia(); $this->set('materias', $materia->find('all', array('recursive' => -1))); $seccion = new Seccion(); $this->set('secciones', $seccion->find('all', array('recursive' => -1))); //$this->set('horarios',$this->Asistencia->Horario->find('list', array('order' => 'Horario.personal_id ASC'))); }
public function personal($action) { if (isset($action)) { if ($action == "create") { $data = Personal::firstOrCreate(Input::all()); return $respuesta = array('Record' => $data, 'Result' => "OK"); } if ($action == "edit") { Personal::where("id", Input::get("id"))->update(Input::except("id")); return $respuesta = array('Record' => Personal::find(Input::get('id')), 'Result' => "OK"); } if ($action == "remove") { Personal::where('id', Input::get("id"))->delete(); return '{"Result":"OK"}'; } if ($action == "list") { $Records = Personal::get(); $respuesta = array('Records' => $Records, 'Result' => "OK"); return json_encode($respuesta); } if ($action == "residencia") { $nulos = DB::table('residencias')->select(DB::raw("'NO POSEE' as DisplayText, NULL as Value")); $respuesta = DB::table('residencias')->select("nombre as DisplayText", "id as Value")->union($nulos)->orderby('value', 'asc')->distinct()->get(); return "var opciones=" . json_encode($respuesta); } } }
/** * Remove the specified resource from storage. * DELETE /personalinjuries/{id} * * @param int $id * @return Response */ public function destroy($id) { $injury_type = Personal::find($id); if ($injury_type->delete()) { return Redirect::to('/allPersonalInjury'); } }
public function eliminarpersonal($id) { $persona = Personal::find($id); if ($persona->residencia_id == Auth::user()->residencia_id) { $persona->delete(); flashMessage("Personal Eliminado"); return Redirect::to("ver-personal"); } else { flashMessage("No posee los permisos para realizar esta acción", 'red'); return Redirect::back(); } }