Platform  3.1
PHP API documentation
 All Data Structures Namespaces Files Functions Variables Pages
fdl_adoc.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  * Generate Php Document Classes
9  *
10  * @author Anakeen 2000
11  * @version $Id: fdl_adoc.php,v 1.20 2008/10/30 17:34:31 eric Exp $
12  * @license http://creativecommons.org/licenses/by-nc-sa/2.0/fr/ Anakeen - licence CC
13  * @package FDL
14  * @subpackage
15  */
16 /**
17  */
18 // refreah for a classname
19 // use this only if you have changed title attributes
20 include_once ("FDL/Lib.Attr.php");
21 include_once ("FDL/Class.DocFam.php");
22 
24 $appl->Set("FDL", $core);
25 
26 $dbaccess = $appl->GetParam("FREEDOM_DB");
27 if ($dbaccess == "") {
28  print "Database not found : param FREEDOM_DB";
29  exit;
30 }
31 
32 $docid = GetHttpVars("docid", 0); // special docid
33 if (($docid !== 0) && (!is_numeric($docid))) {
34  $odocid = $docid;
36  if (!$docid) {
37  print sprintf(_("family %s not found") . "\n", $odocid);
38  exit(1);
39  }
40 }
41 
42 $query = new QueryDb($dbaccess, "DocFam");
43 $query->AddQuery("doctype='C'");
44 $query->order_by = "id";
45 
46 ini_set("memory_limit", -1);
47 
48 if ($docid > 0) {
49  $query->AddQuery("id=$docid");
50  $tid = $query->Query(0, 0, "TABLE");
51 } else {
52  // sort id by dependance
53  $table1 = $query->Query(0, 0, "TABLE");
54  $tid = array();
55  pushfam(0, $tid, $table1);
56 }
57 if ($query->nb > 0) {
58  $pubdir = $appl->GetParam("CORE_PUBDIR");
59  if ($query->nb > 1) {
60  $tii = array(
61  1,
62  2,
63  3,
64  4,
65  5,
66  6,
67  20,
68  21
69  );
70  foreach ($tii as $ii) {
71  updateDoc($dbaccess, $tid[$ii]);
72  unset($tid[$ii]);
73  }
74  }
75  // workflow at the end
76  foreach ($tid as $k => $v) {
77  if ($v["usefor"] == "W") {
78  updateDoc($dbaccess, $v);
79 
80  $wdoc = createDoc($dbaccess, $v["id"]);
81  $wdoc->CreateProfileAttribute(); // add special attribute for workflow
82  activateTrigger($dbaccess, $v["id"]);
83  }
84  }
85  foreach ($tid as $k => $v) {
86  if ($v["usefor"] != "W") {
87  updateDoc($dbaccess, $v);
88  }
89  }
90 }
91 function updateDoc($dbaccess, $v)
92 {
93  $phpfile = createDocFile($dbaccess, $v);
94  print "$phpfile [" . $v["title"] . "(" . $v["name"] . ")]\n";
95  $msg = PgUpdateFamilly($dbaccess, $v["id"], $v["name"]);
96  print $msg;
97  activateTrigger($dbaccess, $v["id"]);
98 }
99 // recursive sort by fromid
100 function pushfam($fromid, &$tid, $tfam)
101 {
102 
103  foreach ($tfam as $k => $v) {
104 
105  if ($v["fromid"] == $fromid) {
106  $tid[$v["id"]] = $v;
107 
108  pushfam($v["id"], $tid, $tfam);
109  }
110  }
111 }
112 ?>
← centre documentaire © anakeen - published under CC License - Dynacase