コード例 #1
0
        $dayCount++;
    }
}
$classCalculator = new ClassCalculator();
$classCalc[0]['min'] = 100;
$classCalc[0]['max'] = 0;
$classCalc[1]['min'] = 100;
$classCalc[1]['max'] = 0;
$classCalc[2]['min'] = 100;
$classCalc[2]['max'] = 0;
foreach ($timezones as $city) {
    for ($i = 0; $i <= 2; $i++) {
        if ($classCalc[$i]['min'] > $city->getDay($i)->getSentimentIndex()) {
            $classCalc[$i]['min'] = $city->getDay($i)->getSentimentIndex();
        }
        if ($classCalc[$i]['max'] < $city->getDay($i)->getSentimentIndex()) {
            $classCalc[$i]['max'] = $city->getDay($i)->getSentimentIndex();
        }
    }
}
$analyse = new Analyse($timezones);
//Jeder Tag hat eigene max und min
$analyse->setMaxMinSentimentIndex(0, $classCalc[0]['max'], $classCalc[0]['min']);
$analyse->setMaxMinSentimentIndex(1, $classCalc[1]['max'], $classCalc[1]['min']);
$analyse->setMaxMinSentimentIndex(2, $classCalc[2]['max'], $classCalc[2]['min']);
//Max und Min für alle 3 Tage
// $analyse->setMaxMinSentimentIndex(0, max($classCalc[0]['max'],$classCalc[1]['max'],$classCalc[1]['max']), min($classCalc[0]['min'],$classCalc[1]['min'],$classCalc[2]['min']));
// $analyse->setMaxMinSentimentIndex(1, max($classCalc[0]['max'],$classCalc[1]['max'],$classCalc[1]['max']), min($classCalc[0]['min'],$classCalc[1]['min'],$classCalc[2]['min']));
// $analyse->setMaxMinSentimentIndex(2, max($classCalc[0]['max'],$classCalc[1]['max'],$classCalc[1]['max']), min($classCalc[0]['min'],$classCalc[1]['min'],$classCalc[2]['min']));
echo "Daten wurden neu geladen. <a href='index.html'>Zur&uuml;k zur Tabelle</a>";
file_put_contents('data.json', json_encode($analyse));