3 * FusionForge Documentation Manager
5 * Copyright 2010-2011, Franck Villaume - Capgemini
6 * Copyright 2012-2016, 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 $redirecturl = '/docman/?group_id='.$group_id.'&dirid='.$dirid;
37 // plugin projects-hierarchy handler
39 $redirecturl .= '&childgroup_id='.$childgroup_id;
40 $g = group_get_object($childgroup_id);
43 if (!forge_check_perm('docman', $g->getID(), 'approve')) {
44 $warning_msg = _('Document Manager Action Denied.');
45 session_redirect($redirecturl);
48 $arr_fileid = explode(',', getStringFromRequest('fileid'));
49 $moveto_dirid = getIntFromRequest('moveto_dirid');
50 foreach ($arr_fileid as $fileid) {
51 if (!empty($fileid)) {
52 $d = document_get_object($fileid, $g->getID());
54 $error_msg = _('Cannot retrieve document');
55 session_redirect($redirecturl);
58 if ($d->isError() || !$d->update($d->getFileName(), $d->getFileType(), NULL, $moveto_dirid, $d->getName(), $d->getDescription(), $d->getStateID(), $d->getVersion())) {
59 $error_msg = $d->getErrorMessage();
60 session_redirect($redirecturl);
65 $count = count($arr_fileid);
66 $feedback = sprintf(ngettext('%s document moved.', '%s documents moved.', $count), $count);
67 session_redirect($redirecturl);