public function actionModificarlista($sacar = null) { $this->menu(); $msg = null; $id_evento = $_SESSION['id_evento']; $connection = \Yii::$app->db; if ($sacar == "si") { $msg = "reconocio string"; $msg = "reconocio si"; $table = Convocados::find()->where(['id_evento' => $_SESSION['id_evento']])->all(); foreach ($table as $val) { $dni[] = $val['dni']; } if (isset($_SESSION['dni'])) { $datos = array_diff($dni, $_SESSION['dni']); foreach ($datos as $id) { $connection->createCommand("delete from convocados where dni={$id}")->execute(); } } else { $connection->createCommand("delete from convocados where id_evento={$id_evento}")->execute(); } } else { $tabla = Vdep_Cat::find()->where(['IN', 'dni', $_SESSION['dni']])->andWhere(['id_deporte' => $_SESSION['id_deporte']])->all(); foreach ($tabla as $valor) { $dni = $valor['dni']; $nombre = $valor['nombre']; $connection->createCommand("insert IGNORE into convocados (dni,nombre,id_evento) VALUES ('{$dni}','{$nombre}','{$id_evento}')")->execute(); } } unset($_SESSION['dni']); unset($_SESSION['id_evento']); unset($_SESSION['deporte']); $this->redirect(['evento/buscar', 'msg' => $msg]); }
public function actionInformacion($dni = null) { if (is_numeric($dni)) { $informacion = Yii::$app->db->createCommand("SELECT TIMESTAMPDIFF(YEAR, deportista.fecha_nac, NOW())as 'edad',id_planilla,telefono,domicilio,email,nombre,apellido,deportista.dni,numero_socio FROM deportista,persona where deportista.dni={$dni} and deportista.dni=persona.dni")->queryOne(); $info_deportes = \app\models\Vdep_Cat::find()->where(['dni' => $dni])->all(); session_start(); $_SESSION['id_planilla'] = $informacion['id_planilla']; return $this->render('informacion', ['informacion' => $informacion, 'info_deporte' => $info_deportes]); } $this->redirect(["deportista/buscar"]); }