delete.php 641 B

1234567891011121314151617181920212223242526272829
  1. <?php
  2. /* For license terms, see /license.txt */
  3. use Chamilo\PluginBundle\Entity\ImsLti\ImsLtiTool;
  4. require_once __DIR__.'/../../main/inc/global.inc.php';
  5. $plugin = ImsLtiPlugin::create();
  6. api_protect_admin_script();
  7. $em = Database::getManager();
  8. /** @var ImsLtiTool $tool */
  9. $tool = isset($_GET['id']) ? $em->find('ChamiloPluginBundle:ImsLti\ImsLtiTool', intval($_GET['id'])) : 0;
  10. if (!$tool) {
  11. api_not_allowed(true);
  12. }
  13. $em->remove($tool);
  14. $em->flush();
  15. Display::addFlash(
  16. Display::return_message($plugin->get_lang('ToolDeleted'), 'success')
  17. );
  18. header('Location: '.api_get_path(WEB_PLUGIN_PATH).'ims_lti/admin.php');
  19. exit;