Pick project from globe

This commit is contained in:
2026-05-13 23:28:36 +02:00
parent c3835f45c5
commit 49f37465bd
9 changed files with 151 additions and 78 deletions

View File

@@ -126,6 +126,8 @@ class Project extends PhpObject {
Db::getId(self::PROJ_TABLE)." AS id",
'codename',
'name',
'latitude',
'longitude',
'active_from',
'active_to',
"IF(NOW() BETWEEN active_from AND active_to, 1, IF(NOW() < active_from, 0, 2)) AS mode"
@@ -147,12 +149,16 @@ class Project extends PhpObject {
$asProject['gpxfilepath'] = Spot::addTimestampToFilePath(Gpx::getDistFilePath($sCodeName));
$asProject['codename'] = $sCodeName;
$asProject['default'] = ($sCodeName == $sDefaultProjectCodeName);
//$asProject['center'] = [$asProject['latitude'], $asProject['longitude']];
}
return $bSpecificProj?$asProject:$asProjects;
}
public function getGeoJson() {
if($this->sCodeName != '' && !Converter::isGeoJsonValid($this->sCodeName)) Converter::convertToGeoJson($this->sCodeName);
if($this->sCodeName != '' && !Converter::isGeoJsonValid($this->sCodeName)){
$aiCenter = Converter::convertToGeoJson($this->sCodeName)['center'];
$this->oDb->updateRow(self::PROJ_TABLE, $this->iProjectId, ['latitude' => $aiCenter[1], 'longitude' => $aiCenter[0]]);
}
return json_decode(file_get_contents(GeoJson::getDistFilePath($this->sCodeName)), true);
}