/**
  * Creates a new Trmaschedule model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  * @return mixed
  */
 public function actionCreate($id = 1)
 {
     $model = new Trmaschedule();
     $querytest = Trmaschedule::find()->where(['MedicaladvID' => $id])->orderBy('mascheduleID')->all();
     $matitle = Msmedicaladv::findOne($id);
     $medicaladvs = Msmedicaladv::find()->all();
     if ($model->load(Yii::$app->request->post()) && $model->save()) {
         return $this->redirect(['view', 'id' => $model->mascheduleID]);
     } else {
         return $this->render('create', ['model' => $model, 'querytest' => $querytest, 'matitle' => $matitle, 'medicaladvs' => $medicaladvs]);
     }
 }
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Msmedicaladv::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(['MedicaladvID' => $this->MedicaladvID]);
     $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;
 }
 /**
  * Finds the Msmedicaladv model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return Msmedicaladv the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = Msmedicaladv::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getMedicaladv()
 {
     return $this->hasOne(Msmedicaladv::className(), ['MedicaladvID' => 'MedicaladvID']);
 }
Beispiel #5
0
<?php

use yii\helpers\ArrayHelper;
use yii\helpers\Html;
use yii\widgets\ActiveForm;
use kartik\datetime\DateTimePicker;
use app\models\Mspatient;
use app\models\Msmedicaladv;
use app\models\Msroom;
/* @var $this yii\web\View */
/* @var $model app\models\Trroomschedule */
/* @var $form yii\widgets\ActiveForm */
$listPatient = ArrayHelper::map(Mspatient::find()->all(), 'PatientID', 'FirstName');
$listAdvisor = ArrayHelper::map(Msmedicaladv::find()->all(), 'MedicaladvID', 'FirstName');
$listRoom = ArrayHelper::map(Msroom::find()->all(), 'RoomID', 'RoomName');
?>

<div class="trroomschedule-form">

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

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

    <?php 
echo $form->field($model, 'MedicaladvID')->dropDownList($listAdvisor);
?>