/**
* Delete Campaign - This function is used to delete a campaign.
*
* @param
* blast_id - The page of sent campaigns to be returned.
* @return
* Returns a string indicating whether or not the campaign was deleted succesfully.
*/
public function campaigns_delete()
{
$sailthruClient = new Sailthru_Client(API_KEY, API_SECRET);
// Get the id of the blast to be deleted from the the URL of this request.
if (isset($this->params['pass'][0])) {
$blast_id = $this->params['pass'][0];
} else {
//Exit if no blast id was specified.
exit;
}
// Make the API call to delete the blast. Return an appropriate response string.
try {
$response = $sailthruClient->deleteBlast($blast_id);
if (!isset($response['error'])) {
if ($response['ok'] == 1) {
echo 'Campaign was deleted successfully.';
} else {
echo 'Campaign could not be deleted.';
}
$this->autoLayout = $this->autoRender = false;
} else {
echo 'error';
}
} catch (Sailthru_Client_Exception $e) {
echo 'exception';
}
}