5 * Copyright 2006 (c) Fabien Regnier - Sogeti
6 * Copyright 2010-2011, Franck Villaume - Capgemini
7 * http://fusionforge.org
9 * This file is part of FusionForge. FusionForge is free software;
10 * you can redistribute it and/or modify it under the terms of the
11 * GNU General Public License as published by the Free Software
12 * Foundation; either version 2 of the Licence, or (at your option)
15 * FusionForge is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
20 * You should have received a copy of the GNU General Public License along
21 * with FusionForge; if not, write to the Free Software Foundation, Inc.,
22 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
26 $projectsHierarchy = plugin_get_object('projects_hierarchy');
28 echo '<h3>'._('Modify the hierarchy').'</h3>';
29 echo '<form method="post" action="/plugins/'.$projectsHierarchy->name.'/?type=group&pluginname='.$projectsHierarchy->name.'&action=addChild&id='.$group_id.'">';
30 echo _('Select a project: ');
31 echo $projectsHierarchy->son_box($group_id, 'sub_project_id', '0');
32 echo '<input type="submit" value="'._('Add Child project').'">';
35 $childs = $projectsHierarchy->getFamily($group_id, 'child', false, 'validated');
36 if (sizeof($childs)) {
37 foreach ($childs as $child) {
38 $childGroup = group_get_object($child[0][0]);
39 echo '<form method="post" action="/plugins/'.$projectsHierarchy->name.'/?type=group&pluginname='.$projectsHierarchy->name.'&action=removeChild&id='.$group_id.'&child_id='.$childGroup->getID().'">';
40 echo $childGroup->getPublicName();
41 echo '<input type="submit" value="'._('Remove child project').'">';
46 $parent = $projectsHierarchy->getFamily($group_id, 'parent', false, 'validated');
47 if (sizeof($parent)) {
48 $parentGroup = group_get_object($parent[0][0]);
49 echo '<form method="post" action="/plugins/'.$projectsHierarchy->name.'/?type=group&pluginname='.$projectsHierarchy->name.'&action=removeParent&id='.$group_id.'&parent_id='.$parentGroup->getID().'">';
50 echo $parentGroup->getPublicName();
51 echo '<input type="submit" value="'._('Remove parent project').'">';
55 echo '<h3>'._('Pending hierarchy request').'</h3>';
56 $pendingParent = $projectsHierarchy->getFamily($group_id, 'parent', false, 'pending');
57 if (sizeof($pendingParent)) {
58 $pendingParentGroup = group_get_object($pendingParent[0][0]);
59 echo '<form method="post" action="/plugins/'.$projectsHierarchy->name.'/?type=group&pluginname='.$projectsHierarchy->name.'&action=validateRelationship&id='.$group_id.'">';
60 echo '<input type="hidden" name="validation_id" value="'.$pendingParent[0][0].'" />';
61 echo _('Validate parent').' '.util_make_link('/projects/'.$pendingParentGroup->getUnixName(), $pendingParentGroup->getPublicName(), array('title'=>_('Browse this project'), 'class'=>'tabtitle'));
62 echo html_build_select_box_from_arrays(array(1,0), array(_('Yes'), _('No')), 'validation_status', 'xzxz', false);
63 echo '<input type="submit" value="'. _('Send') .'" />';
67 $pendingChilds = $projectsHierarchy->getFamily($group_id, 'child', false, 'pending');
68 if (sizeof($pendingChilds)) {
69 foreach ($pendingChilds as $pendingChild) {
70 $pendingChildGroup = group_get_object($pendingChild[0][0]);
71 echo '<form method="post" action="/plugins/'.$projectsHierarchy->name.'/?type=group&pluginname='.$projectsHierarchy->name.'&action=validateRelationship&id='.$group_id.'">';
72 echo '<input type="hidden" name="validation_id" value="'.$pendingChild[0][0].'" />';
73 echo _('Validate child').' '.util_make_link('/projects/'.$pendingChildGroup->getUnixName(), $pendingChildGroup->getPublicName(), array('title'=>_('Browse this project'), 'class'=>'tabtitle'));
74 echo html_build_select_box_from_arrays(array(1,0), array(_('Yes'), _('No')), 'validation_status', 'xzxz', false);
75 echo '<input type="submit" value="'. _('Send') .'" />';
80 if (!sizeof($pendingParent) && !sizeof($pendingChilds))
81 echo '<p class="information">'._('No pending requests').'</p>';