/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = Curriculos::find()->orderBy(['id' => SORT_DESC]); $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, 'datanascimento' => $this->datanascimento, 'idade' => $this->idade, 'data' => $this->data, 'classificado' => $this->classificado]); $query->andFilterWhere(['like', 'edital', $this->edital])->andFilterWhere(['like', 'nome', $this->nome])->andFilterWhere(['like', 'numeroInscricao', $this->numeroInscricao])->andFilterWhere(['like', 'cargo', $this->cargo])->andFilterWhere(['like', 'cpf', $this->cpf])->andFilterWhere(['like', 'sexo', $this->sexo])->andFilterWhere(['like', 'email', $this->email])->andFilterWhere(['like', 'emailAlt', $this->emailAlt])->andFilterWhere(['like', 'telefone', $this->telefone])->andFilterWhere(['like', 'telefoneAlt', $this->telefoneAlt]); return $dataProvider; }
/** * @return \yii\db\ActiveQuery */ public function getCurriculos() { return $this->hasOne(Curriculos::className(), ['id' => 'curriculos_id']); }
/** * Finds the Curriculos model based on its primary key value. * If the model is not found, a 404 HTTP exception will be thrown. * @param integer $id * @return Curriculos the loaded model * @throws NotFoundHttpException if the model cannot be found */ protected function findModel($id) { if (($model = Curriculos::findOne($id)) !== null) { return $model; } else { throw new NotFoundHttpException('The requested page does not exist.'); } }
<?php use yii\helpers\Html; use yii\widgets\DetailView; use app\models\Curriculos; use app\models\CurriculosEndereco; use app\models\CurriculosFormacao; use app\models\CurriculosComplemento; use app\models\CurriculosEmpregos; /* @var $this yii\web\View */ /* @var $model app\models\Curriculos */ $session = Yii::$app->session; $id = $_GET['id']; $sql = 'SELECT * FROM curriculos WHERE id =' . $id . ' '; $model = Curriculos::findBySql($sql)->one(); //busca endereço $sql_endereco = 'SELECT * FROM curriculos_endereco WHERE curriculos_id =' . $id . ' '; $curriculosEndereco = CurriculosEndereco::findBySql($sql_endereco)->one(); //busca formação $sql_formacao = 'SELECT * FROM curriculos_formacao WHERE curriculos_id =' . $id . ' '; $curriculosFormacao = CurriculosFormacao::findBySql($sql_formacao)->one(); //busca cursos complementares $sql_complemento = 'SELECT * FROM curriculos_complemento WHERE curriculos_id =' . $id . ' '; $curriculosComplemento = CurriculosComplemento::findBySql($sql_complemento)->all(); //busca empregos anteriores $sql_emprego = 'SELECT * FROM curriculos_empregos WHERE curriculos_id =' . $id . ' '; $curriculosEmpregos = CurriculosEmpregos::findBySql($sql_emprego)->all(); $this->title = $model->numeroInscricao; $this->params['breadcrumbs'][] = ['label' => 'Curriculos', 'url' => ['index']]; $this->params['breadcrumbs'][] = $this->title; ?>