public function getPreguntasExamen($id) { $preguntas = null; $examen = Examen::findOne($id); if ($examen != null) { $preguntas = $examen->preguntas; } return $preguntas; }
public function inscripcionPorLlave($model) { $llave = Llave::find()->where(['llave' => $model->llave])->one(); if ($llave != null && !empty($llave)) { $examen = \app\models\Examen::findOne($model->id_examen); $inscripcion = new InscripcionExamen(); $persona = Yii::$app->user->identity->idPersona; if ($persona->id_colegio == $llave->id_colegio) { $inscripcion->fecha_inscripcion = date('Y-m-d H:i:s'); $inscripcion->eliminado = 0; if ($inscripcion->save(false)) { $inscripcion->link('idAlumno', $persona); $inscripcion->link('idExamen', $examen); $inscripcion->link('idLlave', $llave); return true; } return false; } return false; } return false; }
public function actionGetDatosExamen($reservaId) { // find the zip code from the locations table $reserva = Reserva::findOne($reservaId); $hora = Hora::findOne($reserva->hora_medica_id); $exSolicitados = HoraExamenSolicitado::find()->where(['hora_id' => $hora->id])->all(); foreach ($exSolicitados as $i => $exSolicitado) { $examen = Examen::findOne($exSolicitado->examen_id); $examenes[$i] = $examen; } echo Json::encode($examenes); }
/** * Finds the Examen model based on its primary key value. * If the model is not found, a 404 HTTP exception will be thrown. * @param integer $id * @return Examen the loaded model * @throws NotFoundHttpException if the model cannot be found */ protected function findModel($id) { if (($model = Examen::findOne($id)) !== null) { return $model; } else { throw new NotFoundHttpException('The requested page does not exist.'); } }