Core  3.2
PHP API documentation
 All Data Structures Namespaces Files Functions Variables Pages
moddfld.php
Go to the documentation of this file.
1 <?php
2 /*
3  * @author Anakeen
4  * @package FDL
5 */
6 /**
7  * Change default folder for family
8  *
9  * @author Anakeen
10  * @version $Id: moddfld.php,v 1.8 2005/06/28 08:37:46 eric Exp $
11  * @package FDL
12  * @subpackage GED
13  */
14 /**
15  */
16 
17 include_once ("FDL/Class.Doc.php");
18 include_once ("FDL/Class.Dir.php");
19 include_once ("FDL/Class.DocAttr.php");
20 include_once ("FDL/freedom_util.php");
21 // -----------------------------------
22 function moddfld(Action & $action)
23 {
24  // -----------------------------------
25  // Get all the params
26  $docid = GetHttpVars("docid");
27  $current = (GetHttpVars("current", "N") == "Y");
28  $newfolder = (GetHttpVars("autofolder", "N") == "Y");
29  $fldid = GetHttpVars("dfldid");
30 
31  $dbaccess = $action->dbaccess;
32  // initialise object
33 
34  /*
35  * @var DocFam $doc
36  */
38  if ($doc === null || !$doc->isAlive()) $action->exitError(sprintf(_("Document with id '%s' not found.") , $docid));
39  // create folder if auto
40  if ($newfolder) {
42  if ($fldid === false) {
43  $action->exitError(_("Error creating new default folder."));
44  }
45  } else {
46  if ($fldid === "0") {
47  $fldid = "";
48  } else {
49  $fld = new_Doc($dbaccess, $fldid);
50  if ($fld === null || !$fld->isAlive()) {
51  $action->exitError(sprintf(_("Document with id '%s' not found.") , $fldid));
52  }
53  if ($fld->defDoctype != 'D' && $fld->defDoctype != 'S') {
54  $action->exitError(sprintf(_("Document with id '%s' is not a folder or search.") , $fld->id));
55  }
56  $fldid = $fld->id;
57  }
58  }
59 
60  if ($current) $doc->cfldid = $fldid;
61  else $doc->dfldid = $fldid; // new default folder
62  // test object permission before modify values (no access control on values yet)
63  $doc->lock(true); // enabled autolock
64  $err = $doc->canEdit();
65  if ($err != "") $action->ExitError($err);
66 
67  $doc->Modify();
68 
69  $doc->unlock(true); // disabled autolock
70  redirect($action, "FDL", "FDL_CARD&id=$docid", $action->GetParam("CORE_STANDURL"));
71 }
global $action
exitError($texterr, $exit=true, $code="")
$docid
Definition: cleanFamily.php:13
createAutoFolder(&$doc)
new_Doc($dbaccess, $id= '', $latest=false)
moddfld(Action &$action)
Definition: moddfld.php:22
$dbaccess
Definition: checkVault.php:17
if($file) if($subject==""&&$file) if($subject=="") $err
← centre documentaire © anakeen