Exemple #1
0
 /**
  * @return array of tipos de Usuários
  */
 public static function findActives()
 {
     $query = TiposUsuario::find();
     $dataProvider = new ActiveDataProvider(['query' => $query]);
     $query->andFilterWhere(['ativo' => 1]);
     return $dataProvider;
 }
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = TiposUsuario::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_tipo_usuario' => $this->id_tipo_usuario, 'ativo' => 1]);
     $query->andFilterWhere(['like', 'nome', $this->nome])->andFilterWhere(['like', 'descricao', $this->descricao]);
     return $dataProvider;
 }
Exemple #3
0
echo $form->field($model, 'foto')->widget(FileInput::classname(), ['options' => ['accept' => 'image/*'], 'pluginOptions' => ['allowedFileExtensions' => ['jpg', 'jpeg', 'png', 'tif', 'tiff'], 'showUpload' => false, 'showRemove' => false, 'initialPreview' => [Html::img($model->getImageUrl(), ['class' => 'file-preview-image', 'alt' => 'Imagem atual', 'title' => 'Imagem Atual'])]]]);
?>

    <?php 
echo $form->field($model, 'email')->input("email");
?>
    
    <?php 
echo $form->field($model, 'password')->passwordInput(['value' => ""]);
?>

    <?php 
echo $form->field($model, 'password_repeat')->passwordInput(['value' => ""]);
?>

    <?php 
echo $form->field($model, 'id_tipo_usuario')->dropdownList(ArrayHelper::map(TiposUsuario::find()->where(['ativo' => 1])->all(), 'id_tipo_usuario', 'nome'), ['prompt' => 'Selecione o tipo de usuário']);
?>

    <div class="form-group">
        <?php 
echo Html::submitButton($model->isNewRecord ? 'Criar' : 'Atualizar', ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']);
?>
    </div>

    <?php 
ActiveForm::end();
?>

</div>