private function update_positions(HTTPRequestCustom $request) { if ($request->get_postvalue('submit', false)) { $categories = json_decode(TextHelper::html_entity_decode($request->get_value('tree'))); foreach ($categories as $position => $tree) { $id = $tree->id; $children = $tree->children[0]; $category = $this->get_categories_manager()->get_categories_cache()->get_category($id); $this->get_categories_manager()->update_position($category, Category::ROOT_CATEGORY, $position + 1); $this->update_childrens_positions($children, $category->get_id()); } $this->tpl->put('MSG', MessageHelper::display(LangLoader::get_message('message.success.position.update', 'status-messages-common'), MessageHelper::SUCCESS, 5)); } }
private function update_position(HTTPRequestCustom $request) { $questions_list = json_decode($request->get_postvalue('tree', false)); foreach ($questions_list as $position => $tree) { FaqService::update_position($tree->id, $position); } }