Example #1
0
File: my.php Project: Amfys/BST
 if ($myStopList[$i]->lat != 0) {
     $r = 6378.137;
     $distant = $r * acos(dsin($lat) * dsin($myStopList[$i]->lat) + dcos($lat) * dcos($myStopList[$i]->lat) * dcos($myStopList[$i]->long - $long));
     $distant = round($distant, 2) . ' km';
 } else {
     $distant = 'N/A';
 }
 echo "<h3>" . $myStopList[$i]->stopName . " <small>{$distant}</small></h3>";
 echo "<hr>";
 $lineList = $Database->getStopLine($myStopList[$i]->stopId);
 for ($j = 0; $j < count($lineList); $j++) {
     $lineName = $Database->getLineName($lineList[$j], $userName);
     echo "<h4>行き先: {$lineName}</h4>";
     echo "<table class=table>";
     echo "<thead><th>時刻</th><th>残り時間</th></thead>";
     $timeData = $Database->getTimeTableEx($myStopList[$i]->stopId, $lineList[$j], get4Time() - 5, 3);
     for ($k = 0; $k < count($timeData); $k++) {
         if ($timeData[$k]->type != getTodayType()) {
             continue;
         }
         $classText = '';
         $stopTime = formatTime($timeData[$k]->time);
         if (getRemainUnixTime($stopTime) < 600) {
             $classText = 'class=warning';
         }
         if ($timeData[$k]->time < get4Time()) {
             $classText = 'class=danger';
         }
         $remain = getRemainTime($stopTime);
         echo "<tr {$classText}><td>{$stopTime}</td><td>{$remain}</td>";
         echo "</tr>";