/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = Relacionamentos::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]); $query->andFilterWhere(['like', 'nome', $this->nome]); return $dataProvider; }
<div class="atividades-form"> <div class="row"> <div class="col-md-9"> <?php $form = ActiveForm::begin(['type' => ActiveForm::TYPE_HORIZONTAL, 'formConfig' => ['labelSpan' => 5]]); ?> <?php echo $form->field($model, 'atividade')->textInput(['maxlength' => true]); ?> <?php echo $form->field($model, 'agenda_id')->dropDownList(ArrayHelper::map(Agendas::find()->all(), 'id', 'nome'), ['prompt' => 'Escolha uma agenda']); ?> <?php echo $form->field($model, 'relacionamento_id')->dropDownList(ArrayHelper::map(Relacionamentos::find()->all(), 'id', 'nome'), ['prompt' => 'Escolha um relacionamento']); ?> <?php echo $form->field($model, 'setor_id')->dropDownList(ArrayHelper::map(Setores::find()->all(), 'id', 'nome'), ['prompt' => 'Escolha um setor']); ?> <div class="form-group"> <?php echo Html::activeLabel($model, 'data_inicio', ['label' => 'Data Início', 'class' => 'col-sm-5 control-label']); ?> <div class="col-md-4"> <?php echo $form->field($model, 'data_inicio', ['contentBeforeInput' => '<div class="input-group"><div class="input-group-addon"><span class="glyphicon glyphicon-calendar"></span></div>', 'contentAfterInput' => '</div>', 'showLabels' => false])->textInput(['placeholder' => 'Data']); ?> </div>