示例#1
0
 /**
  * Updates an existing Bp24h model.
  * If update is successful, the browser will be redirected to the 'view' page.
  * @param integer $id
  * @return mixed
  */
 public function actionUpdate($id)
 {
     $model = $this->findModel($id);
     $upload = new UploadForm();
     $bp24 = new Bp24h();
     $_24hdata = $bp24->pull24hoursdata($id);
     $pid = $model->fk_person;
     $persondetails = \app\models\Participant::findOne(['pk_person' => $pid]);
     if ($model->load(Yii::$app->request->post())) {
         $model->altered = 1;
         $persondetails->filtered = $persondetails->filtered + 1;
         if ($model->wasuploaded != 1) {
             $model->file = UploadedFile::getInstance($model, 'file');
             $model->file->saveAs('uploads/' . $model->file->baseName . '.' . $model->file->extension);
             $model->wasuploaded = 1;
         }
         $persondetails->save(FALSE);
         $model->save(FALSE);
         if (!empty($model->file)) {
             return $this->redirect(['bp24h/uploadexcel', 'fkperson' => $model->fk_person, 'idbp24' => $model->idbp24, 'name' => $model->file->baseName]);
         } else {
             Yii::$app->session->setFlash('success', 'The record has been updated successfully');
             return $this->redirect(['participant/index']);
         }
     } else {
         return $this->render('update', ['model' => $model, 'upload' => $upload, 'dataProvider' => $_24hdata, 'persondetails' => $persondetails]);
     }
 }
 /**
  * Updates an existing Questionnaire model.
  * If update is successful, the browser will be redirected to the 'view' page.
  * @param integer $id
  * @return mixed
  */
 public function actionUpdate($id)
 {
     $model = $this->findModel($id);
     if (\Yii::$app->request->isAjax && $model->load(Yii::$app->request->post())) {
         \Yii::$app->response->format = 'json';
         return \kartik\widgets\ActiveForm::validate($model);
     }
     $persondetails = \app\models\Participant::findOne(['pk_person' => $model->fk_person]);
     if ($model->load(Yii::$app->request->post())) {
         $model->creation_name = Yii::$app->user->identity->username;
         $model->altered = 1;
         $persondetails->filtered = $persondetails->filtered + 1;
         $model->hbp_med_list = $_POST['Questionnaire']['enalapril'] . "," . $_POST['Questionnaire']['atenolol'] . ", " . $_POST['Questionnaire']['propranolol'] . "," . $_POST['Questionnaire']['hydrochlorthiazide'] . "," . $_POST['Questionnaire']['frusemide'] . "," . $_POST['Questionnaire']['aldactone'] . "," . $_POST['Questionnaire']['methyldopa'] . "," . $_POST['Questionnaire']['nifedipine'] . "," . $_POST['Questionnaire']['hydralazine'];
         if ($_POST['Questionnaire']['own_none'] == 1) {
             $model->household_own = "0,0,0,0,0,0,1";
         } else {
             $model->household_own = $_POST['Questionnaire']['car'] . "," . $_POST['Questionnaire']['refridgerator'] . ", " . $_POST['Questionnaire']['bicycle'] . "," . $_POST['Questionnaire']['radio'] . "," . $_POST['Questionnaire']['television'] . "," . $_POST['Questionnaire']['own_none'];
         }
         $persondetails->filtered = 1;
         if ($model->save(FALSE) && $persondetails->save(FALSE)) {
             Yii::$app->session->setFlash('success', 'The questionnaire saved successfully');
             return $this->redirect(['participant/apptmnts']);
         }
     } else {
         return $this->render('update', ['model' => $model, 'persondetails' => $persondetails]);
     }
 }
示例#3
0
 public function updateData($data, $tables)
 {
     $db = new yii\db\Connection(['dsn' => "mysql:host=196.202.202.131;dbname=shinda2", 'username' => 'root', 'password' => 'FAQU', 'charset' => 'utf8']);
     $table = "tbl_" . $tables;
     $columns = $db->getTableSchema($table)->columnNames;
     $sqls = "";
     foreach ($data as $value) {
         $sql = "UPDATE {$table} SET ";
         for ($index = 1; $index < count($columns); $index++) {
             $model = Participant::findOne($columns[0]);
             $col = $columns[$index];
             $hold = $value[$columns[$index]];
             if (empty($hold)) {
                 $val = "NULL";
             } else {
                 $val = "'{$hold}'";
             }
             $sql .= "{$col} = {$val}, ";
         }
         $sql = substr($sql, 0, -2);
         $id = $value[$columns[0]];
         $sql .= " WHERE id_p ={$id};";
         $sqls .= $sql;
     }
     $db->createCommand($sqls)->execute();
     $db->createCommand()->update('tbl_participant', ['altered' => NULL])->execute();
 }
