vote: Add support for deleting votes
This commit is contained in:
committed by
Chris Morgan
parent
835d82e49b
commit
8d9cefe7b6
@@ -55,6 +55,21 @@ class vote
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
public function delete()
|
||||
{
|
||||
/* A vote needs to have a versionId, so if it doesn't that means it is not in the
|
||||
database or it was not selected in the vote editor */
|
||||
if(!$this->iVersionId)
|
||||
return TRUE;
|
||||
|
||||
$hResult = query_parameters("DELETE FROM appVotes WHERE id = '?'", $this->iVoteId);
|
||||
|
||||
if(!$hResult)
|
||||
return FALSE;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
class voteManager
|
||||
@@ -82,7 +97,7 @@ class voteManager
|
||||
|
||||
public function outputEditor($aClean = null)
|
||||
{
|
||||
echo "The following shows your current votes. Check the boxes next to the apps you wish to replace with a vote for ".version::fullNameLink($aClean['iVersionId']).".";
|
||||
echo "The following shows your current votes. Check the boxes next to the apps you wish to replace with a vote for ".version::fullNameLink($aClean['iVersionId'])." or delete.";
|
||||
|
||||
$oTable = new table();
|
||||
$this->aVotes = $this->getVotes();
|
||||
@@ -107,6 +122,11 @@ class voteManager
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
function objectGetMail($sAction, $bMailSubmitter, $bParentAction)
|
||||
{
|
||||
return array(null, null, null); /* No mail */
|
||||
}
|
||||
|
||||
public function mustBeQueued()
|
||||
{
|
||||
return FALSE;
|
||||
@@ -127,6 +147,22 @@ class voteManager
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
public function delete()
|
||||
{
|
||||
$bSuccess = TRUE;
|
||||
|
||||
if(!is_array($this->aVotes))
|
||||
$this->aVotes = $this->getVotes();
|
||||
|
||||
foreach($this->aVotes as $oVote)
|
||||
{
|
||||
if(!$oVote->delete())
|
||||
$bSuccess = FALSE;
|
||||
}
|
||||
|
||||
return $bSuccess;
|
||||
}
|
||||
|
||||
public function update()
|
||||
{
|
||||
foreach($this->aVotes as $oVote)
|
||||
|
||||
Reference in New Issue
Block a user