css par défaut
This commit is contained in:
parent
ce7bdcec0e
commit
9ea224dc10
@ -241,6 +241,7 @@ class agenda extends common
|
||||
self::$agendas[] = $data;
|
||||
}
|
||||
}
|
||||
|
||||
// Valeurs en sortie
|
||||
$this->addOutput([
|
||||
'showBarEditButton' => true,
|
||||
@ -252,79 +253,29 @@ 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;
|
||||
'.textRed {
|
||||
padding: 2px;
|
||||
border-radius: 5px;
|
||||
color: red;
|
||||
background-color: lightgrey;
|
||||
}
|
||||
.leaflet-popup-content {
|
||||
text-align: center;
|
||||
.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]);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user