noalyss Version-9
ajax_remove_submenu.php
Go to the documentation of this file.
1<?php
2/*
3 * This file is part of NOALYSS.
4 *
5 * NOALYSS is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 *
10 * NOALYSS is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with NOALYSS; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18*/
19
20// Copyright 2015 Author Dany De Bontridder danydb@aevalys.eu
21/**
22*@file
23*@brief remove a submenu
24*/
25
26
27if ( ! defined ('ALLOWED') ) die(_('Non autorisé'));
29
30// Security
31if ($g_user->check_module('CFGPRO')==0)
32 die();
33try
34{
35
36 $p_profile_menu_id=$http->get('p_profile_menu_id', "number");
37}
38catch (Exception $exc)
39{
40 error_log($exc->getTraceAsString());
41 return;
42}
43
44// Delete menu + children
45$cn->exec_sql('delete from profile_menu where pm_id = $1 or pm_id_dep=$1',array($p_profile_menu_id));
46
47// remove children without parent
48$cn->exec_sql("delete from profile_menu "
49 . " where pm_id_dep is not null "
50 . " and pm_id_dep not in (select pm_id from profile_menu)");
51?>
global $g_user
if no group available , then stop
manage the http input (get , post, request) and extract from an array