find( ToolLaunch::class, $request->query->getInt('delete') ); if (null === $toolLaunch || $toolLaunch->getCourse()->getId() !== api_get_course_entity()->getId() ) { api_not_allowed(true); } $plugin = XApiPlugin::create(); $em = Database::getManager(); $em->remove($toolLaunch); $em->flush(); Display::addFlash( Display::return_message($plugin->get_lang('ActivityDeleted'), 'success') ); header('Location: '.api_get_course_url()); exit;