protected function actionDelete()
{
$aParams = $this->getParams();
$iCalendar = intval($aParams["delete"]);
if ($this->actionDeleteConfirmed() !== false) {
# catching Exception thrown when model already destroyed
# happens when user refreshes page on delete-URL, for instance
try {
$oModel = new \Baikal\Model\Calendar($iCalendar);
$oModel->destroy();
} catch (\Exception $e) {
# already deleted; silently discarding
}
# Redirecting to admin home
\Flake\Util\Tools::redirectUsingMeta($this->linkHome());
} else {
$oModel = new \Baikal\Model\Calendar($iCalendar);
$this->aMessages[] = \Formal\Core\Message::warningConfirmMessage("Check twice, you're about to delete " . $oModel->label() . "</strong> from the database !", "<p>You are about to delete a calendar and all it's scheduled events. This operation cannot be undone.</p><p>So, now that you know all that, what shall we do ?</p>", $this->linkDeleteConfirm($oModel), "Delete <strong><i class='" . $oModel->icon() . " icon-white'></i> " . $oModel->label() . "</strong>", $this->linkHome());
}
}