Platform  3.1
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  * @license http://creativecommons.org/licenses/by-nc-sa/2.0/fr/ Anakeen - licence CC
5  * @package FDL
6 */
7 /**
8  * Generated Header (not documented yet)
9  *
10  * @author Anakeen 2000
11  * @version $Id: freedom_dedit.php,v 1.7 2005/06/28 08:37:46 eric Exp $
12  * @license http://creativecommons.org/licenses/by-nc-sa/2.0/fr/ Anakeen - licence CC
13  * @package FDL
14  * @subpackage GED
15  */
16 /**
17  */
18 // ---------------------------------------------------------------
19 // $Id: freedom_dedit.php,v 1.7 2005/06/28 08:37:46 eric Exp $
20 // $Source: /home/cvsroot/anakeen/freedom/freedom/Action/Freedom/freedom_dedit.php,v $
21 // ---------------------------------------------------------------
22 include_once ("FDL/freedom_util.php");
23 include_once ("FDL/Lib.Dir.php");
24 // -----------------------------------
26 {
27  // -----------------------------------
28  // Get All Parameters
29  $docid = 0; //GetHttpVars("id",0); // document to edit
30  $classid = GetHttpVars("classid", 0); // use when new doc or change class
31 
32  // Set the globals elements
33  $dbaccess = $action->GetParam("FREEDOM_DB");
34  if ($docid > 0) {
35 
37 
38  if (!$doc->isAlive()) {
39  // the doesn't exist
40  $docid = 0; // to recreate a new one
41 
42  }
43  }
44 
45  if ($docid == 0) {
46  // create default if needed
47  $doc = createDoc($dbaccess, $classid);
48  $fdoc = new DocFam($dbaccess, $classid);
49 
50  $doc->usefor = 'D'; // default document
51  $doc->profid = $fdoc->profid; // same profil as familly doc
52  $doc->title = sprintf(_("default values for %s") , $fdoc->title);
53  $doc->setDefaultValues($fdoc->getDefValues());
54  $err = $doc->Add();
55 
56  if ($err != "") $action->exitError($err);
57  $docid = $doc->id;
58  // insert them if its family
59  $fdoc = new DocFam($dbaccess, $classid);
60  $fdoc->ddocid = $docid;
61  $err = $fdoc->modify();
62  if ($err != "") $action->exitError($err);
63  }
64 
65  redirect($action, GetHttpVars("app") , "FREEDOM_EDIT&id=$docid");
66 }
67 ?>
← centre documentaire © anakeen - published under CC License - Dynacase