Core  3.2
PHP API documentation
 All Data Structures Namespaces Files Functions Variables Pages
freedom_dedit.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: freedom_dedit.php,v 1.7 2005/06/28 08:37:46 eric Exp $
11  * @package FDL
12  * @subpackage GED
13  */
14 /**
15  */
16 // ---------------------------------------------------------------
17 // $Id: freedom_dedit.php,v 1.7 2005/06/28 08:37:46 eric Exp $
18 // $Source: /home/cvsroot/anakeen/freedom/freedom/Action/Freedom/freedom_dedit.php,v $
19 // ---------------------------------------------------------------
20 include_once ("FDL/freedom_util.php");
21 include_once ("FDL/Lib.Dir.php");
22 // -----------------------------------
24 {
25  // -----------------------------------
26  // Get All Parameters
27  $docid = 0; //GetHttpVars("id",0); // document to edit
28  $classid = GetHttpVars("classid", 0); // use when new doc or change class
29  // Set the globals elements
30  $dbaccess = $action->dbaccess;
31  if ($docid > 0) {
32 
34 
35  if (!$doc->isAlive()) {
36  // the doesn't exist
37  $docid = 0; // to recreate a new one
38 
39  }
40  }
41 
42  if ($docid == 0) {
43  // create default if needed
44  $doc = createDoc($dbaccess, $classid);
45  $fdoc = new DocFam($dbaccess, $classid);
46 
47  $doc->usefor = 'D'; // default document
48  $doc->profid = $fdoc->profid; // same profil as familly doc
49  $doc->title = sprintf(_("default values for %s") , $fdoc->title);
50  $doc->setDefaultValues($fdoc->getDefValues());
51  $err = $doc->Add();
52 
53  if ($err != "") $action->exitError($err);
54  $docid = $doc->id;
55  // insert them if its family
56  $fdoc = new DocFam($dbaccess, $classid);
57  $fdoc->ddocid = $docid;
58  $err = $fdoc->modify();
59  if ($err != "") $action->exitError($err);
60  }
61 
62  redirect($action, GetHttpVars("app") , "FREEDOM_EDIT&id=$docid");
63 }
global $action
exitError($texterr, $exit=true, $code="")
$docid
Definition: cleanFamily.php:13
createDoc($dbaccess, $fromid, $control=true, $defaultvalues=true, $temporary=false)
new_Doc($dbaccess, $id= '', $latest=false)
$dbaccess
Definition: checkVault.php:17
freedom_dedit(Action &$action)
if($file) if($subject==""&&$file) if($subject=="") $err
← centre documentaire © anakeen