예제 #1
0
 private static function _evaluateIndicators($content, $hospitalIndicators)
 {
     $returnTable = [];
     preg_match_all("|\\[(.+?)\\]|m", $content, $matches);
     foreach ($matches[1] as $idx => $match) {
         preg_match_all("|([A-Za-z_]+)|", $match, $matchesIndicators);
         if (count($matchesIndicators) > 0) {
             $unit = $basicIndicators = BasicIndicators::find()->where(['name' => $matchesIndicators[1][0]])->one()->unit;
         }
         $returnTable[$matches[0][$idx]] = eval('return (' . preg_replace("|([A-Za-z_]+)|", '$hospitalIndicators->$1', $match) . ')' . ($unit == '%' ? '*100' : '') . ';') . $unit;
     }
     foreach ($returnTable as $key => $value) {
         $content = str_replace($key, $value, $content);
     }
     return $content;
 }
 /**
  * Finds the BasicIndicators model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return BasicIndicators the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = BasicIndicators::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }
예제 #3
0
 public function getBasicDenominator()
 {
     return $this->hasOne(BasicIndicators::className(), ['id' => 'denominator']);
 }
예제 #4
0
 /**
  * @inheritdoc
  */
 public function rules()
 {
     return [[['nazwa', 'id_szpital', 'id_specjalizacja', 'id_data', 'id_oddzial'], 'required'], [['id_szpital', 'id_specjalizacja', 'id_data', 'id_oddzial'], 'integer'], [['nazwa'], 'string'], [BasicIndicators::find()->select('name')->column(), 'number']];
 }
예제 #5
0
<div class="hospitals-form">

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

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

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

    <?php 
foreach (BasicIndicators::find()->select(['description', 'name'])->all() as $indicator) {
    ?>

	<?php 
    echo $form->field($model, $indicator->name, ['showLabels' => true])->textInput()->label($indicator->description);
    ?>

    <?php 
}
?>

    <div class="form-group">
        <?php 
echo Html::submitButton($model->isNewRecord ? 'Utwórz' : 'Aktualizuj', ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']);
?>
    </div>
예제 #6
0
?>

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

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

    <?php 
echo $form->field($model, 'numerator')->dropDownList(BasicIndicators::find()->select(['name', 'id'])->indexBy('id')->column());
?>

    <?php 
echo $form->field($model, 'denominator')->dropDownList([0 => ''] + BasicIndicators::find()->select(['name', 'id'])->indexBy('id')->column());
?>

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

    <div class="form-group">
        <?php 
echo Html::submitButton($model->isNewRecord ? 'Utwórz' : 'Aktualizuj', ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']);
?>
    </div>

    <?php 
ActiveForm::end();
?>