Esempio n. 1
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = UserStatus::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, 'valor' => $this->valor]);
     $query->andFilterWhere(['like', 'nome', $this->nome]);
     return $dataProvider;
 }
Esempio n. 2
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getUserStatus()
 {
     return $this->hasOne(UserStatus::className(), ['id' => 'user_status_id']);
 }
 /**
  * Finds the UserStatus model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return UserStatus the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = UserStatus::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }
Esempio n. 4
0
<div class="user-form">

    <?php 
$form = ActiveForm::begin();
?>

    <?php 
echo $form->field($model, 'username')->textInput();
?>
    <?php 
echo $form->field($model, 'email')->textInput();
?>
    
    <?php 
$statusArray = ArrayHelper::map(\common\models\UserStatus::find()->orderBy('nome')->all(), 'id', 'nome');
?>
    <?php 
echo $form->field($model, 'user_status_id')->dropDownList($statusArray, ['prompt' => '---- Selecione um Status ----'])->label('Status');
?>
    
    <?php 
echo $form->field($model, 'assignmentIds')->widget(Select2::classname(), ['data' => $model->dropAssignment, 'options' => ['multiple' => true]]);
?>
  

    <div class="form-group">
        <?php 
echo Html::submitButton($model->isNewRecord ? 'Create' : 'Update', ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']);
?>
    </div>
Esempio n. 5
0
 public static function getStatusId($nome)
 {
     $status = UserStatus::find('id')->where(['nome' => $nome])->one();
     return isset($status->id) ? $status->id : false;
 }