function actionDeleteCategory($params = '') { if (!empty($params['category_id'])) { $objBlog = new BlogModel(); if ($objBlog->safeToDeleteCategory($params['category_id'])) { $objBlog->deleteCategory($params['category_id']); $this->messages[] = array('type' => 'success', 'message' => 'Blog Category has been deleted.'); } else { $this->messages[] = array('type' => 'error', 'message' => 'Cannot delete a category that has sub categories.'); } } else { $this->messages[] = array('type' => 'error', 'message' => 'Unknown category to delete.'); } $this->actionCategories(); }