private function procesarListaPartidos($postJugadorApi, $postJugadorLocal, $postTorneo, &$listaPartidos) { $selectTorneos = Torneo::model()->selectTorneos(); $peticionPartidos = ApiChallonge::getPartidoTorneo($postTorneo['idTorneo']); $lengthJugadores = count($postJugadorApi); for ($i = 0; $i < $lengthJugadores; $i++) { $jugadorApi = $postJugadorApi[$i]; $jugadorLocal = $postJugadorLocal['jugadorId'][$i]; $idTorneoLocal = $postJugadorLocal['idTorneoVzla']; $posicionJugadorLocal = $postJugadorLocal['posicionJugador'][$i]; $peticionPartidos = str_replace($jugadorApi, $jugadorLocal, $peticionPartidos); $posicionJugador = new JugadorPosicionTorneo(); $posicionJugador->id_jugador = $jugadorLocal; $posicionJugador->id_torneo = $idTorneoLocal; $posicionJugador->posicion = $posicionJugadorLocal; $posicionJugador->save(); } $jsonPartidos = json_decode($peticionPartidos, true); $i = 0; foreach ($jsonPartidos as $key => $value) { $match = $value['match']; $player1Id = $match['player1_id']; $player2Id = $match['player2_id']; $winnerId = $match['winner_id']; $ronda = $match['identifier']; $numeroRonda = $match['round']; $jugadorVzla1 = Jugador::model()->findByPk($player1Id); $jugadorVzla2 = Jugador::model()->findByPk($player2Id); $ganadorVzla = Jugador::model()->findByPk($winnerId); $listaPartidos .= $this->renderPartial('_listaPartidos', array('jsonPartidos' => $jsonPartidos, 'player1Id' => $player1Id, 'player2Id' => $player2Id, 'winnerId' => $winnerId, 'ronda' => $ronda, 'numeroRonda' => $numeroRonda, 'jugadorVzla1' => $jugadorVzla1, 'jugadorVzla2' => $jugadorVzla2, 'ganadorVzla' => $ganadorVzla, 'i' => $i), true, false); $i++; } $listaPartidos .= Chtml::label('ID Torneo SSBMVZLA', 'ResultadoPvP_idTorneoVzla') . '<br/>' . CHtml::dropDownList('ResultadoPvP[idTorneoVzla]', '', $selectTorneos, array('empty' => '')) . '<br/>'; }
public function edit_post() { $idjugador = Input::get('idjugador'); $coddocente = substr(Input::get('Nombre'), 0, 6); if ($docente = Docente::where('codDocente', '=', $coddocente)->first()) { if ($haydocenteenequipo = Delegado::where('dni', '=', $idjugador)->first()) { if ($haydocenteenequipo->codDocente == $coddocente) { $edad = Input::get('rol'); Delegado::where('dni', '=', $idjugador)->update(['rol' => $edad]); Session::flash('message', 'delegado actualizado correctamente'); return Redirect::to('delegado/listar.html'); } else { $haydocenteenequipo = Jugador::where('codDocente', '=', $coddocente)->where('codEquipo', '=', Session::get('user_codequipo'))->first(); if ($haydocenteenequipo == '') { $file->move('storage/jugador', $namefotocomplete); Jugador::where('dni', '=', $idjugador)->update(['foto' => $namefotocomplete, 'codDocente' => $coddocente]); } else { $error = ['wilson' => 'Este jugador ya es parte del equipo. por favor ingrese otro jugador']; return Redirect::back()->withInput()->withErrors($error); } } } else { $error = ['wilson' => 'No se encontro delegado en la base de datos']; return Redirect::back()->withInput()->withErrors($error); } } else { $error = ['wilson' => 'Este docente no existe']; return Redirect::back()->withInput()->withErrors($error); } }
/** * Returns the data model based on the primary key given in the GET variable. * If the data model is not found, an HTTP exception will be raised. * @param integer $id the ID of the model to be loaded * @return Comment the loaded model * @throws CHttpException */ public function loadModel($id) { $model = Jugador::model()->findByPk($id); if ($model === null) { throw new CHttpException(404, 'The requested page does not exist.'); } return $model; }
function actualizar_jugador(Jugador $jugador) { //$this->conexionDB->ejecutarInsertJugador($jugador); $sentencia = $this->conexionDB->get_conexion()->prepare("\n UPDATE \n jugador \n SET\n nombre=:nombre , \n apellidos=:apellido, \n edad=:edad, \n altura=:altura, \n peso=:peso, \n idequipo=:equipo\n WHERE \n id =:id"); $sentencia->bindParam(':nombre', $jugador->get_nombre()); $sentencia->bindParam(':apellido', $jugador->get_apellidos()); $sentencia->bindParam(':edad', $jugador->get_edad()); $sentencia->bindParam(':altura', $jugador->get_altura()); $sentencia->bindParam(':peso', $jugador->get_peso()); $sentencia->bindParam(':equipo', $jugador->get_equipo()); $sentencia->bindParam(':id', $jugador->get_id()); $this->conexionDB->ejecutarInsertUpdateDelete($sentencia); }
/** * Updates a particular model. * If update is successful, the browser will be redirected to the 'view' page. * @param integer $id the ID of the model to be updated */ public function actionUpdate($id) { $model = $this->loadModel($id); $user = Yii::app()->user; $selectJugadores = Jugador::model()->selectJugadores(); $selectTorneos = Torneo::model()->selectTorneos(); // Uncomment the following line if AJAX validation is needed // $this->performAjaxValidation($model); if (isset($_POST['PvpSet'])) { $model->attributes = $_POST['PvpSet']; if ($model->save()) { $user->setFlash('success', "Datos han sido modificados <strong>satisfactoriamente</strong>."); $this->redirect(array('admin')); } } $this->render('update', array('model' => $model, 'selectJugadores' => $selectJugadores, 'selectTorneos' => $selectTorneos)); }
public function searchUser($userName) { $user = new Jugador(); $vector = array($userName); $con = new BDDConexion(); $resultado = $con->launchQuery($this->SELET_USER, $vector); if ($resultado != null) { foreach ($resultado as $row) { $user->setId($row['id']); $user->setCodigo($row['codigo']); $user->setNombre($row['nombre']); $user->setContra($row['contra']); } } return $user; }
/** * Exclude object from result * * @param Jugador $jugador Object to remove from the list of results * * @return JugadorQuery The current query, for fluid interface */ public function prune($jugador = null) { if ($jugador) { $this->addUsingAlias(JugadorPeer::ID, $jugador->getId(), Criteria::NOT_EQUAL); } return $this; }
public function edit_post() { $idjugador = Input::get('idjugador'); $coddocente = substr(Input::get('Nombre'), 0, 6); if ($docente = Docente::where('codDocente', '=', $coddocente)->first()) { if ($haydocenteenequipo = Jugador::where('dni', '=', $idjugador)->first()) { if (Input::hasFile('foto')) { $fullnamedocente = $docente->apellidopaterno . ' ' . $docente->apellidomaterno . ' ' . $docente->nombre; $file = Input::file('foto'); $extension = $file->getClientOriginalExtension(); $namefotocomplete = $fullnamedocente . '.' . $extension; if ($haydocenteenequipo->codDocente == $coddocente) { $file->move('storage/jugador', $namefotocomplete); $direccion = Input::get('direccion'); $telefono = Input::get('telefono'); $edad = Input::get('edad'); Jugador::where('dni', '=', $idjugador)->update(['foto' => $namefotocomplete, 'direccion' => $direccion, 'telefono' => $telefono, 'edad' => $edad]); Session::flash('message', 'Jugador actualizo correctamente'); return Redirect::to('jugador/listar.html'); } else { $haydocenteenequipo = Jugador::where('codDocente', '=', $coddocente)->where('codEquipo', '=', Session::get('user_codequipo'))->first(); if ($haydocenteenequipo == '') { $file->move('storage/jugador', $namefotocomplete); Jugador::where('dni', '=', $idjugador)->update(['foto' => $namefotocomplete, 'codDocente' => $coddocente]); } else { $error = ['wilson' => 'Este jugador ya es parte del equipo. por favor ingrese otro jugador']; return Redirect::back()->withInput()->withErrors($error); } } } else { $error = ['wilson' => 'No ha ingresado ninguna foto']; return Redirect::back()->withInput()->withErrors($error); } } else { $error = ['wilson' => 'No se encontro jugador en la base de datos']; return Redirect::back()->withInput()->withErrors($error); } } else { $error = ['wilson' => 'Este docente no existe']; return Redirect::back()->withInput()->withErrors($error); } }
public function jugadortarjetalist($idfecha, $codcampeonato, $idtorneo, $idfixture, $idjugadorenjuego) { $tarjetasdeljugadorenjuego = Tarjeta::where('idjugadorenjuego', '=', $idjugadorenjuego)->get(); $jugadorenjuego = JugadorEnJuego::where('idjugadorenjuego', '=', $idjugadorenjuego)->first(); $jugador = Jugador::where('idjugador', '=', $jugadorenjuego->idjugador)->first(); return View::make('user_com_organizing.fecha.partido.insidencia.tarjeta.list')->with('idfecha', $idfecha)->with('codcampeonato', $codcampeonato)->with('idtorneo', $idtorneo)->with('idfixture', $idfixture)->with('idjugadorenjuego', $idjugadorenjuego)->with('jugador', $jugador)->with('tarjetasdeljugadorenjuego', $tarjetasdeljugadorenjuego); }
/** * Filter the query by a related Jugador object * * @param Jugador|PropelObjectCollection $jugador The related object(s) to use as filter * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * * @return JugadorMesaQuery The current query, for fluid interface * @throws PropelException - if the provided filter is invalid. */ public function filterByJugador($jugador, $comparison = null) { if ($jugador instanceof Jugador) { return $this->addUsingAlias(JugadorMesaPeer::JUGADOR_ID, $jugador->getId(), $comparison); } elseif ($jugador instanceof PropelObjectCollection) { if (null === $comparison) { $comparison = Criteria::IN; } return $this->addUsingAlias(JugadorMesaPeer::JUGADOR_ID, $jugador->toKeyValue('PrimaryKey', 'Id'), $comparison); } else { throw new PropelException('filterByJugador() only accepts arguments of type Jugador or PropelCollection'); } }
<?php include 'Jugador.php'; include 'Carta.php'; ?> <html> <head> <title>HOLDEM EXAMPLE </title> </head> <body> <?php $jugador1 = new Jugador(); $jugador2 = new Jugador(); $jugador1->setNombre("Paco"); $jugador2->setNombre("Pepe"); echo $jugador1->getNombre(); echo $jugador2->getNombre(); //Vamos a obtener los palos echo Carta::TREBOL; echo Carta::PICA; ?> </body> </html>
<?php session_start(); require_once '../core/Jugador.class.php'; if (isset($_SESSION['admin'])) { $jugador = new Jugador('', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', ''); $jugador->setJugador($_GET['dni']); if ($jugador->removeJugador()) { header("Location: ../../../jugadores.php"); } else { header("Location: ../../../jugadores.php"); } }
private function getInactivePlayers($jugadorLastSet, $dias) { //, $diasRango $inactivePlayers = array(); foreach ($jugadorLastSet as $key => $value) { $nick = Jugador::model()->findByPk($key)->nick; $lastDate = date('Y-m-d', $value); $diff = date_diff(date_create(date('Y-m-d')), date_create($lastDate)); $diasDiff = intval($diff->format("%a")); if ($diasDiff > $dias) { // && $diasDiff < $diasRango $inactivePlayers[$key] = $value; } } return $inactivePlayers; }
public function sincronizarEstadisticasJugadores() { $arregloEquipos = array("AGUI", "BRAV", "CARD", "CARI", "LEON", "MAGA", "TIBU", "TIGR"); //$arregloEquipos = array("LEON"); date_default_timezone_set('America/Caracas'); $date = date("Y/m/d"); foreach ($arregloEquipos as $sigla) { $args["siglas"] = $sigla; $equipo = new Equipo($args); $equipo->obtener(); $matrixBateador = self::obtenerMatrixBateador($sigla); $matrixPitcher = self::obtenerMatrixPitcher($sigla); for ($i = 0; $i < count($matrixBateador[0]); $i++) { $args['nombres'] = $matrixBateador[2][$i]; $args['equipo'] = $equipo->id; $jugador = new Jugador($args); $jugador->obtener(); $argsE['jugador'] = $jugador->id; $argsE['fecha'] = $date; $argsE['ci'] = (int) $matrixBateador[12][$i]; $argsE['ca'] = (int) $matrixBateador[6][$i]; $argsE['vb'] = (int) $matrixBateador[5][$i]; $argsE['br'] = (int) $matrixBateador[18][$i]; $argsE['bb'] = (int) $matrixBateador[13][$i]; $argsE['h'] = (int) $matrixBateador[7][$i]; $argsE['h2'] = (int) $matrixBateador[9][$i]; $argsE['h3'] = (int) $matrixBateador[10][$i]; $argsE['hr'] = (int) $matrixBateador[11][$i]; $argsE['tb'] = (int) $matrixBateador[8][$i]; $argsE['k'] = (int) $matrixBateador[14][$i]; $estadisticas = new Estadistica_Bateo($argsE); $estadisticas->insertar(); } for ($i = 0; $i < count($matrixPitcher[0]); $i++) { $args2['nombres'] = $matrixPitcher[2][$i]; $args2['equipo'] = $equipo->id; $jugador = new Jugador($args2); $jugador->obtener(); $argsEP['jugador'] = $jugador->id; $argsEP['fecha'] = $date; $argsEP['el'] = (int) $matrixPitcher[11][$i]; $argsEP['cl'] = (int) $matrixPitcher[17][$i]; $argsEP['i'] = (int) $matrixPitcher[12][$i]; $argsEP['bb'] = (int) $matrixPitcher[18][$i]; $argsEP['k'] = (int) $matrixPitcher[19][$i]; $argsEP['jg'] = (int) $matrixPitcher[5][$i]; //$argsEP['h3'] = (int)$matrixPitcher[10][$i]; //$argsEP['hr'] = (int)$matrixPitcher[11][$i]; //$argsEP['tb'] = (int)$matrixPitcher[8][$i]; //$argsEP['k'] = (int)$matrixPitcher[14][$i]; $estadisticasP = new Estadistica_Pitcheo($argsEP); $estadisticasP->insertar(); } } }
<?php session_start(); if (isset($_SESSION['admin'])) { require_once 'app/libs/core/Db.class.php'; require_once 'app/libs/core/Scouting.class.php'; require_once 'app/libs/core/Jugador.class.php'; include_once 'app/libs/functions/functions.php'; $scouting = new Scouting('', '', '', '', '', ''); //Cremos un nuevo objeto Equipo para guardar y utilizarlo. $scouting_id = array(); // Creamos un array para guardar los ids de la consulta $jugador = new Jugador('', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', ''); //Cremos un nuevo objeto Equipo para guardar y utilizarlo. //$jugador_dni = array(); // Creamos un array para guardar los ids de la consulta $db = Db::getInstance(); $sql = "SELECT * FROM scouting_individual ORDER BY scouting_id"; $db->execute($sql); ?> <!DOCTYPE html> <html lang="es"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, user-scalable=no"> <title>Jugadores | gf-scouting</title> <link href="img/favicon.ico" rel="icon" type="image/x-icon" /> <link href='http://fonts.googleapis.com/css?family=Roboto' rel='stylesheet' type='text/css'> <link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
private function validarCuentas() { if (isset(Yii::app()->session['jugador_id']) && !empty(Yii::app()->session['jugador_id'])) { $rj = RespuestaXJugador::model()->find("( TIMESTAMPDIFF(MINUTE,fecha,?) <= ? AND jugador_id <> ? ) AND RTRIM( SUBSTR(ip, 1, (INSTR(ip, ':')-1)) ) = ? ", array(0 => date('Y-m-d G:i:s'), 1 => Yii::app()->params['bloqueo'], 2 => Yii::app()->session['jugador_id'], 3 => $_SERVER['REMOTE_ADDR'])); if ($rj === null) { return true; } else { return false; } } else { if (Yii::app()->user->id) { $jugador = Jugador::model()->find('usuario_id = ' . Yii::app()->user->id); if ($jugador != null) { $jugador_id = $jugador->id; Yii::app()->session['jugador_id'] = $jugador_id; if (!empty(Yii::app()->session['jugador_id'])) { $rj = RespuestaXJugador::model()->find("( TIMESTAMPDIFF(MINUTE,fecha,?) <= ? AND jugador_id <> ? ) AND RTRIM( SUBSTR(ip, 1, (INSTR(ip, ':')-1)) ) = ? ", array(0 => date('Y-m-d G:i:s'), 1 => Yii::app()->params['bloqueo'], 2 => Yii::app()->session['jugador_id'], 3 => $_SERVER['REMOTE_ADDR'])); if ($rj === null) { return true; } else { return false; } } } } return false; } }
$jugador->saveJugador(); /*echo $jugador->getJugadorNombre()."</br>"; if($jugador->saveJugador()){ echo "<h1>Guardado</h1>"; }else{ echo "<h1>Sin Guardar</h1>"; }*/ header("Location: ../../../jugadores.php"); } if (isset($_POST['scouting'])) { $jugador_dni = $_POST['dni']; $jugador_nombre = $_POST['nombre']; $jugador_1apellido = $_POST['1apellido']; $jugador_2apellido = $_POST['2apellido']; $jugador_nacimiento = $_POST['nacimiento']; $jugador_telefonofijo = $_POST['telefono']; $jugador_email = $_POST['email']; /*echo $jugador_nacimiento;*/ $jugador = new Jugador($jugador_dni, $jugador_nombre, $jugador_1apellido, $jugador_2apellido, $jugador_nacimiento, '.', '.', '.', 0, $jugador_telefonofijo, 0, 0, 0, $jugador_email, 0, 0, 0); //Cremos un nuevo objeto Equipo para guardar y utilizarlo. $jugador->saveJugador(); /*echo $jugador->getJugadorNombre()."</br>"; if($jugador->saveJugador()){ echo "<h1>Guardado</h1>"; }else{ echo "<h1>Sin Guardar</h1>"; }*/ //echo $_SESSION['jugador']->getJugadorNombre().'</br>'; //$location = 'Location: ../../../new-informe-jug.php?dni='.$jugador->getJugadorDNI(); header('Location: ../../../new-informe-jug.php?dni=' . $jugador->getJugadorDNI()); }
/** * Remove the specified resource from storage. * * @param int $id * @return Response */ public function destroy($id) { $jugador = Jugador::findOrFail($id); $jugador->delete(); Session::flash('message', 'Jugador elimnado correctamente'); //return redirect()->route('tasks.index'); return Redirect::to('/jugador'); }
<?php require_once 'jugador.php'; require_once 'basededatos.php'; //Iniciamos la sesión session_start(); //Creamos el objeto jugador $jugador = new Jugador(); //Creamos objeto de la base de datos $db = new BaseDeDatos(); //Commprobamos si la variable global $_POST no está vacía if (!empty($_POST)) { if (isset($_POST['nombre']) && isset($_POST['apellidos']) && isset($_POST['edad'])) { if (empty($_POST['nombre'])) { header("Location: /P05/index.php"); } if (empty($_POST['apellidos'])) { header("Location: /P05/index.php"); } if (empty($_POST['edad'])) { header("Location: /P05/index.php"); } } //Si existe el POST jugador if (isset($_POST['jugador'])) { if (!isset($_SESSION['jugador'])) { //Inicializamos y creamos la $_SESSION jugador $_SESSION['jugador'] = $jugador; //Si existe el registro en la base de datos if ($jugadorDB = $db->selectUsuario($_POST['nombre'], $_POST['apellidos'])) { //Ponemos nombre al jugador
public function getWinRate($idJugador, $ano = "") { $victorias = Jugador::getVictorias($idJugador, $ano); $loses = Jugador::getDerrotas($idJugador, $ano); $WinRate = 0; $total = $victorias + $loses; if ($total > 0) { $WinRate = $victorias * 100 / $total; } return number_format($WinRate, 1); }
public function addJugador($jugadorJsonObject) { $jugadorNuevo = new Jugador(); $jugadorNuevo->createFromJsonObject($jugadorJsonObject); return $this->jugadoresDb->insertUser($jugadorNuevo); }
<?php //Chequeo si hay sesion abierta include_once "../checkSession.php"; //Inicializo la variable en 0 $cant = 0; if (isset($_POST['search'])) { $db = new Database(); $search = $db->checkInjection($_POST['search']); //Traigo la clase jugador include_once "../classes/jugador.php"; //Creo un nuevo jugador $j = new Jugador(); $j->xLogin($_SESSION['login']); $ids = $j->getPeople($search); $cant = count($ids); } //Traigo la vista include_once "../view/searchFriends.php";
public function editJugador($codcampeonato, $codequipo, $dni) { $ediJ = Jugador::find($dni); $habilitado = ""; if ('habilitado' == Input::get('habilitado')) { $habilitado = "habilitado"; } else { $habilitado = "desabilitado"; } if ('desabilitado' == Input::get('desabilitado')) { $habilitado = "desabilitado"; } $ediJ->estado = $habilitado; $ediJ->save(); return Redirect::to('campeonato/detail/' . $codcampeonato . '/equipodetalle/' . $codequipo . '#jugadores'); }
<?php include 'Jugador.php'; //Abrimos/reanudamos la sesion con la funcion session start session_start(); //Comprobamos si realizamos la accion de crear el Jugador if (isset($_POST['jugador'])) { //Comprobamos un objeto creado en la sesion if (!isset($_SESSION['jugador'])) { $jugador1 = new Jugador(); $jugador1->setNombre($_POST['nom']); //Inicializamos al jugador $_SESSION['jugador'] = $jugador1; } } //Comprobamos un objeto creado en la sesion if (isset($_SESSION['jugador'])) { $jugador1 = $_SESSION['jugador']; $jugador1->puntos++; } ?> <html> <head> <title>POO SESSION </title> </head> <body> <div> <h3>FORMULARIO DE JUGADOR</h3> <form action="poo_session.php" method="post"> <input type="hidden" name="jugador">
/** * Declares an association between this object and a Jugador object. * * @param Jugador $v * @return JugadorMesa The current object (for fluent API support) * @throws PropelException */ public function setJugador(Jugador $v = null) { if ($v === null) { $this->setJugadorId(NULL); } else { $this->setJugadorId($v->getId()); } $this->aJugador = $v; // Add binding for other direction of this n:n relationship. // If this object has already been added to the Jugador object, it will not be re-added. if ($v !== null) { $v->addJugadorMesa($this); } return $this; }
?> <br/> <?php echo CHtml::dropDownList('ListaJugadorLocal[idTorneoVzla]', '', $selectTorneos); ?> </div> <b>Lista de participantes</b> <?php $i = 0; foreach ($jsonParticipantes as $key => $value) { $participant = $value['participant']; $idParticipante = $participant['id']; $nickParticipante = $participant['name']; $rankParticipante = $participant['final_rank']; $jugadorLocal = ''; $busqJugadorVzla = Jugador::model()->find('nick LIKE :nick', array(':nick' => $nickParticipante)); if ($busqJugadorVzla != null) { $jugadorLocal = $busqJugadorVzla->id; } $arrayJugadorApi = array($idParticipante => $nickParticipante); ?> <div class="row-fluid"> <div class="col-md-1"> <div class="form-group"> <?php echo $rankParticipante; ?> ) </div> </div> <div class="col-md-3">
<!DOCTYPE html> <?php include 'Jugador.php'; session_start(); if (isset($_GET['jugador'])) { if (!isset($_SESSION['jugador'])) { $jugador1 = new Jugador(); $jugador1->setNombre($_GET['Nombre']); $jugador1->setApellido($_GET['Apellido']); $jugador1->setPuntos(0); $_SESSION['jugador'] = $jugador1; } else { $jugador1->setNombre($_GET['Nombre']); $jugador1->setApellido($_GET['Apellido']); } } if (isset($_SESSION['jugador'])) { $jugador1 = $_SESSION['jugador']; } if (isset($_SESSION['jugador'])) { $jugador1 = $_SESSION['jugador']; } if ($jugador1->getNombre() == null || $jugador1->getApellido() == null) { header("Location: index.php"); } include "configuracion.php"; include "dados_senior.php"; ?>
<?php session_start(); if (isset($_SESSION['admin'])) { require_once 'app/libs/core/Db.class.php'; require_once 'app/libs/core/Jugador.class.php'; $jugador = new Jugador('', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', ''); //Cremos un nuevo objeto Equipo para guardar y utilizarlo. $jugador_dni = array(); // Creamos un array para guardar los ids de la consulta $db = Db::getInstance(); $sql = "SELECT * FROM jugador ORDER BY jugador_1apellido"; $db->execute($sql); ?> <!DOCTYPE html> <html lang="es"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, user-scalable=no"> <title>Jugadores | gf-scouting</title> <link href="img/favicon.ico" rel="icon" type="image/x-icon" /> <link href='http://fonts.googleapis.com/css?family=Roboto' rel='stylesheet' type='text/css'> <link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet"> <link rel="stylesheet" type="text/css" href="css/style.css"> <link rel="stylesheet" type="text/css" href="css/style-grid.css"> <link rel="stylesheet" type="text/css" href="css/style-form.css"> </head>
public function obtenerEstadistica(Jugador $Jugador) { return $Jugador->obtenerEstadistica($_POST); }
protected function verificar_sesion() { //1. Verifico la sesión para inicializar el juego if (!isset(Yii::app()->session['ronda']) || Yii::app()->session['ronda'] == 0) { if ($this->_jugador_id == 0) { //2. Obtengo el id del jugador $jugador = Jugador::model()->find('usuario_id = ' . Yii::app()->user->id); $jugador_id = $jugador->id; Yii::app()->session['jugador_id'] = $this->_jugador_id = $jugador_id; } //3. Verifico el número de rondas que ha jugado hoy para que no juegue más de la cuenta $rondasdia = Ronda::model()->getRondasDia($this->_jugador_id); $n_rondasdia = count($rondasdia); if ($n_rondasdia >= Yii::app()->params['rondasxdia']) { Yii::app()->user->setFlash('error', "Ya has jugado " . Yii::app()->params['rondasxdia'] . ' veces el día de hoy, vuelve mañana para que sigas acumulando puntos.'); $this->redirect('puntajes'); Yii::app()->end(); } //Verifico el nivel para actualizar el tiempo de cada pregunta $pt = Jugador::model()->getPuntos($this->_jugador_id); $ronda = new Ronda(); Yii::app()->session['ronda'] = $this->_ronda = $ronda->iniciarRonda($this->_jugador_id); Yii::app()->session['preguntas'] = $this->_preguntas = array(); Yii::app()->session['ayudas'] = $this->_ayudas = AyudaXRonda::model()->getAyudasDia($rondasdia); Yii::app()->session['preguntan'] = $this->_preguntan = 0; Yii::app()->session['preguntaid'] = $this->_preguntaid = 0; Yii::app()->session['nivel'] = $this->_nivel = 1; Yii::app()->session['puntosr'] = $this->_puntosr = 0; Yii::app()->session['puntost'] = $this->_puntost = $pt; Yii::app()->session['situacion'] = $this->_situacion = 1; //1. inicio $nivel = Nivel::model()->findByPk($this->_nivel); Yii::app()->session['tiempo'] = $this->_tiempo = $nivel->tiempo; } else { $this->_ronda = Yii::app()->session['ronda']; $this->_jugador_id = Yii::app()->session['jugador_id']; $this->_preguntas = Yii::app()->session['preguntas']; $this->_preguntan = Yii::app()->session['preguntan']; $this->_preguntaid = Yii::app()->session['preguntaid']; $this->_nivel = Yii::app()->session['nivel']; $this->_tiempo = Yii::app()->session['tiempo']; $this->_puntosr = Yii::app()->session['puntosr']; $this->_puntost = Yii::app()->session['puntost']; $this->_situacion = Yii::app()->session['situacion']; $this->_ayudas = Yii::app()->session['ayudas']; } }