예제 #1
0
파일: User.php 프로젝트: bagaswidodo/ta-app
 public static function findByUsername($username)
 {
     //mencari user Dosen berdasarkan username dan hanya dicari 1.
     $user = Dosen::find()->where(['username' => $username])->one();
     if (count($user)) {
         // var_dump($user);
         return new static($user);
         // return "valid";
     }
     return null;
 }
예제 #2
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Dosen::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(['kd_dosen' => $this->kd_dosen]);
     $query->andFilterWhere(['like', 'nama', $this->nama])->andFilterWhere(['like', 'username', $this->username])->andFilterWhere(['like', 'password', $this->password]);
     return $dataProvider;
 }
예제 #3
0
/* @var $form yii\widgets\ActiveForm */
?>

<div class="bimbingan-form">

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

     <?php 
echo $form->field($model, 'nim')->dropDownList(ArrayHelper::map(Mahasiswa::find()->all(), 'nim', 'nim'));
?>
     <?php 
echo $form->field($model, 'kd_dosen')->dropDownList(ArrayHelper::map(Dosen::find()->all(), 'kd_dosen', 'nama'));
?>
     <?php 
echo $form->field($model, 'dosen_dua')->dropDownList(ArrayHelper::map(Dosen::find()->all(), 'kd_dosen', 'nama'));
?>

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

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

</div>
예제 #4
0
 /**
  * Finds the Dosen model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return Dosen the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = Dosen::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }