Esempio n. 1
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Usertypes::find();
     $dataProvider = new ActiveDataProvider(['query' => $query]);
     if (!($this->load($params) && $this->validate())) {
         return $dataProvider;
     }
     $query->andFilterWhere(['UserTypeId' => $this->UserTypeId, 'created_by' => $this->created_by, 'LastUpdatedBy' => $this->LastUpdatedBy, 'created_at' => $this->created_at, 'updated_at' => $this->updated_at, 'deleted_at' => $this->deleted_at]);
     $query->andFilterWhere(['like', 'Name', $this->Name])->andFilterWhere(['like', 'Description', $this->Description])->andFilterWhere(['like', 'Comment', $this->Comment]);
     return $dataProvider;
 }
Esempio n. 2
0
 /**
  * Finds the Usertypes model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return Usertypes the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = Usertypes::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }
Esempio n. 3
0
<?php

use yii\helpers\Html;
use yii\helpers\ArrayHelper;
use yii\bootstrap\ActiveForm;
use kartik\datecontrol\DateControl;
use common\models\Usertypes;
$dataUserTypes = ArrayHelper::map(Usertypes::find()->asArray()->all(), 'UserTypeId', 'Name');
/* @var $this yii\web\View */
/* @var $model common\models\User */
/* @var $form yii\bootstrap\ActiveForm */
?>

<div class="user-form">

    <?php 
// echo '<pre>';
//  print_r(Yii::$app->params['dateControlDisplay']);
//  print_r(Yii::$app->params['dateControlSave']);
//  print_r(Yii::$app->formatter);
//  echo '</pre>';
$form = ActiveForm::begin(['layout' => 'horizontal']);
?>

    <?php 
echo $form->field($model, 'UserTypeId', ['horizontalCssClasses' => ['wrapper' => 'col-sm-4']])->dropDownList($dataUserTypes, ['prompt' => 'Choose a User Type']);
?>

    <?php 
echo $form->field($model, 'username', ['horizontalCssClasses' => ['wrapper' => 'col-sm-4']])->textInput(['maxlength' => 255]);
?>
Esempio n. 4
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getUserType()
 {
     return $this->hasOne(Usertypes::className(), ['UserTypeId' => 'UserTypeId']);
 }