css par défaut

This commit is contained in:
Fred Tempez 2024-08-13 08:33:33 +02:00
parent ce7bdcec0e
commit 9ea224dc10

View File

@ -116,7 +116,7 @@ class agenda extends common
[
'eventName' => $this->getInput('agendaAddEventName', null, true),
'date' => $this->getInput('agendaAddDate', null, true),
'time' => $this->getInput('agendaAddTime', null) ,
'time' => $this->getInput('agendaAddTime', null),
'className' => $this->getInput('agendaAddClass', null),
'dateColor' => $this->getInput('agendaAddDateColor', null),
]
@ -241,6 +241,7 @@ class agenda extends common
self::$agendas[] = $data;
}
}
// Valeurs en sortie
$this->addOutput([
'showBarEditButton' => true,
@ -252,80 +253,30 @@ class agenda extends common
]);
}
// Fonction pour convertir les coordonnées GPS au format décimal
private function gps_decimal($coordinate, $hemisphere)
{
// Extrait les degrés, minutes et secondes
$degrees = count($coordinate) > 0 ? $this->gps2Num($coordinate[0]) : 0;
$minutes = count($coordinate) > 1 ? $this->gps2Num($coordinate[1]) : 0;
$seconds = count($coordinate) > 2 ? $this->gps2Num($coordinate[2]) : 0;
// Convertit les degrés, minutes et secondes en décimal
$decimal = $degrees + ($minutes / 60) + ($seconds / 3600);
// Si l'hémisphère est au Sud ou à l'Ouest, les coordonnées sont négatives
$decimal *= ($hemisphere == 'S' || $hemisphere == 'W') ? -1 : 1;
return $decimal;
}
// Fonction pour convertir les coordonnées GPS en nombre
private function gps2Num($coordPart)
{
$parts = explode('/', $coordPart);
if (count($parts) <= 0)
return 0;
if (count($parts) == 1)
retur;
$parts[0];
return floatval($parts[0]) / floatval($parts[1]);
}
// Fonction pour calculer la distance entre deux points géographiques
private function haversineGreatCircleDistance($latitudeFrom, $longitudeFrom, $latitudeTo, $longitudeTo, $earthRadius = 6371)
{
$latFrom = deg2rad($latitudeFrom);
$lonFrom = deg2rad($longitudeFrom);
$latTo = deg2rad($latitudeTo);
$lonTo = deg2rad($longitudeTo);
$latDelta = $latTo - $latFrom;
$lonDelta = $lonTo - $lonFrom;
$angle = 2 * asin(sqrt(pow(sin($latDelta / 2), 2) +
cos($latFrom) * cos($latTo) * pow(sin($lonDelta / 2), 2)));
return $angle * $earthRadius;
}
// Déterminer le niveau de zoom
// Cette fonction est une approximation pour le calcul du zoom
private function getZoomLevel($maxDistance)
{
$maxZoom = 21; // Le zoom maximal pour Leaflet
$earthCircumference = 40075; // La circonférence de la Terre en km
for ($zoom = $maxZoom; $zoom >= 0; $zoom--) {
if ($maxDistance < ($earthCircumference / pow(2, $zoom))) {
return $zoom;
}
}
return 0;
}
// Page de module vide
private function initCss()
{
if (empty($this->getData(['page', $this->getUrl(0), 'css']))) {
// Feuille de styles
$cssContent =
'#map {
height: 500px;
width: auto;
}
.leaflet-popup-content {
text-align: center;
}';
'.textRed {
padding: 2px;
border-radius: 5px;
color: red;
background-color: lightgrey;
}
.textGreen {
border-radius: 5px;
padding: 2px;
color: lightgreen;
background-color: darkgrey;
}
.textOrange {
padding: 2px;
border-radius: 5px;
color: orange;
background-color: green;
}';
$this->setData(['page', $this->getUrl(0), 'css', $cssContent]);
}
}