if (ClaroCategory::countSubCategories($category->id) > 0) { $dialogBox->error(get_lang('You cannot delete a category having sub categories')); } else { $category->delete(); $dialogBox->success(get_lang('Category deleted. Courses linked to this category have been linked to the root category.')); } } else { $dialogBox->error(get_lang('Category not found')); } break; // Shift or displace category (up) // Shift or displace category (up) case 'exMoveUp': $category = new claroCategory(); if ($category->load($id)) { $category->decreaseRank(); if (claro_failure::get_last_failure() == 'category_no_predecessor') { $dialogBox->error(get_lang('This category can\'t be moved up')); } else { $dialogBox->success(get_lang('Category moved up')); } } else { $dialogBox->error(get_lang('Category not found')); } break; // Shift or displace category (down) // Shift or displace category (down) case 'exMoveDown': $category = new claroCategory(); if ($category->load($id)) { $category->increaseRank();