/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = Atividade::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, 'max_horas' => $this->max_horas, 'curso_id' => $this->curso_id, 'grupo_id' => $this->grupo_id]); $query->andFilterWhere(['like', 'codigo', $this->codigo])->andFilterWhere(['like', 'nome', $this->nome]); return $dataProvider; }
echo $form->field($model, 'status')->textInput(['maxlength' => true]); ?> --> <?php if (isset(Yii::$app->user->identity)) { //$form = ActiveForm::begin(); if (Yii::$app->user->identity->perfil == 'Coordenador') { $items = ['Em Edição' => 'Em Edição', 'Submetida' => 'Submetida', 'Pré-Aprovada' => 'Pré-Aprovada', 'Deferida' => 'Deferida', 'Indeferida' => 'Indeferida']; echo $form->field($model, 'status')->dropDownList($items, ['prompt' => 'Selecione']); } } ?> <?php echo $form->field($model, 'atividade_id')->dropDownList(ArrayHelper::map(\app\models\Atividade::find()->all(), 'id', 'nome'), ['prompt' => 'Selecione']); ?> <?php echo $form->field($model, 'periodo_id')->dropDownList(ArrayHelper::map(\app\models\Periodo::find()->all(), 'id', 'codigo'), ['prompt' => 'Selecione']); ?> <!-- preenchendo o campo solicitante_id com os ids do Aluno, e escondendo do formulario. caso seja coordenador que esteja criando uma solicitação pro Aluno, então o Coordenador preencherá.--> <!--<?php echo $form->field($model, 'solicitante_id')->textInput(); ?> --> <?php if (isset(Yii::$app->user->identity)) { if (Yii::$app->user->identity->perfil == 'Aluno') {
/** * Finds the Atividade model based on its primary key value. * If the model is not found, a 404 HTTP exception will be thrown. * @param integer $id * @return Atividade the loaded model * @throws NotFoundHttpException if the model cannot be found */ protected function findModel($id) { if (($model = Atividade::findOne($id)) !== null) { return $model; } else { throw new NotFoundHttpException('The requested page does not exist.'); } }