Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <h2>40 Day Preview</h2>
- <div class="table-responsive">
- <table class="table table-striped table-sm">
- <thead>
- <tr>
- <th>Days from Today</th>
- <th>Avrage Wave Height</th>
- <th>Star Rating</th>
- <th>Wave Intervals</th>
- <th>Tempreture</th>
- <th>Weather</th>
- <th>More Information</th>
- </tr>
- </thead>
- <tbody>
- <?php
- include 'api.php';
- //set up date array to pull in todays day
- $dates = array("", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday");
- //Set date as day
- $currentDay = date ('l'); // (lowercase 'L')
- $dayFromNow = 0;
- $moreInfoModal = 0;
- $primarySwell = "Primary Swell";
- $secondarySwell = "Secondary Swell";
- $tertiarySwell = "Tertiary Swell";
- foreach ($data as $record) {
- $weatherCondition = "{$record['condition']['weather']}";
- $solidStar = "{$record['solidRating']}";
- $fadedStar = "{$record['fadedRating']}";
- $StarRateFloat = 0;
- echo "<tr>";
- echo "<td>";
- if($dayFromNow == 0){
- echo "$currentDay";
- }
- else{
- echo "Days from now $dayFromNow";
- }
- echo "</td>";
- echo "<td> {$record['swell']['components']['combined']['height']}</td>";
- echo "<td>";
- while ($StarRateFloat < $solidStar){
- echo "★" ;
- $StarRateFloat++;
- }
- $StarRateFloat = 0;
- while ($StarRateFloat < $fadedStar){
- echo " ☆";
- $StarRateFloat++;
- }
- echo "</td>";
- echo "<td> {$record['swell']['components']['combined']['period']}</td>";
- echo "<td> {$record['condition']['temperature']}</td>";
- ?>
- <td> <img src="http://cdnimages.magicseaweed.com/30x30/<?php echo $weatherCondition;?>.png" alt=""> </td>
- <td>
- <button type="button" class="btn btn-primary" data-toggle="modal" data-target="#modal<?php echo $moreInfoModal;?>">
- Full Day
- </button>
- </td>
- <?php
- echo "</tr>";
- ?>
- <!-- Modal -->
- <div class="modal fade" id="modal<?php echo $moreInfoModal;?>" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
- <div class="modal-dialog" role="document">
- <div class="modal-content">
- <div class="modal-header">
- <h5 class="modal-title" id="exampleModalLabel">
- <?php
- if($dayFromNow == 0){
- echo "$currentDay";
- }
- else{
- echo "Days from now $dayFromNow";
- }
- ?>
- </h5>
- <button type="button" class="close" data-dismiss="modal" aria-label="Close">
- <span aria-hidden="true">×</span>
- </button>
- </div>
- <div class="modal-body">
- <?php
- // echo $primarySwell $secondarySwell $tertiarySwell;
- echo "<div class='text-center'>";
- echo "<h3> Genral rating </h3>";
- $solidStar = "{$record['solidRating']}";
- $fadedStar = "{$record['fadedRating']}";
- while ($StarRateFloat < $solidStar){
- echo "★" ;
- $StarRateFloat++;
- }
- $StarRateFloat = 0;
- while ($StarRateFloat < $fadedStar){
- echo " ☆";
- $StarRateFloat++;
- }
- echo "<hr>";
- echo "Wind speed: {$record['wind']['speed']}<br />";
- echo "Temperature: {$record['condition']['temperature']}<br />";
- echo "minBreakingHeight: {$record['swell']['minBreakingHeight']}<br />";
- echo "absMinBreakingHeight: {$record['swell']['absMinBreakingHeight']}<br />";
- echo "maxBreakingHeight: {$record['swell']['maxBreakingHeight']}<br />";
- echo "absMaxBreakingHeight: {$record['swell']['absMaxBreakingHeight']}<br />";
- echo "<hr>";
- echo "<h3> Components </h3>";
- echo "height: {$record['swell']['components']['combined']['height']}<br />";
- echo "period: {$record['swell']['components']['combined']['period']}<br />";
- echo "direction: {$record['swell']['components']['combined']['direction']}<br />";
- echo "compassDirection: {$record['swell']['components']['combined']['compassDirection']}<br />";
- echo "<hr>";
- echo "<h3> Primary Swell </h3>";
- echo "height: {$record['swell']['components']['primary']['height']}<br />";
- echo "period: {$record['swell']['components']['primary']['period']}<br />";
- echo "direction: {$record['swell']['components']['primary']['direction']}<br />";
- echo "compassDirection: {$record['swell']['components']['primary']['compassDirection']}<br />";
- echo "<hr>";
- echo "<h3> Secondary Swell </h3>";
- echo "height: {$record['swell']['components']['secondary']['height']}<br />";
- echo "period: {$record['swell']['components']['secondary']['period']}<br />";
- echo "direction: {$record['swell']['components']['secondary']['direction']}<br />";
- echo "compassDirection: {$record['swell']['components']['secondary']['compassDirection']}<br />";
- echo "<hr>";
- echo "<h3> Swell Tertiary </h3>";
- echo "height: {$record['swell']['components']['tertiary']['height']}<br />";
- echo "period: {$record['swell']['components']['tertiary']['period']}<br />";
- echo "direction: {$record['swell']['components']['tertiary']['direction']}<br />";
- echo "compassDirection: {$record['swell']['components']['tertiary']['compassDirection']}<br />";
- echo "<hr>";
- echo "<h3> Wind </h3>";
- echo "speed: {$record['wind']['speed']}<br />";
- echo "direction: {$record['wind']['direction']}<br />";
- echo "compassDirection: {$record['wind']['compassDirection']}<br />";
- echo "chill: {$record['wind']['chill']}<br />";
- echo "gusts: {$record['wind']['gusts']}<br />";
- echo "unit: {$record['wind']['unit']}<br />";
- echo "<hr>";
- echo "<h3> Condition </h3>";
- echo "pressure: {$record['condition']['pressure']}<br />";
- echo "temperature: {$record['condition']['temperature']}<br />";
- echo "unitPressure: {$record['condition']['unitPressure']}<br />";
- echo "unit: {$record['condition']['unit']}<br />";
- echo "<hr>";
- echo "<h3> Condition </h3>";
- $swellGif = "{$record['charts']['swell']}";
- echo "<img class='img-fluid' src='$swellGif'>";
- echo "<h3> Wind </h3>";
- $windGif = "{$record['charts']['wind']}";
- echo "<img class='img-fluid' src='$windGif'>";
- echo "<h3> Pressure </h3>";
- $pressureGif = "{$record['charts']['pressure']}";
- echo "<img class='img-fluid' src='$pressureGif'>";
- $sstGif = "{$record['charts']['sst']}";
- if(strlen($sstGif) > 1){
- echo "<h3> Sst </h3>";
- echo "<img class='img-fluid' src='$sstGif'>";
- }
- echo '</div>';
- ?>
- </div>
- <div class="modal-footer">
- <button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
- </div>
- </div>
- </div>
- </div>
- <?php
- //unique-ish id for each modal
- $moreInfoModal++;
- //Count over the next day
- $dayFromNow++;
- }
- ?>
- <!-- Large modal -->
- </tbody>
- </table>
- </div>
- <!-- Button trigger modal -->
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement