You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
42 lines
868 B
42 lines
868 B
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
/* For licensing terms, see /license.txt */
|
|
|
|
use Chamilo\CoreBundle\Entity\XApiToolLaunch;
|
|
use Symfony\Component\HttpFoundation\Request as HttpRequest;
|
|
|
|
require_once __DIR__.'/../../main/inc/global.inc.php';
|
|
|
|
api_protect_course_script(true);
|
|
api_protect_teacher_script();
|
|
|
|
$request = HttpRequest::createFromGlobals();
|
|
|
|
$em = Database::getManager();
|
|
|
|
$toolLaunch = $em->find(
|
|
XApiToolLaunch::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;
|
|
|