コード例 #1
3
ファイル: _findForm.php プロジェクト: SerhiiPetliak/medik
use kartik\select2\Select2;
use app\models\Streets;
/* @var $this yii\web\View */
/* @var $model app\models\Peoples */
/* @var $form yii\widgets\ActiveForm */
?>

<div class="peoples-form">

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

    <?php 
echo Html::label("Вулиця");
echo Select2::widget(['model' => $model, 'attribute' => 'streetId', 'language' => 'uk', 'data' => ArrayHelper::map(Streets::find()->all(), 'streetId', 'streetName')]);
?>

    <?php 
echo $form->field($model, 'yearVal')->textInput()->label('Кількість років');
?>

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

    <?php 
ActiveForm::end();
?>
コード例 #2
0
ファイル: StreetsSearch.php プロジェクト: SerhiiPetliak/medik
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Streets::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(['streetId' => $this->streetId]);
     $query->andFilterWhere(['like', 'streetName', $this->streetName]);
     return $dataProvider;
 }
コード例 #3
0
ファイル: index.php プロジェクト: SerhiiPetliak/medik
}], ['attribute' => 'peopleWorking', 'value' => 'peopleWorking0.workingName'], ['attribute' => 'fluInfo', 'format' => 'raw', 'value' => function ($data) {
    $res = "";
    if ($data->peopleFluResult == 0) {
        $res = '<span class="label label-danger">Патологія</span>';
    } else {
        $res = '<span class="label label-success">Норма</span>';
    }
    return $data->peopleFluNumber . "<br/>" . date('d.m.Y', strtotime($data->peopleFluDate)) . "<br/>" . $res;
}], ['attribute' => 'graft', 'format' => 'raw', 'value' => function ($data) {
    $r = "";
    $findRes = graftsPeoples::find()->where(['peopleId' => $data->peopleId])->all();
    foreach ($findRes as $f) {
        $graftName = Grafts::find()->where(['graftId' => $f['graftId']])->all();
        $r .= '<span class="label label-primary">' . $graftName[0]['graftName'] . '</span>&nbsp;';
    }
    return $r;
}], ['attribute' => 'chronic', 'format' => 'raw', 'value' => function ($data) {
    $r = "";
    $findRes = chronicDiseasesPeoples::find()->where(['peopleId' => $data->peopleId])->all();
    foreach ($findRes as $f) {
        $chronicDiseasesName = chronicDiseases::find()->where(['chronicDiseasesId' => $f['chronicDiseasesId']])->all();
        $r .= '<span class="label label-primary">' . $chronicDiseasesName[0]['chronicDiseasesName'] . '</span>&nbsp;';
    }
    return $r;
}], ['attribute' => 'peopleStreet', 'value' => 'peopleStreet0.streetName', 'filter' => ArrayHelper::map(Streets::find()->all(), 'streetId', 'streetName')], 'peopleAdress', ['class' => 'yii\\grid\\ActionColumn']]]);
?>
    
     

</div>
コード例 #4
0
ファイル: fluFind.php プロジェクト: SerhiiPetliak/medik
function findStreet($id)
{
    $streetName = Streets::find()->where(['streetId' => $id])->one();
    return $streetName['streetName'];
}
コード例 #5
0
ファイル: Peoples.php プロジェクト: SerhiiPetliak/medik
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getPeopleStreet0()
 {
     return $this->hasOne(Streets::className(), ['streetId' => 'peopleStreet']);
 }
コード例 #6
0
 /**
  * Finds the Streets model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return Streets the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = Streets::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }