本文整理汇总了PHP中PageManager::deletePageTypes方法的典型用法代码示例。如果您正苦于以下问题:PHP PageManager::deletePageTypes方法的具体用法?PHP PageManager::deletePageTypes怎么用?PHP PageManager::deletePageTypes使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PageManager
的用法示例。
在下文中一共展示了PageManager::deletePageTypes方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: delete
/**
* This function takes a Page ID and removes the Page from the database
* in `tbl_pages` and it's associated Page Types in `tbl_pages_types`.
* This function does not delete any of the Page's children.
*
* @see toolkit.PageManager#deletePageTypes
* @see toolkit.PageManager#deletePageFiles
* @param integer $page_id
* The ID of the Page that should be deleted.
* @param boolean $delete_files
* If true, this parameter will remove the Page's templates from the
* the filesystem. By default this is true.
* @return boolean
*/
public static function delete($page_id = null, $delete_files = true)
{
if (!is_int($page_id)) {
return false;
}
$can_proceed = true;
// Delete Files (if told to)
if ($delete_files) {
$page = PageManager::fetchPageByID($page_id, array('path', 'handle'));
if (empty($page)) {
return false;
}
$can_proceed = PageManager::deletePageFiles($page['path'], $page['handle']);
}
// Delete from tbl_pages/tbl_page_types
if ($can_proceed) {
PageManager::deletePageTypes($page_id);
Symphony::Database()->delete('tbl_pages', sprintf(" `id` = %d ", $page_id));
Symphony::Database()->query(sprintf("\n\t\t\t\t\t\tUPDATE\n\t\t\t\t\t\t\ttbl_pages\n\t\t\t\t\t\tSET\n\t\t\t\t\t\t\t`sortorder` = (`sortorder` + 1)\n\t\t\t\t\t\tWHERE\n\t\t\t\t\t\t\t`sortorder` < %d\n\t\t\t\t\t", $page_id));
}
return $can_proceed;
}