Names Fix
This commit is contained in:
118
astro_functions.php
Normal file
118
astro_functions.php
Normal file
@@ -0,0 +1,118 @@
|
||||
<?php
|
||||
|
||||
require_once 'constants.php';
|
||||
|
||||
function getPlanetName(string $planetKey, string $mode = NAME_MODE_MODERN): string
|
||||
{
|
||||
return PLANET_NAMES[$mode][$planetKey] ?? $planetKey;
|
||||
}
|
||||
|
||||
function getPlanetShortName(string $planetKey): string
|
||||
{
|
||||
return PLANET_SHORT_NAMES[$planetKey] ?? strtoupper(substr($planetKey, 0, 2));
|
||||
}
|
||||
|
||||
function getSignName(string $signKey, string $mode = NAME_MODE_MODERN): string
|
||||
{
|
||||
return SIGN_NAMES[$mode][$signKey] ?? $signKey;
|
||||
}
|
||||
|
||||
function getNakshatraName(string $nakshatraKey, string $mode = NAME_MODE_MODERN): string
|
||||
{
|
||||
return NAKSHATRA_NAMES[$mode][$nakshatraKey] ?? $nakshatraKey;
|
||||
}
|
||||
|
||||
function getSignKeyByIndex(int $index): string
|
||||
{
|
||||
return SIGN_KEYS[$index] ?? SIGN_KEYS[0];
|
||||
}
|
||||
|
||||
function getNakshatraKeyByIndex(int $index): string
|
||||
{
|
||||
return NAKSHATRA_KEYS[$index] ?? NAKSHATRA_KEYS[0];
|
||||
}
|
||||
|
||||
function formatDegree(float $degree): string
|
||||
{
|
||||
$deg = floor($degree);
|
||||
$minutesFloat = ($degree - $deg) * 60;
|
||||
$min = floor($minutesFloat);
|
||||
$sec = floor(($minutesFloat - $min) * 60);
|
||||
|
||||
return $deg . ' deg ' . str_pad((string)$min, 2, '0', STR_PAD_LEFT) . "' " .
|
||||
str_pad((string)$sec, 2, '0', STR_PAD_LEFT) . '"';
|
||||
}
|
||||
|
||||
function normalizeLongitude(float $longitude): float
|
||||
{
|
||||
$result = fmod($longitude, 360);
|
||||
if ($result < 0) {
|
||||
$result += 360;
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
function getSignIndexFromLongitude(float $longitude): int
|
||||
{
|
||||
$longitude = normalizeLongitude($longitude);
|
||||
return (int) floor($longitude / 30);
|
||||
}
|
||||
|
||||
function getSignKeyFromLongitude(float $longitude): string
|
||||
{
|
||||
$signIndex = getSignIndexFromLongitude($longitude);
|
||||
return getSignKeyByIndex($signIndex);
|
||||
}
|
||||
|
||||
function getDegreeWithinSign(float $longitude): float
|
||||
{
|
||||
$longitude = normalizeLongitude($longitude);
|
||||
return fmod($longitude, 30);
|
||||
}
|
||||
|
||||
function getNakshatraIndexFromLongitude(float $longitude): int
|
||||
{
|
||||
$longitude = normalizeLongitude($longitude);
|
||||
$nakshatraSize = 360 / 27;
|
||||
return (int) floor($longitude / $nakshatraSize);
|
||||
}
|
||||
|
||||
function getNakshatraKeyFromLongitude(float $longitude): string
|
||||
{
|
||||
$nakshatraIndex = getNakshatraIndexFromLongitude($longitude);
|
||||
return getNakshatraKeyByIndex($nakshatraIndex);
|
||||
}
|
||||
|
||||
function buildPlanetDataFromLongitude(
|
||||
string $planetKey,
|
||||
float $longitude,
|
||||
int $segment,
|
||||
string $mode = NAME_MODE_MODERN
|
||||
): array {
|
||||
$signKey = getSignKeyFromLongitude($longitude);
|
||||
$nakshatraKey = getNakshatraKeyFromLongitude($longitude);
|
||||
$degreeWithinSign = getDegreeWithinSign($longitude);
|
||||
|
||||
return [
|
||||
'key' => $planetKey,
|
||||
'name' => getPlanetName($planetKey, $mode),
|
||||
'short' => getPlanetShortName($planetKey),
|
||||
'house' => $segment,
|
||||
'longitude' => normalizeLongitude($longitude),
|
||||
'sign_key' => $signKey,
|
||||
'sign' => getSignName($signKey, $mode),
|
||||
'degree_value' => $degreeWithinSign,
|
||||
'degree' => formatDegree($degreeWithinSign),
|
||||
'nakshatra_key' => $nakshatraKey,
|
||||
'nakshatra' => getNakshatraName($nakshatraKey, $mode)
|
||||
];
|
||||
}
|
||||
|
||||
function sortPlanetsByLongitude(array $planets): array
|
||||
{
|
||||
usort($planets, function ($a, $b) {
|
||||
return ($a['longitude'] ?? 0) <=> ($b['longitude'] ?? 0);
|
||||
});
|
||||
|
||||
return $planets;
|
||||
}
|
||||
202
constants.php
Normal file
202
constants.php
Normal file
@@ -0,0 +1,202 @@
|
||||
<?php
|
||||
|
||||
// ----------------------------
|
||||
// DISPLAY MODE
|
||||
// ----------------------------
|
||||
const NAME_MODE_MODERN = 'modern';
|
||||
const NAME_MODE_VEDIC = 'vedic';
|
||||
|
||||
// ----------------------------
|
||||
// PLANETS
|
||||
// ----------------------------
|
||||
const PLANET_KEYS = [
|
||||
'sun',
|
||||
'moon',
|
||||
'mercury',
|
||||
'venus',
|
||||
'mars',
|
||||
'jupiter',
|
||||
'saturn',
|
||||
'rahu',
|
||||
'ketu'
|
||||
];
|
||||
|
||||
const PLANET_NAMES = [
|
||||
'modern' => [
|
||||
'sun' => 'Sun',
|
||||
'moon' => 'Moon',
|
||||
'mercury' => 'Mercury',
|
||||
'venus' => 'Venus',
|
||||
'mars' => 'Mars',
|
||||
'jupiter' => 'Jupiter',
|
||||
'saturn' => 'Saturn',
|
||||
'rahu' => 'Rahu',
|
||||
'ketu' => 'Ketu'
|
||||
],
|
||||
'vedic' => [
|
||||
'sun' => 'Surya',
|
||||
'moon' => 'Chandra',
|
||||
'mercury' => 'Budha',
|
||||
'venus' => 'Shukra',
|
||||
'mars' => 'Mangala',
|
||||
'jupiter' => 'Guru',
|
||||
'saturn' => 'Shani',
|
||||
'rahu' => 'Rahu',
|
||||
'ketu' => 'Ketu'
|
||||
]
|
||||
];
|
||||
|
||||
const PLANET_SHORT_NAMES = [
|
||||
'sun' => 'Su',
|
||||
'moon' => 'Mo',
|
||||
'mercury' => 'Me',
|
||||
'venus' => 'Ve',
|
||||
'mars' => 'Ma',
|
||||
'jupiter' => 'Ju',
|
||||
'saturn' => 'Sa',
|
||||
'rahu' => 'Ra',
|
||||
'ketu' => 'Ke'
|
||||
];
|
||||
|
||||
// ----------------------------
|
||||
// SIGNS
|
||||
// ----------------------------
|
||||
const SIGN_KEYS = [
|
||||
'aries',
|
||||
'taurus',
|
||||
'gemini',
|
||||
'cancer',
|
||||
'leo',
|
||||
'virgo',
|
||||
'libra',
|
||||
'scorpio',
|
||||
'sagittarius',
|
||||
'capricorn',
|
||||
'aquarius',
|
||||
'pisces'
|
||||
];
|
||||
|
||||
const SIGN_NAMES = [
|
||||
'modern' => [
|
||||
'aries' => 'Aries',
|
||||
'taurus' => 'Taurus',
|
||||
'gemini' => 'Gemini',
|
||||
'cancer' => 'Cancer',
|
||||
'leo' => 'Leo',
|
||||
'virgo' => 'Virgo',
|
||||
'libra' => 'Libra',
|
||||
'scorpio' => 'Scorpio',
|
||||
'sagittarius' => 'Sagittarius',
|
||||
'capricorn' => 'Capricorn',
|
||||
'aquarius' => 'Aquarius',
|
||||
'pisces' => 'Pisces'
|
||||
],
|
||||
'vedic' => [
|
||||
'aries' => 'Mesha',
|
||||
'taurus' => 'Vrishabha',
|
||||
'gemini' => 'Mithuna',
|
||||
'cancer' => 'Karka',
|
||||
'leo' => 'Simha',
|
||||
'virgo' => 'Kanya',
|
||||
'libra' => 'Tula',
|
||||
'scorpio' => 'Vrischika',
|
||||
'sagittarius' => 'Dhanu',
|
||||
'capricorn' => 'Makara',
|
||||
'aquarius' => 'Kumbha',
|
||||
'pisces' => 'Meena'
|
||||
]
|
||||
];
|
||||
|
||||
// ----------------------------
|
||||
// NAKSHATRAS
|
||||
// ----------------------------
|
||||
const NAKSHATRA_KEYS = [
|
||||
'ashwini',
|
||||
'bharani',
|
||||
'krittika',
|
||||
'rohini',
|
||||
'mrigashira',
|
||||
'ardra',
|
||||
'punarvasu',
|
||||
'pushya',
|
||||
'ashlesha',
|
||||
'magha',
|
||||
'purva_phalguni',
|
||||
'uttara_phalguni',
|
||||
'hasta',
|
||||
'chitra',
|
||||
'swati',
|
||||
'vishakha',
|
||||
'anuradha',
|
||||
'jyeshtha',
|
||||
'mula',
|
||||
'purva_ashadha',
|
||||
'uttara_ashadha',
|
||||
'shravana',
|
||||
'dhanishta',
|
||||
'shatabhisha',
|
||||
'purva_bhadrapada',
|
||||
'uttara_bhadrapada',
|
||||
'revati'
|
||||
];
|
||||
|
||||
const NAKSHATRA_NAMES = [
|
||||
'modern' => [
|
||||
'ashwini' => 'Ashwini',
|
||||
'bharani' => 'Bharani',
|
||||
'krittika' => 'Krittika',
|
||||
'rohini' => 'Rohini',
|
||||
'mrigashira' => 'Mrigashira',
|
||||
'ardra' => 'Ardra',
|
||||
'punarvasu' => 'Punarvasu',
|
||||
'pushya' => 'Pushya',
|
||||
'ashlesha' => 'Ashlesha',
|
||||
'magha' => 'Magha',
|
||||
'purva_phalguni' => 'Purva Phalguni',
|
||||
'uttara_phalguni' => 'Uttara Phalguni',
|
||||
'hasta' => 'Hasta',
|
||||
'chitra' => 'Chitra',
|
||||
'swati' => 'Swati',
|
||||
'vishakha' => 'Vishakha',
|
||||
'anuradha' => 'Anuradha',
|
||||
'jyeshtha' => 'Jyeshtha',
|
||||
'mula' => 'Mula',
|
||||
'purva_ashadha' => 'Purva Ashadha',
|
||||
'uttara_ashadha' => 'Uttara Ashadha',
|
||||
'shravana' => 'Shravana',
|
||||
'dhanishta' => 'Dhanishta',
|
||||
'shatabhisha' => 'Shatabhisha',
|
||||
'purva_bhadrapada' => 'Purva Bhadrapada',
|
||||
'uttara_bhadrapada'=> 'Uttara Bhadrapada',
|
||||
'revati' => 'Revati'
|
||||
],
|
||||
'vedic' => [
|
||||
'ashwini' => 'Ashwini',
|
||||
'bharani' => 'Bharani',
|
||||
'krittika' => 'Krittika',
|
||||
'rohini' => 'Rohini',
|
||||
'mrigashira' => 'Mrigashira',
|
||||
'ardra' => 'Ardra',
|
||||
'punarvasu' => 'Punarvasu',
|
||||
'pushya' => 'Pushya',
|
||||
'ashlesha' => 'Ashlesha',
|
||||
'magha' => 'Magha',
|
||||
'purva_phalguni' => 'Purva Phalguni',
|
||||
'uttara_phalguni' => 'Uttara Phalguni',
|
||||
'hasta' => 'Hasta',
|
||||
'chitra' => 'Chitra',
|
||||
'swati' => 'Swati',
|
||||
'vishakha' => 'Vishakha',
|
||||
'anuradha' => 'Anuradha',
|
||||
'jyeshtha' => 'Jyeshtha',
|
||||
'mula' => 'Mula',
|
||||
'purva_ashadha' => 'Purva Ashadha',
|
||||
'uttara_ashadha' => 'Uttara Ashadha',
|
||||
'shravana' => 'Shravana',
|
||||
'dhanishta' => 'Dhanishta',
|
||||
'shatabhisha' => 'Shatabhisha',
|
||||
'purva_bhadrapada' => 'Purva Bhadrapada',
|
||||
'uttara_bhadrapada'=> 'Uttara Bhadrapada',
|
||||
'revati' => 'Revati'
|
||||
]
|
||||
];
|
||||
86
css.css
86
css.css
@@ -34,7 +34,8 @@
|
||||
border-radius: 50%;
|
||||
border: 4px solid #facc15;
|
||||
background: radial-gradient(circle, #1e293b 40%, #0f172a 100%);
|
||||
overflow: hidden;
|
||||
overflow: visible;
|
||||
margin: 40px;
|
||||
}
|
||||
|
||||
.segment-line {
|
||||
@@ -139,14 +140,77 @@
|
||||
padding: 3px 6px;
|
||||
}
|
||||
}
|
||||
.segment-label{
|
||||
position:absolute;
|
||||
font-weight:bold;
|
||||
font-size:18px;
|
||||
color:#facc15;
|
||||
transform:translate(-50%,-50%);
|
||||
background:rgba(0,0,0,0.35);
|
||||
padding:6px 10px;
|
||||
border-radius:6px;
|
||||
border:1px solid rgba(255,255,255,0.2);
|
||||
|
||||
.result-box{
|
||||
margin-top: 15px;
|
||||
padding: 15px 18px;
|
||||
border-radius: 12px;
|
||||
background: rgba(255,255,255,0.06);
|
||||
border: 1px solid rgba(255,255,255,0.08);
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
.result-box p{
|
||||
margin-bottom: 8px;
|
||||
}
|
||||
.planet-tag{
|
||||
position:absolute;
|
||||
transform:translate(-50%,-50%);
|
||||
background:rgba(250, 204, 21, 0.18);
|
||||
color:#ffffff;
|
||||
border:1px solid rgba(250, 204, 21, 0.55);
|
||||
border-radius:8px;
|
||||
padding:4px 8px;
|
||||
font-size:13px;
|
||||
font-weight:700;
|
||||
line-height:1;
|
||||
white-space:nowrap;
|
||||
box-shadow:0 4px 10px rgba(0,0,0,0.2);
|
||||
}
|
||||
.table-box{
|
||||
background: rgba(255,255,255,0.05);
|
||||
border: 1px solid rgba(255,255,255,0.08);
|
||||
border-radius: 14px;
|
||||
padding: 18px;
|
||||
}
|
||||
|
||||
.table-title{
|
||||
color: #facc15;
|
||||
font-weight: 700;
|
||||
margin-bottom: 15px;
|
||||
}
|
||||
|
||||
.astro-table{
|
||||
background: transparent;
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
.astro-table thead th{
|
||||
background: rgba(250, 204, 21, 0.15);
|
||||
color: #facc15;
|
||||
border-color: rgba(255,255,255,0.12);
|
||||
}
|
||||
|
||||
.astro-table td,
|
||||
.astro-table th{
|
||||
border-color: rgba(255,255,255,0.12);
|
||||
background: rgba(255,255,255,0.03);
|
||||
}
|
||||
|
||||
.astro-table tbody tr:hover td{
|
||||
background: rgba(255,255,255,0.07);
|
||||
}
|
||||
.sign-label{
|
||||
position:absolute;
|
||||
transform:translate(-50%,-50%);
|
||||
color:#cbd5e1;
|
||||
font-size:12px;
|
||||
font-weight:700;
|
||||
line-height:1.1;
|
||||
text-align:center;
|
||||
white-space:nowrap;
|
||||
background:rgba(15, 23, 42, 0.55);
|
||||
padding:3px 6px;
|
||||
border-radius:6px;
|
||||
border:1px solid rgba(255,255,255,0.08);
|
||||
}
|
||||
260
index.php
260
index.php
@@ -1,3 +1,109 @@
|
||||
<?php
|
||||
require_once 'constants.php';
|
||||
require_once 'astro_functions.php';
|
||||
|
||||
$nameMode = NAME_MODE_MODERN;
|
||||
$nameMode=NAME_MODE_VEDIC;
|
||||
date_default_timezone_set('Asia/Kathmandu');
|
||||
|
||||
$date = $_GET['date'] ?? '';
|
||||
$time = $_GET['time'] ?? '';
|
||||
$location = $_GET['location'] ?? '';
|
||||
|
||||
$locationMap = [
|
||||
'Kathmandu' => ['latitude' => 27.7172, 'longitude' => 85.3240],
|
||||
'Pokhara' => ['latitude' => 28.2096, 'longitude' => 83.9856],
|
||||
'Lalitpur' => ['latitude' => 27.6644, 'longitude' => 85.3188],
|
||||
'Bhaktapur' => ['latitude' => 27.6710, 'longitude' => 85.4298],
|
||||
'Biratnagar' => ['latitude' => 26.4525, 'longitude' => 87.2718],
|
||||
'Chitwan' => ['latitude' => 27.5291, 'longitude' => 84.3542],
|
||||
'Butwal' => ['latitude' => 27.7000, 'longitude' => 83.4480]
|
||||
];
|
||||
|
||||
$latitude = '';
|
||||
$longitude = '';
|
||||
|
||||
$localDateTime = '';
|
||||
$utcDateTime = '';
|
||||
$unixTimestamp = '';
|
||||
$julianDay = '';
|
||||
$decimalHour = '';
|
||||
|
||||
if (!empty($location) && isset($locationMap[$location])) {
|
||||
$latitude = $locationMap[$location]['latitude'];
|
||||
$longitude = $locationMap[$location]['longitude'];
|
||||
}
|
||||
|
||||
function getJulianDayFromDateTime($date, $time, $timezone = 'Asia/Kathmandu')
|
||||
{
|
||||
$dt = new DateTime("$date $time", new DateTimeZone($timezone));
|
||||
$dtUtc = clone $dt;
|
||||
$dtUtc->setTimezone(new DateTimeZone('UTC'));
|
||||
|
||||
$year = (int)$dtUtc->format('Y');
|
||||
$month = (int)$dtUtc->format('m');
|
||||
$day = (int)$dtUtc->format('d');
|
||||
$hour = (int)$dtUtc->format('H');
|
||||
$minute = (int)$dtUtc->format('i');
|
||||
$second = (int)$dtUtc->format('s');
|
||||
|
||||
$decimalHour = $hour + ($minute / 60) + ($second / 3600);
|
||||
|
||||
if ($month <= 2) {
|
||||
$year -= 1;
|
||||
$month += 12;
|
||||
}
|
||||
|
||||
$A = floor($year / 100);
|
||||
$B = 2 - $A + floor($A / 4);
|
||||
|
||||
$jd = floor(365.25 * ($year + 4716))
|
||||
+ floor(30.6001 * ($month + 1))
|
||||
+ $day + $B - 1524.5
|
||||
+ ($decimalHour / 24);
|
||||
|
||||
return [
|
||||
'local_datetime' => $dt->format('Y-m-d H:i:s'),
|
||||
'utc_datetime' => $dtUtc->format('Y-m-d H:i:s'),
|
||||
'unix_timestamp' => $dt->getTimestamp(),
|
||||
'julian_day' => round($jd, 6),
|
||||
'decimal_hour' => round($decimalHour, 6)
|
||||
];
|
||||
}
|
||||
|
||||
if (!empty($date) && !empty($time) && !empty($location) && isset($locationMap[$location])) {
|
||||
$calcData = getJulianDayFromDateTime($date, $time);
|
||||
|
||||
$localDateTime = $calcData['local_datetime'];
|
||||
$utcDateTime = $calcData['utc_datetime'];
|
||||
$unixTimestamp = $calcData['unix_timestamp'];
|
||||
$julianDay = $calcData['julian_day'];
|
||||
$decimalHour = $calcData['decimal_hour'];
|
||||
}
|
||||
|
||||
/*
|
||||
SAMPLE PLANET DATA
|
||||
house = wheel segment number
|
||||
*/
|
||||
$samplePlanets = [
|
||||
buildPlanetDataFromLongitude('sun', 5.20, 1, $nameMode),
|
||||
buildPlanetDataFromLongitude('moon', 72.13, 3, $nameMode),
|
||||
buildPlanetDataFromLongitude('mars', 78.35, 3, $nameMode),
|
||||
buildPlanetDataFromLongitude('mercury', 32.08, 2, $nameMode),
|
||||
buildPlanetDataFromLongitude('venus', 41.30, 2, $nameMode),
|
||||
buildPlanetDataFromLongitude('jupiter', 129.18, 5, $nameMode),
|
||||
buildPlanetDataFromLongitude('saturn', 22.43, 1, $nameMode),
|
||||
buildPlanetDataFromLongitude('rahu', 304.23, 11, $nameMode),
|
||||
buildPlanetDataFromLongitude('ketu', 124.23, 7, $nameMode)
|
||||
];
|
||||
|
||||
$planetsByHierarchy = $samplePlanets;
|
||||
$positionsInOrder = sortPlanetsByLongitude($samplePlanets);
|
||||
|
||||
usort($positionsInOrder, function ($a, $b) {
|
||||
return $a['house'] <=> $b['house'];
|
||||
});
|
||||
?>
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
|
||||
@@ -8,13 +114,11 @@
|
||||
|
||||
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css" rel="stylesheet">
|
||||
<link href="css.css" rel="stylesheet">
|
||||
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
<div class="container py-5">
|
||||
|
||||
<div class="text-center mb-5">
|
||||
<h1 class="fw-bold text-warning">Prajwal's Astro Analysis</h1>
|
||||
<p class="text-light">
|
||||
@@ -23,75 +127,167 @@
|
||||
</div>
|
||||
|
||||
<div class="main-card p-4 p-md-5">
|
||||
|
||||
<div class="row g-4">
|
||||
<div class="row g-4 align-items-start">
|
||||
|
||||
<div class="col-lg-12">
|
||||
<div class="row g-3">
|
||||
|
||||
<form method="GET" action="" class="row">
|
||||
<div class="col-lg-4">
|
||||
<label class="form-label">Select Date</label>
|
||||
<input type="date" class="form-control" id="datePicker">
|
||||
<input type="date" class="form-control" id="datePicker" name="date" value="<?= htmlspecialchars($date) ?>">
|
||||
</div>
|
||||
|
||||
<div class="col-lg-4">
|
||||
<label class="form-label">Select Time</label>
|
||||
<input type="time" class="form-control" id="timePicker">
|
||||
<input type="time" class="form-control" id="timePicker" name="time" value="<?= htmlspecialchars($time) ?>">
|
||||
</div>
|
||||
|
||||
<div class="col-lg-4">
|
||||
<label class="form-label">Select Location</label>
|
||||
<select class="form-select" id="locationSelector">
|
||||
<option selected disabled>Choose location</option>
|
||||
<option>Kathmandu</option>
|
||||
<option>Pokhara</option>
|
||||
<option>Lalitpur</option>
|
||||
<option>Bhaktapur</option>
|
||||
<option>Biratnagar</option>
|
||||
<option>Chitwan</option>
|
||||
<option>Butwal</option>
|
||||
<select class="form-select" id="locationSelector" name="location">
|
||||
<option value="" disabled <?= $location === '' ? 'selected' : '' ?>>Choose location</option>
|
||||
<option value="Kathmandu" <?= $location === 'Kathmandu' ? 'selected' : '' ?>>Kathmandu</option>
|
||||
<option value="Pokhara" <?= $location === 'Pokhara' ? 'selected' : '' ?>>Pokhara</option>
|
||||
<option value="Lalitpur" <?= $location === 'Lalitpur' ? 'selected' : '' ?>>Lalitpur</option>
|
||||
<option value="Bhaktapur" <?= $location === 'Bhaktapur' ? 'selected' : '' ?>>Bhaktapur</option>
|
||||
<option value="Biratnagar" <?= $location === 'Biratnagar' ? 'selected' : '' ?>>Biratnagar</option>
|
||||
<option value="Chitwan" <?= $location === 'Chitwan' ? 'selected' : '' ?>>Chitwan</option>
|
||||
<option value="Butwal" <?= $location === 'Butwal' ? 'selected' : '' ?>>Butwal</option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="col-lg-12">
|
||||
<button class="btn btn-custom w-100 mt-2">Analyze</button>
|
||||
</div>
|
||||
|
||||
<button type="submit" class="btn btn-custom w-100 mt-2">Analyze</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<div class="col-lg-12">
|
||||
|
||||
<div class="row g-3 mb-4">
|
||||
<div class="info-box">
|
||||
<div class="section-title">Geocentric Positioning of Planets</div>
|
||||
|
||||
<div class="section-title">
|
||||
Geocentric Positioning of Planets, Nakshatra, and Horoscope
|
||||
<?php if ($date || $time || $location): ?>
|
||||
<div class="result-box mt-3">
|
||||
<div class="row">
|
||||
<div class="col-6">
|
||||
<p><strong>Date:</strong> <?= htmlspecialchars($date ?: '-') ?></p>
|
||||
<p><strong>Time:</strong> <?= htmlspecialchars($time ?: '-') ?></p>
|
||||
<p><strong>Location:</strong> <?= htmlspecialchars($location ?: '-') ?></p>
|
||||
<p><strong>Latitude:</strong> <?= $latitude !== '' ? htmlspecialchars((string)$latitude) : '-' ?></p>
|
||||
<p><strong>Longitude:</strong> <?= $longitude !== '' ? htmlspecialchars((string)$longitude) : '-' ?></p>
|
||||
</div>
|
||||
<div class="col-6">
|
||||
<p><strong>Local DateTime:</strong> <?= $localDateTime ?: '-' ?></p>
|
||||
<p><strong>UTC DateTime:</strong> <?= $utcDateTime ?: '-' ?></p>
|
||||
<p><strong>Unix Timestamp:</strong> <?= $unixTimestamp !== '' ? $unixTimestamp : '-' ?></p>
|
||||
<p><strong>Decimal Hour (UTC):</strong> <?= $decimalHour !== '' ? $decimalHour : '-' ?></p>
|
||||
<p><strong>Julian Day:</strong> <?= $julianDay !== '' ? $julianDay : '-' ?></p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
<?php else: ?>
|
||||
<div class="result-box mt-3">
|
||||
<p class="mb-0">Please select date, time, and location, then click Analyze.</p>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
|
||||
<div class="chart-wrapper">
|
||||
|
||||
<div class="astro-circle" id="astroCircle">
|
||||
|
||||
<div class="earth-center">
|
||||
<img src="https://upload.wikimedia.org/wikipedia/commons/9/97/The_Earth_seen_from_Apollo_17.jpg">
|
||||
<img src="https://upload.wikimedia.org/wikipedia/commons/9/97/The_Earth_seen_from_Apollo_17.jpg" alt="Earth">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row g-4 mt-4">
|
||||
<div class="col-lg-6">
|
||||
<div class="table-box">
|
||||
<h5 class="table-title">Table 1: Positions by Planets</h5>
|
||||
<div class="table-responsive">
|
||||
<table class="table table-dark table-bordered align-middle astro-table mb-0">
|
||||
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Planet</th>
|
||||
<th>Segment</th>
|
||||
<th>Sign</th>
|
||||
<th>Degree</th>
|
||||
<th>Nakshatra</th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
<tbody>
|
||||
|
||||
<?php foreach ($planetsByHierarchy as $planet): ?>
|
||||
|
||||
<tr>
|
||||
<td><?= htmlspecialchars($planet['name']) ?></td>
|
||||
<td><?= htmlspecialchars($planet['house']) ?></td>
|
||||
<td><?= htmlspecialchars($planet['sign']) ?></td>
|
||||
<td><?= htmlspecialchars($planet['degree']) ?></td>
|
||||
<td><?= htmlspecialchars($planet['nakshatra']) ?></td>
|
||||
</tr>
|
||||
|
||||
<?php endforeach; ?>
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div class="col-lg-6">
|
||||
<div class="table-box">
|
||||
<h5 class="table-title">Table 2: Positions in Order</h5>
|
||||
<div class="table-responsive">
|
||||
<table class="table table-dark table-bordered align-middle astro-table mb-0">
|
||||
|
||||
</div>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Segment</th>
|
||||
<th>Planet</th>
|
||||
<th>Sign</th>
|
||||
<th>Degree</th>
|
||||
<th>Nakshatra</th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
</div>
|
||||
<tbody>
|
||||
|
||||
<?php foreach ($positionsInOrder as $planet): ?>
|
||||
|
||||
<tr>
|
||||
<td><?= htmlspecialchars($planet['house']) ?></td>
|
||||
<td><?= htmlspecialchars($planet['name']) ?></td>
|
||||
<td><?= htmlspecialchars($planet['sign']) ?></td>
|
||||
<td><?= htmlspecialchars($planet['degree']) ?></td>
|
||||
<td><?= htmlspecialchars($planet['nakshatra']) ?></td>
|
||||
</tr>
|
||||
|
||||
<?php endforeach; ?>
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<script>
|
||||
const samplePlanets = <?= json_encode($samplePlanets, JSON_UNESCAPED_UNICODE); ?>;
|
||||
const signNames = <?= json_encode(array_values(SIGN_NAMES[$nameMode])); ?>;
|
||||
</script>
|
||||
<script src="js.js"></script>
|
||||
|
||||
|
||||
|
||||
</body>
|
||||
|
||||
</html>
|
||||
80
js.js
80
js.js
@@ -1,47 +1,91 @@
|
||||
document.addEventListener("DOMContentLoaded", function () {
|
||||
|
||||
const astroCircle = document.getElementById("astroCircle");
|
||||
|
||||
const labels = [
|
||||
"1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12"
|
||||
];
|
||||
const segmentNumbers = ["1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12"];
|
||||
|
||||
|
||||
const circleSize = astroCircle.offsetWidth;
|
||||
const centerX = circleSize / 2;
|
||||
const centerY = circleSize / 2;
|
||||
|
||||
const radius = circleSize / 2;
|
||||
|
||||
// numbers will be placed OUTSIDE the circle
|
||||
const numberRadius = radius + 25;
|
||||
const numberRadius = radius + (circleSize < 400 ? 18 : 28);
|
||||
const signRadius = radius * 0.84;
|
||||
const planetRadius = radius * 0.66;
|
||||
|
||||
for (let i = 0; i < 12; i++) {
|
||||
|
||||
const angleDeg = i * 30;
|
||||
const angleRad = (angleDeg - 90) * Math.PI / 180;
|
||||
|
||||
// draw segment divider
|
||||
// segment divider
|
||||
const line = document.createElement("div");
|
||||
line.classList.add("segment-line");
|
||||
line.style.transform = `translateX(-50%) rotate(${angleDeg}deg)`;
|
||||
astroCircle.appendChild(line);
|
||||
|
||||
// place number in center of segment
|
||||
// middle of segment
|
||||
const midAngle = angleDeg + 15;
|
||||
const midRad = (midAngle - 90) * Math.PI / 180;
|
||||
|
||||
const x = centerX + numberRadius * Math.cos(midRad);
|
||||
const y = centerY + numberRadius * Math.sin(midRad);
|
||||
// outside segment number
|
||||
const numberX = centerX + numberRadius * Math.cos(midRad);
|
||||
const numberY = centerY + numberRadius * Math.sin(midRad);
|
||||
|
||||
const number = document.createElement("div");
|
||||
number.classList.add("segment-number");
|
||||
number.innerText = labels[i];
|
||||
|
||||
number.style.left = `${x}px`;
|
||||
number.style.top = `${y}px`;
|
||||
|
||||
number.innerText = segmentNumbers[i];
|
||||
number.style.left = `${numberX}px`;
|
||||
number.style.top = `${numberY}px`;
|
||||
astroCircle.appendChild(number);
|
||||
|
||||
// inside sign label
|
||||
const signX = centerX + signRadius * Math.cos(midRad);
|
||||
const signY = centerY + signRadius * Math.sin(midRad);
|
||||
|
||||
const sign = document.createElement("div");
|
||||
sign.classList.add("sign-label");
|
||||
sign.innerText = signNames[i];
|
||||
sign.style.left = `${signX}px`;
|
||||
sign.style.top = `${signY}px`;
|
||||
astroCircle.appendChild(sign);
|
||||
}
|
||||
|
||||
if (typeof samplePlanets !== "undefined" && Array.isArray(samplePlanets)) {
|
||||
placeSamplePlanets(astroCircle, samplePlanets, centerX, centerY, planetRadius);
|
||||
}
|
||||
});
|
||||
|
||||
function placeSamplePlanets(astroCircle, planets, centerX, centerY, planetRadius) {
|
||||
const groupedByHouse = {};
|
||||
|
||||
planets.forEach(planet => {
|
||||
if (!groupedByHouse[planet.house]) {
|
||||
groupedByHouse[planet.house] = [];
|
||||
}
|
||||
groupedByHouse[planet.house].push(planet);
|
||||
});
|
||||
|
||||
Object.keys(groupedByHouse).forEach(houseKey => {
|
||||
const houseNumber = parseInt(houseKey, 10);
|
||||
const housePlanets = groupedByHouse[houseNumber];
|
||||
|
||||
const segmentStartAngle = (houseNumber - 1) * 30;
|
||||
const segmentMidAngle = segmentStartAngle + 15;
|
||||
const segmentMidRad = (segmentMidAngle - 90) * Math.PI / 180;
|
||||
|
||||
const baseX = centerX + planetRadius * Math.cos(segmentMidRad);
|
||||
const baseY = centerY + planetRadius * Math.sin(segmentMidRad);
|
||||
|
||||
housePlanets.forEach((planet, index) => {
|
||||
const planetEl = document.createElement("div");
|
||||
planetEl.classList.add("planet-tag");
|
||||
planetEl.innerText = planet.short;
|
||||
planetEl.title = planet.name + " | Segment " + planet.house + " | " + planet.sign;
|
||||
|
||||
const verticalOffset = index * 24;
|
||||
planetEl.style.left = `${baseX}px`;
|
||||
planetEl.style.top = `${baseY + verticalOffset}px`;
|
||||
|
||||
astroCircle.appendChild(planetEl);
|
||||
});
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user