Publication::delete PHP Method

delete() public method

Delete the publication and all of its aliases.
public delete ( ) : boolean
return boolean
    public function delete()
    {
        $aliases = Alias::GetAliases(null, $this->m_data['Id']);
        if ($aliases && count($aliases) > 0) {
            foreach ($aliases as $alias) {
                $alias->delete();
            }
        }
        $tmpData = $this->m_data;
        $deleted = parent::delete();
        return $deleted;
    }

Usage Example

Exemplo n.º 1
0
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>');
}
echo camp_html_content_top(getGS("Deleting publication"), array("Pub" => $publicationObj));
?>
<P>
<TABLE BORDER="0" CELLSPACING="0" CELLPADDING="8" class="message_box">
<TR>
	<TD COLSPAN="2">
		<B> <?php 
putGS("Deleting publication");
?>
 </B>
		<HR NOSHADE SIZE="1" COLOR="BLACK">