3 * Projects Hierarchy plugin
6 * Copyright 2011, Franck Villaume - Capgemini
7 * Copyright 2013, French Ministry of National Education
8 * http://fusionforge.org
10 * This file is part of FusionForge. FusionForge is free software;
11 * you can redistribute it and/or modify it under the terms of the
12 * GNU General Public License as published by the Free Software
13 * Foundation; either version 2 of the Licence, or (at your option)
16 * FusionForge is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
21 * You should have received a copy of the GNU General Public License along
22 * with FusionForge; if not, write to the Free Software Foundation, Inc.,
23 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
26 global $projectsHierarchy; // the projects-hierarchy plugin object
30 $sub_project_id = getIntFromRequest('sub_project_id');
31 if ($sub_project_id && $projectsHierarchy->is_child($sub_project_id))
32 $projectsHierarchy->redirect($_SERVER['HTTP_REFERER'], 'error_msg', _('This project already has a parent'));
34 if ($sub_project_id && $projectsHierarchy->addChild($id, $sub_project_id))
35 $projectsHierarchy->redirect($_SERVER['HTTP_REFERER'], 'feedback', _('Successfully added child'));
37 $projectsHierarchy->redirect($_SERVER['HTTP_REFERER'], 'error_msg', _('Failed to add child'));