Add Local Time Zone
This commit is contained in:
@@ -66,7 +66,7 @@ class Project extends PhpObject {
|
||||
}
|
||||
|
||||
public function createProjectId() {
|
||||
$this->setProjectId($this->oDb->insertRow(self::PROJ_TABLE, array('timezone'=>Settings::TIMEZONE)));
|
||||
$this->setProjectId($this->oDb->insertRow(self::PROJ_TABLE, array('codename'=>'')));
|
||||
return $this->getProjectId();
|
||||
}
|
||||
|
||||
@@ -104,14 +104,6 @@ class Project extends PhpObject {
|
||||
}
|
||||
}
|
||||
|
||||
public function getTimeZone() {
|
||||
return $this->asGeo['timezone'];
|
||||
}
|
||||
|
||||
public function setTimeZone($sTimeZone) {
|
||||
return $this->updateField('timezone', $sTimeZone);
|
||||
}
|
||||
|
||||
public function getFeedIds() {
|
||||
return $this->oDb->selectColumn(
|
||||
Feed::FEED_TABLE,
|
||||
@@ -129,8 +121,7 @@ class Project extends PhpObject {
|
||||
'name',
|
||||
'active_from',
|
||||
'active_to',
|
||||
"IF(NOW() BETWEEN active_from AND active_to, 1, IF(NOW() < active_from, 0, 2)) AS mode",
|
||||
'timezone'
|
||||
"IF(NOW() BETWEEN active_from AND active_to, 1, IF(NOW() < active_from, 0, 2)) AS mode"
|
||||
),
|
||||
'from' => self::PROJ_TABLE
|
||||
);
|
||||
@@ -186,7 +177,7 @@ class Project extends PhpObject {
|
||||
$this->asActive = array('from'=>$asProject['active_from'], 'to'=>$asProject['active_to']);
|
||||
$this->sCodeName = $asProject['codename'];
|
||||
$this->sName = $asProject['name'];
|
||||
$this->asGeo = array('geofile'=>$asProject['geofilepath'], 'gpxfile'=>$asProject['gpxfilepath'], 'timezone'=>$asProject['timezone']);
|
||||
$this->asGeo = array('geofile'=>$asProject['geofilepath'], 'gpxfile'=>$asProject['gpxfilepath']);
|
||||
}
|
||||
else $this->addError('Error while setting project: no project ID');
|
||||
}
|
||||
@@ -199,13 +190,21 @@ class Project extends PhpObject {
|
||||
}
|
||||
|
||||
public function delete() {
|
||||
$sDesc = '';
|
||||
$asResult = array();
|
||||
if($this->getProjectId() > 0) {
|
||||
$bSuccess = $this->oDb->deleteRow(self::PROJ_TABLE, $this->getProjectId());
|
||||
if(!$bSuccess) $sDesc = $this->oDb->getLastError();
|
||||
}
|
||||
else $sDesc = 'Error while setting project: no project ID';
|
||||
$asFeedIds = $this->getFeedIds();
|
||||
foreach($asFeedIds as $iFeedId) {
|
||||
$asResult['feed'][] = (new Feed($this->oDb, $iFeedId))->delete();
|
||||
}
|
||||
|
||||
return $sDesc;
|
||||
$asResult['project'][] = array(
|
||||
'id' => $this->getProjectId(),
|
||||
'del' => $this->oDb->deleteRow(self::PROJ_TABLE, $this->getProjectId()),
|
||||
'desc' => $this->oDb->getLastError()
|
||||
);
|
||||
}
|
||||
else $asResult['project'][] = array('del'=>false, 'desc'=>'Error while setting project: no project ID');
|
||||
|
||||
return $asResult;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user