Implement version::objectMoveChildren() on top of version::objectGetChildren()

This commit is contained in:
Alexander Nicolaysen Sørnes
2009-07-23 01:40:25 +02:00
parent bd7081ebb4
commit e9c4d2ef16
10 changed files with 232 additions and 48 deletions

View File

@@ -61,6 +61,22 @@ class Monitor {
}
}
public function objectGetParent($sClass = '')
{
if($this->iVersionId)
return new version($this->iVersionId);
else
return new application($this->iAppId);
}
public function objectSetParent($iNewId, $sClass = '')
{
if($this->iVersionId)
$this->iVersionId = $iNewId;
else
$this->iAppId = $iNewId;
}
function objectGetChildren($bIncludeDeleted = false)
{
/* We have none */
@@ -103,7 +119,28 @@ class Monitor {
function update()
{
/* Stub */
$oMonitor = new monitor($this->iMonitorId);
if($this->iVersionId && $oMonitor->iVersionId != $this->iVersionId)
{
$hResult = query_parameters("UPDATE appMonitors SET versionId = '?'
WHERE monitorId = '?'",
$this->iVersionId, $this->iMonitorId);
if(!$hResult)
return FALSE;
}
if($this->iAppId && $oMonitor->iAppId != $this->iAppId)
{
$hResult = query_parameters("UPDATE appMonitors SET appId = '?'
WHERE monitorId = '?'",
$this->iAppId, $this->iMonitorId);
if(!$hResult)
return FALSE;
}
return TRUE;
}