/** * Creates a new Alumno model. * If creation is successful, the browser will be redirected to the 'view' page. * @return mixed */ public function actionCreate() { $hoy = date('Y-m-d H:i:s'); $perfil = new Perfil(); $perfil->fecha_alta = $hoy; $alumno = new Alumno(); $alumno->estado_id = EstadoAlumno::findOne(['descripcion' => EstadoAlumno::PREINSCRIPTO])->id; // Ver http://www.yiiframework.com/forum/index.php/topic/53935-subforms/page__gopid__248185#entry248185 if ($perfil->load(Yii::$app->request->post()) && Model::validateMultiple([$perfil, $alumno])) { $perfil->save(false); $alumno->perfil_id = $perfil->id; $alumno->save(false); return $this->redirect(['view', 'id' => $alumno->id]); } else { return $this->render('create', ['model' => $alumno, 'perfil' => $perfil]); } }
public static function perfilAtivo($idUser) { $idPerfil = PerfilUser::where('id_user', $idUser)->first()->id_perfil; $perfi = Perfil::findOrFail($idPerfil); if ($perfi->status == 1) { return true; } else { return false; } }
/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = Perfil::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, 'fechaNacimiento' => $this->fechaNacimiento, 'renumeracionActual' => $this->renumeracionActual, 'renumeracionIdeal' => $this->renumeracionIdeal]); $query->andFilterWhere(['like', 'apellidos', $this->apellidos])->andFilterWhere(['like', 'nombres', $this->nombres])->andFilterWhere(['like', 'genero', $this->genero])->andFilterWhere(['like', 'correo', $this->correo])->andFilterWhere(['like', 'valorAgregado', $this->valorAgregado])->andFilterWhere(['like', 'telefono', $this->telefono])->andFilterWhere(['like', 'celular', $this->celular])->andFilterWhere(['like', 'licenciaConducir', $this->licenciaConducir])->andFilterWhere(['like', 'rutaCV', $this->rutaCV])->andFilterWhere(['like', 'estado', $this->estado]); return $dataProvider; }
/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = Perfil::find(); // add conditions that should always apply here $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; } // grid filtering conditions $query->andFilterWhere(['id' => $this->id]); $query->andFilterWhere(['like', 'nombre_apellido', $this->nombre_apellido])->andFilterWhere(['like', 'Pais', $this->Pais])->andFilterWhere(['like', 'email', $this->email]); return $dataProvider; }
public function actionGetrank() { $rankLista = array(); $rankUser = array(); $modelAposta = User::find()->orderby('id')->all(); $total = 0; $id_user = 0; foreach ($modelAposta as $item) { $perfil = Perfil::find()->where(['=', 'id', $item->id])->one(); if ($perfil != null) { $rankUser = array("acertos" => Rank::GetAcertos($item->id), "nome" => $perfil->nome, "pontos" => Rank::actionGetTotal($item->id), "foto" => $perfil->foto, "resultados" => Rank::GetResultados($item->id)); array_push($rankLista, $rankUser); } } $rankLista = Rank::ordenarRank($rankLista, 'pontos', 'acertos'); return $this->render('getrank', ['dataProvider' => $rankLista]); }
/** * @return \yii\db\ActiveQuery */ public function getIdPerfil() { return $this->hasOne(Perfil::className(), ['id' => 'id_perfil']); }
</li> <li class="dropdown hidden-xs"> </li> <li class="dropdown"> <a href="#" class="dropdown-toggle" data-toggle="dropdown"> <span class="thumb-sm avatar pull-left"> <img src="/images/<?php echo Perfil::find($modelUsers->id)->where(['=', 'id', $modelUsers->id])->one()->foto; ?> "> </span><?php echo Perfil::find()->where(['=', 'id', $modelUsers->id])->one()->nome; ?> </a> <ul class="dropdown-menu animated fadeInRight"> <span class="arrow top"></span> <li> <a href="#">Settings</a> </li> <li> <a href="/perfil/trocasenha">Trocar Senha</a> </li> <li> <a href="#"> <span class="badge bg-danger pull-right">3</span> Notifications</a> </li>
/** * @return \yii\db\ActiveQuery */ public function getIdPerfils() { return $this->hasMany(Perfil::className(), ['id' => 'idPerfil'])->viaTable('formacion', ['idTipo' => 'id']); }
<?php use app\models\User; use app\models\Rank; use app\models\Perfil; $modelUsers = User::findByUsername(Yii::$app->user->identity->username); $perfil = Perfil::find()->where(['=', 'id', $modelUsers->id])->one(); ?> <section class="vbox"> <header class="header bg-white b-b b-light"> <p>Extrato de Pontos <small>(de jogos realizados)</small></p> </header> <section class="scrollable wrapper"> <div class="row"> <div class="col-lg-8"> <div class="row"> <div class="col-sm-6"> <section class="panel panel-default"> <header class="panel-heading bg-danger lt no-border"> <div class="clearfix"><a href="#" class="pull-left thumb avatar b-3x m-r"> <img src='/images/<?php echo $perfil->foto; ?> ' class="img-circle"> </a> <div class="clear"> <div class="h3 m-t-xs m-b-xs text-white"><?php $perfil->nome; ?> <i class="fa fa-circle text-white pull-right text-xs m-t-sm"></i></div> <small class="text-muted"></small> </div>
/** * Finds the Perfil model based on its primary key value. * If the model is not found, a 404 HTTP exception will be thrown. * @param integer $id * @return Perfil the loaded model * @throws NotFoundHttpException if the model cannot be found */ protected function findModel($id) { if (($model = Perfil::findOne($id)) !== null) { return $model; } else { throw new NotFoundHttpException('The requested page does not exist.'); } }
/** * @return \yii\db\ActiveQuery */ public function getPerfils() { return $this->hasMany(Perfil::className(), ['sexo_id' => 'id']); }
public function updateStatus($status, $id) { try { $dado = Perfil::findOrFail($id); $dado->status = $status; $dado->save(); session()->flash('flash_message', 'Status alterado com sucesso!'); } catch (\Exception $e) { LogR::exception($dado, $e); session()->flash('flash_message', 'Ops!! Ocorreu algum problema!. ' . $e->getMessage()); } return Redirect::back(); }
/** * Display the specified resource. * * @param int $id * @return Response */ public function show($id) { try { $dados['put'] = true; $dados['route'] = '/admin/configuracoes/usuarios/atualizar/' . $id; $dados['dados'] = User::findOrFail($id); $dados['funcoes'] = Funcao::all(); $dados['roles'] = Role::all(); $dados['permissao'] = PermissaoUser::where('id_user', $id)->get(); $dados['perfis'] = Perfil::all(); $dados['perfilUser'] = PerfilUser::where('id_user', $id)->first(); return view('admin/usuarios/dados', $dados); } catch (\Exception $e) { LogR::exception('show usuarios', $e); session()->flash('flash_message', 'Ops!! Ocorreu algum problema!. ' . $e->getMessage()); return Redirect::back(); } }
public static function GetPosicao($id) { $rankLista = array(); $rankUser = array(); $modelAposta = User::find()->orderby('id')->all(); $total = 0; $id_user = 0; foreach ($modelAposta as $item) { $perfil = Perfil::find()->where(['=', 'id', $item->id])->one(); if ($perfil != null) { $rankUser = array("acertos" => Rank::GetAcertos($item->id), "nome" => $perfil->nome, "id" => $item->id, "pontos" => Rank::actionGetTotal($item->id), "foto" => $perfil->foto, "resultados" => Rank::GetResultados($item->id)); array_push($rankLista, $rankUser); } } $rankLista = Rank::ordenarRank($rankLista, 'pontos', 'acertos'); $key = array_search($id, array_column($rankLista, 'id')); return $key + 1; }
/** * @return \yii\db\ActiveQuery */ public function getPerfil() { return $this->hasOne(Perfil::className(), ['id' => 'perfil_id']); }
/** * This function will be triggered when user is successfuly authenticated using some oAuth client. * * @param yii\authclient\ClientInterface $client * @return boolean|yii\web\Response */ public function oAuthSuccess($client) { // get user data from client $userAttributes = $client->getUserAttributes(); //cuida de logar $user = User::find()->where(['=', 'email', $userAttributes['email']])->one(); if ($user != null) { Yii::$app->user->login($user); copy('http://graph.facebook.com/' . $user->username . '/picture?type=large', 'images/' . $user->username . '.jpeg'); return $this->goHome(); } else { $modelCadastro = new SignupForm(); $modelCadastro->email = $userAttributes['email']; $modelCadastro->username = $userAttributes['id']; $modelCadastro->password = $userAttributes['id']; $nome = explode(" ", $userAttributes['name']); if ($user = $modelCadastro->signup()) { $modelPerfil = new Perfil(); $modelPerfil->id = $user->id; $modelPerfil->data = date('Y-m-d'); $modelPerfil->nome = $nome[0]; $modelPerfil->sobrenome = $nome[1]; copy('http://graph.facebook.com/' . $modelCadastro->username . '/picture?type=large', 'images/' . $modelCadastro->username . '.jpeg'); $modelPerfil->foto = $modelCadastro->username . '.jpeg'; $modelPerfil->save(); if (Yii::$app->getUser()->login($user)) { return $this->goHome(); } } } //Cuida do cadastro do usuario na base // do some thing with user data. for example with $userAttributes['email'] }
/** * @return \yii\db\ActiveQuery */ public function getPerfils() { return $this->hasMany(Perfil::className(), ['estado_documento_id' => 'id']); }
/** * @return \yii\db\ActiveQuery */ public function getIdPerfils() { return $this->hasMany(Perfil::className(), ['id' => 'idPerfil'])->viaTable('conocimiento', ['idAreaConocimiento' => 'id']); }
/** * @return \yii\db\ActiveQuery */ public function getPerfil() { return $this->hasOne(Perfil::className(), ['id' => 'perfil_id'])->viaTable('perfil_domicilio', ['domicilio_id' => 'id']); }