Improve admin page (add new projects)
This commit is contained in:
@@ -24,9 +24,10 @@ class Project extends PhpObject {
|
||||
private $asActive;
|
||||
private $asGeo;
|
||||
|
||||
public function __construct(Db &$oDb) {
|
||||
public function __construct(Db &$oDb, $iProjectId=0) {
|
||||
parent::__construct(__CLASS__, Settings::DEBUG);
|
||||
$this->oDb = &$oDb;
|
||||
if($iProjectId > 0) $this->setProjectId($iProjectId);
|
||||
}
|
||||
|
||||
public function getProjectId() {
|
||||
@@ -64,10 +65,23 @@ class Project extends PhpObject {
|
||||
$this->setProjectInfo();
|
||||
}
|
||||
|
||||
public function createProjectId() {
|
||||
$this->setProjectId($this->oDb->insertRow(self::PROJ_TABLE, array('timezone'=>Settings::TIMEZONE)));
|
||||
return $this->getProjectId();
|
||||
}
|
||||
|
||||
public function getMode() {
|
||||
return $this->sMode;
|
||||
}
|
||||
|
||||
public function getProjectName() {
|
||||
return $this->sName;
|
||||
}
|
||||
|
||||
public function setProjectName($sName) {
|
||||
return $this->updateField('name', $sName);
|
||||
}
|
||||
|
||||
public function getProjectCodeName() {
|
||||
return $this->sCodeName;
|
||||
}
|
||||
@@ -130,7 +144,7 @@ class Project extends PhpObject {
|
||||
case 2: $asProject['mode'] = self::MODE_HISTO; break;
|
||||
}
|
||||
|
||||
if(!Converter::isGeoJsonValid($sCodeName)) Converter::convertToGeoJson($sCodeName);
|
||||
if($sCodeName!= '' && !Converter::isGeoJsonValid($sCodeName)) Converter::convertToGeoJson($sCodeName);
|
||||
|
||||
$asProject['geofilepath'] = Spot::addTimestampToFilePath(Geo::getFilePath($sCodeName, GeoJson::EXT));
|
||||
$asProject['gpxfilepath'] = Spot::addTimestampToFilePath(Geo::getFilePath($sCodeName, Gpx::EXT));
|
||||
|
||||
Reference in New Issue
Block a user