delete() public method

Delete the article type. This will delete the entire table in the database. Not recommended unless there is no article data in the table.
public delete ( )
Example #1
0
	if (!SecurityToken::isValid()) {
		camp_html_display_error(getGS('Invalid security token!'));
		exit;
	}

	$res = ArticleType::merge($f_src, $f_dest, $f_src_c);
    if (!$res) {
        $errMsgs[] = getGS("Merge failed.");
        $ok = false;
    }
    if ($ok) {
    	$f_delete = Input::get('f_delete', 'checkbox', 0);
        if ($f_delete) {
            // delete the source article type
            $at = new ArticleType($f_src);
            $at->delete();
        }

        camp_html_goto_page("/$ADMIN/article_types/");
        exit(0);
    }
}


//
// Otherwise, we are in preview mode, so render up a preview
//
if ($ok) {
    //
    // calculate where this article is in relation to all the articles of the src type
    //
Example #2
0
if (!$g_user->hasPermission('DeleteArticleTypes')) {
	camp_html_display_error(getGS("You do not have the right to delete article types."));
	exit;
}

$articleTypeName = Input::Get('f_article_type');
$doDelete = true;
$errorMsgs = array();

if ($doDelete) {
	$articleType = new ArticleType($articleTypeName);
	$articles = Article::GetArticlesOfType($articleTypeName);
	foreach ($articles as $a) {
		$a->delete();
	}
	$articleType->delete();
	camp_html_goto_page("/$ADMIN/article_types/");
} else {
	$errorMsgs[] = getGS('The article type $1 could not be deleted.', '<B>'.htmlspecialchars($articleTypeName).'</B>');
}


$crumbs = array();
$crumbs[] = array(getGS("Configure"), "");
$crumbs[] = array(getGS("Article Types"), "/$ADMIN/article_types/");
$crumbs[] = array(getGS("Delete article type $1", $articleTypeName), "");

echo camp_html_breadcrumbs($crumbs);


?>