public function respond() { if (!$this->requireConfig(array('location'))) { return 'location is required'; } list($lat, $lon) = $this->config['location']; $now = time(); $tomorrow = strtotime('+1 day', $now); $yesterday = strtotime('-1 day', $now); $sun_info = date_sun_info($now, $lat, $lon); $sun_info_tomorrow = date_sun_info($tomorrow, $lat, $lon); $sun_info_yesterday = date_sun_info($yesterday, $lat, $lon); if ($this->matches[1] == 'sunrise') { $mode = 'sunrise'; if ($now > $sun_info['sunset']) { $ts = $sun_info_tomorrow['sunrise']; } else { $ts = $sun_info['sunrise']; } } else { $mode = 'sunset'; if ($now < $sun_info['sunrise']) { $ts = $sun_info_yesterday['sunset']; } else { $ts = $sun_info['sunset']; } } $time = date('g:ia', $ts); $seconds = $ts - $now; $minutes = $hours = 0; $past = false; if ($seconds < 0) { $past = true; $seconds = abs($seconds); } if ($seconds > 60) { $minutes = floor($seconds / 60); $seconds = $seconds % 60; } if ($minutes > 60) { $hours = floor($minutes / 60); $minutes = $minutes % 60; } $time_string = ''; if ($hours > 0) { $time_string = self::plural($hours, 'hour') . ' and ' . self::plural($minutes, 'minute'); } elseif ($minutes > 0) { $time_string = self::plural($minutes, 'minute') . ' and ' . self::plural($seconds, 'second'); } else { $time_string = self::plural($seconds, 'second'); } if ($past) { $verb = $mode == 'sunrise' ? 'rose' : 'set'; return "The sun {$verb} {$time_string} ago ({$time})"; } else { $verb = $mode == 'sunrise' ? 'rise' : 'set'; return "The sun will {$verb} in {$time_string} ({$time})"; } }
public function __construct($current_location) { if (empty($current_location)) { $current_location = unserialize(Atlas::SetDefaultCity(5128581)); } $this->_Page['country'] = $current_location['country_name']; $this->_Page['city'] = $current_location['name']; $this->_Page['placeSearch'] = $current_location; date_default_timezone_set($current_location['timezone']['timezone']); $current_time = time(); $this->_Page['sun'] = date_sun_info($current_time, $current_location['latitude'], $current_location['longitude']); $this->_Page['tomorrow'] = array(); $this->_Page['tomorrow']['sun'] = date_sun_info($current_time + 86400, $current_location['latitude'], $current_location['longitude']); $this->setTodaysChart(); $this->calculateMoonPhase(); $this->calculateMoonNakshatra(); $this->calculateMoonKarana(); $this->calculateYoga(); $this->calculateSpecialPeriods(); }
<?php date_default_timezone_set("America/Los_Angeles"); var_dump(date_sun_info(strtotime("2006-12-12"), 31.7667, 35.2333)); /* * calculate the sunrise time for Lisbon, Portugal * Latitude: 38.4 North * Longitude: 9 West * Zenith ~= 90 * offset: +1 GMT */ var_dump(date_sunrise(strtotime("2004-12-20"), SUNFUNCS_RET_STRING, 38.4, -9, 90, 1)); /* * calculate the sunset time for Lisbon, Portugal * Latitude: 38.4 North * Longitude: 9 West * Zenith ~= 90 * offset: +1 GMT */ var_dump(date_sunset(strtotime("2004-12-20"), SUNFUNCS_RET_STRING, 38.4, -9, 90, 1));
/** * Get the sun information at the specified time for the given location as an array with information about * sunset/sunrise and twilight begin/end. The returned array will contain the following keys: * - sunrise * - sunset * - transit * - civil_twilight_begin * - civil_twilight_end * - nautical_twilight_begin * - nautical_twilight_end * - astronomical_twilight_begin * - astronomical_twilight_end * All array values are specified as DateTime objects. * * @param float|null $latitude [optional] The latitude, or null to use the default latitude specified by * 'date.default_latitude' in PHPs INI. * @param float|null $longitude [optional] The longitude, or null to use the default longitude specified by * 'date.default_longitude' in PHPs INI. * * @return Array|null An array with information about sunset/sunrise and twilight begin/end, or null on failure. */ public function getSunInfo($latitude = null, $longitude = null) { // Get the timestamp $timestamp = $this->copy()->startOfDay()->getTimestamp(); // Parse the latitude and longitudes if ($latitude === null) { $latitude = ini_get('date.default_latitude'); } if ($longitude === null) { $longitude = ini_get('date.default_longitude'); } // Get the sun info array, return null on failure if (($sunInfo = date_sun_info($timestamp, $latitude, $longitude)) === false) { return null; } // Replace the timestamps with DateTime objects foreach ($sunInfo as $key => &$value) { $value = new self($value); } // Return the array with the sun info return $sunInfo; }
<?php $date = new DateTime('June 21, 2015 Europe/London'); $lat = 51.507351; $long = -0.127758; $london = date_sun_info($date->getTimestamp(), $lat, $long); $sunrise = clone $date->setTimestamp($london['sunrise']); $daylight = $sunrise->diff($date->setTimestamp($london['sunset'])); echo $daylight->format('%h:%I hours of daylight') . ' in London on ' . $date->format('F j, Y');
* Clock * * @package Anqh * @author Antti Qvickström * @copyright (c) 2010-2011 Antti Qvickström * @license http://www.opensource.org/licenses/mit-license.php MIT license */ // Sun if ($user && $user->latitude && $user->longitude) { $latitude = $user->latitude; $longitude = $user->longitude; } else { $latitude = 60.1829; $longitude = 24.9549; } $sun = date_sun_info(time(), $latitude, $longitude); $sunrise = __(':day, week :week | Sunrise: :sunrise | Sunset: :sunset', array(':day' => strftime('%A'), ':week' => strftime('%V'), ':sunrise' => Date::format(Date::TIME, $sun['sunrise']), ':sunset' => Date::format(Date::TIME, $sun['sunset']))); // Weather /* if ($user && $user->city_name) { $location = $user->city_name; } else { $location = 'Helsinki'; } $weather = Weather::get_weather($location); $today = $weather['wind'] . ', ' . $weather['humidity']; $tomorrow = array(); $next = array(); $d = 0; foreach ($weather['forecast'] as $day => $forecast) { $min = ($forecast['low'] > 0 ? '+' : '') . $forecast['low'] . '°';
function calculate_sun_rise_set() { $tzone = date_default_timezone_get(); if ($tzone == '') { $tzone = 'Europe/Berlin'; } $tz = new DateTimeZone($tzone); $loc = $tz->getLocation(); $sun_info = date_sun_info(time(), $loc['latitude'], $loc['longitude']); //returns sunrise, sunset, ... //echo "Sunrise: " . date("H:i:s", $sun_info['sunrise']) . "\n"; //echo "Sunset: " . date("H:i:s", $sun_info['sunset']) . "\n"; //update sunrise $sql = query("SELECT id,suninfo,name FROM timer WHERE suninfo='sunset' OR suninfo='sunrise'"); while ($row = fetch($sql)) { //echo $row['suninfo'] . $row['name'] ; if ($row['suninfo'] == 'sunrise') { $sqlset = query("UPDATE timer SET time = '" . date("H:i", $sun_info['sunrise']) . "', hour ='" . date("H", $sun_info['sunrise']) . "', minute ='" . date("i", $sun_info['sunrise']) . "' WHERE id = '" . $row['id'] . "'"); } if ($row['suninfo'] == 'sunset') { $sqlset = query("UPDATE timer SET time = '" . date("H:i", $sun_info['sunset']) . "', hour ='" . date("H", $sun_info['sunset']) . "', minute ='" . date("i", $sun_info['sunset']) . "' WHERE id = '" . $row['id'] . "'"); } } }
private function calculateRiseTransitSettingTimeCommon($jd, $longitude, $latitude, $ra1, $ra2, $ra3, $dec1, $dec2, $dec3, $moonHorParallax, $timedifference) { // Step 1 : Calculate the apparent siderial time at Greenwich at 0h UT. $jd = floor($jd) - 0.5; $T = ($jd - 2451545.0) / 36525.0; $theta0 = 100.46061837 + 36000.770053608 * $T + 0.000387933 * $T * $T - $T * $T * $T / 38710000.0; if ($theta0 < 0.0) { $a = -floor($theta0 / 360.0) + 1; $theta0 = $theta0 + $a * 360.0; } if ($theta0 > 360.0) { $a = floor($theta0 / 360.0); $theta0 = $theta0 - $a * 360.0; } $theta0 = $theta0 / 15.0; $nutat = $this->calculateNutation($jd); $theta0 = $theta0 + $nutat[0] * cos(deg2rad($nutat[3])) / 15.0 / 3600.0; // STEP 2 : Calculating the rise, transit and set time of the object $ra1 = $ra1 * 15.0; $ra2 = $ra2 * 15.0; $ra3 = $ra3 * 15.0; // Tests when the object passes ra 24 and goes back to 0 if ($ra3 - $ra2 < -50.0) { $ra3 = $ra3 + 360.0; } else { if ($ra2 - $ra1 < -50.0) { $ra3 = $ra3 + 360.0; $ra2 = $ra2 + 360.0; } else { if ($ra2 - $ra3 < -50.0) { $ra1 = $ra1 + 360.0; $ra2 = $ra2 + 360.0; } else { if ($ra1 - $ra2 < -50.0) { $ra1 = $ra1 + 360.0; } } } } $longitude = -$longitude; if ($moonHorParallax == -99.98999999999999) { $h0 = -0.5667; } else { $h0 = 0.7275 * $moonHorParallax - 0.566667; } $Hcap0 = rad2deg(acos((sin(deg2rad($h0)) - sin(deg2rad($latitude)) * sin(deg2rad($dec2))) / (cos(deg2rad($latitude)) * cos(deg2rad($dec2))))); $m0 = ($ra2 + $longitude - $theta0 * 15.0) / 360.0; $m0 = $m0 - floor($m0); if (is_nan($Hcap0)) { $m1 = 99; $m2 = 99; } else { $m1 = $m0 - $Hcap0 / 360.0; $m1 = $m1 - floor($m1); $m2 = $m0 + $Hcap0 / 360.0; $m2 = $m2 - floor($m2); } // STEP 3 : Extra calculation to work for moving bodies... // 3.1 : transit time $theta = $theta0 * 15.0 + 360.985647 * $m0; $theta = $theta / 360.0; $theta = $theta - floor($theta); $theta = $theta * 360.0; // deltaT is 70 for 2010 $n = $m0 + 70 / 86400; $a = $ra2 - $ra1; $b = $ra3 - $ra2; $c = $b - $a; $alphaInterpol = $ra2 + $n / 2.0 * ($a + $b + $n * $c); $H = $theta - $longitude - $alphaInterpol; $deltaM = -$H / 360.0; $m0 = ($deltaM + $m0) * 24.0; if (is_nan($Hcap0)) { } else { // 3.2 : rise time $theta = $theta0 * 15.0 + 360.985647 * $m1; $theta = $theta / 360.0; $theta = $theta - floor($theta); $theta = $theta * 360.0; $n = $m1 + 56 / 86400; $a = $ra2 - $ra1; $b = $ra3 - $ra2; $c = $b - $a; $alphaInterpol = $ra2 + $n / 2.0 * ($a + $b + $n * $c); $a = $dec2 - $dec1; $b = $dec3 - $dec2; $c = $b - $a; $deltaInterpol = $dec2 + $n / 2.0 * ($a + $b + $n * $c); $H = $theta - $longitude - $alphaInterpol; $h = rad2deg(asin(sin(deg2rad($latitude)) * sin(deg2rad($deltaInterpol)) + cos(deg2rad($latitude)) * cos(deg2rad($deltaInterpol)) * cos(deg2rad($H)))); $deltaM = ($h - $h0) / (360.0 * cos(deg2rad($deltaInterpol)) * cos(deg2rad($latitude)) * sin(deg2rad($H))); $m1 = ($deltaM + $m1) * 24.0; // 3.3 : set time $theta = $theta0 * 15.0 + 360.985647 * $m2; $theta = $theta / 360.0; $theta = $theta - floor($theta); $theta = $theta * 360.0; $n = $m2 + 56 / 86400; $a = $ra2 - $ra1; $b = $ra3 - $ra2; $c = $b - $a; $alphaInterpol = $ra2 + $n / 2.0 * ($a + $b + $n * $c); $a = $dec2 - $dec1; $b = $dec3 - $dec2; $c = $b - $a; $deltaInterpol = $dec2 + $n / 2.0 * ($a + $b + $n * $c); $H = $theta - $longitude - $alphaInterpol; $h = rad2deg(asin(sin(deg2rad($latitude)) * sin(deg2rad($deltaInterpol)) + cos(deg2rad($latitude)) * cos(deg2rad($deltaInterpol)) * cos(deg2rad($H)))); $deltaM = ($h - $h0) / (360.0 * cos(deg2rad($deltaInterpol)) * cos(deg2rad($latitude)) * sin(deg2rad($H))); $m2 = ($deltaM + $m2) * 24.0; } $ris_tra_set[0] = $m1; $ris_tra_set[1] = $m0; $ris_tra_set[2] = $m2; $rise = $ris_tra_set[0]; if ($ris_tra_set[0] > 48 || $ris_tra_set[0] < -24) { $ris_tra_set[0] = "-"; } else { $ris_tra_set[0] = $ris_tra_set[0] + $timedifference; if ($ris_tra_set[0] < 0) { $ris_tra_set[0] = $ris_tra_set[0] + 24; } if ($ris_tra_set[0] > 24) { $ris_tra_set[0] = $ris_tra_set[0] - 24; } $minutes = round(($ris_tra_set[0] - floor($ris_tra_set[0])) * 60); if ($minutes == 60) { $minutes = 0; $toAdd = 1; } else { $toAdd = 0; } if ($minutes < 10) { $minutes = "0" . $minutes; } $ris_tra_set[0] = floor($ris_tra_set[0]) + $toAdd . ":" . $minutes; } $transit = $ris_tra_set[1]; if ($ris_tra_set[1] > 48 || $ris_tra_set[1] < -24) { $ris_tra_set[1] = "-"; } else { $ris_tra_set[1] = $ris_tra_set[1] + $timedifference; if ($ris_tra_set[1] < 0) { $ris_tra_set[1] = $ris_tra_set[1] + 24; } if ($ris_tra_set[1] > 24) { $ris_tra_set[1] = $ris_tra_set[1] - 24; } $minutes = round(($ris_tra_set[1] - floor($ris_tra_set[1])) * 60); if ($minutes == 60) { $minutes = 0; $toAdd = 1; } else { $toAdd = 0; } if ($minutes < 10) { $minutes = "0" . $minutes; } $ris_tra_set[1] = floor($ris_tra_set[1]) + $toAdd . ":" . $minutes; } $set = $ris_tra_set[2]; if ($ris_tra_set[2] > 48 || $ris_tra_set[2] < -24) { $ris_tra_set[2] = "-"; } else { $ris_tra_set[2] = $ris_tra_set[2] + $timedifference; if ($ris_tra_set[2] < 0) { $ris_tra_set[2] = $ris_tra_set[2] + 24; } if ($ris_tra_set[2] > 24) { $ris_tra_set[2] = $ris_tra_set[2] - 24; } $minutes = round(($ris_tra_set[2] - floor($ris_tra_set[2])) * 60); if ($minutes == 60) { $minutes = 0; $toAdd = 1; } else { $toAdd = 0; } if ($minutes < 10) { $minutes = "0" . $minutes; } $ris_tra_set[2] = floor($ris_tra_set[2]) + $toAdd . ":" . $minutes; } $ris_tra_set[4] = 0; $ra2 = $ra2 / 15; date_default_timezone_set("UTC"); $temptime = jdtogregorian($jd + 1); $temppos = strpos($temptime, "/"); $tempmonth = substr($temptime, 0, $temppos); $temptime = substr($temptime, $temppos + 1); $temppos = strpos($temptime, "/"); $tempday = substr($temptime, 0, $temppos); $tempyear = substr($temptime, $temppos + 1); $timestr = $tempyear . "-" . $tempmonth . "-" . $tempday; $sun_info = date_sun_info(strtotime($timestr), $latitude, -$longitude); $astrobegin = date("H:i", $sun_info["astronomical_twilight_begin"]); sscanf($astrobegin, "%d:%d", $hour, $minute); $astrobegin = $hour + $minute / 60.0; $astroend = date("H:i", $sun_info["astronomical_twilight_end"]); sscanf($astroend, "%d:%d", $hour, $minute); $astroend = $hour + $minute / 60.0; $nautbegin = date("H:i", $sun_info["nautical_twilight_begin"]); sscanf($nautbegin, "%d:%d", $hour, $minute); $nautbegin = $hour + $minute / 60.0; $nautend = date("H:i", $sun_info["nautical_twilight_end"]); sscanf($nautend, "%d:%d", $hour, $minute); $nautend = $hour + $minute / 60.0; if ($transit > 0) { $transit = $transit % 24.0 + ($transit - floor($transit)); } else { $toAdd = floor(-$transit / 24.0) + 1; $transit = $transit + 24.0 * $toAdd; } if ($astroend > 0 && $astrobegin > 0) { $tocompare = -999; if ($astrobegin > 12) { $toCheck = $astrobegin; } else { $toCheck = $astrobegin + 24; } if ($transit + 24 < $astroend + 24 && $transit + 24 > $toCheck) { // The transit is during the day // Check the rise time for $astroend and for $astrobegin $theta0w = $theta0 + $astrobegin * 1.00273790935; if ($theta0w > 0) { $theta0w = $theta0w % 24.0 + ($theta0w - floor($theta0w)); } else { $toAdd = floor(-$theta0w / 24.0) + 1; $theta0w = $theta0w + 24.0 * $toAdd; } $H = ($theta0w - $longitude / 15 - $ra2) * 15.0; if ($H > 0) { $H = $H % 360.0 + ($H - floor($H)); } else { $toAdd = floor(-$H / 360.0) + 1; $H = $H + 360.0 * $toAdd; } $tocompare = rad2deg(asin(sin(deg2rad($latitude)) * sin(deg2rad($dec2)) + cos(deg2rad($latitude)) * cos(deg2rad($dec2)) * cos(deg2rad($H)))); $transit = $astroend; } $theta0 = $theta0 + $transit * 1.00273790935; if ($theta0 > 0) { $theta0 = $theta0 % 24.0 + ($theta0 - floor($theta0)); } else { $toAdd = floor(-$theta0 / 24.0) + 1; $theta0 = $theta0 + 24.0 * $toAdd; } $H = ($theta0 - $longitude / 15 - $ra2) * 15.0; if ($H > 0) { $H = $H % 360.0 + ($H - floor($H)); } else { $toAdd = floor(-$H / 360.0) + 1; $H = $H + 360.0 * $toAdd; } $ris_tra_set[3] = rad2deg(asin(sin(deg2rad($latitude)) * sin(deg2rad($dec2)) + cos(deg2rad($latitude)) * cos(deg2rad($dec2)) * cos(deg2rad($H)))); if ($tocompare != -999) { if ($tocompare > $ris_tra_set[3]) { $ris_tra_set[3] = $tocompare; $ris_tra_set[4] = $astrobegin; } else { $ris_tra_set[4] = $astroend; } } else { $ris_tra_set[4] = $transit; } $minutes = round(($ris_tra_set[3] - floor($ris_tra_set[3])) * 60); if ($minutes == 60) { $minutes = 0; $toAdd = 1; } else { $toAdd = 0; } if ($minutes < 10) { $minutes = "0" . $minutes; } if ($ris_tra_set[3] < 0) { $ris_tra_set[3] = "-"; } else { $ris_tra_set[3] = floor($ris_tra_set[3]) + $toAdd . "°" . $minutes . "'"; } if ($ris_tra_set[4] > 24 || $ris_tra_set[4] < 0 || $ris_tra_set[3] == "-") { $ris_tra_set[4] = "-"; } else { $ris_tra_set[4] = $ris_tra_set[4] + $timedifference; if ($ris_tra_set[4] < 0) { $ris_tra_set[4] = $ris_tra_set[4] + 24; } if ($ris_tra_set[4] > 24) { $ris_tra_set[4] = $ris_tra_set[4] - 24; } $minutes = round(($ris_tra_set[4] - floor($ris_tra_set[4])) * 60); if ($minutes == 60) { $minutes = 0; $toAdd = 1; } else { $toAdd = 0; } if ($minutes < 10) { $minutes = "0" . $minutes; } $ris_tra_set[4] = floor($ris_tra_set[4]) + $toAdd . ":" . $minutes; } } else { $ris_tra_set[3] = "-"; $ris_tra_set[4] = "-"; } // if no astro twilight, or no best astro time for object // if($ris_tra_set[3]=="-") if (!($astroend > 0 && $astrobegin > 0)) { if ($nautend > 0 && $nautbegin > 0) { $tocompare = -999; if ($nautbegin > 12) { $toCheck = $nautbegin; } else { $toCheck = $nautbegin + 24; } if ($transit + 24 < $nautend + 24 && $transit + 24 > $toCheck) { // The transit is during the day // Check the rise time for $nautend and for $nautbegin $theta0w = $theta0 + $nautbegin * 1.00273790935; if ($theta0w > 0) { $theta0w = $theta0w % 24.0 + ($theta0w - floor($theta0w)); } else { $toAdd = floor(-$theta0w / 24.0) + 1; $theta0w = $theta0w + 24.0 * $toAdd; } $H = ($theta0w - $longitude / 15 - $ra2) * 15.0; if ($H > 0) { $H = $H % 360.0 + ($H - floor($H)); } else { $toAdd = floor(-$H / 360.0) + 1; $H = $H + 360.0 * $toAdd; } $tocompare = rad2deg(asin(sin(deg2rad($latitude)) * sin(deg2rad($dec2)) + cos(deg2rad($latitude)) * cos(deg2rad($dec2)) * cos(deg2rad($H)))); $transit = $nautend; } $theta0 = $theta0 + $transit * 1.00273790935; if ($theta0 > 0) { $theta0 = $theta0 % 24.0 + ($theta0 - floor($theta0)); } else { $toAdd = floor(-$theta0 / 24.0) + 1; $theta0 = $theta0 + 24.0 * $toAdd; } $H = ($theta0 - $longitude / 15 - $ra2) * 15.0; if ($H > 0) { $H = $H % 360.0 + ($H - floor($H)); } else { $toAdd = floor(-$H / 360.0) + 1; $H = $H + 360.0 * $toAdd; } $ris_tra_set[3] = rad2deg(asin(sin(deg2rad($latitude)) * sin(deg2rad($dec2)) + cos(deg2rad($latitude)) * cos(deg2rad($dec2)) * cos(deg2rad($H)))); if ($tocompare != -999) { if ($tocompare > $ris_tra_set[3]) { $ris_tra_set[3] = $tocompare; $ris_tra_set[4] = $nautbegin; } else { $ris_tra_set[4] = $nautend; } } else { $ris_tra_set[4] = $transit; } $minutes = round(($ris_tra_set[3] - floor($ris_tra_set[3])) * 60); if ($minutes == 60) { $minutes = 0; $toAdd = 1; } else { $toAdd = 0; } if ($minutes < 10) { $minutes = "0" . $minutes; } if ($ris_tra_set[3] < 0) { $ris_tra_set[3] = "-"; } else { $ris_tra_set[3] = floor($ris_tra_set[3]) + $toAdd . "°" . $minutes . "'"; } if ($ris_tra_set[4] > 24 || $ris_tra_set[4] < 0 || $ris_tra_set[3] == "-") { $ris_tra_set[4] = "-"; } else { $ris_tra_set[4] = $ris_tra_set[4] + $timedifference; if ($ris_tra_set[4] < 0) { $ris_tra_set[4] = $ris_tra_set[4] + 24; } if ($ris_tra_set[4] > 24) { $ris_tra_set[4] = $ris_tra_set[4] - 24; } $minutes = round(($ris_tra_set[4] - floor($ris_tra_set[4])) * 60); if ($minutes == 60) { $minutes = 0; $toAdd = 1; } else { $toAdd = 0; } if ($minutes < 10) { $minutes = "0" . $minutes; } $ris_tra_set[4] = floor($ris_tra_set[4]) + $toAdd . ":" . $minutes; } } else { $ris_tra_set[3] = "-"; $ris_tra_set[4] = "-"; } if ($ris_tra_set[3] != "-") { $ris_tra_set[3] = "(" . $ris_tra_set[3] . ")"; } } return $ris_tra_set; }
<?php /* Prototype : array date_sun_info ( int $time , float $latitude , float $longitude ) * Description: Returns an array with information about sunset/sunrise and twilight begin/end. * Source code: ext/standard/data/php_date.c */ date_default_timezone_set("UTC"); echo "*** Testing date_sun_info() : usage variations ***\n"; //get an unset variable $unset_var = 10; unset($unset_var); // heredoc string $heredoc = <<<EOT abc xyz EOT; // get a resource variable $fp = fopen(__FILE__, "r"); $inputs = array(0, 1, 12345, -2345, 10.5, -10.5, 123456789000.0, 1.23456789E-9, 0.5, NULL, null, true, false, TRUE, FALSE, "", '', array(), "abcxyz", 'abcxyz', $heredoc, @$undefined_var, @$unset_var, $fp); // loop through each element of $inputs to check the behaviour of date_sun_info() $iterator = 1; foreach ($inputs as $input) { echo "\n-- Iteration {$iterator} --\n"; var_dump(date_sun_info(strtotime("2006-12-12"), 31.7667, $input)); $iterator++; } ?> ===Done===
} </style> </head> <body> <h1>Sunrise and Sunset This Week in Tehran</h1> <table> <tr> <th>Date</th> <th>Sunrise</th> <th>Sunset</th> <th>Hours of Daylight</th> </tr> <?php foreach ($days as $day) { // get details of the sun's movement for the current day $carp = date_sun_info($day->getTimestamp(), $lat, $long); // clone the DateTime object to store the time of sunrise $sunrise = clone $day->setTimestamp($carp['sunrise']); // set the original DateTime object to sunset // and calculate the difference from sunrise $daylight = $sunrise->diff($day->setTimestamp($carp['sunset'])); ?> <tr> <td><?php echo $day->format('D M j'); ?> </td> <td><?php echo $sunrise->format('g:i a'); ?> </td>
if ($minute_ten >= 60) { $hour++; $minute_ten -= 60; } return str_pad($hour, 2, "0", STR_PAD_LEFT) . ':' . str_pad($minute_ten, 2, "0", STR_PAD_LEFT) . ':00'; } $sun_info = date_sun_info(time(), 50.824, -0.14028); // foreach ($sun_info as $title=>$info) { // echo $title.':'.date("Hi s",$info).'<br>'; // } $lengths = array(31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31); $dates = array(); for ($month = 1; $month <= 12; $month++) { for ($day = 1; $day <= $lengths[$month - 1]; $day++) { $date = strtotime("2013-{$month}-{$day}"); $sun_info = date_sun_info($date, 50.824, -0.14028); $diff = abs(strtotime(nearest_ten($sun_info['civil_twilight_end'])) - strtotime(date("H:i:s", $sun_info['civil_twilight_end']))); $dates[] = array(date("d-M-Y", $date), nearest_ten($sun_info['civil_twilight_end']), $diff); } } echo '<br>'; $diff = 500; $first = true; foreach ($dates as $index => $date) { if ($date[2] <= $diff) { $diff = $date[2]; $first = true; } else { $diff = $date[2]; if ($first) { //echo $dates[$index-1][0].' '.$dates[$index-1][1].'<br>';
function daylength($lat, $long) { $sun = date_sun_info(time(), $lat, $long); $daylength = $sun['sunset'] - $sun['sunrise']; $dayH = intval($daylength / 3600); $day = $daylength - 3600 * $dayH; $dayM = intval($day / 60); $dayS = $day - 60 * $dayM; return sprintf("%d:%02d:%02d", $dayH, $dayM, $dayS); }
<a href="http://meteoarmada.directemar.cl" target="_blank"><img src="scr/img/armada.png"/></a> </div> <div class="col-md-4 col-sm-4"> <a href="<?php echo $linkE; ?> " target="_blank"><img src="scr/img/<?php echo $imagenE; ?> " height="60px"/></a> </div> </div> </div> <?php $sun_info = date_sun_info(strtotime("now"), $lat, $lon); date_default_timezone_set('America/Santiago'); include "moon.php"; $sunrise = date("H:i", $sun_info['sunrise']); $sunset = date("H:i", $sun_info['sunset']); $civil_twilight_begin = date("H:i", $sun_info['civil_twilight_begin']); $civil_twilight_end = date("H:i", $sun_info['civil_twilight_end']); $m = date('m'); $d = date('d'); $y = date('Y'); $moon = Moon::calculateMoonTimes($m, $d, $y, $lat, $lon); $moonrise1 = date("H:i", $moon->moonrise); $moonrise = date("H:i", strtotime("{$moonrise1} + 1 hours")); $moonset1 = date("H:i", $moon->moonset); $moonset = date("H:i", strtotime("{$moonset1} + 1 hours")); //Calculo de intervalo de horas
<?php /* Codeine * @author bergstein@trickyplan.com * @description * @package Codeine * @version 8.x */ setFn('Do', function ($Call) { if (!isset($Call['Time'])) { $Call['Time'] = F::Run('System.Time', 'Get'); } $Output = date_sun_info($Call['Time'], $Call['Lattitude'], $Call['Longitude']); $Output['daylight'] = $Output['sunset'] - $Output['sunrise']; if (isset($Call['Sun Key'])) { $Output = $Output[$Call['Sun Key']]; } return $Output; });
<?php /* Prototype : array date_sun_info ( int $time , float $latitude , float $longitude ) * Description: Returns an array with information about sunset/sunrise and twilight begin/end. * Source code: ext/standard/data/php_date.c */ echo "*** Testing date_sun_info() : usage variations ***\n"; $time = "2006-12-12"; $latitude = 31.7667; $longitude = 35.2333; echo "\n-- Testing date_sun_info() function with less than expected no. of arguments --\n"; var_dump(date_sun_info()); var_dump(date_sun_info($time)); var_dump(date_sun_info($time, $latitude)); echo "\n-- Testing date_sun_info() function with more than expected no. of arguments --\n"; $extra_arg = 99; var_dump(date_create($time, $latitude, $longitude, $extra_arg)); ?> ===Done===
public function getSeenObjectDetails($obs, $seen = "A") { global $loggedUser, $objAtlas, $objLocation, $objDatabase, $objPresentations, $objObserver; $result2 = array(); $obscnt = sizeof($obs); if ($obscnt > 0) { $j = 0; reset($obs); while (list($key, $value) = each($obs)) { if (array_key_exists('name', $value)) { $object = $value['name']; } else { $object = $value[1]; } $seentype = "-"; $objectseen = ''; $objectseenlink = ''; $objectlastseen = ''; $objectlastseenlink = ''; $this->getSeenLastseenLink($object, $objectseen, $objectseenlink, $objectlastseen, $objectlastseenlink); if ($seen == "A" || (strlen($seen) == 1 ? strpos(" " . $objectseen, substr($seen, 0, 1)) : (strlen($seen) == 2 ? strpos(" " . $objectseen, substr($seen, 0, 1)) || strpos(" " . $objectseen, substr($seen, 1, 1)) : strpos(" " . $objectseen, substr($seen, 0, 1)) || strpos(" " . $objectseen, substr($seen, 1, 1)) || strpos(" " . $objectseen, substr($seen, 2, 1))))) { $result2[$j]['objectname'] = $object; $get = $objDatabase->selectRecordset("SELECT * FROM objects WHERE name = \"" . $object . "\"")->fetch(PDO::FETCH_OBJ); $result2[$j]['objecttype'] = $get->type; $result2[$j]['objecttypefull'] = $GLOBALS[$get->type]; $altnames = $this->getAlternativeNames($object); $alt = ""; while (list($keyaltnames, $valuealtnames) = each($altnames)) { if (trim($valuealtnames) != trim($object)) { $alt .= ($alt ? "/" : "") . trim($valuealtnames); } } $result2[$j]['altname'] = $alt; $result2[$j]['objectconstellation'] = $get->con; $result2[$j]['objectconstellationfull'] = $GLOBALS[$get->con]; $result2[$j]['objectseen'] = $objectseen; $result2[$j]['objectlastseen'] = $objectlastseen; $result2[$j]['objectseenlink'] = $objectseenlink; $result2[$j]['objectlastseenlink'] = $objectlastseenlink; if (is_numeric($key)) { $result2[$j]['showname'] = $object; } else { $result2[$j]['showname'] = $key; } $result2[$j]['objectmagnitude'] = $get->mag == 99.90000000000001 ? '' : round($get->mag, 1); $result2[$j]['objectsurfacebrightness'] = $get->subr == 99.90000000000001 ? '' : round($get->subr, 1); $result2[$j]['objectra'] = $get->ra; $result2[$j]['objectrahms'] = $objPresentations->raToStringHMS($result2[$j]['objectra']); $result2[$j]['objectdecl'] = $get->decl; $result2[$j]['objectdecldms'] = $objPresentations->decToStringDegMinSec($result2[$j]['objectdecl'], 0); $result2[$j]['objectradecl'] = $objPresentations->raToStringHMS($result2[$j]['objectra']) . ' ' . $objPresentations->decToStringDegMinSec($result2[$j]['objectdecl'], 0); $result2[$j]['objectdiam1'] = $get->diam1; $result2[$j]['objectdiam2'] = $get->diam2; $result2[$j]['objectsize'] = $this->calculateSize($get->diam1, $get->diam2); $result2[$j]['objectpa'] = $get->pa; $result2[$j]['objectsizepa'] = $result2[$j]['objectsize'] ? $result2[$j]['objectsize'] . '/' . $objPresentations->presentationInt($result2[$j]['objectpa'], 999, "-") : '-'; if (array_key_exists('name', $value)) { $result2[$j]['objectpositioninlist'] = $j; } else { $result2[$j]['objectpositioninlist'] = $value[0]; } $result2[$j]['objectsbcalc'] = $get->SBObj; $result2[$j]['objectdescription'] = $get->description; if (is_array($value) && count($value) == 3) { $result2[$j]['objectlistdescription'] = $value[2]; } reset($objAtlas->atlasCodes); while (list($key, $value) = each($objAtlas->atlasCodes)) { $result2[$j][$key] = $get->{$key}; } $result2[$j]['objectcontrast'] = '-'; $result2[$j]['objectcontrasttype'] = '-'; $result2[$j]['objectcontrastpopup'] = ''; $result2[$j]['objectoptimalmagnification'] = '-'; $result2[$j]['objectmaxalt'] = "-"; $result2[$j]['objectmaxaltstart'] = "-"; $result2[$j]['objectmaxaltend'] = "-"; if ($loggedUser && $objObserver->getObserverProperty($loggedUser, 'stdLocation')) { $theLocation = $objObserver->getObserverProperty($loggedUser, 'stdLocation'); $longitude = 1.0 * $objLocation->getLocationPropertyFromId($theLocation, 'longitude'); $latitude = 1.0 * $objLocation->getLocationPropertyFromId($theLocation, 'latitude'); $timezone = $objLocation->getLocationPropertyFromId($theLocation, 'timezone'); $dateTimeZone = new DateTimeZone($timezone); $maxalt = '-'; $maxaltstart = '-'; $maxaltend = '-'; for ($i = 1; $i < 13; $i++) { $datestr = sprintf("%02d", $i) . "/" . sprintf("%02d", 1) . "/" . $_SESSION['globalYear']; $dateTime = new DateTime($datestr, $dateTimeZone); $timedifference = $dateTimeZone->getOffset($dateTime); if (strncmp($timezone, "Etc/GMT", 7) == 0) { $timedifference = -$timedifference; } date_default_timezone_set("UTC"); $theTimeDifference1[$i] = $timedifference; $theEphemerides1[$i] = $this->getEphemerides($object, 1, $i, 2010); $theNightEphemerides1[$i] = date_sun_info(strtotime("2010" . "-" . $i . "-" . "1"), $latitude, $longitude); $datestr = sprintf("%02d", $i) . "/" . sprintf("%02d", 1) . "/" . $_SESSION['globalYear']; $dateTime = new DateTime($datestr, $dateTimeZone); $timedifference = $dateTimeZone->getOffset($dateTime); if (strncmp($timezone, "Etc/GMT", 7) == 0) { $timedifference = -$timedifference; } date_default_timezone_set("UTC"); $theTimeDifference15[$i] = $timedifference; $theEphemerides15[$i] = $this->getEphemerides($object, 15, $i, 2010); $theNightEphemerides15[$i] = date_sun_info(strtotime("2010" . "-" . $i . "-" . "15"), $latitude, $longitude); } for ($i = 1; $i < 13; $i++) { if ($i == 1) { if ($theEphemerides1[$i]['altitude'] != '-' && ($theEphemerides1[$i]['altitude'] == $theEphemerides15[$i]['altitude'] || $theEphemerides1[$i]['altitude'] == $theEphemerides15[12]['altitude'])) { $maxalt = $theEphemerides1[$i]['altitude']; if ($theEphemerides1[$i]['altitude'] > $theEphemerides15[12]['altitude']) { $maxaltstart = 0; } else { if ($theEphemerides1[$i]['altitude'] > $theEphemerides15[$i]['altitude']) { $maxaltend = 0; } } } } else { if ($theEphemerides1[$i]['altitude'] != '-' && ($theEphemerides1[$i]['altitude'] == $theEphemerides15[$i]['altitude'] || $theEphemerides1[$i]['altitude'] == $theEphemerides15[$i - 1]['altitude'])) { $maxalt = $theEphemerides1[$i]['altitude']; if ($theEphemerides1[$i]['altitude'] > $theEphemerides15[$i - 1]['altitude']) { $maxaltstart = $i - 1; } else { if ($theEphemerides1[$i]['altitude'] > $theEphemerides15[$i]['altitude']) { $maxaltend = $i - 1; } } } } if ($i == 12) { if ($theEphemerides15[$i]['altitude'] != '-' && ($theEphemerides15[$i]['altitude'] == $theEphemerides1[$i]['altitude'] || $theEphemerides15[$i]['altitude'] == $theEphemerides1[1]['altitude'])) { $maxalt = $theEphemerides15[$i]['altitude']; if ($theEphemerides15[$i]['altitude'] > $theEphemerides1[$i]['altitude']) { $maxaltstart = $i + 0.5 - 1; } else { if ($theEphemerides15[$i]['altitude'] > $theEphemerides1[1]['altitude']) { $maxaltend = $i + 0.5 - 1; } } } } else { if ($theEphemerides15[$i]['altitude'] != '-' && ($theEphemerides15[$i]['altitude'] == $theEphemerides1[$i]['altitude'] || $theEphemerides15[$i]['altitude'] == $theEphemerides1[$i + 1]['altitude'])) { $maxalt = $theEphemerides15[$i]['altitude']; if ($theEphemerides15[$i]['altitude'] > $theEphemerides1[$i]['altitude']) { $maxaltstart = $i + 0.5 - 1; } else { if ($theEphemerides15[$i]['altitude'] > $theEphemerides1[$i + 1]['altitude']) { $maxaltend = $i + 0.5 - 1; } } } } } $result2[$j]['objectmaxalt'] = $maxalt; $result2[$j]['objectmaxaltstart'] = '-'; $result2[$j]['objectmaxaltend'] = '-'; $result2[$j]['objectmaxaltmid'] = '-'; $result2[$j]['objectmaxaltstarttext'] = "-"; $result2[$j]['objectmaxaltmidtext'] = "-"; $result2[$j]['objectmaxaltendtext'] = "-"; if ($maxalt != '-') { $result2[$j]['objectmaxaltstart'] = 100 * ($maxaltstart + 1); $result2[$j]['objectmaxaltend'] = 100 * ($maxaltend + 1); if ($maxaltstart > $maxaltend) { $maxaltmid = ($maxaltstart + 12 + $maxaltend) / 2; } else { $maxaltmid = ($maxaltstart + $maxaltend) / 2; } if ($maxaltmid >= 12) { $maxaltmid -= 12; } $result2[$j]['objectmaxaltmid'] = 100 * ($maxaltmid + 1); $a = floor($maxaltstart + 1); $b = $maxaltstart + 1 - $a; if ($b == 0.75) { $c = LangMonthEnd; } else { if ($b == 0.5) { $c = LangMonthMid; } else { if ($b == 0.25) { $c = LangMonthStart; } else { $c = LangMonthTransit; } } } $result2[$j]['objectmaxaltstarttext'] = $c . ' ' . $GLOBALS['Month' . $a . 'Short']; $a = floor($maxaltend + 1); $b = $maxaltend + 1 - $a; if ($b == 0.75) { $c = LangMonthEnd; } else { if ($b == 0.5) { $c = LangMonthMid; } else { if ($b == 0.25) { $c = LangMonthStart; } else { $c = LangMonthTransit; } } } $result2[$j]['objectmaxaltendtext'] = $c . ' ' . $GLOBALS['Month' . $a . 'Short']; $a = floor($maxaltmid + 1); $b = $maxaltmid + 1 - $a; if ($b == 0.75) { $c = LangMonthEnd; } else { if ($b == 0.5) { $c = LangMonthMid; } else { if ($b == 0.25) { $c = LangMonthStart; } else { $c = LangMonthTransit; } } } $result2[$j]['objectmaxaltmidtext'] = $c . ' ' . $GLOBALS['Month' . $a . 'Short']; } } $j++; } } } $obs = $this->getObjectVisibilities($result2); return $obs; }
$ip = "111.68.105.70"; foreach ($error as $value) { $ip = $value->clientIP; } $url = "http://freegeoip.net/json/{$ip}"; $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 5); $data = curl_exec($ch); curl_close($ch); if ($data) { $location = json_decode($data); $lat = $location->latitude; $lon = $location->longitude; $sun_info = date_sun_info(time(), $lat, $lon); print_r("lat=" . $lat . '<br>' . "lon=" . $lon); } ?> <script src="https://maps.googleapis.com/maps/api/js?key=AIzaSyAUstEMWunH22j5D0mpJatREDNcYpUCMrc&=false&callback=initMap"></script> <script src="http://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.10.1.min.js"></script> <!-- BEGIN PAGE CONTENT --> <div class="page-content page-thin"> <div class="row"> <div class="col-md-12 portlets ui-sortable"> <div class="panel"> <div class="panel-header panel-controls">
<?php /* Prototype : array date_sun_info ( int $time , float $latitude , float $longitude ) * Description: Returns an array with information about sunset/sunrise and twilight begin/end. * Source code: ext/standard/data/php_date.c */ date_default_timezone_set("UTC"); echo "*** Testing date_sun_info() : usage variations ***\n"; //get an unset variable $unset_var = 10; unset($unset_var); // heredoc string $heredoc = <<<EOT abc xyz EOT; // get a resource variable $fp = fopen(__FILE__, "r"); $inputs = array(0, 1, 12345, -2345, 10.5, -10.5, 1234567.89, 0.000123456789, 0.5, NULL, null, true, false, TRUE, FALSE, "", '', array(), "abcxyz", 'abcxyz', $heredoc, @$undefined_var, @$unset_var, $fp); // loop through each element of $inputs to check the behaviour of date_sun_info() $iterator = 1; foreach ($inputs as $input) { echo "\n-- Iteration {$iterator} --\n"; var_dump(date_sun_info($input, 31.7667, 35.2333)); $iterator++; } ?> ===Done===
<?php date_default_timezone_set('Europe/Oslo'); $sun_info = date_sun_info(strtotime("2007-04-13 08:31:15 UTC"), 59.21, 9.609999999999999); foreach ($sun_info as $key => $elem) { echo date('Y-m-d H:i:s T', $elem), " ", $key, "\n"; } echo "Done\n";
<?php $b = (string) trim($a); $c = (array) array_filter($a, $b); $d = (bool) array_key_exists($a, $b); $d = (bool) phpinfo(); $e = (double) date_sun_info(); $g = (double) imagefttext(); $g = (double) acosh(); $f = (int) memory_get_peak_usage(); $g = (int) curl_errno(); // This is OK $h = (bool) curl_errno(); // This is to be ignored $i = (int) $a->curl_errno(); $j = (int) A::curl_errno(); $k = (int) $a->{$curl_errno}(); $l = (int) A::$curl_errno();
function showObjectEphemerides($theLocation) { global $baseURL, $object, $theMonth, $theDay, $objLocation, $objObject, $objPresentations, $objUtil; $longitude = 1.0 * $objLocation->getLocationPropertyFromId($theLocation, 'longitude'); $latitude = 1.0 * $objLocation->getLocationPropertyFromId($theLocation, 'latitude'); $timezone = $objLocation->getLocationPropertyFromId($theLocation, 'timezone'); $dateTimeZone = new DateTimeZone($timezone); $theMonth = $_SESSION['globalMonth']; $theDay = $_SESSION['globalDay']; echo "<div id=\"ephemeridesdiv\">"; for ($i = 1; $i < 13; $i++) { $datestr = sprintf("%02d", $i) . "/" . sprintf("%02d", 1) . "/" . $_SESSION['globalYear']; $dateTime = new DateTime($datestr, $dateTimeZone); $timedifference = $dateTimeZone->getOffset($dateTime); if (strncmp($timezone, "Etc/GMT", 7) == 0) { $timedifference = -$timedifference; } date_default_timezone_set("UTC"); $theTimeDifference1[$i] = $timedifference; $theEphemerides1[$i] = $objObject->getEphemerides($object, 1, $i, 2010); $theNightEphemerides1[$i] = date_sun_info(strtotime("2010" . "-" . $i . "-" . "1"), $latitude, $longitude); $datestr = sprintf("%02d", $i) . "/" . sprintf("%02d", 1) . "/" . $_SESSION['globalYear']; $dateTime = new DateTime($datestr, $dateTimeZone); $timedifference = $dateTimeZone->getOffset($dateTime); if (strncmp($timezone, "Etc/GMT", 7) == 0) { $timedifference = -$timedifference; } date_default_timezone_set("UTC"); $theTimeDifference15[$i] = $timedifference; $theEphemerides15[$i] = $objObject->getEphemerides($object, 15, $i, 2010); $theNightEphemerides15[$i] = date_sun_info(strtotime("2010" . "-" . $i . "-" . "15"), $latitude, $longitude); } echo "<h4>" . "<a href=\"" . $baseURL . "index.php?indexAction=detail_object&object=" . urlencode($_GET['object']) . '&zoom=' . $objUtil->checkGetKey("zoom", 30) . '&SID=Qobj&viewobjectephemerides=hidden' . "\" title=\"" . ReportEpehemeridesForHide . "\">-</a> " . ReportEpehemeridesFor . " " . stripslashes($object) . ' ' . ReportEpehemeridesIn . ' ' . $objLocation->getLocationPropertyFromId($theLocation, 'name') . "</h4>"; echo "<hr />"; echo "<table class=\"table table-condensed\">"; echo "<tr class=\"type10\">"; echo "<th class=\"right\">" . LangMonth . " > </th>"; for ($i = 1; $i < 13; $i++) { $background1 = ''; $background15 = ''; if ($i == $theMonth && $theDay < 8 || $i - 1 == $theMonth && $theDay > 22) { $background1 = 'class="current"'; } if ($i == $theMonth && $theDay >= 8 && $theDay <= 22) { $background15 = 'class="current"'; } echo "<th " . $background1 . "> </th><th class=\"centered\" " . $background15 . ">" . $i . "</th>"; } $background1 = ''; if (12 == $theMonth && $theDay > 22) { $background1 = " style=\"background-color:#FFAAAA\" color: red"; } echo "<th" . $background1 . "> </th>"; echo "</tr>"; echo "<tr class=\"type20\">"; echo "<td class=\"centered\">" . LangMaxAltitude . "</td>"; for ($i = 1; $i < 13; $i++) { $colorclass = ""; if ($i == 1) { if ($theEphemerides1[$i]['altitude'] != '-' && $theEphemerides15[$i]['altitude'] != '-' && ($theEphemerides1[$i]['altitude'] == $theEphemerides15[$i]['altitude'] || $theEphemerides1[$i]['altitude'] == $theEphemerides15[12]['altitude'])) { $colorclass = "ephemeridesgreen"; } } else { if ($theEphemerides1[$i]['altitude'] != '-' && $theEphemerides15[$i]['altitude'] != '-' && ($theEphemerides1[$i]['altitude'] == $theEphemerides15[$i]['altitude'] || $theEphemerides1[$i]['altitude'] == $theEphemerides15[$i - 1]['altitude'])) { $colorclass = "ephemeridesgreen"; } } echo "<td class=\"centered " . $colorclass . "\">" . $theEphemerides1[$i]['altitude'] . "</td>"; $colorclass = ""; if ($i == 12) { if ($theEphemerides1[$i]['altitude'] != '-' && $theEphemerides15[$i]['altitude'] != '-' && ($theEphemerides15[$i]['altitude'] == $theEphemerides1[$i]['altitude'] || $theEphemerides15[$i]['altitude'] == $theEphemerides1[1]['altitude'])) { $colorclass = "ephemeridesgreen"; } } else { if ($theEphemerides15[$i]['altitude'] != '-' && $theEphemerides15[$i]['altitude'] != '-' && ($theEphemerides15[$i]['altitude'] == $theEphemerides1[$i]['altitude'] || $theEphemerides15[$i]['altitude'] == $theEphemerides1[$i + 1]['altitude'])) { $colorclass = "ephemeridesgreen"; } } echo "<td class=\"centered " . $colorclass . "\">" . $theEphemerides15[$i]['altitude'] . "</td>"; } $colorclass = ""; if ($theEphemerides1[1]['altitude'] != '-' && $theEphemerides15[1]['altitude'] != '-' && ($theEphemerides1[1]['altitude'] == $theEphemerides15[1]['altitude'] || $theEphemerides1[1]['altitude'] == $theEphemerides15[12]['altitude'])) { $colorclass = "ephemeridesgreen"; } echo "<td class=\"centered " . $colorclass . "\">" . $theEphemerides1[1]['altitude'] . "</td>"; echo "</tr>"; echo "<tr class=\"type10\">"; echo "<td class=\"centered\">" . LangTransit . "</td>"; for ($i = 1; $i < 13; $i++) { $colorclass = ""; if (date("H:i", $theNightEphemerides1[$i]["astronomical_twilight_end"]) != "00:00" && $objUtil->checkNightHourMinuteBetweenOthers($theEphemerides1[$i]['transit'], date("H:i", $theNightEphemerides1[$i]["astronomical_twilight_end"] + $theTimeDifference1[$i]), date("H:i", $theNightEphemerides1[$i]["astronomical_twilight_begin"] + $theTimeDifference1[$i]))) { $colorclass = "ephemeridesgreen"; } elseif (date("H:i", $theNightEphemerides1[$i]["nautical_twilight_end"]) != "00:00" && $objUtil->checkNightHourMinuteBetweenOthers($theEphemerides1[$i]['transit'], date("H:i", $theNightEphemerides1[$i]["nautical_twilight_end"] + $theTimeDifference1[$i]), date("H:i", $theNightEphemerides1[$i]["nautical_twilight_begin"] + $theTimeDifference1[$i]))) { $colorclass = "ephemeridesyellow"; } echo "<td class=\"centered " . $colorclass . "\">" . $theEphemerides1[$i]['transit'] . "</td>"; $colorclass = ""; if (date("H:i", $theNightEphemerides15[$i]["nautical_twilight_end"]) != "00:00" && $objUtil->checkNightHourMinuteBetweenOthers($theEphemerides15[$i]['transit'], date("H:i", $theNightEphemerides15[$i]["astronomical_twilight_end"] + $theTimeDifference15[$i]), date("H:i", $theNightEphemerides15[$i]["astronomical_twilight_begin"] + $theTimeDifference15[$i]))) { $colorclass = "ephemeridesgreen"; } elseif (date("H:i", $theNightEphemerides15[$i]["nautical_twilight_end"]) != "00:00" && $objUtil->checkNightHourMinuteBetweenOthers($theEphemerides15[$i]['transit'], date("H:i", $theNightEphemerides15[$i]["nautical_twilight_end"] + $theTimeDifference15[$i]), date("H:i", $theNightEphemerides15[$i]["nautical_twilight_begin"] + $theTimeDifference15[$i]))) { $colorclass = "ephemeridesyellow"; } echo "<td class=\"centered " . $colorclass . "\">" . $theEphemerides15[$i]['transit'] . "</td>"; } $colorclass = ""; if (date("H:i", $theNightEphemerides1[1]["astronomical_twilight_end"]) != "00:00" && $objUtil->checkNightHourMinuteBetweenOthers($theEphemerides1[1]['transit'], date("H:i", $theNightEphemerides1[1]["astronomical_twilight_end"] + $theTimeDifference1[1]), date("H:i", $theNightEphemerides1[1]["astronomical_twilight_begin"] + $theTimeDifference1[1]))) { $colorclass = "ephemeridesgreen"; } elseif (date("H:i", $theNightEphemerides1[1]["nautical_twilight_end"]) != "00:00" && $objUtil->checkNightHourMinuteBetweenOthers($theEphemerides1[1]['transit'], date("H:i", $theNightEphemerides1[1]["nautical_twilight_end"] + $theTimeDifference1[1]), date("H:i", $theNightEphemerides1[1]["nautical_twilight_begin"] + $theTimeDifference1[1]))) { $colorclass = "ephemeridesyellow"; } echo "<td class=\"centered " . $colorclass . "\">" . $theEphemerides1[1]['transit'] . "</td>"; echo "</tr>"; echo "<tr class=\"type20\">"; echo "<td class=\"centered\">" . LangAstroNight . "</td>"; for ($i = 1; $i < 13; $i++) { echo "<td class=\"centered\">" . (date("H:i", $theNightEphemerides1[$i]["astronomical_twilight_end"]) != "00:00" ? date("H:i", $theNightEphemerides1[$i]["astronomical_twilight_end"] + $theTimeDifference1[$i]) . "<br />-<br />" . date("H:i", $theNightEphemerides1[$i]["astronomical_twilight_begin"] + $theTimeDifference1[$i]) : "-") . "</td>"; echo "<td class=\"centered\">" . (date("H:i", $theNightEphemerides15[$i]["astronomical_twilight_end"]) != "00:00" ? date("H:i", $theNightEphemerides15[$i]["astronomical_twilight_end"] + $theTimeDifference15[$i]) . "<br />-<br />" . date("H:i", $theNightEphemerides15[$i]["astronomical_twilight_begin"] + $theTimeDifference15[$i]) : "-") . "</td>"; } echo "<td class=\"centered\">" . (date("H:i", $theNightEphemerides1[1]["astronomical_twilight_end"]) != "00:00" ? date("H:i", $theNightEphemerides1[1]["astronomical_twilight_end"] + $theTimeDifference1[1]) . "<br />-<br />" . date("H:i", $theNightEphemerides1[1]["astronomical_twilight_begin"] + $theTimeDifference1[1]) : "-") . "</td>"; echo "</tr>"; echo "<tr class=\"type10\">"; echo "<td class=\"centered\">" . LangNauticalNight . "</td>"; for ($i = 1; $i < 13; $i++) { echo "<td class=\"centered\">" . (date("H:i", $theNightEphemerides1[$i]["nautical_twilight_end"]) != "00:00" ? date("H:i", $theNightEphemerides1[$i]["nautical_twilight_end"] + $theTimeDifference1[$i]) . "<br />-<br />" . date("H:i", $theNightEphemerides1[$i]["nautical_twilight_begin"] + $theTimeDifference1[$i]) : "-") . "</td>"; echo "<td class=\"centered\">" . (date("H:i", $theNightEphemerides15[$i]["nautical_twilight_end"]) != "00:00" ? date("H:i", $theNightEphemerides15[$i]["nautical_twilight_end"] + $theTimeDifference15[$i]) . "<br />-<br />" . date("H:i", $theNightEphemerides15[$i]["nautical_twilight_begin"] + $theTimeDifference15[$i]) : "-") . "</td>"; } echo "<td class=\"centered\">" . (date("H:i", $theNightEphemerides1[1]["nautical_twilight_end"]) != "00:00" ? date("H:i", $theNightEphemerides1[1]["nautical_twilight_end"] + $theTimeDifference1[1]) . "<br />-<br />" . date("H:i", $theNightEphemerides1[1]["nautical_twilight_begin"] + $theTimeDifference1[1]) : "-") . "</td>"; echo "</tr>"; echo "<tr class=\"type20\">"; echo "<td class=\"centered\">" . LangObjectRiseSet . "</td>"; for ($i = 1; $i < 13; $i++) { $colorclass = ""; if ($theEphemerides1[$i]['rise'] == '-') { if (date("H:i", $theNightEphemerides1[$i]["astronomical_twilight_end"]) != "00:00") { $colorclass = "ephemeridesgreen"; } else { if (date("H:i", $theNightEphemerides1[$i]["nautical_twilight_end"]) != "00:00") { $colorclass = "ephemeridesyellow"; } } } if (date("H:i", $theNightEphemerides1[$i]["astronomical_twilight_end"]) != "00:00" && $objUtil->checkNightHourMinutePeriodOverlap($theEphemerides1[$i]['rise'], $theEphemerides1[$i]['set'], date("H:i", $theNightEphemerides1[$i]["astronomical_twilight_end"] + $theTimeDifference1[$i]), date("H:i", $theNightEphemerides1[$i]["astronomical_twilight_begin"] + $theTimeDifference1[$i]))) { $colorclass = "ephemeridesgreen"; } else { if (date("H:i", $theNightEphemerides1[$i]["nautical_twilight_end"]) != "00:00" && $objUtil->checkNightHourMinutePeriodOverlap($theEphemerides1[$i]['rise'], $theEphemerides1[$i]['set'], date("H:i", $theNightEphemerides1[$i]["nautical_twilight_end"] + $theTimeDifference1[$i]), date("H:i", $theNightEphemerides1[$i]["nautical_twilight_begin"] + $theTimeDifference1[$i]))) { $colorclass = "ephemeridesyellow"; } } echo "<td class=\"centered " . $colorclass . "\">" . ($theEphemerides1[$i]['rise'] == '-' ? "-" : $theEphemerides1[$i]['rise'] . "<br />-<br />" . $theEphemerides1[$i]['set']) . "</td>"; $colorclass = ""; if ($theEphemerides15[$i]['rise'] == '-') { if (date("H:i", $theNightEphemerides15[$i]["astronomical_twilight_end"]) != "00:00") { $colorclass = "ephemeridesgreen"; } else { if (date("H:i", $theNightEphemerides15[$i]["nautical_twilight_end"]) != "00:00") { $colorclass = "ephemeridesyellow"; } } } else { if (date("H:i", $theNightEphemerides15[$i]["astronomical_twilight_end"]) != "00:00" && $objUtil->checkNightHourMinutePeriodOverlap($theEphemerides15[$i]['rise'], $theEphemerides15[$i]['set'], date("H:i", $theNightEphemerides15[$i]["astronomical_twilight_end"] + $theTimeDifference15[$i]), date("H:i", $theNightEphemerides15[$i]["astronomical_twilight_begin"] + $theTimeDifference15[$i]))) { $colorclass = "ephemeridesgreen"; } else { if (date("H:i", $theNightEphemerides15[$i]["nautical_twilight_end"]) != "00:00" && $objUtil->checkNightHourMinutePeriodOverlap($theEphemerides15[$i]['rise'], $theEphemerides15[$i]['set'], date("H:i", $theNightEphemerides15[$i]["nautical_twilight_end"] + $theTimeDifference15[$i]), date("H:i", $theNightEphemerides15[$i]["nautical_twilight_begin"] + $theTimeDifference15[$i]))) { $colorclass = "ephemeridesyellow"; } } } echo "<td class=\"centered " . $colorclass . "\">" . ($theEphemerides15[$i]['rise'] == "-" ? "-" : $theEphemerides15[$i]['rise'] . "<br />-<br />" . $theEphemerides15[$i]['set']) . "</td>"; } $colorclass = ""; if ($theEphemerides1[1]['rise'] == '-') { if (date("H:i", $theNightEphemerides1[1]["astronomical_twilight_end"]) != "00:00") { $colorclass = "ephemeridesgreen"; } else { if (date("H:i", $theNightEphemerides1[1]["nautical_twilight_end"]) != "00:00") { $colorclass = "ephemeridesyellow"; } } } else { if (date("H:i", $theNightEphemerides1[1]["astronomical_twilight_end"]) != "00:00" && $objUtil->checkNightHourMinutePeriodOverlap($theEphemerides1[1]['rise'], $theEphemerides1[1]['set'], date("H:i", $theNightEphemerides1[1]["astronomical_twilight_end"] + $theTimeDifference1[1]), date("H:i", $theNightEphemerides1[1]["astronomical_twilight_begin"] + $theTimeDifference1[1]))) { $colorclass = "ephemeridesgreen"; } else { if (date("H:i", $theNightEphemerides1[1]["nautical_twilight_end"]) != "00:00" && $objUtil->checkNightHourMinutePeriodOverlap($theEphemerides1[1]['rise'], $theEphemerides1[1]['set'], date("H:i", $theNightEphemerides1[1]["nautical_twilight_end"] + $theTimeDifference1[1]), date("H:i", $theNightEphemerides1[1]["nautical_twilight_begin"] + $theTimeDifference1[1]))) { $colorclass = "ephemeridesyellow"; } } } echo "<td class=\"centered " . $colorclass . "\">" . ($theEphemerides1[1]['rise'] == '-' ? '-' : $theEphemerides1[1]['rise'] . "<br />-<br />" . $theEphemerides1[1]['set']) . "</td>"; echo "</tr>"; echo "</table>"; echo "<hr />"; echo "</div>"; }
function menu_moon() { global $baseURL, $dateformat, $loggedUser, $menuMoon, $objAstroCalc, $objObserver, $objLocation, $objUtil; $theYear = $objUtil->checkSessionKey('globalYear', date("Y")); $theMonth = $objUtil->checkSessionKey('globalMonth', date("n")); $theDay = $objUtil->checkSessionKey('globalDay', date('j')); $theHour = ""; $theMinute = ""; $date = $theYear . "-" . $theMonth . "-" . $theDay; $time = "23:59:59"; $tzone = "GMT"; $dateTimeText0 = date($dateformat, mktime(0, 0, 0, $theMonth, $theDay, $theYear)); $dateTimeText1 = date($dateformat, mktime(0, 0, 0, $theMonth, $theDay, $theYear) + 60 * 60 * 24); if ($dateformat == 'd-M-Y') { if (substr($dateTimeText0, -8) == substr($dateTimeText1, -8)) { $dateTimeText0 = substr($dateTimeText0, 0, 2); } elseif (substr($dateTimeText0, -5) == substr($dateTimeText1, -5)) { $dateTimeText0 = substr($dateTimeText0, 0, 5); } } elseif ($dateformat == "d/m/Y") { if (substr($dateTimeText0, -7) == substr($dateTimeText1, -7)) { $dateTimeText0 = substr($dateTimeText0, 0, 2); } elseif (substr($dateTimeText0, -5) == substr($dateTimeText1, -5)) { $dateTimeText0 = substr($dateTimeText0, 0, 5); } } elseif ($dateformat == 'd-m-Y') { if (substr($dateTimeText0, -7) == substr($dateTimeText1, -7)) { $dateTimeText0 = substr($dateTimeText0, 0, 2); } elseif (substr($dateTimeText0, -5) == substr($dateTimeText1, -5)) { $dateTimeText0 = substr($dateTimeText0, 0, 5); } } elseif ($dateformat == 'M-d-Y') { if (substr($dateTimeText0, 0, 3) == substr($dateTimeText1, 0, 3)) { $dateTimeText0 = substr($dateTimeText0, 0, 6); $dateTimeText1 = substr($dateTimeText1, -7); } elseif (substr($dateTimeText0, -5) == substr($dateTimeText1, -5)) { $dateTimeText0 = substr($dateTimeText0, 0, 6); } } $moondata = phase(strtotime($date . ' ' . $time . ' ' . $tzone)); $MoonIllum = $moondata[1]; $MoonAge = $moondata[2]; $nextNewMoonText = LangMoonMenuNewMoon . ": "; $phases = array(); $phases = phasehunt(strtotime($date)); $nextNewMoonText .= date("j M", $phases[4]); // Convert $MoonIllum to percent and round to whole percent. $MoonIllum = round($MoonIllum, 2); $MoonIllum *= 100; // 1) Check if logged in if ($loggedUser && $objObserver->getObserverProperty($loggedUser, 'stdLocation')) { // 2) Get the julian day of today... $jd = gregoriantojd($theMonth, $theDay, $theYear); // 3) Get the standard location of the observer $longitude = $objLocation->getLocationPropertyFromId($objObserver->getObserverProperty($loggedUser, 'stdLocation'), 'longitude'); $latitude = $objLocation->getLocationPropertyFromId($objObserver->getObserverProperty($loggedUser, 'stdLocation'), 'latitude'); if (!$objUtil->checkSessionKey('efemerides') || $_SESSION['efemerides']['base'] != $jd . "/" . $longitude . "/" . $latitude) { if ($longitude > -199) { $timezone = $objLocation->getLocationPropertyFromId($objObserver->getObserverProperty($loggedUser, 'stdLocation'), 'timezone'); $dateTimeZone = new DateTimeZone($timezone); $datestr = sprintf("%02d", $_SESSION['globalMonth']) . "/" . sprintf("%02d", $_SESSION['globalDay']) . "/" . $_SESSION['globalYear']; $dateTime = new DateTime($datestr, $dateTimeZone); // Geeft tijdsverschil terug in seconden $timedifference = $dateTimeZone->getOffset($dateTime); $timedifference = $timedifference / 3600.0; if (strncmp($timezone, "Etc/GMT", 7) == 0) { $timedifference = -$timedifference; } // Calculate the rise and set time of the moon $moon = $objAstroCalc->calculateMoonRiseTransitSettingTime($jd, $longitude, $latitude, $timedifference); // SUNRISE and SET, TWILIGHT... date_default_timezone_set("UTC"); $timestr = $theYear . "-" . $theMonth . "-" . $theDay; $sun_info = date_sun_info(strtotime($timestr), $latitude, $longitude); $srise = $sun_info["sunrise"]; if ($srise > 1) { $srise = date("H:i", $srise + $timedifference * 60 * 60); } else { $srise = "-"; } $sset = $sun_info["sunset"]; if ($sset > 1) { $sset = date("H:i", $sset + $timedifference * 60 * 60); } else { $sset = "-"; } $nautb = $sun_info["nautical_twilight_begin"]; if ($nautb > 1) { $nautb = date("H:i", $nautb + $timedifference * 60 * 60); } else { $nautb = "-"; } $naute = $sun_info["nautical_twilight_end"]; if ($naute > 1) { $naute = date("H:i", $naute + $timedifference * 60 * 60); } else { $naute = "-"; } $astrob = $sun_info["astronomical_twilight_begin"]; if ($astrob > 1) { $astrob = date("H:i", $astrob + $timedifference * 60 * 60); } else { $astrob = "-"; } $astroe = $sun_info["astronomical_twilight_end"]; if ($astroe > 1) { $astroe = date("H:i", $astroe + $timedifference * 60 * 60); } else { $astroe = "-"; } $_SESSION['efemerides']['base'] = $jd . "/" . $longitude . "/" . $latitude; $_SESSION['efemerides']['astrob'] = $astrob; $_SESSION['efemerides']['astroe'] = $astroe; $_SESSION['efemerides']['nautb'] = $nautb; $_SESSION['efemerides']['naute'] = $naute; $_SESSION['efemerides']['srise'] = $srise; $_SESSION['efemerides']['sset'] = $sset; $_SESSION['efemerides']['moon0'] = $moon[0]; $_SESSION['efemerides']['moon2'] = $moon[2]; } } } echo "<li>"; reset($_GET); $link = ""; while (list($key, $value) = each($_GET)) { if ($key != "menuMoon") { $link .= "&" . $key . "=" . urlencode($value); } } reset($_GET); echo "<p><br /><h4>"; echo ($loggedUser && $objObserver->getObserverProperty($loggedUser, 'stdLocation') ? LangMoonSunMenuTitle : LangMoonMenuTitle) . "<br />"; echo "</h4>"; echo "<span style=\"font-weight:normal;\">" . LangOn . " " . $dateTimeText0 . "><" . $dateTimeText1 . "</span>"; echo "</p>"; if ($loggedUser && $objObserver->getObserverProperty($loggedUser, 'stdLocation')) { echo "<table class=\"table table-condensed\">"; if (isset($_SESSION['efemerides'])) { echo "<tr>"; echo "<td>" . LangMoon . "</td>" . "<td>" . $_SESSION['efemerides']['moon0'] . "</td>" . "<td>" . $_SESSION['efemerides']['moon2'] . "</td>"; echo "</tr>"; echo "<tr>"; echo "<td>" . LangMoonSun . "</td>" . "<td>" . $_SESSION['efemerides']['sset'] . "</td>" . "<td>" . $_SESSION['efemerides']['srise'] . "</td>"; echo "</tr>"; echo "<tr>"; echo "<td>" . LangMoonNaut . "</td>" . "<td>" . $_SESSION['efemerides']['naute'] . "</td>" . "<td>" . $_SESSION['efemerides']['nautb'] . "</td>"; echo "</tr>"; echo "<tr>"; echo "<td>" . LangMoonAstro . "</td>" . "<td>" . $_SESSION['efemerides']['astroe'] . "</td>" . "<td>" . $_SESSION['efemerides']['astrob'] . "</td>"; echo "</tr>"; } echo "</table>"; } $file = "m" . round($MoonAge / SYNMONTH * 40) . ".gif"; echo "<p><img src=\"" . $baseURL . "/lib/moonpics/" . $file . "\" title=\"" . $MoonIllum . "%\" height=\"100px\" width=\"100px\" alt=\"" . $MoonIllum . "%\" /></p>"; echo $nextNewMoonText . "<br />"; echo "</li>"; }
<?php date_default_timezone_set('UTC'); $sun_info = date_sun_info(strtotime("2006-12-12"), 31.7667, 35.2333); var_dump($sun_info); echo "Done\n";
<?php /** * Header file common to all * templates * */ $menu_args = array('theme_location' => 'main', 'menu' => 'main', 'menu_id' => '', 'echo' => true, 'walker' => ''); $sun_info = date_sun_info(time(), 40.583143, -122.412897); if (time() < $sun_info['sunrise'] || time() > $sun_info['sunset']) { $dayphase = 'nighttime'; } else { $dayphase = 'daytime'; } ?> <!doctype html> <html class="site <?php echo $dayphase; ?> " <?php language_attributes(); ?> > <head> <!--[if lt IE 9]> <script src="//cdnjs.cloudflare.com/ajax/libs/html5shiv/3.7.2/html5shiv.min.js"></script> <![endif]--> <meta charset="<?php bloginfo('charset'); ?>
public function pdfAtlasObjectSet($theobject, $theShowname, $theSet, $thedsos, $thestars, $thephotos, $datapage = 'false', $reportlayoutselect = '', $ephemerides = 'true', $yearephemerides = false, $nostream = false) { global $theMonth, $theDay, $theYear, $dateformat, $baseURL, $objList, $objInstrument, $objLocation, $objUtil, $instDir, $loggedUser, $loggedUserName, $objObserver, $objObject, $objPresentations, $objReportLayout, $listname, $myList; $firstpage = true; $astroObjects = array(); $indexlist = array(); set_time_limit(300); $raDSS = $objPresentations->raToStringDSS2($objObject->getDsoProperty($theobject, 'ra')); $declDSS = $objPresentations->decToStringDSS2($objObject->getDsoProperty($theobject, 'decl')); $radeclALADIN = $objPresentations->radeclToStringALADIN($objObject->getDsoProperty($theobject, 'ra'), $objObject->getDsoProperty($theobject, 'decl')); $_GET['pdfTitle'] = $theShowname; $this->pdf = new Cezpdf('a4', 'landscape'); $this->canvasDimensionXpx = $this->pdf->ez['pageWidth']; $this->canvasDimensionYpx = $this->pdf->ez['pageHeight']; $this->pdf->selectFont($instDir . 'lib/fonts/Courier.afm'); $this->fontSize1b = max(min($objUtil->checkRequestKey('fontsize', $this->fontSize1b), 9), 6); $this->fontSize1a = round($this->fontSize1b * 1.666); $this->atlaspagerahr = $objObject->getDsoProperty($theobject, 'ra', 0); $this->atlaspagedecldeg = $objObject->getDsoProperty($theobject, 'decl', 0); $this->pdf->addTextWrap(0, 10, $this->pdf->ez['pageWidth'] - 10, 10, $theShowname, 'right'); if ($datapage == 'true') { $firstpage = false; $theobjectdata = $objObject->getSeenObjectDetails(array($theobject => array(0, $theobject))); $theobjectdata = $theobjectdata[0]; $liney = $this->canvasDimensionYpx - 50; $this->pdf->addTextWrap(50, $liney, $this->canvasDimensionXpx - 100, 15, 'Atlas pages for ' . $theShowname, 'center'); $liney -= 5; $this->pdf->line(50, $liney, $this->canvasDimensionXpx - 50, $liney); $liney -= 15; $this->pdf->addTextWrap(50, $liney, 450, 10, Reportaltname . ": " . ($theobjectdata['altname'] ? $theobjectdata['altname'] : '-'), 'left'); if ($loggedUser) { $this->pdf->addTextWrap(550, $liney, 200, 10, LangViewObservationField2 . ': ' . $loggedUserName, 'left'); } $liney -= 25; $this->pdf->addTextWrap(50, $liney, 200, 10, Reportobjectra . ': ' . $theobjectdata['objectrahms'], 'left'); $this->pdf->addTextWrap(300, $liney, 200, 10, Reportobjectmagnitude . ': ' . ($theobjectdata['objectmagnitude'] ? $theobjectdata['objectmagnitude'] : '-'), 'left'); $this->pdf->addTextWrap(550, $liney, 200, 10, Reportobjectconstellationfull . ': ' . $theobjectdata['objectconstellationfull'], 'left'); $liney -= 15; $this->pdf->addTextWrap(50, $liney, 200, 10, Reportobjectdecl . ': ' . $theobjectdata['objectdecldms'], 'left'); $this->pdf->addTextWrap(300, $liney, 200, 10, Reportobjectsurfacebrightness . ': ' . ($theobjectdata['objectsurfacebrightness'] ? $theobjectdata['objectsurfacebrightness'] : '-'), 'left'); $this->pdf->addTextWrap(550, $liney, 200, 10, Reportobjecttypefull . ': ' . $theobjectdata['objecttypefull'], 'left'); $liney -= 15; $this->pdf->addTextWrap(50, $liney, 200, 10, LangViewObjectField9 . ': ' . ($theobjectdata['objectsize'] ? $theobjectdata['objectsize'] : '-'), 'left'); $this->pdf->addTextWrap(300, $liney, 200, 10, LangViewObjectField12 . ': ' . (($pa = $theobjectdata['objectpa']) == 999 ? '-' : $pa), 'left'); $this->pdf->addTextWrap(550, $liney, 200, 10, LangOverviewObjectsHeader7 . ': ' . $theobjectdata['objectseen'], 'left'); $liney -= 20; if ($loggedUser) { $this->pdf->addTextWrap(50, $liney, 4500, 10, LangViewObjectFieldOptimumDetectionMagnification . ': ' . $theobjectdata['objectoptimalmagnification'], 'left'); $this->pdf->addTextWrap(550, $liney, 200, 10, LangOverviewObjectsHeader8 . ': ' . ($theobjectdata['objectlastseen'] ? $theobjectdata['objectlastseen'] : '-'), 'left'); $liney -= 15; $this->pdf->addTextWrap(50, $liney, 750, 10, Reportobjectcontrast . ': ' . ($theobjectdata['objectcontrast'] != '0.0' ? $theobjectdata['objectcontrast'] . ' - ' : '') . stripslashes($theobjectdata['objectcontrastpopup']), 'left'); $liney -= 15; if ($ephemerides == 'true') { $liney -= 15; $theYear = $objUtil->checkSessionKey('globalYear', date("Y")); $theMonth = $objUtil->checkSessionKey('globalMonth', date("n")); $theDay = $objUtil->checkSessionKey('globalDay', date('j')); $dateTimeText0 = date($dateformat, mktime(0, 0, 0, $theMonth, $theDay, $theYear)); $dateTimeText1 = date($dateformat, mktime(0, 0, 0, $theMonth, $theDay, $theYear) + 60 * 60 * 24); if ($dateformat == 'd-M-Y') { if (substr($dateTimeText0, -8) == substr($dateTimeText1, -8)) { $dateTimeText0 = substr($dateTimeText0, 0, 2); } elseif (substr($dateTimeText0, -5) == substr($dateTimeText1, -5)) { $dateTimeText0 = substr($dateTimeText0, 0, 5); } } elseif ($dateformat == "d/m/Y") { if (substr($dateTimeText0, -7) == substr($dateTimeText1, -7)) { $dateTimeText0 = substr($dateTimeText0, 0, 2); } elseif (substr($dateTimeText0, -5) == substr($dateTimeText1, -5)) { $dateTimeText0 = substr($dateTimeText0, 0, 5); } } elseif ($dateformat == 'd-m-Y') { if (substr($dateTimeText0, -7) == substr($dateTimeText1, -7)) { $dateTimeText0 = substr($dateTimeText0, 0, 2); } elseif (substr($dateTimeText0, -5) == substr($dateTimeText1, -5)) { $dateTimeText0 = substr($dateTimeText0, 0, 5); } } elseif ($dateformat == 'M-d-Y') { if (substr($dateTimeText0, 0, 3) == substr($dateTimeText1, 0, 3)) { $dateTimeText0 = substr($dateTimeText0, 0, 6); $dateTimeText1 = substr($dateTimeText1, -7); } elseif (substr($dateTimeText0, -5) == substr($dateTimeText1, -5)) { $dateTimeText0 = substr($dateTimeText0, 0, 6); } } $this->pdf->addTextWrap(50, $liney, 600, 10, ReportEpehemeridesFor . ' ' . $dateTimeText0 . "-" . $dateTimeText1 . ' ' . ReportEpehemeridesIn . ' ' . $objLocation->getLocationPropertyFromId($objObserver->getObserverProperty($loggedUser, 'stdlocation'), 'name') . ReportInLocalTime, 'left'); $liney -= 5; $this->pdf->line(50, $liney, $this->canvasDimensionXpx - 50, $liney); $liney -= 15; $this->pdf->addTextWrap(50, $liney, 150, 10, LangMoonSun . ' ' . LangMoonSet . ': ' . $_SESSION['efemerides']['sset'], 'left'); $this->pdf->addTextWrap(250, $liney, 150, 10, LangMoonSun . ' ' . LangMoonRise . ': ' . $_SESSION['efemerides']['srise'], 'left'); $this->pdf->addTextWrap(450, $liney, 150, 10, LangMoon . ' ' . LangMoonRise . ': ' . $_SESSION['efemerides']['moon0'], 'left'); $this->pdf->addTextWrap(650, $liney, 150, 10, LangMoon . ' ' . LangMoonSet . ': ' . $_SESSION['efemerides']['moon2'], 'left'); $liney -= 15; $this->pdf->addTextWrap(50, $liney, 350, 10, LangAstronomicalTwilight . ' ' . LangFrom . ' ' . $_SESSION['efemerides']['astroe'] . LangTo . $_SESSION['efemerides']['astrob'], 'left'); $this->pdf->addTextWrap(450, $liney, 350, 10, LangNauticalTwilight . ' ' . LangFrom . ' ' . $_SESSION['efemerides']['naute'] . LangTo . $_SESSION['efemerides']['nautb'], 'left'); $liney -= 15; $this->pdf->addTextWrap(50, $liney, 150, 10, LangpdfseriesObject . ' ' . LangMoonRise . ': ' . $theobjectdata['objectrise'], 'left'); $this->pdf->addTextWrap(250, $liney, 150, 10, LangTransit . ': ' . $theobjectdata['objecttransit'], 'left'); $this->pdf->addTextWrap(450, $liney, 150, 10, LangMoonSet . ': ' . $theobjectdata['objectset'], 'left'); $this->pdf->addTextWrap(650, $liney, 150, 10, LangMaxAltitude . ": " . $objPresentations->decToString($theobjectdata['objectmaxaltitude'], 0), 'left'); $liney -= 15; } $liney -= 10; if ($objObserver->getObserverProperty($loggedUser, 'stdLocation') && $yearephemerides == 'true') { $this->pdf->addTextWrap(50, $liney, $this->canvasDimensionXpx - 100, 10, ReportEpehemeridesFor . ' ' . $theShowname . ' ' . ReportEpehemeridesIn . ' ' . $objLocation->getLocationPropertyFromId($objObserver->getObserverProperty($loggedUser, 'stdlocation'), 'name') . ReportInLocalTime, 'left'); $liney -= 5; $this->pdf->line(50, $liney, $this->canvasDimensionXpx - 50, $liney); $theLocation = $objObserver->getObserverProperty($loggedUser, 'stdLocation'); $liney -= 15; $object = $theobject; $longitude = 1.0 * $objLocation->getLocationPropertyFromId($theLocation, 'longitude'); $latitude = 1.0 * $objLocation->getLocationPropertyFromId($theLocation, 'latitude'); $timezone = $objLocation->getLocationPropertyFromId($theLocation, 'timezone'); $dateTimeZone = new DateTimeZone($timezone); for ($i = 1; $i < 13; $i++) { $datestr = sprintf("%02d", $i) . "/" . sprintf("%02d", 1) . "/" . $_SESSION['globalYear']; $dateTime = new DateTime($datestr, $dateTimeZone); $timedifference = $dateTimeZone->getOffset($dateTime); if (strncmp($timezone, "Etc/GMT", 7) == 0) { $timedifference = -$timedifference; } date_default_timezone_set("UTC"); $theTimeDifference1[$i] = $timedifference; $theEphemerides1[$i] = $objObject->getEphemerides($object, 1, $i, 2010); $theNightEphemerides1[$i] = date_sun_info(strtotime("2010" . "-" . $i . "-" . "1"), $latitude, $longitude); $datestr = sprintf("%02d", $i) . "/" . sprintf("%02d", 1) . "/" . $_SESSION['globalYear']; $dateTime = new DateTime($datestr, $dateTimeZone); $timedifference = $dateTimeZone->getOffset($dateTime); if (strncmp($timezone, "Etc/GMT", 7) == 0) { $timedifference = -$timedifference; } date_default_timezone_set("UTC"); $theTimeDifference15[$i] = $timedifference; $theEphemerides15[$i] = $objObject->getEphemerides($object, 15, $i, 2010); $theNightEphemerides15[$i] = date_sun_info(strtotime("2010" . "-" . $i . "-" . "15"), $latitude, $longitude); } $this->pdf->addTextWrap(50, $liney, 100, 8, LangMonth, 'center'); for ($i = 1; $i < 7; $i++) { $this->pdf->addTextWrap(100 + 100 * $i, $liney, 50, 8, $i, 'center'); } $liney -= 15; $this->pdf->addTextWrap(50, $liney, 100, 8, LangMaxAltitude, 'center'); for ($i = 1; $i < 7; $i++) { $colorclass = ""; $colorclass2 = ""; if ($i == 1) { if ($theEphemerides1[$i]['altitude'] != '-' && ($theEphemerides1[$i]['altitude'] == $theEphemerides15[$i]['altitude'] || $theEphemerides1[$i]['altitude'] == $theEphemerides15[12]['altitude'])) { $colorclass = "<c:uline><b>"; $colorclass2 = "</c:uline></b>"; } } else { if ($theEphemerides1[$i]['altitude'] != '-' && ($theEphemerides1[$i]['altitude'] == $theEphemerides15[$i]['altitude'] || $theEphemerides1[$i]['altitude'] == $theEphemerides15[$i - 1]['altitude'])) { $colorclass = "<c:uline><b>"; $colorclass2 = "</c:uline></b>"; } } $this->pdf->addTextWrap(50 + 100 * $i, $liney, 50, 8, $colorclass . $this->filterdegpart($theEphemerides1[$i]['altitude']) . $colorclass2, 'center'); $colorclass = ""; $colorclass2 = ""; if ($theEphemerides15[$i]['altitude'] != '-' && ($theEphemerides15[$i]['altitude'] == $theEphemerides1[$i]['altitude'] || $theEphemerides15[$i]['altitude'] == $theEphemerides1[$i + 1]['altitude'])) { $colorclass = "<c:uline><b>"; $colorclass2 = "</c:uline></b>"; } $this->pdf->addTextWrap(100 + 100 * $i, $liney, 50, 8, $colorclass . $this->filterdegpart($theEphemerides15[$i]['altitude']) . $colorclass2, 'center'); } $colorclass = ""; $colorclass2 = ""; if ($theEphemerides1[7]['altitude'] != '-' && ($theEphemerides1[7]['altitude'] == $theEphemerides15[7]['altitude'] || $theEphemerides1[7]['altitude'] == $theEphemerides15[6]['altitude'])) { $colorclass = "<c:uline><b>"; $colorclass2 = "</c:uline></b>"; } $this->pdf->addTextWrap(50 + 100 * 7, $liney, 50, 8, $colorclass . $this->filterdegpart($theEphemerides1[7]['altitude']) . $colorclass2, 'center'); $liney -= 15; $this->pdf->addTextWrap(50, $liney, 100, 8, LangTransit, 'center'); for ($i = 1; $i < 7; $i++) { $colorclass = ""; $colorclass2 = ""; if (date("H:i", $theNightEphemerides1[$i]["astronomical_twilight_end"]) != "00:00" && $objUtil->checkNightHourMinuteBetweenOthers($theEphemerides1[$i]['transit'], date("H:i", $theNightEphemerides1[$i]["astronomical_twilight_end"] + $theTimeDifference1[$i]), date("H:i", $theNightEphemerides1[$i]["astronomical_twilight_begin"] + $theTimeDifference1[$i]))) { $colorclass = "<c:uline><b>"; $colorclass2 = "</c:uline></b>"; } $this->pdf->addTextWrap(50 + 100 * $i, $liney, 50, 8, $colorclass . $theEphemerides1[$i]['transit'] . $colorclass2, "center"); $colorclass = ""; $colorclass2 = ""; if (date("H:i", $theNightEphemerides15[$i]["nautical_twilight_end"]) != "00:00" && $objUtil->checkNightHourMinuteBetweenOthers($theEphemerides15[$i]['transit'], date("H:i", $theNightEphemerides15[$i]["astronomical_twilight_end"] + $theTimeDifference15[$i]), date("H:i", $theNightEphemerides15[$i]["astronomical_twilight_begin"] + $theTimeDifference15[$i]))) { $colorclass = "<c:uline><b>"; $colorclass2 = "</c:uline></b>"; } $this->pdf->addTextWrap(100 + 100 * $i, $liney, 50, 8, $colorclass . $theEphemerides15[$i]['transit'] . $colorclass2, "center"); } $colorclass = ""; $colorclass2 = ""; if (date("H:i", $theNightEphemerides1[7]["astronomical_twilight_end"]) != "00:00" && $objUtil->checkNightHourMinuteBetweenOthers($theEphemerides1[7]['transit'], date("H:i", $theNightEphemerides1[7]["astronomical_twilight_end"] + $theTimeDifference1[7]), date("H:i", $theNightEphemerides1[7]["astronomical_twilight_begin"] + $theTimeDifference1[7]))) { $colorclass = "<c:uline><b>"; $colorclass2 = "</c:uline></b>"; } $this->pdf->addTextWrap(50 + 100 * $i, $liney, 50, 8, $colorclass . $theEphemerides1[7]['transit'] . $colorclass2, "center"); $liney -= 15; $this->pdf->addTextWrap(50, $liney - 4, 100, 8, LangAstroNight, 'center'); for ($i = 1; $i < 7; $i++) { if (date("H:i", $theNightEphemerides1[$i]["astronomical_twilight_end"]) == "00:00") { $this->pdf->addTextWrap(50 + 100 * $i, $liney - 4, 50, 8, "-", "center"); } else { $this->pdf->addTextWrap(50 + 100 * $i, $liney, 50, 8, date("H:i", $theNightEphemerides1[$i]["astronomical_twilight_end"] + $theTimeDifference1[$i]), "center"); $this->pdf->addTextWrap(50 + 100 * $i, $liney - 7, 50, 8, date("H:i", $theNightEphemerides1[$i]["astronomical_twilight_begin"] + $theTimeDifference1[$i]), 'center'); } if (date("H:i", $theNightEphemerides15[$i]["astronomical_twilight_end"]) == "00:00") { $this->pdf->addTextWrap(100 + 100 * $i, $liney - 4, 50, 8, "-", "center"); } else { $this->pdf->addTextWrap(100 + 100 * $i, $liney, 50, 8, date("H:i", $theNightEphemerides15[$i]["astronomical_twilight_end"] + $theTimeDifference15[$i]), "center"); $this->pdf->addTextWrap(100 + 100 * $i, $liney - 7, 50, 8, date("H:i", $theNightEphemerides15[$i]["astronomical_twilight_begin"] + $theTimeDifference15[$i]), 'center'); } } if (date("H:i", $theNightEphemerides1[7]["astronomical_twilight_end"]) == "00:00") { $this->pdf->addTextWrap(50 + 100 * 7, $liney - 7, 50, 8, "-", "center"); } else { $this->pdf->addTextWrap(50 + 100 * 7, $liney, 50, 8, date("H:i", $theNightEphemerides1[7]["astronomical_twilight_end"] + $theTimeDifference1[7]), "center"); $this->pdf->addTextWrap(50 + 100 * 7, $liney - 7, 50, 8, date("H:i", $theNightEphemerides1[7]["astronomical_twilight_begin"] + $theTimeDifference1[7]), 'center'); } $liney -= 25; $this->pdf->addTextWrap(50, $liney - 4, 100, 8, LangNauticalNight, 'center'); for ($i = 1; $i < 7; $i++) { if (date("H:i", $theNightEphemerides1[$i]["nautical_twilight_end"]) == "00:00") { $this->pdf->addTextWrap(50 + 100 * $i, $liney - 4, 50, 8, "-", "center"); } else { $this->pdf->addTextWrap(50 + 100 * $i, $liney, 50, 8, date("H:i", $theNightEphemerides1[$i]["nautical_twilight_end"] + $theTimeDifference1[$i]), "center"); $this->pdf->addTextWrap(50 + 100 * $i, $liney - 7, 50, 8, date("H:i", $theNightEphemerides1[$i]["nautical_twilight_begin"] + $theTimeDifference1[$i]), 'center'); } if (date("H:i", $theNightEphemerides15[$i]["nautical_twilight_end"]) == "00:00") { $this->pdf->addTextWrap(100 + 100 * $i, $liney - 4, 50, 8, "-", "center"); } else { $this->pdf->addTextWrap(100 + 100 * $i, $liney, 50, 8, date("H:i", $theNightEphemerides15[$i]["nautical_twilight_end"] + $theTimeDifference15[$i]), "center"); $this->pdf->addTextWrap(100 + 100 * $i, $liney - 7, 50, 8, date("H:i", $theNightEphemerides15[$i]["nautical_twilight_begin"] + $theTimeDifference15[$i]), 'center'); } } if (date("H:i", $theNightEphemerides1[7]["nautical_twilight_end"]) == "00:00") { $this->pdf->addTextWrap(50 + 100 * 7, $liney - 7, 50, 8, "-", "center"); } else { $this->pdf->addTextWrap(50 + 100 * 7, $liney, 50, 8, date("H:i", $theNightEphemerides1[7]["nautical_twilight_end"] + $theTimeDifference1[7]), "center"); $this->pdf->addTextWrap(50 + 100 * 7, $liney - 7, 50, 8, date("H:i", $theNightEphemerides1[7]["nautical_twilight_begin"] + $theTimeDifference1[7]), 'center'); } $liney -= 25; $this->pdf->addTextWrap(50, $liney - 4, 100, 8, LangObjectRiseSet2, 'center'); for ($i = 1; $i < 7; $i++) { if ($theEphemerides1[$i]['rise'] == '-') { $this->pdf->addTextWrap(50 + 100 * $i, $liney - 4, 50, 8, "-", "center"); } else { $this->pdf->addTextWrap(50 + 100 * $i, $liney, 50, 8, $theEphemerides1[$i]['rise'], "center"); $this->pdf->addTextWrap(50 + 100 * $i, $liney - 7, 50, 8, $theEphemerides1[$i]['set'], 'center'); } if ($theEphemerides1[$i]['rise'] == '-') { $this->pdf->addTextWrap(100 + 100 * $i, $liney - 4, 50, 8, "-", "center"); } else { $this->pdf->addTextWrap(100 + 100 * $i, $liney, 50, 8, $theEphemerides15[$i]['rise'], "center"); $this->pdf->addTextWrap(100 + 100 * $i, $liney - 7, 50, 8, $theEphemerides15[$i]['set'], 'center'); } } if ($theEphemerides1[7]['rise'] == '-') { $this->pdf->addTextWrap(50 + 100 * 7, $liney - 4, 50, 8, "-", "center"); } else { $this->pdf->addTextWrap(50 + 100 * 7, $liney, 50, 8, $theEphemerides1[7]['rise'], "center"); $this->pdf->addTextWrap(50 + 100 * 7, $liney - 7, 50, 8, $theEphemerides1[7]['set'], 'center'); } $liney -= 35; $this->pdf->addTextWrap(50, $liney, 100, 8, LangMonth, 'center'); for ($i = 7; $i < 13; $i++) { $this->pdf->addTextWrap(100 + 100 * $i - 600, $liney, 50, 8, $i, 'center'); } $liney -= 15; $this->pdf->addTextWrap(50, $liney, 100, 8, LangMaxAltitude, 'center'); for ($i = 7; $i < 13; $i++) { $colorclass = ""; $colorclass2 = ""; if ($theEphemerides1[$i]['altitude'] != '-' && ($theEphemerides1[$i]['altitude'] == $theEphemerides15[$i]['altitude'] || $theEphemerides1[$i]['altitude'] == $theEphemerides15[$i - 1]['altitude'])) { $colorclass = "<c:uline><b>"; $colorclass2 = "</c:uline></b>"; } $this->pdf->addTextWrap(100 * $i - 550, $liney, 50, 8, $colorclass . $this->filterdegpart($theEphemerides1[$i]['altitude']) . $colorclass2, 'center'); $colorclass = ""; $colorclass2 = ""; if ($i == 12) { if ($theEphemerides15[$i]['altitude'] != '-' && ($theEphemerides15[$i]['altitude'] == $theEphemerides1[$i]['altitude'] || $theEphemerides15[$i]['altitude'] == $theEphemerides1[1]['altitude'])) { $colorclass = "<c:uline><b>"; $colorclass2 = "</c:uline></b>"; } } else { if ($theEphemerides15[$i]['altitude'] != '-' && ($theEphemerides15[$i]['altitude'] == $theEphemerides1[$i]['altitude'] || $theEphemerides15[$i]['altitude'] == $theEphemerides1[$i + 1]['altitude'])) { $colorclass = "<c:uline><b>"; $colorclass2 = "</c:uline></b>"; } } $this->pdf->addTextWrap(100 * $i - 500, $liney, 50, 8, $colorclass . $this->filterdegpart($theEphemerides15[$i]['altitude']) . $colorclass2, 'center'); } $colorclass = ""; $colorclass2 = ""; if ($theEphemerides1[1]['altitude'] != '-' && ($theEphemerides1[1]['altitude'] == $theEphemerides15[12]['altitude'] || $theEphemerides1[1]['altitude'] == $theEphemerides15[1]['altitude'])) { $colorclass = "<c:uline><b>"; $colorclass2 = "</c:uline></b>"; } $this->pdf->addTextWrap(50 + 100 * 7, $liney, 50, 8, $colorclass . $this->filterdegpart($theEphemerides1[1]['altitude']) . $colorclass2, 'center'); $liney -= 15; $this->pdf->addTextWrap(50, $liney, 100, 8, LangTransit, 'center'); for ($i = 7; $i < 13; $i++) { $colorclass = ""; $colorclass2 = ""; if (date("H:i", $theNightEphemerides1[$i]["astronomical_twilight_end"]) != "00:00" && $objUtil->checkNightHourMinuteBetweenOthers($theEphemerides1[$i]['transit'], date("H:i", $theNightEphemerides1[$i]["astronomical_twilight_end"] + $theTimeDifference1[$i]), date("H:i", $theNightEphemerides1[$i]["astronomical_twilight_begin"] + $theTimeDifference1[$i]))) { $colorclass = "<c:uline><b>"; $colorclass2 = "</c:uline></b>"; } $this->pdf->addTextWrap(100 * $i - 550, $liney, 50, 8, $colorclass . $theEphemerides1[$i]['transit'] . $colorclass2, "center"); $colorclass = ""; $colorclass2 = ""; if (date("H:i", $theNightEphemerides15[$i]["nautical_twilight_end"]) != "00:00" && $objUtil->checkNightHourMinuteBetweenOthers($theEphemerides15[$i]['transit'], date("H:i", $theNightEphemerides15[$i]["astronomical_twilight_end"] + $theTimeDifference15[$i]), date("H:i", $theNightEphemerides15[$i]["astronomical_twilight_begin"] + $theTimeDifference15[$i]))) { $colorclass = "<c:uline><b>"; $colorclass2 = "</c:uline></b>"; } $this->pdf->addTextWrap(100 * $i - 500, $liney, 50, 8, $colorclass . $theEphemerides15[$i]['transit'] . $colorclass2, "center"); } $colorclass = ""; $colorclass2 = ""; if (date("H:i", $theNightEphemerides1[1]["astronomical_twilight_end"]) != "00:00" && $objUtil->checkNightHourMinuteBetweenOthers($theEphemerides1[1]['transit'], date("H:i", $theNightEphemerides1[1]["astronomical_twilight_end"] + $theTimeDifference1[1]), date("H:i", $theNightEphemerides1[1]["astronomical_twilight_begin"] + $theTimeDifference1[1]))) { $colorclass = "<c:uline><b>"; $colorclass2 = "</c:uline></b>"; } $this->pdf->addTextWrap(100 * $i - 550, $liney, 50, 8, $colorclass . $theEphemerides1[1]['transit'] . $colorclass2, "center"); $liney -= 15; $this->pdf->addTextWrap(50, $liney - 4, 100, 8, LangAstroNight, 'center'); for ($i = 7; $i < 13; $i++) { if (date("H:i", $theNightEphemerides1[$i]["astronomical_twilight_end"]) == "00:00") { $this->pdf->addTextWrap(100 * $i - 550, $liney - 4, 50, 8, "-", "center"); } else { $this->pdf->addTextWrap(100 * $i - 550, $liney, 50, 8, date("H:i", $theNightEphemerides1[$i]["astronomical_twilight_end"] + $theTimeDifference1[$i]), "center"); $this->pdf->addTextWrap(100 * $i - 550, $liney - 7, 50, 8, date("H:i", $theNightEphemerides1[$i]["astronomical_twilight_begin"] + $theTimeDifference1[$i]), 'center'); } if (date("H:i", $theNightEphemerides15[$i]["astronomical_twilight_end"]) == "00:00") { $this->pdf->addTextWrap(100 * $i - 500, $liney - 4, 50, 8, "-", "center"); } else { $this->pdf->addTextWrap(100 * $i - 500, $liney, 50, 8, date("H:i", $theNightEphemerides15[$i]["astronomical_twilight_end"] + $theTimeDifference15[$i]), "center"); $this->pdf->addTextWrap(100 * $i - 500, $liney - 7, 50, 8, date("H:i", $theNightEphemerides15[$i]["astronomical_twilight_begin"] + $theTimeDifference15[$i]), 'center'); } } if (date("H:i", $theNightEphemerides1[1]["astronomical_twilight_end"]) == "00:00") { $this->pdf->addTextWrap(100 * 13 - 550, $liney - 7, 50, 8, "-", "center"); } else { $this->pdf->addTextWrap(100 * 13 - 550, $liney, 50, 8, date("H:i", $theNightEphemerides1[1]["astronomical_twilight_end"] + $theTimeDifference1[1]), "center"); $this->pdf->addTextWrap(100 * 13 - 550, $liney - 7, 50, 8, date("H:i", $theNightEphemerides1[1]["astronomical_twilight_begin"] + $theTimeDifference1[1]), 'center'); } $liney -= 25; $this->pdf->addTextWrap(50, $liney - 4, 100, 8, LangNauticalNight, 'center'); for ($i = 7; $i < 13; $i++) { if (date("H:i", $theNightEphemerides1[$i]["nautical_twilight_end"]) == "00:00") { $this->pdf->addTextWrap(100 * $i - 550, $liney - 4, 50, 8, "-", "center"); } else { $this->pdf->addTextWrap(100 * $i - 550, $liney, 50, 8, date("H:i", $theNightEphemerides1[$i]["nautical_twilight_end"] + $theTimeDifference1[$i]), "center"); $this->pdf->addTextWrap(100 * $i - 550, $liney - 7, 50, 8, date("H:i", $theNightEphemerides1[$i]["nautical_twilight_begin"] + $theTimeDifference1[$i]), 'center'); } if (date("H:i", $theNightEphemerides15[$i]["nautical_twilight_end"]) == "00:00") { $this->pdf->addTextWrap(100 * $i - 500, $liney - 4, 50, 8, "-", "center"); } else { $this->pdf->addTextWrap(100 * $i - 500, $liney, 50, 8, date("H:i", $theNightEphemerides15[$i]["nautical_twilight_end"] + $theTimeDifference15[$i]), "center"); $this->pdf->addTextWrap(100 * $i - 500, $liney - 7, 50, 8, date("H:i", $theNightEphemerides15[$i]["nautical_twilight_begin"] + $theTimeDifference15[$i]), 'center'); } } if (date("H:i", $theNightEphemerides1[1]["nautical_twilight_end"]) == "00:00") { $this->pdf->addTextWrap(100 * 13 - 550, $liney - 7, 50, 8, "-", "center"); } else { $this->pdf->addTextWrap(100 * 13 - 550, $liney, 50, 8, date("H:i", $theNightEphemerides1[1]["nautical_twilight_end"] + $theTimeDifference1[1]), "center"); $this->pdf->addTextWrap(100 * 13 - 550, $liney - 7, 50, 8, date("H:i", $theNightEphemerides1[1]["nautical_twilight_begin"] + $theTimeDifference1[1]), 'center'); } $liney -= 25; $this->pdf->addTextWrap(50, $liney - 4, 100, 8, LangObjectRiseSet2, 'center'); for ($i = 7; $i < 13; $i++) { if ($theEphemerides1[$i]['rise'] == '-') { $this->pdf->addTextWrap(100 * $i - 550, $liney - 4, 50, 8, "-", "center"); } else { $this->pdf->addTextWrap(100 * $i - 550, $liney, 50, 8, $theEphemerides1[$i]['rise'], "center"); $this->pdf->addTextWrap(100 * $i - 550, $liney - 7, 50, 8, $theEphemerides1[$i]['set'], 'center'); } if ($theEphemerides1[$i]['rise'] == '-') { $this->pdf->addTextWrap(100 * $i - 500, $liney - 4, 50, 8, "-", "center"); } else { $this->pdf->addTextWrap(100 * $i - 500, $liney, 50, 8, $theEphemerides15[$i]['rise'], "center"); $this->pdf->addTextWrap(100 * $i - 500, $liney - 7, 50, 8, $theEphemerides15[$i]['set'], 'center'); } } if ($theEphemerides1[1]['rise'] == '-') { $this->pdf->addTextWrap(50 + 100 * 7, $liney - 4, 50, 8, "-", "center"); } else { $this->pdf->addTextWrap(50 + 100 * 7, $liney, 50, 8, $theEphemerides1[1]['rise'], "center"); $this->pdf->addTextWrap(50 + 100 * 7, $liney - 7, 50, 8, $theEphemerides1[1]['set'], 'center'); } } } $liney -= 35; $textextra = ''; if (($listname = $objUtil->checkSessionKey('listname')) && $objList->checkObjectInMyActiveList($theobject)) { $textextra = $this->pdf->addTextWrap(50, $liney, 750, 10, LangViewObservationField8, 'left'); $liney -= 5; $this->pdf->line(50, $liney, $this->canvasDimensionXpx - 50, $liney); $liney -= 15; $textextra = $this->pdf->addTextWrap(50, $liney, 750, 10, $objList->getListObjectDescription($theobject), 'left'); } elseif ($theobjectdata['objectdescription']) { $textextra = $this->pdf->addTextWrap(50, $liney, 750, 10, LangViewObservationField8, 'left'); $liney -= 5; $this->pdf->line(50, $liney, $this->canvasDimensionXpx - 50, $liney); $liney -= 15; $this->pdf->addTextWrap(50, $liney, 750, 10, $theobjectdata['objectdescription'], 'left'); } $liney -= 15; while ($textextra) { $textextra = $this->pdf->addTextWrap(50, $liney, 750, 10, $textextra, 'left'); $liney -= 15; if ($liney < 30) { $this->pdf->newPage(); $this->pdf->addTextWrap(0, 10, $this->pdf->ez['pageWidth'] - 10, 10, $theShowname, 'right'); $liney = $this->canvasDimensionYpx - 50; } } } if (is_array($thephotos) && array_key_exists(0, $thephotos) && $thephotos[0] > 0) { if ($firstpage) { $firstpage = false; } else { $this->pdf->newPage(); } // show small lookup map $theView = 120; $minDegs = $theView / 120; $i = $this->gridMaxDimension; while ($i && $this->gridDimensions[$i][0] < $minDegs) { $i--; } $this->gridActualDimension = $i; $this->atlasmagnitude = 10; $this->starsmagnitude = 11; $tempw = 200; $temph = 200; $tempx = $this->pdf->ez['pageWidth'] - $tempw - 30; $tempy = $this->pdf->ez['pageHeight'] - $temph - 15; $this->pdf->setLineStyle(0.5); $this->gridInitSpecial($tempx, $tempy, $tempw, $temph); $this->gridInitScale($this->atlaspagerahr, $this->atlaspagedecldeg, $this->atlaspagezoomdeg); $this->pdf->setStrokeColor(0.9, 0.9, 0.9); $this->pdf->setLineStyle(0.5, '', '', array(1)); $this->gridDrawCoordLines(); $this->pdf->setLineStyle(0.5, '', '', array()); $this->pdf->setStrokeColor(0.7, 0.7, 0.7); $this->pdf->setStrokeColor(0, 0, 0); $this->astroDrawStarsArr(); $this->astroDrawObjects($theobject); $this->pdf->setStrokeColor(0, 0, 0); $this->pdf->setColor(1, 1, 1); $this->pdf->filledRectangle(0, 0, $this->pdf->ez['pageWidth'], $tempy); $this->pdf->filledRectangle(0, 0, $tempx, $this->pdf->ez['pageHeight']); $this->pdf->filledRectangle($tempx + $tempw, 0, $this->pdf->ez['pageWidth'] - ($tempx + $tempw), $this->pdf->ez['pageHeight']); $this->pdf->filledRectangle(0, $tempy + $temph, $this->pdf->ez['pageWidth'], $this->pdf->ez['pageHeight'] - ($tempy + $temph)); $this->pdf->setColor(0, 0, 0); $this->pdf->rectangle($tempx, $tempy, $tempw, $temph); $this->pdf->addTextWrap(0, 10, $this->pdf->ez['pageWidth'] - 10, 10, $theShowname, 'right'); $liney = 25; if ($thephotos[0] > 75) { $thephotos[0] = 75; } $url = 'http://archive.stsci.edu/cgi-bin/dss_search?v=poss2ukstu_red&r=' . $raDSS . '.0&d=' . $declDSS . '&e=J2000&h=' . $thephotos[0] . '.0&w=' . $thephotos[0] . '&f=gif&c=none&fov=NONE&v3='; $this->pdf->addText(50, $liney - 15, 10, LangViewDSSImageTitle . $thephotos[0] . 'x' . $thephotos[0] . ' ' . LangNewObjectSizeUnits1); if ($img = @imagecreatefromgif($url)) { imagefilter($img, IMG_FILTER_NEGATE); $this->pdf->addImage($img, 50, $liney, 350); if ($thephotos[0] == 60) { $theView = 60; $minDegs = $theView / 120; $i = $this->gridMaxDimension; while ($i && $this->gridDimensions[$i][0] < $minDegs) { $i--; } $this->gridActualDimension = $i; $this->atlasmagnitude = -10; $tempw = 350; $temph = 350; $tempx = 50; $tempy = $liney; $this->pdf->setLineStyle(0.5); $this->gridInitSpecial($tempx, $tempy, $tempw, $temph); $this->gridInitScale($this->atlaspagerahr, $this->atlaspagedecldeg, $this->atlaspagezoomdeg); $this->astroDrawObject($theobject); $this->pdf->setStrokeColor(0, 0, 0); } } $this->pdf->rectangle(48, $liney - 2, 354, 354); if (is_array($thephotos) && array_key_exists(1, $thephotos) && $thephotos[1] > 0) { if ($thephotos[1] > 75) { $thephotos[1] = 75; } $url = 'http://archive.stsci.edu/cgi-bin/dss_search?v=poss2ukstu_red&r=' . $raDSS . '.0&d=' . $declDSS . '&e=J2000&h=' . $thephotos[1] . '.0&w=' . $thephotos[1] . '&f=gif&c=none&fov=NONE&v3='; $this->pdf->rectangle(448, $liney - 2, 354, 354); $this->pdf->addText(450, $liney - 15, 10, LangViewDSSImageTitle . $thephotos[1] . 'x' . $thephotos[1] . ' ' . LangNewObjectSizeUnits1); if ($img = @imagecreatefromgif($url)) { imagefilter($img, IMG_FILTER_NEGATE); $this->pdf->addImage($img, 450, $liney, 350); } } $this->pdf->rectangle(448, $liney - 2, 354, 354); $this->pdf->setColor(0, 0, 0); $liney = $this->canvasDimensionYpx - 50; $this->pdf->addTextWrap(50, $liney, $this->canvasDimensionXpx - 100, 15, ReportImagesFor . $theShowname, 'center'); $liney -= 5; $this->pdf->line(50, $liney, $this->canvasDimensionXpx - 250, $liney); $liney -= 15; $this->pdf->addTextWrap(50, $liney, 450, 10, '(c) STScI Digitized Sky Survey', 'left'); $liney -= 25; if ($datapage != 'true') { $theobjectdata = $objObject->getSeenObjectDetails(array($theobject => array(0, $theobject))); $theobjectdata = $theobjectdata[0]; $this->pdf->addTextWrap(50, $liney, 450, 10, Reportaltname . ": " . ($theobjectdata['altname'] ? $theobjectdata['altname'] : '-'), 'left'); $liney -= 25; $this->pdf->addTextWrap(50, $liney, 200, 10, Reportobjecttypefull . ': ' . $theobjectdata['objecttypefull'], 'left'); $this->pdf->addTextWrap(300, $liney, 200, 10, Reportobjectmagnitude . ': ' . ($theobjectdata['objectmagnitude'] ? $theobjectdata['objectmagnitude'] : '-'), 'left'); $liney -= 15; $this->pdf->addTextWrap(50, $liney, 200, 10, Reportobjectconstellationfull . ': ' . $theobjectdata['objectconstellationfull'], 'left'); $this->pdf->addTextWrap(300, $liney, 200, 10, Reportobjectsurfacebrightness . ': ' . ($theobjectdata['objectsurfacebrightness'] ? $theobjectdata['objectsurfacebrightness'] : '-'), 'left'); $liney -= 15; $this->pdf->addTextWrap(50, $liney, 200, 10, Reportobjectra . ': ' . $theobjectdata['objectrahms'], 'left'); $this->pdf->addTextWrap(300, $liney, 200, 10, LangViewObjectField9 . ': ' . ($theobjectdata['objectsize'] ? $theobjectdata['objectsize'] : '-'), 'left'); $liney -= 15; $this->pdf->addTextWrap(50, $liney, 200, 10, Reportobjectdecl . ': ' . $theobjectdata['objectdecldms'], 'left'); $this->pdf->addTextWrap(300, $liney, 200, 10, LangViewObjectField12 . ': ' . (($pa = $theobjectdata['objectpa']) == 999 ? '-' : $pa), 'left'); } $this->labelsArr = array(); } for ($k = 0; $k < count($theSet); $k++) { if (is_numeric($theSet[$k]) && is_numeric($thedsos[$k]) && is_numeric($thestars[$k])) { if ($firstpage) { $firstpage = false; } else { $this->pdf->newPage(); } $minDegs = $theSet[$k] / 120; $i = $this->gridMaxDimension; while ($i && $this->gridDimensions[$i][0] < $minDegs) { $i--; } $this->gridActualDimension = $i; $this->atlasmagnitude = max(min((int) $thedsos[$k], 99), 8); $this->starsmagnitude = max(min((int) $thestars[$k], 16), 8); $this->pdf->setLineStyle(0.5); $this->gridInit(); $this->gridInitScale($this->atlaspagerahr, $this->atlaspagedecldeg, $this->atlaspagezoomdeg); $this->pdf->setStrokeColor(0.9, 0.9, 0.9); $this->pdf->setLineStyle(0.5, '', '', array(1)); $this->gridDrawCoordLines(); $this->pdf->setLineStyle(0.5, '', '', array()); $this->pdf->setStrokeColor(0.7, 0.7, 0.7); $this->astroDrawConstellations(); $this->pdf->setStrokeColor(0, 0, 0); $this->astroDrawStarsArr(); $this->astroDrawObjects($theobject); $this->pdf->setColor(1, 1, 1); $this->pdf->filledRectangle(0, 0, $this->gridOffsetXpx, $this->canvasDimensionYpx); $this->pdf->filledRectangle(0, 0, $this->canvasDimensionXpx, $this->gridOffsetYpx); $this->pdf->filledRectangle($this->canvasDimensionXpx - $this->gridOffsetXpx, 0, $this->gridOffsetXpx, $this->canvasDimensionYpx); $this->pdf->filledRectangle(0, $this->canvasDimensionYpx - $this->gridOffsetYpx, $this->canvasDimensionXpx, $this->gridOffsetYpx); $this->pdf->setColor(0, 0, 0); $this->gridShowInfo(); $this->atlasDrawLegend(); $temp = $objObserver->getObserverProperty($loggedUser, 'firstname') . " " . $objObserver->getObserverProperty($loggedUser, 'name') . " - " . date('d M Y'); $this->pdf->addText($this->canvasDimensionXpx - $this->gridOffsetXpx - strlen($temp) * 5, $this->canvasDimensionYpx - $this->Legend1y - 10, $this->fontSize1b, $temp); $this->pdf->setLineStyle(2, 'round'); $this->pdf->rectangle($this->gridOffsetXpx - 1, $this->gridOffsetYpx - 1, $this->canvasDimensionXpx - ($this->gridOffsetXpx << 1) + 2, $this->canvasDimensionYpx - ($this->gridOffsetYpx << 1) + 2); for ($i = 0, $z = count($this->labelsArr); $i < $z; $i++) { $this->pdf->addTextWrap($this->labelsArr[$i][0], $this->labelsArr[$i][1], $this->labelsArr[$i][2], $this->labelsArr[$i][3], $this->labelsArr[$i][4], $this->labelsArr[$i][5]); } $this->labelsArr = array(); $temp = '(c) www.deepskylog.org - No publishing without written autorisation - Object Database originally based on Eye&Telescope - Star Database by Tycho 2+ and USNO UCAC3 (Zacharia).'; $this->pdf->addTextWrap(0, 10, $this->pdf->ez['pageWidth'] - 10, 10, $theShowname, 'right'); $this->pdf->addText($this->gridOffsetXpx, 13, $this->fontSize1b, $temp); $astroObjects[$k] = $objObject->getSeenObjectDetails($this->astroObjectsArr); } } if ($reportlayoutselect) { if ($firstpage) { $firstpage = false; } else { $this->pdf->newPage(); $this->pdf->addTextWrap(0, 10, $this->pdf->ez['pageWidth'] - 10, 10, $theShowname, 'right'); } $this->pdf->setLineStyle(1); $reportuser = substr($reportlayoutselect, 0, strpos($reportlayoutselect, ": ")); $reportname = 'ReportQueryOfObjects'; $reportlayout = substr($reportlayoutselect, strpos($reportlayoutselect, ": ") + 2); $reportdata = $objReportLayout->getReportData($reportuser, $reportname, $reportlayout); $pagesize = $objReportLayout->getLayoutFieldPosition($reportuser, $reportname, $reportlayout, 'pagesize'); $pageorientation = $objReportLayout->getLayoutFieldPosition($reportuser, $reportname, $reportlayout, 'pageorientation'); $bottom = $objReportLayout->getLayoutFieldPosition($reportuser, $reportname, $reportlayout, 'bottom'); $top = $objReportLayout->getLayoutFieldPosition($reportuser, $reportname, $reportlayout, 'top'); $header = $objReportLayout->getLayoutFieldPosition($reportuser, $reportname, $reportlayout, 'header'); $footer = $objReportLayout->getLayoutFieldPosition($reportuser, $reportname, $reportlayout, 'footer'); $xleft = $objReportLayout->getLayoutFieldPosition($reportuser, $reportname, $reportlayout, 'xleft'); $xmid = $objReportLayout->getLayoutFieldPosition($reportuser, $reportname, $reportlayout, 'xmid'); $fontSizeSection = $objReportLayout->getLayoutFieldPosition($reportuser, $reportname, $reportlayout, 'fontSizeSection'); $fontSizeText = $objReportLayout->getLayoutFieldPosition($reportuser, $reportname, $reportlayout, 'fontSizeText'); $sectionBarSpace = $objReportLayout->getLayoutFieldPosition($reportuser, $reportname, $reportlayout, 'sectionbarspace'); $deltalineSection = $objReportLayout->getLayoutFieldPosition($reportuser, $reportname, $reportlayout, 'deltalineSection'); $deltaline = $objReportLayout->getLayoutFieldPosition($reportuser, $reportname, $reportlayout, 'deltalineExtra') + $fontSizeText; $deltaobjectline = $objReportLayout->getLayoutFieldPosition($reportuser, $reportname, $reportlayout, 'deltaobjectline'); $pagenr = $objReportLayout->getLayoutFieldPosition($reportuser, $reportname, $reportlayout, 'startpagenumber'); $sectionBarHeight = $objReportLayout->getLayoutFieldPosition($reportuser, $reportname, $reportlayout, 'sectionBarHeightextra') + $fontSizeSection; $SectionBarWidth = $objReportLayout->getLayoutFieldPosition($reportuser, $reportname, $reportlayout, 'SectionBarWidthbase') + $sectionBarSpace; $showelements = $objReportLayout->getLayoutFieldPosition($reportuser, $reportname, $reportlayout, 'showelements'); $this->pdf->selectFont($instDir . 'lib/fonts/Helvetica.afm'); $sort = ''; $actualsort = ''; $theDate = date('d/m/Y'); $objUtil->firstpage($y, $bottom, $top, $xbase, $xmid, $pagenr, $this->pdf, $xleft, $header, $fontSizeText, $theDate, $footer, $SectionBarWidth, $sectionBarSpace, $deltalineSection, $sectionBarHeight, $fontSizeSection, $deltaline, $deltalineSection, '', $showelements, $reportdata); for ($j = 0; $j < $k; $j++) { $y -= $deltalineSection; $this->pdf->rectangle($xbase - $sectionBarSpace, $y - $sectionBarSpace, $SectionBarWidth, $sectionBarHeight); $this->pdf->addText($xbase, $y, $fontSizeSection, 'Chart ' . ($j + 1)); $y -= $deltaline + $deltalineSection; $result = $astroObjects[$j]; while (list($key, $valueA) = each($result)) { $con = $valueA['objectconstellation']; $deltaymax = 0; reset($reportdata); while (list($key, $dataelement) = each($reportdata)) { if ($dataelement['fieldwidth']) { if ($dataelement['fieldname'] == "objectlistdescription") { if (array_key_exists('objectlistdescription', $valueA) && $valueA['objectlistdescription']) { $deltaymax = max($deltaymax, $dataelement['fieldline']); } } elseif ($dataelement['fieldname'] == "objectdescription") { if (array_key_exists('objectdescription', $valueA) && $valueA['objectdescription'] != '') { $deltaymax = max($deltaymax, $dataelement['fieldline']); } } else { $deltaymax = max($deltaymax, $dataelement['fieldline']); } } } $deltaymax++; if ($y - $deltaline * $deltaymax < $bottom && $sort) { $this->{$objUtil}->newpage($y, $bottom, $top, $bottom, $xbase, $xmid, $pagenr, $this->pdf, $xleft, $header, $fontSizeText, $theDate, $footer, $SectionBarWidth, $sectionBarSpace, $sort, $con, $deltalineSection, $sectionBarHeight, $fontSizeSection, $deltaline, $deltalineSection, "", "", $showelements, $reportdata); } elseif ($y - $deltaline * $deltaymax < $bottom && !$sort) { $objUtil->newpage($y, $bottom, $top, $bottom, $xbase, $xmid, $pagenr, $this->pdf, $xleft, $header, $fontSizeText, $theDate, $footer, $SectionBarWidth, $sectionBarSpace, $sort, $con, $deltalineSection, $sectionBarHeight, $fontSizeSection, $deltaline, $deltalineSection, "", "", $showelements, $reportdata); if (strpos($showelements, 's') !== FALSE) { $this->pdf->setLineStyle(0.5); $this->pdf->line($xbase - $sectionBarSpace, $y + ($deltaline + $deltaobjectline) * 0.75, $xbase + $SectionBarWidth, $y + ($deltaline + $deltaobjectline) * 0.75); $this->pdf->setLineStyle(1); } } elseif ($sort && ${$sort} != $actualsort) { if ($y - $deltaline * $deltaymax - $sectionBarSpace - $deltalineSection < $bottom) { $objUtil->newpage($y, $bottom, $top, $bottom, $xbase, $xmid, $pagenr, $this->pdf, $xleft, $header, $fontSizeText, $theDate, $footer, $SectionBarWidth, $sectionBarSpace, $sort, $con, $deltalineSection, $sectionBarHeight, $fontSizeSection, $deltaline, $deltalineSection, "", "", $showelements, $reportdata); } else { $y -= $deltalineSection; $this->pdf->rectangle($xbase - $sectionBarSpace, $y - $sectionBarSpace, $SectionBarWidth, $sectionBarHeight); $this->pdf->addText($xbase, $y, $fontSizeSection, $GLOBALS[${$sort}]); $y -= $deltaline + $deltalineSection; } $indexlist[${$sort}] = $pagenr; } else { if (strpos($showelements, 's') !== FALSE) { $this->pdf->setLineStyle(0.5); $this->pdf->line($xbase - $sectionBarSpace, $y + ($deltaline + $deltaobjectline) * 0.75, $xbase + $SectionBarWidth, $y + ($deltaline + $deltaobjectline) * 0.75); $this->pdf->setLineStyle(1); } } reset($reportdata); $deltaymax = 0; while (list($key, $dataelement) = each($reportdata)) { if ($dataelement['fieldwidth']) { if ($y - $deltaline * $dataelement['fieldline'] < $bottom) { $objUtil->newpage($y, $bottom, $top, $bottom, $xbase, $xmid, $pagenr, $this->pdf, $xleft, $header, $fontSizeText, $theDate, $footer, $SectionBarWidth, $sectionBarSpace, $sort, $con, $deltalineSection, $sectionBarHeight, $fontSizeSection, $deltaline, $deltalineSection, "", "", $showelements, $reportdata); } $justification = 'left'; $i = ''; $b = ''; if (strpos($dataelement['fieldstyle'], 'r') !== FALSE) { $justification = 'right'; } if (strpos($dataelement['fieldstyle'], 'c') !== FALSE) { $justification = 'center'; } if (strpos($dataelement['fieldstyle'], 'b') !== FALSE) { $b = "<c:uline><b>"; $this->pdf->addText(0, 0, $fontSizeText, '<b>'); } if (strpos($dataelement['fieldstyle'], 'i') !== FALSE) { $i = '<i>'; $this->pdf->addText(0, 0, $fontSizeText, '<i>'); } if ($dataelement['fieldname'] == "showname") { if ($valueA[$dataelement['fieldname']]) { $this->pdf->addText(0, 0, $fontSizeText, '<c:alink:' . $baseURL . 'index.php?indexAction=detail_object&object=' . urlencode($valueA['objectname']) . '>'); $this->pdf->addTextWrap($xbase + $dataelement['fieldposition'], $y - $deltaline * $dataelement['fieldline'], $dataelement['fieldwidth'], $fontSizeText, $dataelement['fieldafter'] . html_entity_decode($valueA[$dataelement['fieldname']]) . $dataelement['fieldafter'], $justification); $this->pdf->addText(0, 0, $fontSizeText, '</c:alink>'); $deltaymax = max($deltaymax, $dataelement['fieldline']); } } else { if ($dataelement['fieldname'] == "objectuseratlaspage") { $this->pdf->addTextWrap($xbase + $dataelement['fieldposition'], $y - $deltaline * $dataelement['fieldline'], $dataelement['fieldwidth'], $fontSizeText, $dataelement['fieldbefore'] . html_entity_decode($valueA[$loggedUser ? $objObserver->getObserverProperty($loggedUser, 'standardAtlasCode', 'urano') : 'urano']) . $dataelement['fieldafter'], $justification); $deltaymax = max($deltaymax, $dataelement['fieldline']); } else { if ($dataelement['fieldname'] == "objectlistdescription") { if (array_key_exists('objectlistdescription', $valueA) && $valueA['objectlistdescription'] != '') { $theText = $dataelement['fieldbefore'] . html_entity_decode($objPresentations->br2nl($valueA['objectlistdescription'])) . $dataelement['fieldafter']; $theText = $this->pdf->addTextWrap($xbase + $dataelement['fieldposition'], $y - $deltaline * $dataelement['fieldline'], $dataelement['fieldwidth'], $fontSizeText, $theText, $justification); while ($theText) { $y -= $deltaline; if ($y - $deltaline * $dataelement['fieldline'] < $bottom) { $objUtil->newpage($y, $bottom, $top, $bottom, $xbase, $xmid, $pagenr, $this->pdf, $xleft, $header, $fontSizeText, $theDate, $footer, $SectionBarWidth, $sectionBarSpace, $sort, $con, $deltalineSection, $sectionBarHeight, $fontSizeSection, $deltaline, $deltalineSection, $i, $b, $showelements, $reportdata); $y += $deltaline * $dataelement['fieldline']; } $theText = $this->pdf->addTextWrap($xbase + $dataelement['fieldposition'], $y - $deltaline * $dataelement['fieldline'], $dataelement['fieldwidth'], $fontSizeText, $theText, $justification); } $deltaymax = max($deltaymax, $dataelement['fieldline']); } } elseif ($dataelement['fieldname'] == "objectdescription") { if (array_key_exists('objectlistdescription', $valueA) && $valueA['objectlistdescription'] != '') { $theText = $dataelement['fieldbefore'] . html_entity_decode($objPresentations->br2nl($valueA['objectlistdescription'])) . $dataelement['fieldafter']; $theText = $this->pdf->addTextWrap($xbase + $dataelement['fieldposition'], $y - $deltaline * $dataelement['fieldline'], $dataelement['fieldwidth'], $fontSizeText, $theText, $justification); while ($theText) { $y -= $deltaline; if ($y - $deltaline * $dataelement['fieldline'] < $bottom) { $objUtil->newpage($y, $bottom, $top, $bottom, $xbase, $xmid, $pagenr, $this->pdf, $xleft, $header, $fontSizeText, $theDate, $footer, $SectionBarWidth, $sectionBarSpace, $sort, $con, $deltalineSection, $sectionBarHeight, $fontSizeSection, $deltaline, $deltalineSection, $i, $b, $showelements, $reportdata); $y += $deltaline * $dataelement['fieldline']; } $theText = $this->pdf->addTextWrap($xbase + $dataelement['fieldposition'], $y - $deltaline * $dataelement['fieldline'], $dataelement['fieldwidth'], $fontSizeText, $theText, $justification); } $deltaymax = max($deltaymax, $dataelement['fieldline']); } else { if (array_key_exists('objectdescription', $valueA) && $valueA['objectdescription'] != '') { $theText = $dataelement['fieldbefore'] . html_entity_decode($objPresentations->br2nl($valueA['objectdescription'])) . $dataelement['fieldafter']; $theText = $this->pdf->addTextWrap($xbase + $dataelement['fieldposition'], $y - $deltaline * $dataelement['fieldline'], $dataelement['fieldwidth'], $fontSizeText, $theText, $justification); while ($theText) { $y -= $deltaline; if ($y - $deltaline * $dataelement['fieldline'] < $bottom) { $objUtil->newpage($y, $bottom, $top, $bottom, $xbase, $xmid, $pagenr, $this->pdf, $xleft, $header, $fontSizeText, $theDate, $footer, $SectionBarWidth, $sectionBarSpace, $sort, $con, $deltalineSection, $sectionBarHeight, $fontSizeSection, $deltaline, $deltalineSection, $i, $b, $showelements, $reportdata); $y += $deltaline * $dataelement['fieldline']; } $theText = $this->pdf->addTextWrap($xbase + $dataelement['fieldposition'], $y - $deltaline * $dataelement['fieldline'], $dataelement['fieldwidth'], $fontSizeText, $theText, $justification); } $deltaymax = max($deltaymax, $dataelement['fieldline']); } } } else { if ($valueA[$dataelement['fieldname']] != '') { $this->pdf->addTextWrap($xbase + $dataelement['fieldposition'], $y - $deltaline * $dataelement['fieldline'], $dataelement['fieldwidth'], $fontSizeText, $dataelement['fieldbefore'] . html_entity_decode($valueA[$dataelement['fieldname']]) . $dataelement['fieldafter'], $justification); $deltaymax = max($deltaymax, $dataelement['fieldline']); } } } } if (strpos($dataelement['fieldstyle'], 'b') !== FALSE) { $this->pdf->addText(0, 0, $fontSizeText, '</b>'); } if (strpos($dataelement['fieldstyle'], 'i') !== FALSE) { $this->pdf->addText(0, 0, $fontSizeText, '</i>'); } } } $y -= $deltaline * $deltaymax; $y -= $deltaline + $deltaobjectline; if ($sort) { $actualsort = ${$sort}; } } if (strpos($showelements, 'i') !== FALSE && count($indexlist) > 0 && $sort) { $base = $xmid; $objUtil->newpage($y, $bottom, $top, $bottom, $xbase, $xmid, $pagenr, $this->pdf, $xleft, $header, $fontSizeText, $theDate, $footer, $SectionBarWidth, $sectionBarSpace, '', '', $deltalineSection, $sectionBarHeight, $fontSizeSection, $deltaline, $deltalineSection, "", "", $showelements, $reportdata); $this->pdf->setLineStyle(0.5); $y = $top; while (list($key, $value) = each($indexlist)) { $this->pdf->line($xbase - $sectionBarSpace, $y + ($deltaline + $deltaobjectline) * 0.75, $xbase + $SectionBarWidth, $y + ($deltaline + $deltaobjectline) * 0.75); $this->pdf->addTextWrap($xbase, $y, 50, $fontSizeText, $key, 'left'); $this->pdf->addTextWrap($xbase + $SectionBarWidth - $sectionBarSpace - 50, $y, 50, $fontSizeText, trim($value), 'right'); $y -= $deltaline + $deltaobjectline; if ($y - ($deltaline + $deltaobjectline) < $bottom) { $objUtil->newpage($y, $bottom, $top, $bottom, $xbase, $xmid, $pagenr, $this->pdf, $xleft, $header, $fontSizeText, $theDate, $footer, $SectionBarWidth, $sectionBarSpace, '', '', $deltalineSection, $sectionBarHeight, $fontSizeSection, $deltaline, $deltalineSection, "", "", $showelements, $reportdata); $this->pdf->setLineStyle(0.5); } } } } } if (!$nostream) { $this->pdf->Stream(); } }
<?php /* Prototype : array date_sun_info ( int $time , float $latitude , float $longitude ) * Description: Returns an array with information about sunset/sunrise and twilight begin/end. * Source code: ext/standard/data/php_date.c */ date_default_timezone_set("UTC"); echo "*** Testing date_sun_info() : usage variations ***\n"; //get an unset variable $unset_var = 10; unset($unset_var); // heredoc string $heredoc = <<<EOT abc xyz EOT; // get a resource variable $fp = fopen(__FILE__, "r"); $inputs = array(0, 1, 12345, -2345, 10.5, -10.5, 123456789000.0, 1.23456789E-9, 0.5, NULL, null, true, false, TRUE, FALSE, "", '', array(), "abcxyz", 'abcxyz', $heredoc, @$undefined_var, @$unset_var, $fp); // loop through each element of $inputs to check the behaviour of date_sun_info() $iterator = 1; foreach ($inputs as $input) { echo "\n-- Iteration {$iterator} --\n"; var_dump(date_sun_info(strtotime("2006-12-12"), $input, 35.2333)); $iterator++; } ?> ===Done===