3 * FusionForge Documentation Manager
5 * Copyright 2010-2011, Franck Villaume - Capgemini
6 * Copyright 2013-2015, Franck Villaume - TrivialDev
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.
25 /* please do not add require here : use www/docman/index.php to add require */
26 /* global variables used */
27 global $g; // Group object
28 global $dirid; // id of doc_group
29 global $group_id; // id of group
30 global $childgroup_id; // id of child group if any
35 $urlredirect = '/docman/?group_id='.$group_id.'&dirid='.$dirid;
37 // plugin projects-hierarchy handler
39 $g = group_get_object($childgroup_id);
40 $urlredirect .= '&childgroup_id='.$childgroup_id;
43 if (!forge_check_perm('docman', $g->getID(), 'approve')) {
44 $warning_msg = _('Document Manager Action Denied.');
45 session_redirect($urlredirect);
48 $arr_fileid = explode(',', getStringFromRequest('fileid'));
49 foreach ($arr_fileid as $fileid) {
50 if (!empty($fileid)) {
51 $d = document_get_object($fileid, $g->getID());
52 if ($d->isError() || !$d->setState('1')) {
53 $error_msg = $d->getErrorMessage();
54 session_redirect($urlredirect);
57 $warning_msg = _('No action to perform');
58 session_redirect($urlredirect);
61 $count = count($arr_fileid);
62 $feedback = sprintf(ngettext('%s document validated successfully.', '%s documents validated successfully.', $count), $count);
63 session_redirect($urlredirect);