Example #1
0
    exit;
}
$doDelete = true;
$publicationObj = new Publication($Pub);
$issuesRemaining = Issue::GetNumIssues($Pub);
$errorMsgs = array();
if ($issuesRemaining > 0) {
    $errorMsgs[] = getGS('There are $1 issue(s) left.', $issuesRemaining);
    $doDelete = false;
}
$sectionsRemaining = Section::GetSections($Pub, null, null, null, null, null, true);
if (count($sectionsRemaining) > 0) {
    $errorMsgs[] = getGS('There are $1 section(s) left.', count($sectionsRemaining));
    $doDelete = false;
}
$articlesRemaining = Article::GetNumUniqueArticles($Pub);
if ($articlesRemaining > 0) {
    $errorMsgs[] = getGS('There are $1 article(s) left.', $articlesRemaining);
    $doDelete = false;
}
$subscriptionsRemaining = Subscription::GetNumSubscriptions($Pub);
if ($subscriptionsRemaining > 0) {
    $errorMsgs[] = getGS('There are $1 subscription(s) left.', $subscriptionsRemaining);
    $doDelete = false;
}
if ($doDelete) {
    $publicationObj->delete();
    camp_html_goto_page("/{$ADMIN}/pub");
} else {
    $errorMsgs[] = getGS('The publication $1 could not be deleted.', '<B>' . htmlspecialchars($publicationObj->getName()) . '</B>');
}