/**
* Sorting display order of categories.
*/
public function categoriesTree()
{
// Check permission
$this->permission(['Garden.Community.Manage', 'Garden.Settings.Manage'], false);
if ($this->Request->isAuthenticatedPostBack(true)) {
$tree = json_decode($this->Request->post('Subtree'), true);
$this->CategoryModel->saveSubtree($tree, $this->Request->post('ParentID', -1));
$this->setData('Result', count($this->CategoryModel->Validation->results()) === 0);
$this->setData('Validation', $this->CategoryModel->Validation->resultsArray());
} else {
throw new Gdn_UserException($this->Request->requestMethod() . ' is not allowed.', 405);
}
// Renders true/false rather than template
$this->render();
}