Ejemplo n.º 1
0
 private static function _getRank($indicatorName, $indicatorValue, $id, $idSpec)
 {
     echo $indicatorName . " " . $indicatorValue;
     $mathRules = IndicatorMath::find()->where(['indicator' => $indicatorName])->andWhere(['like', 'id_specjalizacja', $idSpec])->one();
     if (!$mathRules) {
         $mathRules = IndicatorMath::find()->where(['indicator' => $indicatorName])->andWhere(['id_specjalizacja' => ''])->one();
     }
     if ($mathRules) {
         if ($indicatorValue < 0) {
             if (isset($mathRules->minus2) && $indicatorValue < -$mathRules->minus2) {
                 return -2;
             } elseif ($indicatorValue < -$mathRules->minus1) {
                 return -1;
             } else {
                 return 0;
             }
         } elseif ($indicatorValue > 0) {
             if (isset($mathRules->plus2) && $indicatorValue > $mathRules->plus2) {
                 return 2;
             } elseif ($indicatorValue > $mathRules->plus1) {
                 return 1;
             } else {
                 return 0;
             }
         } else {
             return 0;
         }
     } else {
         return 0;
     }
 }
 /**
  * Lists all IndicatorMath models.
  * @return mixed
  */
 public function actionIndex()
 {
     if (\Yii::$app->user->isGuest) {
         return $this->goHome();
     }
     $dataProvider = new ActiveDataProvider(['query' => IndicatorMath::find()]);
     return $this->render('index', ['dataProvider' => $dataProvider]);
 }