Ejemplo n.º 1
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = UserType::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, 'status' => $this->status, 'created_dt' => $this->created_dt]);
     $query->andFilterWhere(['like', 'title', $this->title]);
     return $dataProvider;
 }
Ejemplo n.º 2
0
 /**
  * Finds the UserType model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return UserType the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = UserType::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }
Ejemplo n.º 3
0
use yii\helpers\Html;
use yii\widgets\ActiveForm;
use common\models\UserType;
use yii\helpers\ArrayHelper;
/* @var $this yii\web\View */
/* @var $model common\models\RoleMaster */
/* @var $form yii\widgets\ActiveForm */
?>

<?php 
$form = ActiveForm::begin();
?>
    <div class="box-body" id="treeview">
        <div class="form-group">
            <?php 
echo $form->field($model, 'user_type_id')->dropDownList(ArrayHelper::map(UserType::find()->all(), 'id', 'title'));
?>
        </div>
        <div class="form-group">
            <?php 
echo $tree_view;
?>
        </div>
        <div class="box-footer">
            <?php 
echo Html::submitButton($model->isNewRecord ? 'Create' : 'Update', ['class' => 'btn btn-primary']);
?>
            <?php 
echo Html::a('Cancel', ['/usertype'], ['class' => 'btn btn-default']);
?>
        </div>
Ejemplo n.º 4
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getUserType()
 {
     return $this->hasOne(UserType::className(), ['id' => 'user_type_id']);
 }