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

@@ -136,13 +136,20 @@ class Comment {
*/
function update($sSubject=null, $sBody=null, $iParentId=null, $iVersionId=null)
{
$oComment = new comment($this->iCommentId);
if(!$iVersionId && $this->iVersionId != $oComment->iVersionId)
$iVersionId = $this->iVersionId;
if(!$iParentId && $this->iParentId != $oComment->iParentId)
$iParentId = $this->iParentId;
if ($iParentId)
{
if (!query_parameters("UPDATE appComments SET parentId = '?' WHERE commentId = '?'",
$iParentId, $this->iCommentId))
return false;
$this->iParentId = $iParentId;
}
}
if ($iVersionId)
{
@@ -523,6 +530,32 @@ class Comment {
return array($sSubject, $sMessage, $aRecipients);
}
public function objectGetParent($sClass = '')
{
switch($sClass)
{
case 'version':
return new version($this->iVersionId);
case 'comment':
return new comment($this->iParentId);
}
}
public function objectSetParent($iNewId, $sClass = '')
{
switch($sClass)
{
case 'version':
$this->iVersionId = $iNewId;
break;
case 'comment':
$this->iParentId = $iNewId;
break;
}
}
function objectGetChildren($bIncludeDeleted = false)
{
$aObjects = array();