/** * Creates a new model. * If creation is successful, the browser will be redirected to the 'view' page. */ public function actionCreate() { $model = new JugadorRanking(); $user = Yii::app()->user; // Uncomment the following line if AJAX validation is needed // $this->performAjaxValidation($model); if (isset($_POST['JugadorRanking'])) { $model->attributes = $_POST['JugadorRanking']; if ($model->save()) { $user->setFlash('success', "Datos han sido guardados <strong>satisfactoriamente</strong>."); $this->redirect(array('admin')); } } $this->render('create', array('model' => $model)); }
/** * Función para importar los jugadores del ranking temporal al ranking * Todos aquellos jugadores que tengan como status de su ranking 1 (activo) * Pasaran de forma automatica al ranking principal */ public function actionImportRank() { $user = Yii::app()->user; $busqRankTemp = JugadorRankTemp::model()->findAll(array('condition' => 'status=1')); foreach ($busqRankTemp as $rnkTmp) { $newRank = new JugadorRanking(); $newRank->id_jugador = $rnkTmp->id_jugador; $newRank->puntos = $rnkTmp->puntos; $newRank->fecha = date("Y-m-d h:i:s"); $newRank->status = $rnkTmp->status; $newRank->posicion = $rnkTmp->posicion; $newRank->save(); } $user->setFlash('success', "Datos han sido modificados <strong>satisfactoriamente</strong>."); $this->redirect(array('admin')); }