/**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = SpecialistSick::find();
     $query->joinWith(['specialist', 'statusgroup']);
     $dataProvider = new ActiveDataProvider(['query' => $query]);
     $dataProvider->sort->attributes['specialist'] = ['asc' => ['specialist.name_specialist' => SORT_ASC], 'desc' => ['specialist.name_specialist' => SORT_DESC]];
     $dataProvider->sort->attributes['statusgroup'] = ['asc' => ['status.name' => SORT_ASC], 'desc' => ['status.name' => SORT_DESC]];
     $this->load($params);
     if (!$this->validate()) {
         return $dataProvider;
     }
     $query->andFilterWhere(['id_sick' => $this->id_sick, 'create_day' => $this->create_day, 'status' => $this->status]);
     $query->andFilterWhere(['like', 'name_sick', $this->name_sick]);
     $query->andFilterWhere(['like', 'specialist.name_specialist', $this->specialist])->andFilterWhere(['like', 'status.name', $this->statusgroup]);
     return $dataProvider;
 }
Esempio n. 2
0
use backend\models\SpecialistSick;
use dosamigos\ckeditor\CKEditor;
use backend\models\Status;
/* @var $this yii\web\View */
/* @var $model backend\models\PostSick */
/* @var $form yii\widgets\ActiveForm */
?>

<div class="post-sick-form">

    <?php 
$form = ActiveForm::begin();
?>
    
    <?php 
echo $form->field($model, 'id_sick')->dropDownList(ArrayHelper::map(SpecialistSick::find()->all(), 'id_sick', 'name_sick'), ['prompt' => 'Select Sick']);
?>

    <?php 
echo $form->field($model, 'name_post')->textInput(['maxlength' => true]);
?>

    <?php 
echo $form->field($model, 'content')->widget(CKEditor::className(), ['options' => ['rows' => 6], 'preset' => 'full']);
?>

    <?php 
echo $form->field($model, 'create_day')->textInput();
?>

    <?php 
Esempio n. 3
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getSick()
 {
     return $this->hasOne(SpecialistSick::className(), ['id_sick' => 'id_sick']);
 }
Esempio n. 4
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getSpecialistSicks()
 {
     return $this->hasMany(SpecialistSick::className(), ['status' => 'id']);
 }
 /**
  * Finds the SpecialistSick model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return SpecialistSick the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = SpecialistSick::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }