Hi Ken,
Again thank you as always for a brilliant update: get-USNO-sunmoon.php ( V3.00 ).
I found using the :
worked better for me.
Sun Times where out by one or 2 mins if I used USNO rather than Internal (however I did compare against "
www.timeanddate.com" which I am not sure is 100% accurate), but the bonus is it results in yet another non reliance on external data capture which is great.
I also decided to utilise the array in the "Common.php" to make the "Lunar Cycles" more timely, as they where always displaying past times.
Code: Select all
# tman1991 mods for cell.php add-on
$moonD = array($NM, $Q1, $Q2, $Q3, $Q4, $Q1Moons[$mi], $fullMoons[$mi], $Q3Moons[$mi] );
$moonP = array("New Moon", "First Quarter", "Full Moon", "Last Quarter", "New Moon", "First Quarter", "Full Moon", "Last Quarter");
$moonI = array("NM", "Q1, "FM", "Q3", "NM", "Q1", "FM", "Q3");
foreach($moonD as $key=>$mdate) {
if ($mdate>$date) {
$info->moons[] = array ($moonP[$key], $mdate, $moonI[$key], date("r",$mdate));
}
}
# end tman1991 mods for cell.php add-on
Original : (most Times are
Historic) : Current Date is :
14/10/2017 "AEDT" ("UTC" +11)
almanacold.PNG
New : (All Times are in the
Future) :
and dynamically adjust left to right according to Date/Time. :
Current Date is :
14/10/2017 "AEDT" ("UTC" +11)
Note: I also changed the old "GMT" to "UTC".
almanacnew.PNG
To Enable this change : I did the following :
In my "wxalmanac.php" or
( "wxastronomy.php" or "sunmoon.php" ) which ever file users have, I changed :
FROM :
(NOTE: my files are .png vs users may have .jpg)
Code: Select all
<div align="center">
<table width="99%" cellpadding="0" border="0" cellspacing="0">
<tr>
<td width="25%" align="center"><?php langtrans('First Quarter Moon') ;?></td>
<td width="25%" align="center"><?php langtrans('Full Moon'); ?></td>
<td width="25%" align="center"><?php langtrans('Last Quarter Moon'); ?></td>
<td width="25%" align="center"><?php langtrans('New Moon'); ?></td>
</tr>
<tr>
<td align="center">
<img src="<?php print $SITE['imagesDir']; ?>moon-firstquar.png" width="100" height="100"
alt="<?php langtrans('First Quarter Moon'); ?>"
title="<?php langtrans('First Quarter Moon'); ?>"/></td>
<td align="center">
<img src="<?php print $SITE['imagesDir']; ?>moon-fullmoon.png" width="100" height="100"
alt="<?php langtrans('Full Moon'); ?>"
title="<?php langtrans('Full Moon'); ?>"/></td>
<td align="center">
<img src="<?php print $SITE['imagesDir']; ?>moon-lastquar.png" width="100" height="100"
alt="<?php langtrans('Last Quarter Moon'); ?>"
title="<?php langtrans('Last Quarter Moon'); ?>"/></td>
<td align="center">
<img src="<?php print $SITE['imagesDir']; ?>moon-newmoon.png" width="100" height="100"
alt="<?php langtrans('New Moon'); ?>"
title="<?php langtrans('New Moon'); ?>"/></td>
</tr>
<?php $sourceMonths = $SITE['monthNames']; // from Settings.php file for WD month names ?>
<tr>
<td width="25%" align="center">
<?php echo get_localdate($firstquarter); ?><br/>
<small><?php echo get_utcdate($firstquarter); ?></small></td>
<td width="25%" align="center">
<?php echo get_localdate($fullmoon); ?><br/>
<small><?php echo get_utcdate($fullmoon); ?></small></td>
<td width="25%" align="center">
<?php echo get_localdate($lastquarter); ?><br/>
<small><?php echo get_utcdate($lastquarter); ?></small></td>
<td width="25%" align="center">
<?php echo get_localdate($nextnewmoon); ?><br/>
<small><?php echo get_utcdate($nextnewmoon); ?></small></td>
</tr>
</table>
</div>
TO :
(NOTE: my files are .png vs users may have .jpg)
Code: Select all
<div align="center">
<table width="100%" cellpadding="0" border="0" cellspacing="0">
<tr>
<td width="25%" align="center"><?php echo langtransstr($moon->moons[0][0]); ?></td>
<td width="25%" align="center"><?php echo langtransstr($moon->moons[1][0]); ?></td>
<td width="25%" align="center"><?php echo langtransstr($moon->moons[2][0]); ?></td>
<td width="25%" align="center"><?php echo langtransstr($moon->moons[3][0]); ?></td>
</tr>
<tr>
<td width="25%" align="center">
<img src="<?php print $SITE['imagesDir'].$moon->moons[0][2].'.png'; ?>" width="100" height="100" alt ="<?php echo langtransstr($moon->moons[0][0]); ?>" title="<?php echo langtransstr($moon->moons[0][0]); ?>"/></td>
<td width="25%" align="center">
<img src="<?php print $SITE['imagesDir'].$moon->moons[1][2].'.png'; ?>" width="100" height="100" alt ="<?php echo langtransstr($moon->moons[1][0]); ?>" title="<?php echo langtransstr($moon->moons[1][0]); ?>"/></td></td>
<td width="25%" align="center">
<img src="<?php print $SITE['imagesDir'].$moon->moons[2][2].'.png'; ?>" width="100" height="100" alt ="<?php echo langtransstr($moon->moons[2][0]); ?>" title="<?php echo langtransstr($moon->moons[2][0]); ?>"/></td></td>
<td width="25%" align="center">
<img src="<?php print $SITE['imagesDir'].$moon->moons[3][2].'.png'; ?>" width="100" height="100" alt ="<?php echo langtransstr($moon->moons[3][0]); ?>" title="<?php echo langtransstr($moon->moons[3][0]); ?>"/></td></td>
</tr>
<?php $sourceMonths = $SITE['monthNames']; // from Settings.php file for WD month names ?>
<tr>
<td width="25%" align="center">
<?php echo date("l",$moon->moons[0][1]); ?><br/>
<?php echo date("d/m/Y H:i",$moon->moons[0][1]); ?> <small><?php echo date("T",$moon->moons[0][1]); ?></small><br/>
<small><?php echo date("d F Y H:i",$moon->moons[0][1]-date("Z",$moon->moons[0][1])).' '.'UTC'; ?></small>
</td>
<td width="25%" align="center">
<?php echo date("l",$moon->moons[1][1]); ?><br/>
<?php echo date("d/m/Y H:i",$moon->moons[1][1]); ?> <small><?php echo date("T",$moon->moons[1][1]); ?></small><br/>
<small><?php echo date("d F Y H:i",$moon->moons[1][1]-date("Z",$moon->moons[1][1])).' '.'UTC'; ?></small>
</td>
<td width="25%" align="center">
<?php echo date("l",$moon->moons[2][1]); ?><br/>
<?php echo date("d/m/Y H:i",$moon->moons[2][1]); ?> <small><?php echo date("T",$moon->moons[2][1]); ?></small><br/>
<small><?php echo date("d F Y H:i",$moon->moons[2][1]-date("Z",$moon->moons[2][1])).' '.'UTC'; ?></small>
</td>
<td width="25%" align="center">
<?php echo date("l",$moon->moons[3][1]); ?><br/>
<?php echo date("d/m/Y H:i",$moon->moons[3][1]); ?> <small><?php echo date("T",$moon->moons[3][1]); ?></small><br/>
<small><?php echo date("d F Y H:i",$moon->moons[3][1]-date("Z",$moon->moons[3][1])).' '.'UTC'; ?></small>
</td>
</tr>
</table>
</div>
In order to have the
$moon Array available :
in same file around row (141) I added :
:
Example :
Code: Select all
if(file_exists("get-USNO-sunmoon.php")) {
include_once("get-USNO-sunmoon.php");
$USNOdata = getUSNOsunmoon();
}
if(isset($USNOdata['sunrise'])) {$sunrise = $USNOdata['sunrise']; }
if(isset($USNOdata['sunrisedate'])) {$sunrisedate = $USNOdata['sunrisedate']; }
if(isset($USNOdata['sunset'])) {$sunset = $USNOdata['sunset']; }
if(isset($USNOdata['sunsetdate'])) {$sunsetdate = $USNOdata['sunsetdate']; }
if(isset($USNOdata['moonrise'])) {$moonrise = $USNOdata['moonrise']; }
if(isset($USNOdata['moonrisedate'])) {$moonrisedate= $USNOdata['moonrisedate']; }
if(isset($USNOdata['moonset'])) {$moonset = $USNOdata['moonset']; }
if(isset($USNOdata['moonsetdate'])) {$moonsetdate = $USNOdata['moonsetdate']; }
if(isset($USNOdata['moonphase'])) {$moonphasename = $USNOdata['moonphase']; }
if(isset($USNOdata['illumination'])) {$moonphase = $USNOdata['illumination']; }
if(isset($USNOdata['hoursofpossibledaylight'])) {$hoursofpossibledaylight = $USNOdata['hoursofpossibledaylight'];}
}
$moon = cgetMoonInfo();
?>
Then I Copied/Renamed the following Moon Images :
(to work with the array) :
(NOTE: my files are .png vs users may have .jpg)
moon-firstquar.png = Q1.png
moon-fullmoon.png = FM.png
moon-lastquar.png = Q3.png
moon-newmoon.png = NM.png
That's it, well I would like to make the "Solar Cycle" (Season) section dynamic as well, however that will sit on the drawing board for a while till I figure out a way to turn it into an array , which would then I suppose remove the requirement for the "get_localdate" and "get_utcdate" for it, or at worst have to adjust them.
I also modified the Class Moon() in Brians "LiveData.php" file as per your mods :
Code: Select all
// $timezone = (int)($lon / 15);
$date = self::modifiedJulianDate($month, $day, $year);
// $date -= $timezone / 24;
$timezone = date('Z')/3600; // KT
$date -= $timezone / 24;
And that works perfect, removing the need to use the Homeweather Templates (Moon/Fine Tuning) requirement in "easyweathersetup.php".
That coupled with the recent mod I made to remove the need to adjust the Homeweather Templates "UTC" Offset every time we swing from "ST" to "DST" now means the Homeweather Template can run in auto without having to change either of the above mentioned settings.
(ref: images below). The first Moon/Fine Adjustment image (displays a "1") as it's an old image, in my case that is now "0" and will remain that way.
Again, Thanks Ken (Legend).
PS. Forgot to add:
In the "Common.php" : To change the "GMT" to "UTC" :
(For Solar Cycle/Season)
FROM: (Around Line "715")
Code: Select all
// -----------------------------------------------------------------------------
// SEASON FUNCTIONS return season dates based on USNO dates for Spring, Summer, Fall, Winter .
// -----------------------------------------------------------------------------
function cGetSeasonInfo ($YY=0) { // feed it the year
$seasonList = array( // seasons from USNO in WD date format
// year => 'Spring|Summer|Autumn|Winter'
'2009' => '11:44 GMT 20 March 2009|05:46 GMT 21 June 2009|21:19 GMT 22 September 2009|17:47 GMT 21 December 2009|',
'2010' => '17:32 GMT 20 March 2010|11:28 GMT 21 June 2010|03:09 GMT 23 September 2010|23:38 GMT 21 December 2010|',
'2011' => '23:21 GMT 20 March 2011|17:16 GMT 21 June 2011|09:05 GMT 23 September 2011|05:30 GMT 22 December 2011|',
'2012' => '05:14 GMT 20 March 2012|23:09 GMT 20 June 2012|14:49 GMT 22 September 2012|11:12 GMT 21 December 2012|',
'2013' => '11:02 GMT 20 March 2013|05:04 GMT 21 June 2013|20:44 GMT 22 September 2013|17:11 GMT 21 December 2013|',
'2014' => '16:57 GMT 20 March 2014|10:51 GMT 21 June 2014|02:29 GMT 23 September 2014|23:03 GMT 21 December 2014|',
'2015' => '22:45 GMT 20 March 2015|16:38 GMT 21 June 2015|08:21 GMT 23 September 2015|04:48 GMT 22 December 2015|',
'2016' => '04:30 GMT 20 March 2016|22:34 GMT 20 June 2016|14:21 GMT 22 September 2016|10:44 GMT 21 December 2016|',
'2017' => '10:29 GMT 20 March 2017|04:24 GMT 21 June 2017|20:02 GMT 22 September 2017|16:28 GMT 21 December 2017|',
'2018' => '16:15 GMT 20 March 2018|10:07 GMT 21 June 2018|01:54 GMT 23 September 2018|22:23 GMT 21 December 2018|',
'2019' => '21:58 GMT 20 March 2019|15:54 GMT 21 June 2019|07:50 GMT 23 September 2019|04:19 GMT 22 December 2019|',
'2020' => '03:50 GMT 20 March 2020|21:44 GMT 20 June 2020|13:31 GMT 22 September 2020|10:02 GMT 21 December 2020|',
); // end of seasonList
TO:
Code: Select all
// -----------------------------------------------------------------------------
// SEASON FUNCTIONS return season dates based on USNO dates for Spring, Summer, Fall, Winter .
// -----------------------------------------------------------------------------
function cGetSeasonInfo ($YY=0) { // feed it the year
$seasonList = array( // seasons from USNO in WD date format
// year => 'Spring|Summer|Autumn|Winter'
'2009' => '11:44 UTC 20 March 2009|05:46 UTC 21 June 2009|21:19 UTC 22 September 2009|17:47 UTC 21 December 2009|',
'2010' => '17:32 UTC 20 March 2010|11:28 UTC 21 June 2010|03:09 UTC 23 September 2010|23:38 UTC 21 December 2010|',
'2011' => '23:21 UTC 20 March 2011|17:16 UTC 21 June 2011|09:05 UTC 23 September 2011|05:30 UTC 22 December 2011|',
'2012' => '05:14 UTC 20 March 2012|23:09 UTC 20 June 2012|14:49 UTC 22 September 2012|11:12 UTC 21 December 2012|',
'2013' => '11:02 UTC 20 March 2013|05:04 UTC 21 June 2013|20:44 UTC 22 September 2013|17:11 UTC 21 December 2013|',
'2014' => '16:57 UTC 20 March 2014|10:51 UTC 21 June 2014|02:29 UTC 23 September 2014|23:03 UTC 21 December 2014|',
'2015' => '22:45 UTC 20 March 2015|16:38 UTC 21 June 2015|08:21 UTC 23 September 2015|04:48 UTC 22 December 2015|',
'2016' => '04:30 UTC 20 March 2016|22:34 UTC 20 June 2016|14:21 UTC 22 September 2016|10:44 UTC 21 December 2016|',
'2017' => '10:29 UTC 20 March 2017|04:24 UTC 21 June 2017|20:02 UTC 22 September 2017|16:28 UTC 21 December 2017|',
'2018' => '16:15 UTC 20 March 2018|10:07 UTC 21 June 2018|01:54 UTC 23 September 2018|22:23 UTC 21 December 2018|',
'2019' => '21:58 UTC 20 March 2019|15:54 UTC 21 June 2019|07:50 UTC 23 September 2019|04:19 UTC 22 December 2019|',
'2020' => '03:50 UTC 20 March 2020|21:44 UTC 20 June 2020|13:31 UTC 22 September 2020|10:02 UTC 21 December 2020|',
); // end of seasonList
Ah ! : Forgot some additional changes
(for the Moon Array) : in order to Display "First Quarter Moon" or "Last Quarter Moon" vs just "First Quarter" or "Last Quarter" above each Moon image, you will need further changes to "Common.php" and "get-USNO-sunmoon.php".
So rather than waffle on more here, I have attached both files, just do the usual (backup/copy/diffmerge/whatever) before using, oh and ensure you have applied the earlier - above mentioned changes first.
Note: also, unless I'm wrong (
possible), I reverse my "
Summer" / "
Winter"
Solstice images for "Southern Hemisphere" display. I made this change ages ago Ken as the Switch did not seem to work and never bothered to investigate why, in the end I created new images to be more relevant to Aus/Southern Hemisphere. They are rough and ready, but do me.
almanacnew2.PNG
earth-fall.jpg
earth-winter.jpg
earth-spring.jpg
earth-summer.jpg
And as I no longer have a public website : image attached is of the entire page.
Huon River Vista Weather AlamanaAAAA.png
You do not have the required permissions to view the files attached to this post.