示例#4
0
 public function actionUpdateresults($id)
 {
     if (Yii::$app->user->can('clinic_results') || Yii::$app->user->can('system_admin')) {
         $model = $this->findModel($id);
         $part = \app\models\Participant::findOne(['pk_person' => $model->fk_person]);
         if ($model->load(Yii::$app->request->post())) {
             $model->aliquots = $_POST['Urine']['aliquot1'] . "," . $_POST['Urine']['aliquot2'];
             $model->save(FALSE);
             Yii::$app->session->setFlash('success', 'The record has been updated successfully');
             return $this->redirect(['urine/index']);
         } else {
             return $this->render('updateresult', ['model' => $model, 'persondetails' => $part]);
         }
     } else {
         throw new \yii\web\ForbiddenHttpException('Currently you do not have permissions to view this section');
     }
 }
 /**
  * Finds the Participant model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return Participant the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = Participant::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }
示例#6
0
文件: view.php 项目: jibendi/shinda2
<?php

use yii\helpers\Html;
use yii\widgets\DetailView;
/* @var $this yii\web\View */
/* @var $model app\models\Urine */
$this->title = \app\models\Participant::findOne(['pk_person' => $model->fk_person])->names;
?>
<div class="panel panel-primary">
    
  <div class="panel-heading">
    <h3 class="panel-title"><?php 
echo Html::encode($this->title);
?>
</h3>
  </div>
  <div class="panel-body">
<div class="urine-view">

    <?php 
echo DetailView::widget(['model' => $model, 'attributes' => ['id', 'fk_person', 'fk_study_no', 'date_visit', 'time_visit', 'spot_urine_collected', 'reason_not_collected', 'spot_urine_time', 'date_collect_urine', 'date_received_urine', 'time_received_urine', 'date_result_spot_urine', 'time_result_spot_urine', 'spot_na_urine', 'spot_k_urine', 'spot_cr_urine', 'spot_alb_urine', 'year', 'clinician', 'result_complete', 'aliquots', 'sample_labelled', 'frozen', 'tech_initials_r', 'tech_date_r', 'tech_time_r', 'tech_initials_p', 'tech_date_p', 'tech_time_p']]);
?>

</div>
  </div>
</div>
示例#7
0
 public function actionUpdatebp($id)
 {
     $model = $this->findModel($id);
     if (\Yii::$app->request->isAjax && $model->load(Yii::$app->request->post())) {
         \Yii::$app->response->format = 'json';
         return \kartik\widgets\ActiveForm::validate($model);
     }
     if ($model->load(Yii::$app->request->post()) && $model->validate()) {
         $model->updated_date = new \yii\db\Expression('NOW()');
         $model->update_name = \Yii::$app->user->identity->username;
         if ($model->save()) {
             Yii::$app->session->setFlash('success', 'The record has been updated successfully');
             return $this->redirect(['participant/index']);
         }
     } else {
         $fkperson = \app\models\Participant::findOne(['pk_person' => $model->fk_person]);
         return $this->render('updatebp', ['model' => $model, 'persondetails' => $fkperson]);
     }
 }
 public function findOne($id)
 {
     if (($participant = Participant::findOne($id)) !== null) {
         $this->id = $participant->id;
         $this->makeNameFromParticipant($participant->name);
         $this->setUserType($participant->type);
         $this->smi_name = $participant->smi_name;
         $this->smi_type = $participant->smi_type;
         $this->smi_url = $participant->smi_url;
         $this->smi_editor = $participant->smi_editor;
         $this->smi_periodity = $participant->smi_periodity;
         $this->smi_field = $participant->smi_field;
         $this->smi_area = $participant->smi_area;
         $this->smi_status = $participant->smi_status;
         $this->smi_head = $participant->smi_head;
         $this->smi_jur_address = $participant->smi_jur_address;
         $this->occupation = $participant->occupation;
         $this->post_address = $participant->post_address;
         $this->city_phone = $participant->city_phone;
         $this->mobile_phone = $participant->mobile_phone;
         return $this;
     }
     return null;
 }