Core  3.2
PHP API documentation
 All Data Structures Namespaces Files Functions Variables Pages
movedirfile.php
Go to the documentation of this file.
1 <?php
2 /*
3  * @author Anakeen
4  * @package FDL
5 */
6 /**
7  * Generated Header (not documented yet)
8  *
9  * @author Anakeen
10  * @version $Id: movedirfile.php,v 1.12 2008/03/14 13:58:03 eric Exp $
11  * @package FDL
12  * @subpackage GED
13  */
14 /**
15  */
16 
17 include_once ("FDL/Lib.Dir.php");
18 include_once ("FDL/freedom_util.php");
19 // -----------------------------------
21 {
22  // -----------------------------------
23  // Get all the params
24  $todirid = GetHttpVars("todirid");
25  $fromdirid = GetHttpVars("fromdirid");
26  $docid = GetHttpVars("docid");
27  $return = GetHttpVars("return"); // return action may be folio
28  $dbaccess = $action->dbaccess;
29 
31  // add before suppress
32 
33  /*
34  * @var Dir $dir
35  */
36  $dir = new_Doc($dbaccess, $todirid);
37  if ($dir->locked == - 1) { // it is revised document
38  $ldocid = $dir->getLatestId();
39  if ($ldocid != $dir->id) $dir = new_Doc($dbaccess, $ldocid);
40  }
41  $err = $dir->AddFile($docid);
42  if ($err != "") $action->exitError($err);
43 
44  $action->AddLogMsg(sprintf(_("%s has been added in %s folder") , $doc->title, $dir->title));
45 
46  $dir2 = new_Doc($dbaccess, $fromdirid);
47  if ($dir2->locked == - 1) { // it is revised document
48  $ldocid = $dir2->getLatestId();
49  if ($ldocid != $dir2->id) $dir2 = new_Doc($dbaccess, $ldocid);
50  }
51 
52  if (method_exists($dir2, "DelFile")) {
53  $err = $dir2->DelFile($docid);
54  if ($err != "") $action->exitError($err);
55 
56  $action->AddLogMsg(sprintf(_("%s has been removed in %s folder") , $doc->title, $dir2->title));
57  }
58  if (($doc->prelid == 0) && ($err == "")) { // because deletion id done after add
59  $doc->prelid = $dir->initid;
60  $doc->modify(true, array(
61  "prelid"
62  ) , true);
63  }
64 
65  if ($return == "folio") redirect($action, GetHttpVars("app") , "FOLIOLIST&dirid=$todirid");
66  else redirect($action, GetHttpVars("app") , "FREEDOM_VIEW&dirid=$todirid");
67 }
global $action
movedirfile(Action &$action)
Definition: movedirfile.php:20
exitError($texterr, $exit=true, $code="")
$docid
Definition: cleanFamily.php:13
new_Doc($dbaccess, $id= '', $latest=false)
$dir
Definition: resizeimg.php:144
$dbaccess
Definition: checkVault.php:17
if($file) if($subject==""&&$file) if($subject=="") $err
← centre documentaire © anakeen