/**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Mspatient::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(['PatientID' => $this->PatientID]);
     $query->andFilterWhere(['like', 'FirstName', $this->FirstName])->andFilterWhere(['like', 'LastName', $this->LastName])->andFilterWhere(['like', 'PhoneNumber', $this->PhoneNumber])->andFilterWhere(['like', 'Address', $this->Address])->andFilterWhere(['like', 'Gender', $this->Gender])->andFilterWhere(['like', 'Notes', $this->Notes]);
     return $dataProvider;
 }
Beispiel #2
0
use yii\helpers\ArrayHelper;
use yii\helpers\Html;
use yii\widgets\ActiveForm;
use yii\jui\DatePicker;
use app\models\Msroom;
use app\models\Mspatient;
use app\models\Msdoctor;
use kartik\datetime\DateTimePicker;
/* @var $this yii\web\View */
/* @var $model app\models\Trreservation */
/* @var $form yii\widgets\ActiveForm */
?>

<?php 
$listRoom = ArrayHelper::map(Msroom::find()->all(), 'RoomID', 'RoomName');
$listPatient = ArrayHelper::map(Mspatient::find()->all(), 'PatientID', 'FirstName');
$listDoctor = ArrayHelper::map(Msdoctor::find()->all(), 'DoctorID', 'FirstName');
?>

<div class="trreservation-form">

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

    <?php 
echo $form->field($model, 'Date')->widget(DateTimePicker::className());
?>

    <?php 
echo $form->field($model, 'RoomID')->dropDownList($listRoom);
 /**
  * Finds the Mspatient model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return Mspatient the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = Mspatient::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getPatient()
 {
     return $this->hasOne(Mspatient::className(), ['PatientID' => 'PatientID']);
 }