{ return sin(deg2rad($arg)); } for ($i = 0; $i < count($myStopList); $i++) { 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';
<!DOCTYPE html> <?php require_once '../db.php'; $Database = new DbUtil(); $userName = $Database->getUserName(); if ($userName == null) { header('Location: ../login.php', true, 303); exit; } $ID = $_GET['sid']; $LINE = $_GET['lid']; $stopData = $Database->getStop($ID); $lineName = $Database->getLineName($LINE, $userName); if ($lineName == null) { die('PERMISSION DENIED'); } $timeData = $_GET['time']; $typeData = $_GET['type']; if ($Database->isExistTime($ID, $LINE, $timeData, $typeData)) { $Database->deleteTime($ID, $LINE, $timeData, $typeData); } header("Location: timetable.php?stopid={$ID}&lineid={$LINE}", true, 303);
<h2>バス停情報</h2> <hr /> <h3><?php echo "{$stopData->stopName}"; ?> </h3> <table class="table"> <thead> <tr> <th>行き先</th> <th><div align="right"><input type="button" class="btn btn-primary" value="新規" data-toggle="modal" data-target="#newModal"/></div></th> </tr> </thead> <?php for ($i = 0; $i < count($lineData); $i++) { $lineName = $Database->getLineName($lineData[$i], $userName); echo "<tr><td><a href=timetable.php?stopid={$ID}&lineid={$lineData[$i]}>{$lineName}</a></td>"; echo "<td align='right'><a href='delline.php?sid={$ID}&lid={$lineData[$i]}' class='btn btn-danger'>削除</a></td></tr>"; } ?> </table> </div> </div> <div class="modal fade" id="newModal"> <div class="modal-dialog"> <div class="modal-content"> <div class="modal-header"> <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button> <h4 class="modal-title">行き先の追加</h4> </div>