function nombreSolicitante() { $nombre = ""; if ($this->tipo_solicitante == 1) { $alumno = Alumno::find($this->cve_solicitante); $nombre = $alumno->nombreCompleto(); } else { if ($this->tipo_solicitante == 0) { $profesor = Profesor::find($this->cve_solicitante); $nombre = $profesor->nombreCompleto(); } } return $nombre; }
/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = Profesor::find(); $dataProvider = new ActiveDataProvider(['query' => $query]); $this->load($params); if (!$this->validate()) { // uncomment the following line if you do not want to return any records when validation fails // $query->where('0=1'); return $dataProvider; } $query->andFilterWhere(['ID' => $this->ID, 'edad' => $this->edad]); $query->andFilterWhere(['like', 'Nombre', $this->Nombre]); return $dataProvider; }
function dameNombre(Request $r) { $clave = $r->input('clave_profesor'); $res = ['success' => false]; try { $profesor = Profesor::find($clave); $res['nombre'] = ""; if ($profesor != null) { $res['nombre'] = $profesor->nombreCompleto(); $res['success'] = true; } } catch (Exception $e) { $res['msj'] = $e->getMessage(); } return response()->json($res); }
public function postInscribirProfesores() { $user = User::fromToken(); $votacion = VtVotacion::actual($user); $profesores = Profesor::fromyear($user->year_id); $participantes = []; for ($i = 0; $i < count($profesores); $i++) { $partic = VtParticipante::where('user_id', $profesores[$i]->user_id)->where('votacion_id', $votacion->id)->first(); if (!$partic) { if (!$profesores[$i]->user_id) { $dirtyName = $profesores[$i]->nombres; $name = preg_replace('/\\s+/', '', $dirtyName); $usuario = new User(); $usuario->username = $name; $usuario->password = '******'; $usuario->is_superuser = false; $usuario->is_active = true; $usuario->save(); $profe = Profesor::find($profesores[$i]->id); $profe->user_id = $usuario->id; $profe->save(); $profesores[$i]->user_id = $profe->user_id; } $partic_trash = VtParticipante::onlyTrashed()->where('user_id', $profesores[$i]->user_id)->where('votacion_id', $votacion->id)->first(); if ($partic_trash) { $participante = $partic_trash; $participante->restore(); } else { $participante = new VtParticipante(); $participante->user_id = $profesores[$i]->user_id; $participante->votacion_id = $votacion->id; $participante->locked = false; $participante->intentos = 0; $participante->save(); } array_push($participantes, $participante); } } return $participantes; }
public function actionModificar() { $msg = null; $model = new ValidarCategoria(); if (isset($_REQUEST['id_categoria'])) { $model->id_categoria = $_REQUEST['id_categoria']; $table = Categoria::findOne($model->id_categoria); $model->nombre = $table->nombre; $model->edad_min = $table->edad_minima; $model->edad_max = $table->edad_maxima; $model->deporte = $table->id_deporte; $model->profesor_suplente = $table->id_profesor_suplente; $model->profesor_titular = $table->id_profesor_titular; } if ($model->load(Yii::$app->request->post()) && Yii::$app->request->isAjax) { Yii::$app->response->format = Response::FORMAT_JSON; return ActiveForm::validate($model); } if ($model->load(Yii::$app->request->post())) { if ($model->validate()) { $table = Categoria::findOne($model->id_categoria); $table->nombre = $model->nombre; $table->edad_maxima = $model->edad_max; $table->edad_minima = $model->edad_min; $table->id_deporte = $model->deporte; $table->id_profesor_suplente = $model->profesor_suplente; $table->id_profesor_titular = $model->profesor_titular; if ($table->update()) { $msg = "modificado con exito"; $model->nombre = NULL; $model->edad_min = NULL; $model->edad_max = NULL; $model->deporte = NULL; $model->profesor_suplente = NULL; $model->profesor_titular = NULL; $this->redirect(["categoria/buscar", 'msg' => $msg]); } } } $deporte = ArrayHelper::map(Deporte::find()->all(), 'id_deporte', 'nombre'); $profesor = ArrayHelper::map(Profesor::find()->all(), 'dni', 'nombre'); return $this->render("modificar_categoria", ['msg' => $msg, 'model' => $model, 'profesor' => $profesor, 'deporte' => $deporte]); }
public function deleteDestroy($id) { $user = User::fromToken(); $profesor = Profesor::find($id); //$queries = DB::getQueryLog(); //$last_query = end($queries); //return $last_query; if ($profesor) { $profesor->delete(); } else { return abort(400, 'Profesor no existe o está en Papelera.'); } return $profesor; }
public function getShow($id) { $grupo = Grupo::findOrFail($id); $profesor = Profesor::find($grupo->titular_id); $grupo->titular = $profesor; $grado = Grado::findOrFail($grupo->grado_id); $grupo->grado = $grado; return $grupo; }
public function actionModificar() { $this->menu(); $model = new ValidarEvento(); $msg = null; if (isset($_REQUEST['id_evento'])) { if ($_REQUEST['id_evento']) { $model->id_evento = $_REQUEST['id_evento']; $tabla = Evento::findOne($model->id_evento); $model->nombre = $tabla->nombre; $model->condicion = $tabla->condicion; $model->fecha = $tabla->fecha; $model->id_profesor_titular = $tabla->id_profesor_titular; $model->id_profesor_suplente = $tabla->id_profesor_suplente; $model->id_deporte = $tabla->id_deporte; $model->convocados = 1; } } if ($model->load(Yii::$app->request->post()) && Yii::$app->request->isAjax) { Yii::$app->response->format = Response::FORMAT_JSON; return ActiveForm::validate($model); } if ($model->load(Yii::$app->request->post())) { $msg = "askdjla"; if ($model->validate()) { $tabla = Evento::findOne($model->id_evento); $tabla->nombre = $model->nombre; $tabla->condicion = $model->condicion; $tabla->fecha = $model->fecha; $tabla->id_profesor_titular = $model->id_profesor_titular; $tabla->id_profesor_suplente = $model->id_profesor_suplente; $tabla->id_deporte = $model->id_deporte; if ($tabla->update()) { $msg = "Evento registrado con exito!"; $model->nombre = null; $model->condicion = null; $model->fecha = null; $model->id_profesor_titular = null; $model->id_profesor_suplente = null; $model->id_deporte = null; $this->redirect(["evento/buscar", 'msg' => $msg]); } else { $msg = "no se pudo actualizar"; } } else { $model->getErrors(); } } $deporte = ArrayHelper::map(Deporte::find()->all(), 'id_deporte', 'nombre_deporte'); $profesor = ArrayHelper::map(Profesor::find()->all(), 'dni', 'nombre'); $categoria = ArrayHelper::map(Categoria::find()->all(), 'id_categoria', 'nombre_categoria'); $convocados = ArrayHelper::map(Convocados::find()->all(), 'id_lista', 'nombre'); return $this->render("modificar", ['model' => $model, 'msg' => $msg, "profesor" => $profesor, "categoria" => $categoria, "deporte" => $deporte, "convocados" => $convocados]); }
public function imprimirSociosxProfesor($plan, $profesor) { $plan = Plan::find($plan); $profesor = Profesor::find($profesor); $vista = \View::make('profesores.sociosxprofesorpdf', ['plan' => $plan, 'profesor' => $profesor])->render(); $pdf = \App::make('dompdf.wrapper'); $pdf->loadHTML($vista); return $pdf->stream('sociosxprofesorpdf'); }